Testing, in VB, if the macro security has been set to high ?

Angelo Dundee

Board Regular
Joined
Nov 18, 2002
Messages
167
1) Can someone do a test in visual basic to check whether the macro
security has been set to high ?
e.g. If the security is high, then the program should issue the following
warning, when starting :-
'The program will not open because your macro security has been set to
high'
'Change the macro security to medium, and re-open the program'

2) Can someone do a test in visual basic to check whether the user has
disabled the macro's ( on entry ) ?
e.g. If the macro's have been disabled, then the program should issue the
following warning, when starting :-
'The program will not open because you have disabled the macro's'
'Re-start the program, and enable the macro's, or else the program will not
open'
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Angelo Dundee

Board Regular
Joined
Nov 18, 2002
Messages
167
re :-

Thanks Andrew, however :-

The warning sheet has been made visible and all other sheets have been
hidden on the previous close of the program.

The problem with this is that :-

After the user presses enable macro's the warning sheet will become
visible, and stay visible, untill the Workbook_Open VB has finished
initialising.
If the Workbook_Open macro is big, then the warning sheet may stay
visible for quite some time.
Obviously this is not neat programing !

Can anybody suggest a solution to this ?
 

bandit_1981

Board Regular
Joined
Aug 17, 2005
Messages
201
It might not be neat but it is sadly the best and safest way to handle this. You can do it but the method used is not a wise one to take I and just about everyone else will agree on that. If you where to use a VB launch program for your spreadsheet you could look at their registry settings and see what the marco sercurity is. Then you could prompt your message before opening the spread sheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,111
Messages
5,570,257
Members
412,313
Latest member
pauloalex
Top