Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate Code
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) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate Code
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) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate Code
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deactivate Save As | Excel Discussion (Misc queries) | |||
Deactivate worksheet | Excel Discussion (Misc queries) | |||
Worksheet Deactivate | Excel Programming | |||
Workbook Deactivate | Excel Programming | |||
Deactivate Formula | Excel Programming |