Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default Disabling Macros

I have a workbook (with several worksheets). One of the worksheets just
contains information explaining the use and functionality of the workbook.
How can I stop a user from trying to run the macro when the informational
sheet is active? MY first attempt was to create a private sub on the
worksheet and use Application.OnKey and trap the macro's I do not want the
user to run. Excel blew up and abended abnormally.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Disabling Macros

Hi Greg

You can use something like this

Sub test()
If ActiveSheet.Name = "Sheet1" Then
'do nothing
Else
MsgBox "Your code"
End If
End Sub





--
Regards Ron de Bruin
http://www.rondebruin.nl



"Greg" wrote in message ...
I have a workbook (with several worksheets). One of the worksheets just
contains information explaining the use and functionality of the workbook.
How can I stop a user from trying to run the macro when the informational
sheet is active? MY first attempt was to create a private sub on the
worksheet and use Application.OnKey and trap the macro's I do not want the
user to run. Excel blew up and abended abnormally.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disabling Macros

I would recommend a low tech, low maintenance solution such as:

Sub MyMacro()
if lcase(sh.Name) = "Intro" then exit sub
' existing code
End sub

Using something to check that is guaranteed not to change might be better
than the sheet name. It could also be a positive check - check for the
sheet you want you macro to run on.

--
Regards,
Tom Ogilvy


"Greg" wrote in message
...
I have a workbook (with several worksheets). One of the worksheets just
contains information explaining the use and functionality of the workbook.
How can I stop a user from trying to run the macro when the informational
sheet is active? MY first attempt was to create a private sub on the
worksheet and use Application.OnKey and trap the macro's I do not want the
user to run. Excel blew up and abended abnormally.



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
Disabling macros EllenM Excel Discussion (Misc queries) 1 February 26th 08 04:57 PM
Disabling Macros R. SRIKANTH Excel Programming 4 January 11th 04 03:26 PM
Disabling/Enabling Macros HRobertson Excel Programming 2 October 24th 03 04:07 PM
preventing disabling of macros Combo[_2_] Excel Programming 0 October 9th 03 12:46 AM
disabling Auto_Open macros Malone[_2_] Excel Programming 3 October 2nd 03 10:20 PM


All times are GMT +1. The time now is 06:42 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"