Problem accessing MSWord ActiveDocument
When I try to programmatically access the Word object model, I get an error when no document is active. This is because I load the document as invisible using Word automation and I have to keep it invisible.
How do I code an open macro so that it doesn't do anything in this case?
If Not ActiveDocument is Nothing Then
does not work.
Private Sub Document_Open()
If (ActiveDocument.SaveFormat = wdFormatRTF) Then
'Do some stuff
End If
End Sub
+1
source to share