' If Word isn't open VB will raise an error
' so this statement takes care of that
On Error Resume Next
' Check if Word is open
Set Test = GetObject(, "Word.application"
' If Word is not open
If Test Is Nothing Then
Set Test = CreateObject("Word.Application"
Test.Visible = False
End If
' If Word is open
If Not Test Is Nothing Then
' This is the location of the template I created
Test.WindowState = 2
Test.Documents.Add "D:\Example.doc"
End If
' ***************** DO STUFF *****************
' I didn't save the document you can if you
' want to, just remove DoNot
Test.ActiveDocument.Close wdDoNotSaveChanges
Word.Application.Quit wdDoNotSaveChanges
' Remove word from memory
Set Test = Nothing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.