Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controling MS Word from VFP
Message
From
05/08/1997 09:57:42
 
 
To
04/08/1997 12:26:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00043068
Message ID:
00043208
Views:
30
>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?

There is an article in the MS Knowledge base called "Converting VBA to VFP and Using OLE". It pretty much lays out the rules for the syntax. If you can't find it, let me know and I'll see if I can dig it up for you.

Erik
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform