Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Word 97 Ole Automation Commands in Visual Fox
Message
De
18/03/1998 08:20:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00085204
Message ID:
00085304
Vues:
35
>I have used the following code to try changing the font to Bold:
>
>OWord = CreateObject("word.basic.8")
>OWord.FileNew()
>OWord.Insert("This is the non-bolded text")
>OWord.selection.font.bold = .T.
>OWord.Insert("This is the bolded text")
>
>This code bombs on the fourth line with an OLE error of "Unknown Name".

I think you need to add an object between oWord and .selection to indicate the document; that is, .selection is not a property of the Word application, it's a property of a document in Word. I'm not real sure about this, though. I found OLE in Word 97 more difficult than the earlier WordBasic, so I just use .wordbasic before the old code I used in Word 95. Actually, because we have both Word 95 and 97 in our environemnt, it was easier to create the Word application object and create a reference to it that is "goWord" if it is Word 95, and "goWord.wordbasic" if it is Word 97. That way I can just use Word 95 calls without having to know which version the user is running.

Sorry I don't have my code in front of me at the moment. If you need more help I can get it for you.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform