ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook opened with macros disabled (https://www.excelbanter.com/excel-programming/305289-workbook-opened-macros-disabled.html)

Alan.Hutchins

Workbook opened with macros disabled
 
Having got past the issue of users using CTRL+Break to
stop a macro, a colleague has pointed out that users may
open a workbook with "Macros disabled".

This presents me with a conundrum...........

If the workbook is opened with macros disabled, I want to
prevent any data entry from taking place, but if the
macros are disabled, I can't use the worksheet change
event to inform the user..

The only solution I could think of is:

1. Identify all the cells which are unlocked for data
entry (all the rest are locked), and set them to "locked".

2. Write a procedure that "unlocks" these cells if the
parameter is set to an agreed value.

3. Set the parameter to the agreed value if the auto_open
macro has been successfully completed - thereby unlocking
the data entry cells.

This would stop any data entry if the workbook was opened
and the macros were disabled.

BUT, does anyone have any better solutions to this ?

I am presently on Windows NT with Excel 97.

Thanks

Alan

Frank Kabel

Workbook opened with macros disabled
 
Hi
I use a quite similar approach
1. Create a worksheet with a message like 'Macros have to
be enabled'
2. Hide all other sheets (with xlsheetveryhidden)
3. In the AutoOpen macro hide sheet 1 and unhide all other
sheets
4. In the Beforeclose event hide all sheets and unhide
sheet 1 + save the workbook



-----Original Message-----
Having got past the issue of users using CTRL+Break to
stop a macro, a colleague has pointed out that users may
open a workbook with "Macros disabled".

This presents me with a conundrum...........

If the workbook is opened with macros disabled, I want to
prevent any data entry from taking place, but if the
macros are disabled, I can't use the worksheet change
event to inform the user..

The only solution I could think of is:

1. Identify all the cells which are unlocked for data
entry (all the rest are locked), and set them to "locked".

2. Write a procedure that "unlocks" these cells if the
parameter is set to an agreed value.

3. Set the parameter to the agreed value if the auto_open
macro has been successfully completed - thereby unlocking
the data entry cells.

This would stop any data entry if the workbook was opened
and the macros were disabled.

BUT, does anyone have any better solutions to this ?

I am presently on Windows NT with Excel 97.

Thanks

Alan
.



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

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