T
TedMi
I'm using the following code to manipulate some word docs from Access:
Dim appWord as Word.Application
If appWord Is Nothing Then Set appWord=CreateObject("Word.Application")
appWord.Visible = True
appWord.Documents.Open FileName:="xx.doc"
' set doc properties here
This works fine, except if the user closes Word from within Word. In that
case, when back in Access, appWord is *not* nothing, so the object is not
created, and the visible statement fails. I have trapped this error and
create the object in the error handler, but am wondering if there is a more
robust way to test if the application has been closed.
Thanks.
Dim appWord as Word.Application
If appWord Is Nothing Then Set appWord=CreateObject("Word.Application")
appWord.Visible = True
appWord.Documents.Open FileName:="xx.doc"
' set doc properties here
This works fine, except if the user closes Word from within Word. In that
case, when back in Access, appWord is *not* nothing, so the object is not
created, and the visible statement fails. I have trapped this error and
create the object in the error handler, but am wondering if there is a more
robust way to test if the application has been closed.
Thanks.