PC Review


Reply
Thread Tools Rate Thread

Deactivate Code

 
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      14th Sep 2007
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)
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      14th Sep 2007
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.

"Paul" wrote:

> 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)

 
Reply With Quote
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      14th Sep 2007
As always the simplest answers are the best.

Many thanks

"Joel" wrote:

> 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.
>
> "Paul" wrote:
>
> > 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)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I deactivate code in word to read it? truckerfriend Microsoft Word New Users 2 19th Jun 2009 06:01 AM
Need to Deactivate my XP Pro Starship Windows XP General 3 12th Jul 2008 02:59 PM
Need to Deactivate my XP Pro Starship Windows XP Help 3 12th Jul 2008 02:59 PM
How to deactivate XP =?Utf-8?B?QnJ1Y2VG?= Windows XP Setup 4 8th Mar 2005 07:17 PM
How do I deactivate XP? K Windows XP Security 3 19th Nov 2003 03:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:27 PM.