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.

OLE and Word Example


A simple example for Word OLE
; This code accesses an existing copy of Word if already running or launches Word.
file=  "c:\name.doc"

If AppExist("winword.exe")
  oWORD  = ObjectGet("Word.Application", @FALSE)
  newWord = @FALSE
Else
  oWORD  = ObjectCreate("Word.Application")
  newWord = @TRUE
EndIf
oWORD.visible=@TRUE
oDOCS = oWORD.Documents
oDOC  = oDOCS.Open(file)
oActiveDoc = oWORD.activedocument

oActiveDoc.close()
oSel = 0
oActiveDoc = 0
oDOC = 0
oDOCS = 0
If newWord
  oWord.Quit
EndIf
oWORD = 0
Exit


Article ID:   W16145
File Created: 2010:07:29:10:57:26
Last Updated: 2010:07:29:10:57:26