Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing a workbook to open on a certain page learningguru1978 Excel Discussion (Misc queries) 6 November 21st 08 07:29 PM
Deny/Allow for certain range. Dan Excel Discussion (Misc queries) 2 October 5th 08 02:56 AM
deny printing for certain blank cells huntnpeck2 Excel Worksheet Functions 2 October 3rd 07 04:57 PM
How do I deny opening and viewing any file to any user and lock i. Leah Wright Excel Discussion (Misc queries) 1 April 22nd 05 11:59 PM
Deny file access if user declines macros? [email protected] Excel Discussion (Misc queries) 3 February 7th 05 03:02 PM


All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"