General information
Category:
Coding, syntax & commands
>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.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only