ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Manually call Workbook_Activate procedure (https://www.excelbanter.com/excel-programming/382784-manually-call-workbook_activate-procedure.html)

joeeng

Manually call Workbook_Activate procedure
 
Is there a way to manually run the Workbook_Activate event procedure from
another workbook without actually activating the workbook?

Gary''s Student

Manually call Workbook_Activate procedure
 
Very easy:

Construct the Workbook Activate sub to do nothing other than call another
public sub in a standard module. This "other" sub will do the real work.

In this way the "other "sub will be available to other projects/modules.


--
Gary's Student
gsnu200704


"joeeng" wrote:

Is there a way to manually run the Workbook_Activate event procedure from
another workbook without actually activating the workbook?


joeeng

Manually call Workbook_Activate procedure
 
Your response was very inciteful. However, it still left the question of how
to call the "other" sub, anyway. In figuring that out, I did find a way to
actually address the Workbook_Activate sub directly.

Application.Run "'Other workbook name.xls'!Thisworkbook.Workbook_Activate"

Workbook_Activate can be either private or public sub. The single quotes
around the workbook name are used just in case the workbook name contains
spaces.

joeeng

"Gary''s Student" wrote:

Very easy:

Construct the Workbook Activate sub to do nothing other than call another
public sub in a standard module. This "other" sub will do the real work.

In this way the "other "sub will be available to other projects/modules.


--
Gary's Student
gsnu200704


"joeeng" wrote:

Is there a way to manually run the Workbook_Activate event procedure from
another workbook without actually activating the workbook?



All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com