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 / November 2007

Tip: Looking for answers? Try searching our database.

How to CLOSE ALL DIALOGS before saving???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Antinsh - 15 Nov 2007 13:45 GMT
That's it! I need to save my file from code but if someone has opened like
say FIND DIALOG then you cant save. So I would like to know if there's any
way to close all the open dialogs before saving.

Dont be shy:) Any help will be appreciated.
Signature

...but the beer is still good!

fumei - 27 Nov 2007 19:25 GMT
Hmmm.  No reply yet.  I would be interested in someone came up with something.
I am not sure it is possible.  An open dialog has focus.  You can not execute
anything until it loses that focus.

If you have any open dialog, and try to run any code at all, even right from
the VBE, you can't.  The Application object is giving full focus to the
dialog.

I would be happy to hear that one could do what you are asking, but it may
not be possible.
Julian - 29 Nov 2007 23:57 GMT
I can't see what the original question was but reading between the lines...
and assuming this is Word VBA...

> Hmmm.  No reply yet.  I would be interested in someone came up with
> something.
[quoted text clipped - 6 lines]
> the VBE, you can't.  The Application object is giving full focus to the
> dialog.

In principle IF the dialog is MODAL, not otherwise - but I regularly see
supposedly MODAL dialogs that have lost focus and can't easily be dismissed.
And OnTime code will run whenever it's supposed to except in Debug mode -
and the VBE will tell you that it has failed to run as soon as it tries.

To get rid of potentially lurking dialogs - if they are userforms, msgbox's,
inputs - enforce some form of titling convention and then iterate through
the Tasks collection and close the task on string matching - but beware:
unpredictable results may occur, but it's handy if you're stuck... you can
even do it across applications via the Tasks collection.

Rate this thread:






 
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.