Method for checking if an object is open

  • Thread starter Thread starter strangermike
  • Start date Start date
S

strangermike

I have a button on my tool bar that will open a word docuement with
template. However, being new to most of this coding in Outlook, I a
not sure how to code for the possibility of the user closing MS Word
vs. the program running the .quit method.

So basically I get an error on this line of code if the user has al
ready closed MS Word.

appWord.quit

(appWord was derived by Set appWord = CreateObject("Word.Application")


If they have not closed word, it runs okay.

Can you tell me what I can check to see if Word is still open befor
running the quit?

Also, where can I find a list of the different methods that can be use
with the objects, for Word, Access, Excel, etc?

Thanks for your help
 
Why not just handle the error?

On Error Resume Next
AppWord.Quit

When in doubt about objects, properties, and methods, check the object
browser: Press ALt+F11 to open the VBA environment in Outlook, then press
F2. Add other libraries to the project references to browse their objects as
well.
 
Back
Top