Could you check it like this? So can you determine which object is Nothing ... maybe it is ActiveDocument in your case?
If ThisApplication Is Nothing Then
Err.Raise 91, , "ThisApplication is Nothing!"
Else
If ThisApplication.ActiveDocument Is Nothing Then
Err.Raise 91, , "ActiveDocument is Nothing!"
Else
If ThisApplication.ActiveDocument.File Is Nothing Then
Err.Raise 91, , "File is Nothing!"
End If
End If
End If
Dim f As File
Set f = ThisApplication.ActiveDocument.File
Or just like this (to reduce nesting of ifs):
If ThisApplication Is Nothing Then
Err.Raise 91, , "ThisApplication is Nothing!"
End If
If ThisApplication.ActiveDocument Is Nothing Then
Err.Raise 91, , "ActiveDocument is Nothing!"
End If
If ThisApplication.ActiveDocument.File Is Nothing Then
Err.Raise 91, , "File is Nothing!"
End If