Conditional Closing of open Word Doc

  • Thread starter jer99 via AccessMonster.com
  • Start date
J

jer99 via AccessMonster.com

I have the following code:
Set m_objWord = New Word.Application
Set m_objDoc = m_objWord.Documents.Add(m_strDir & m_strTemp)
(populate bookmarks)
(print)
(save)
m_objDoc.Close
m_objWord.Quit

Set m_objDoc = Nothing
Set m_objWord = Nothing

It works great. But if there is an error, it goes to the error handler and
bypasses the close/quit logic.
Is there a way to test to see if it is open and if so, THEN close it?
 
P

Pendragon

Type Open Word Doc into the search engine of this thread and you should find
several responses that detail how to do this.
 
Top