Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Work with only one Instance of Word
Message
De
27/05/2002 11:22:20
 
 
À
27/05/2002 10:16:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00658782
Message ID:
00661697
Vues:
27
>>I've tried
>>
>>oDoc = GetObject(lcDocument, "Word.Application")
>>oDoc.Visible = .T.
>>
>>The first line returns an "OLE error code....No such interface supported."
>>
>>I'm just not understanding the GetObject() function. Isn't this what I want to use prevent the second launch of MS Word?
>>
>>Thank you very much
>
>Elgin,
>
>oWord = GetObject(, "Word.Application")
>oWord.Documnts.Open(lcDoc)
>
>Basically either creates a new instance or gets one existing if any. BUT never do it IMO. When you need one use createobject() or if you're keen about you want one only at least do it like :
>
>if isnull(oApp.oWord)
> oApp.oWord = createobject("Word.Application")
>endif
>

Unless there's some reason to automate Word in these circumstances, why not simply launch the document with ShellExecute()? The OS will use DDE to initiate a new Word window if Word is already up, and will launch Word if it's not currently running...
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform