If found the code below on the Internet but cannot use it because some of the code such as Word.Document and Word.Application produces an error "not defined". Is there an Import that I need to use?
Private Sub GetWordStatus()
Dim wordDoc As Word.Document
Dim wordAppl As Word.Application
Dim mydoc As String
Dim myAppl As String
'now check if Word is running
If Not IsRunning(wordAppl) Then
MessageBox.Show("Word is not running -> will create a new instance of Word. ")
Set wordAppl = CreateObject("Word.Application")
Set wordDoc = wordAppl.Documents.Open(mydoc)
Else
MessageBox.Show("Word is running -> will get the specified document. ")
' Bind the wordDoc variable to a specific Word document
Set wordDoc = GetObject(mydoc)
End If
End Sub
