Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using OLE Automation with Word97
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00154208
Message ID:
00154231
Views:
15
>My goal is to be able to...
>
>1) Check to see if Word 97 is open
>2) If not, open it
>3) Open a mail merge document
>4) Perform the mail merge
>5) Print the result
>6) Quit Word (If it was not already open)
>
>Where do I find all of the proper syntax to use?
>Do I use GETOBJECT/CREATEOBJECT? With what parameters?
>DDEInitiate?
>
>I'm so confused...
>
>Any help would be appreciated!

I create an object line and I add some properties (objName, bErrorWord97)

*-- If word is not open GETOBJECT return an error so in the Error methode
*-- I set .bErrorWord97 = .T.

.objName = GETOBJECT(, "Word.Application.8")
IF .bErrorWord97

.bErrorWord97 = .F.
lobuffer = CREATEOBJECT("Word.Application.8")
*-- 2 lines above use to fix a no-toolbar trouble
lobuffer.APPLICATION.WINDOWSTATE = 0
lobuffer.visible = .T.
RELEASE lobuffer
.objName = GETOBJECT(, "Word.Application.8")
ENDIF

to merge I have something like
WITH THIS.ObjName.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute()
ENDWITH

POSITION.HLP this file can help you, you can find it on MS web site (it could be position.exe an extract file) and to find the command you need, the help in the macro editor is usefull too. I hope it can help you to start.
Analystik Team
1430 Belanger
Montreal (Quebec)
Canada
(514) 278-2727
analyste@analystik.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform