General information
Category:
Coding, syntax & commands
>Hello All,
>
>Recently, I have been trying to control Word 97 from Visual Foxpro 5.0 using Word as an OLE Automation Server, and I have had limited success at best in controlling the Word application.
>
>More specifically, I have been unable to change the properties of the current selection, such as turning the Bold property on and off, or the orientation property of the current document.
>
>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".
>
>What am I doing wrong? Does anyone know a list of Word 97 Visual Basic functions that directly translate in Visual Fox 5?
>
>Thanks in advance,
>
>Ben Holton
Hi Ben
You can't use selection object unless you select portion of the text.
Try to use Formatfont method instead.
Formatfont accepts a lot of parameters.VB has named parameters. VFP does not have this. So order of parameters is very important.
Parameters to Formatfont looks such :
FormatFont [.Points = number] [, .Underline = number] [, .Color = number] [, .Strikethrough = number] [, .Superscript = number] [, .Subscript = number] [, .Shadow = number] [, .Hidden = number] [, .SmallCaps = number] [, .AllCaps = number] [, .Outline = number] [, .Spacing = number] [, .Position = number or text] [, .Kerning = number] [, .KerningMin = number or text] [, .Default] [, .Tab = number] [, .Font = text] [, .Bold = number] [, .Italic = number]
Hope this help. ALEX
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