Trouble accessing MSWord ActiveDocument
- by Adam Tegen
When I try to programmatically access a word object model, I get an error no document is active. This appears to be because I am loading the document as not visible using Word automation, and I have to keep it invisible.
How would I code the open macro so that it does nothing in this case? "If Not ActiveDocument is Nothing Then" didn't work.
Private Sub Document_Open()
If (ActiveDocument.SaveFormat = wdFormatRTF) Then
'Do some stuff
End If
End Sub