General information
Category:
Coding, syntax & commands
Title:
Controling MS Word from VFP
I'm trying to upgrade an application I wrote to send information to MS Word to work better with Office 97. The scant documentation that I found said that I could create a word application object then control it with VB for Applications methods. I use the object browser in MS Word to get the syntax and values for the constants but I can't seem to get some things to work. Here is the code I'm using:
loTest = createobject("word.application")
lodoc = lotest.documents.add("d:\cust\penski\apps32\data\report01.dot")
loTest.visible = .t.
lotest.selection.EndKey(6)
lotest.selection.Font.Size = 12
lotest.Selection.InsertBefore("Date goes here") &&() && DateTimeFormat:="MMMM d, yyyy", InsertAsField:= _False
lotest.Selection.InsertDateTime() &&() && DateTimeFormat:="MMMM d, yyyy", InsertAsField:= _False
loTest.Selection.ParagraphFormat.Alignment = 1 && "wdAlignParagraphCenter"
loTest.Selection.InsertParagraph()
loTest.Selection.ParagraphFormat.Alignment = 0
loTest.Selection.InsertParagraph()
wait window
lotest.activate
wait window
lotest.quit
rele loTest
return
Everything works EXCEPT the "InsertDateTime" command. What I'm really looking for is:
1) A reference for using word in VFP and
2) A header file so I can use their constants instead of the cryptic values.
Anyone have any ideas?
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