Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Talking to MS Word
Message
De
08/09/1997 17:54:22
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00048731
Message ID:
00049061
Vues:
44
>>Hi!
>>
>>Probably, you should use OLE Automation instead of DDE...
>>
>>Have a happy day
>>Vladimir Shevchenko
>>
>>> I have no problem talking to Word (once it is running) to make pretty
>>> 1) Run it from within VFP 5
>
>I AM using OLE automation...
>For example:
> oWord = CREATEOBJECT("Word.Basic") && Get a reference to Word
> oWord.FileOpen("filename of master merge file")
> oWord.MailMergeToDoc && To do the actual mailmerge
> oWord=null && Disconnect
>
>But I still don't understand how to detect if Word is already running and second how to run it once I determine that it is not...
>
>Anybody else?

GetObject normally works will locating a registered application. It does work with Excel (GetObject(, 'excel.application') but not with Word. Word does not respond to the empty first parameter.

The best way to check with Word is to use DDE

OldSafety = DDESETOPTION("Safety")
DDESETOPTION("Safety", .F.)
lnhandle = DDEINITIATE("WinWord", "System")
lisrunning = .f.

IF lnhandle <> -1
*-- it is running
lisrunning = .T.
DDETERMINATE(lnhandle)
ENDIF

RETURN lisrunning

If it is running, you can use GetObject with an empty string, because you know it is running!
GetObject("", "Word.Basic")
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform