Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Checking if Application closed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TedMi - 07 Oct 2006 15:11 GMT
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.
Signature

Ted

Jay Freedman - 07 Oct 2006 18:44 GMT
Have a look at the technique in
http://www.word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm. The same
thing should work from Access.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>I'm using the following code to manipulate some word docs from Access:
>Dim appWord as Word.Application
[quoted text clipped - 9 lines]
>robust way to test if the application has been closed.
>Thanks.
TedMi - 09 Oct 2006 15:06 GMT
Thanks Jay, that works
Signature

Ted

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.