>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement