ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving Code (https://www.excelbanter.com/excel-programming/311441-moving-code.html)

[email protected]

Moving Code
 
I have a series of workbooks that are being created through a VBA tool.

In each of these workbooks, I need to place code that will execute upon
their opening and thus I need code in the This Workbook.

I've tried to think of a way to do this by moving a worksheet from my
tool into the new workbooks, but I can't seem to find a way.

Am I better off having the code in another file that my tool opens,
customizes the data in, and then closes? If so, how do I can I
temporarily turn off the code in that file while my tool dumps data and
formats in then turn it back on so that when a user opens that file,
the code executes as it should.


Tom Ogilvy

Moving Code
 
application.EnableEvents = False
' open the workbook
' process the workbook
' close the workbook
Application.EnableEvents = True

--
Regards,
Tom Ogilvy

" wrote in message
oups.com...
I have a series of workbooks that are being created through a VBA tool.

In each of these workbooks, I need to place code that will execute upon
their opening and thus I need code in the This Workbook.

I've tried to think of a way to do this by moving a worksheet from my
tool into the new workbooks, but I can't seem to find a way.

Am I better off having the code in another file that my tool opens,
customizes the data in, and then closes? If so, how do I can I
temporarily turn off the code in that file while my tool dumps data and
formats in then turn it back on so that when a user opens that file,
the code executes as it should.





All times are GMT +1. The time now is 09:45 PM.

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