Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Forcing Macros to Run (Else Deny Access to Workbook)
Hi All,
I seem to recall occasionally opening a workbook that has macros in it and, upon asking Excel to 'disable macros', being informed that the workbook contained macros written in Excel 4 which cannot be disabled. In that situation, if I recall correctly, I was given two choices: 1) Open the workbook with the macros enabled; or 2) Don't open it at all. At the time I was quite annoyed, but now it seems to me to be a good way to avoid staff from disabling the macros within a shared workbook where I really need for them to be active. Is there still a way, using Excel 2000 (or Excel 97), to create an Excel 4 macro that will ensure users have to enable macros? The macro does not need to do anything in particular I guess, just being there should be enough? Thanks in advance, Alan. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Forcing Macros to Run (Else Deny Access to Workbook)
One possible solution
A good way is to hide all sheets except one and unhide them in the workbook open event. Place a message on that sheet with "you must enabled macro's to work with this file" And hide the sheets in the beforeclose event. So the user can't use the workbook if he disable macro's. If he do the workbook open event don't run so there are no sheets to work with Some example code to do this Sheet 1 stay always visible Sub HidealmostAll() Dim a As Integer For a = 2 To Sheets.Count Sheets(a).Visible = xlVeryHidden Next a End Sub Sub ShowAll() Dim a As Integer For a = 2 To Sheets.Count Sheets(a).Visible = True Next a End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Alan" wrote in message ... Hi All, I seem to recall occasionally opening a workbook that has macros in it and, upon asking Excel to 'disable macros', being informed that the workbook contained macros written in Excel 4 which cannot be disabled. In that situation, if I recall correctly, I was given two choices: 1) Open the workbook with the macros enabled; or 2) Don't open it at all. At the time I was quite annoyed, but now it seems to me to be a good way to avoid staff from disabling the macros within a shared workbook where I really need for them to be active. Is there still a way, using Excel 2000 (or Excel 97), to create an Excel 4 macro that will ensure users have to enable macros? The macro does not need to do anything in particular I guess, just being there should be enough? Thanks in advance, Alan. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Forcing Macros to Run (Else Deny Access to Workbook)
Hi Alan
If you protect your project also he can't with xlVeryHidden Alt-F11 ToolsVBA project properties See the protection tab -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Alan" wrote in message ... "Ron de Bruin" wrote in message ... One possible solution A good way is to hide all sheets except one and unhide them in the workbook open event. Place a message on that sheet with "you must enabled macro's to work with this file" And hide the sheets in the beforeclose event. So the user can't use the workbook if he disable macro's. If he do the workbook open event don't run so there are no sheets to work with Some example code to do this Sheet 1 stay always visible Sub HidealmostAll() Dim a As Integer For a = 2 To Sheets.Count Sheets(a).Visible = xlVeryHidden Next a End Sub Sub ShowAll() Dim a As Integer For a = 2 To Sheets.Count Sheets(a).Visible = True Next a End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl Hi Ron, What is to stop a user just unhiding the sheets? That is what I would do! Thanks, Alan. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Forcing a workbook to open on a certain page | Excel Discussion (Misc queries) | |||
Deny/Allow for certain range. | Excel Discussion (Misc queries) | |||
deny printing for certain blank cells | Excel Worksheet Functions | |||
How do I deny opening and viewing any file to any user and lock i. | Excel Discussion (Misc queries) | |||
Deny file access if user declines macros? | Excel Discussion (Misc queries) |