WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Word

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Run a Word Macro


;Code that launches an Word macro

;Define .DOC file 
doc = "C:\Temp\test.doc"
MacroName = "Macro1"
objWord = ObjectCreate("Word.Application")
objWord.Visible = @TRUE  ;Set to @FALSE when completely debugged
objWord.DisplayAlerts = @FALSE

;Open .doc file
objDoc = objWord.Documents
objDoc.Open(doc)

;Get Current time
starttime = 

;Execute macro code
objWord.Run(MacroName)


;Close object handles
objDoc = 0
objWord = 0
exit

Article ID:   W17188
File Created: 2007:07:03:14:28:40
Last Updated: 2007:07:03:14:28:40