G
George Lee
If the user closes a document, the object reference becomes invalid but it is
not NULL, Nothing, or Empty. How do test if a document is still valid? For
example:
dim gWordDocument as Word.Document
Set gWordDocument = ActiveDocument
...
'If the user closes the document now, the following tests do not work
If IsEmpty(gWordDocument) Then ...
If IsNull(gWordDocument) Then ...
If gWordDocument Is Nothing Then...
'This will error
Label3.Caption = "File name: " & gWordDocument.Windows(1).Caption
not NULL, Nothing, or Empty. How do test if a document is still valid? For
example:
dim gWordDocument as Word.Document
Set gWordDocument = ActiveDocument
...
'If the user closes the document now, the following tests do not work
If IsEmpty(gWordDocument) Then ...
If IsNull(gWordDocument) Then ...
If gWordDocument Is Nothing Then...
'This will error
Label3.Caption = "File name: " & gWordDocument.Windows(1).Caption