ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I run macros upon opening only if it is not the template? (https://www.excelbanter.com/excel-programming/409461-how-do-i-run-macros-upon-opening-only-if-not-template.html)

davis6206

How do I run macros upon opening only if it is not the template?
 
I currently have a Private Sub that is supposed to run on Workbook_Open. It
runs macros when I open that particular workbook. However, that workbook is
a template. I don't want the macros to run when I'm opening the template. I
only want them to run if I'm creating a new workbook using that template.
How do I tell it to run the macros depending on whether I'm opening the
template or creating a new workbook using the template?

Office_Novice

How do I run macros upon opening only if it is not the template?
 
Try putting the code in Workbook_New rather then _open. This should solve
your problem

"davis6206" wrote:

I currently have a Private Sub that is supposed to run on Workbook_Open. It
runs macros when I open that particular workbook. However, that workbook is
a template. I don't want the macros to run when I'm opening the template. I
only want them to run if I'm creating a new workbook using that template.
How do I tell it to run the macros depending on whether I'm opening the
template or creating a new workbook using the template?



All times are GMT +1. The time now is 09:51 AM.

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