ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Macro (https://www.excelbanter.com/excel-programming/398692-disable-macro.html)

phuser[_2_]

Disable Macro
 
I have a macro that prompts the user to make a new workbook on startup,
would it be possible to stop the macro using an if statement that says if
this book has any other filename other than the origanl =vbno ?



Sam Wilson

Disable Macro
 
I think what you want is quite straight-forward. In your existing macro you
need to add something like the following before it gets down to business...

if not activeworkbook.name = "blahblahblah.xls" then
exit sub
end if

where blahblahblah.xls is the only workbook where the macro isn't stopped.

"phuser" wrote:

I have a macro that prompts the user to make a new workbook on startup,
would it be possible to stop the macro using an if statement that says if
this book has any other filename other than the origanl =vbno ?




phuser[_2_]

Disable Macro
 
Sweet!! Thanks so much


"Sam Wilson" wrote in message
...
I think what you want is quite straight-forward. In your existing macro you
need to add something like the following before it gets down to
business...

if not activeworkbook.name = "blahblahblah.xls" then
exit sub
end if

where blahblahblah.xls is the only workbook where the macro isn't stopped.

"phuser" wrote:

I have a macro that prompts the user to make a new workbook on startup,
would it be possible to stop the macro using an if statement that says if
this book has any other filename other than the origanl =vbno ?







All times are GMT +1. The time now is 02:20 PM.

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