Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Open a Worddocument in with VFP7
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00945445
Message ID:
00945453
Vues:
22
>Hallo!
>Are there any easy way to start a program (Word... Excel...) and open a specified document?
>
>I have tried "run /n winword.exe", but i dont work. I must have the whole path to Winword.exe, otherwise VFP dont find it.
>
>My wish is to click (doubbleclick) on a document in a list, and then schould the document open in the right program.
>(The same who happen when you doubbleclick on a file in Explorer.)
>
>Thanks in advance for any help, so I know where to begin.
>/Kjell

You can open Word and then the document with OLE Automation.
ox = CREATEOBJECT('Word.Application')
ox.documents.open("Path and Doc Name")
However, it sounds like you don't necessarily want to open Word every time, but rather the program that's associated with the file type selected. For that, you can use the SHELLEXECUTE() command to open the correct program, but then you don't have control over that program the way you do with Automation.
DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
        INTEGER lnHWnd, ;
        STRING lcAction, ;   
        STRING lcFileName, ;
        STRING lcExeParams, ;
        STRING lcDefDir, ;
        INTEGER lnShowWindow
lnResult = ShellExecute( 0, 'open', lcFileName, "", "", 1 )
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform