Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Automation - avoiding 2 copies of Word
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00748221
Message ID:
00748283
Vues:
14
>This is because CREATEOBJECT() always creates a new instance of Word.
>What you need to do is use GETOBJECT() to grab a reference to an
>existing instance of Word. Unfortunately, the GETOBJECT() syntax can
>crash with error 1426 if there is no existing reference. This code should
>help get you started:

And, the VFP8 version:
LOCAL oerr as Exception
*** Use GetObject to grab a reference to an existing
*** instance of the server or create one if there is none
TRY
   oWord = GETOBJECT( , 'Word.Application' )
CATCH TO oErr
   IF oErr.ErrorNo = 1426
      oWord = CREATEOBJECT('Word.Application')
   ELSE
      THROW oErr
   ENDIF
ENDTRY
P.S. -- Hey, Michel, you need some new syntax coloring code. :-)
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform