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 / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Deactivate Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 14 Sep 2007 11:16 GMT
I have a model which allows users to select a range of items to print, and it
can be used from a variety of other model sources.

When it is used it displays the list, allows them to select, then has two
buttons - one to process and one to exit.

However, if they simply activate another workbook the process becomes lost.  

What I want to do is place some code in the WorkbookDeactivate event that
will ask whether this is what they want to do, then return without
deactivating the selection model if they select that option.  A messagebox in
the deactivate code gives me the response, but how do I pass the user back to
the workbook they have just tried to deactivate ?

(Sorry for the long-winded explanation)
Joel - 14 Sep 2007 12:32 GMT
I think you are over complicating the problem.  ThisWorkbook needs to be
added to your code which will return the code to the workbook where the code
is executing rather than any other workbook.  The default window is the
active window which is the newly opened workbook.  Simply adding
Thisworkbook.Activate should solve the problem.

> I have a model which allows users to select a range of items to print, and it
> can be used from a variety of other model sources.
[quoted text clipped - 11 lines]
>
> (Sorry for the long-winded explanation)
Paul - 14 Sep 2007 13:02 GMT
As always the simplest answers are the best.

Many thanks

> I think you are over complicating the problem.  ThisWorkbook needs to be
> added to your code which will return the code to the workbook where the code
[quoted text clipped - 17 lines]
> >
> > (Sorry for the long-winded explanation)
 
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.