ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting VBA Code Programmatically (https://www.excelbanter.com/excel-programming/376301-inserting-vba-code-programmatically.html)

roadkill

Inserting VBA Code Programmatically
 
Is there a way to insert VBA code programmatically? I have a template
containing a macro that, among other things, creates a sheet with a pivot
table. There is also a macro in a module in this file that I want to run
whenever this pivot table is updated. Since the sheet with the pivot table
doesn't exist until created by the macro, I don't know of a way (other than
manually after the macro runs) to drop in the event macro to trigger the
desired module code. Is there a programmatic way to do this?
Will

Jim Thomlinson

Inserting VBA Code Programmatically
 
Check out this link...

http://www.cpearson.com/excel/vbe.htm

--
HTH...

Jim Thomlinson


"roadkill" wrote:

Is there a way to insert VBA code programmatically? I have a template
containing a macro that, among other things, creates a sheet with a pivot
table. There is also a macro in a module in this file that I want to run
whenever this pivot table is updated. Since the sheet with the pivot table
doesn't exist until created by the macro, I don't know of a way (other than
manually after the macro runs) to drop in the event macro to trigger the
desired module code. Is there a programmatic way to do this?
Will


roadkill

Inserting VBA Code Programmatically
 
This looks like it should take care of my my problem.
Thank you

"Jim Thomlinson" wrote:

Check out this link...

http://www.cpearson.com/excel/vbe.htm

--
HTH...

Jim Thomlinson


"roadkill" wrote:

Is there a way to insert VBA code programmatically? I have a template
containing a macro that, among other things, creates a sheet with a pivot
table. There is also a macro in a module in this file that I want to run
whenever this pivot table is updated. Since the sheet with the pivot table
doesn't exist until created by the macro, I don't know of a way (other than
manually after the macro runs) to drop in the event macro to trigger the
desired module code. Is there a programmatic way to do this?
Will



All times are GMT +1. The time now is 04:38 AM.

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