Code: Select all
wdApp := ComObjCreate("Word.Application") ;create a word app
wdApp.Visible := true
oConnect := ComObjConnect(wdApp,"wd_") ;connect to events
wdApp.Documents.Add() ;add a new document
wd_NewDocument(Doc,App) { ;when creating a new document, this triggers
MsgBox, % Doc.Name ; Show the name of the new document
App.Selection.TypeText("Hello world") ; Type text at the current selection
}
wd_Close(Doc,App) ;<------------ Here is the problem, I've tried wd_Close,wd_Quit and wd_Exit with no success
MsgBox, % App.Name ; Show the name of the application
ComObjConnect(App) ; Disconnect from App events
}