ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do I prevent a file from opening if user has disabled macros? (https://www.excelbanter.com/excel-programming/330108-how-do-i-prevent-file-opening-if-user-has-disabled-macros.html)

mwh1107

how do I prevent a file from opening if user has disabled macros?
 
I would like to show a dialogue box telling user that they do not have
macro's enabled and that the file they are attempting to open requires
macro's to work properly. I'd like this to show up even if they have set
Macro Security to high.

Jim Thomlinson[_4_]

how do I prevent a file from opening if user has disabled macros?
 
Can't do it. If security is high the macros won't run. Catch 22. Here is the
workaround. Add a sheet telling the user that macro security must be medium
or low. Use an on_open macro that does nothing but hide this sheet
(xlVeryHidden). If security is high then they see the sheet because the macro
won't run. Otherwise they see just what they are supposed to see. And to
answer your next question, no you can not change the security setting using a
macro.
--
HTH...

Jim Thomlinson


"mwh1107" wrote:

I would like to show a dialogue box telling user that they do not have
macro's enabled and that the file they are attempting to open requires
macro's to work properly. I'd like this to show up even if they have set
Macro Security to high.


mwh1107

how do I prevent a file from opening if user has disabled macr
 
Thanks. As a newby, it took me a while to figure out how to make a On_Open
sub, but I figured it out.

I also had to change the state of the "warning" worksheet to visible
BeforeClose.

Thanks again.

"Jim Thomlinson" wrote:

Can't do it. If security is high the macros won't run. Catch 22. Here is the
workaround. Add a sheet telling the user that macro security must be medium
or low. Use an on_open macro that does nothing but hide this sheet
(xlVeryHidden). If security is high then they see the sheet because the macro
won't run. Otherwise they see just what they are supposed to see. And to
answer your next question, no you can not change the security setting using a
macro.
--
HTH...

Jim Thomlinson


"mwh1107" wrote:

I would like to show a dialogue box telling user that they do not have
macro's enabled and that the file they are attempting to open requires
macro's to work properly. I'd like this to show up even if they have set
Macro Security to high.



All times are GMT +1. The time now is 02:08 AM.

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