LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Hiding Macro from View

John,

This should fit your need.
I have several VBA applications that I not only want to
protect the code, but also need to prevent the User from
running a macro out of sequence (They click a button to
run them).
1. First, protect all the macros with password.
In the workbook load event, set a variable to a value.
For example:
okToRun = False
2. Then in each marco, add code to check the value of a
variable.
if example:
If okToRun = False Then
MsgBox "You are not authorized to run this macro." &
vbCrLf & "Contact for additional
information.", vbExclamation, "Security Warning"
Exit Sub
Else: End If
3. Then in the event that allows the User to run the
macro (clicking the command button in my example), set
the variable to True:
okToRun = True

Show, the macros are still visible, but can't be run
unless the button is clicked.
Hope that helps. Email me if you have any questions.

Ed

 
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
Hiding Columns in split view gtslabs Excel Worksheet Functions 1 December 14th 08 06:06 PM
Resetting view when hiding detail in outline level VJP Excel Discussion (Misc queries) 0 November 9th 07 02:29 PM
help... i might need a macro for this.. (hiding a specific # of ro Mo2 New Users to Excel 7 May 28th 07 08:13 AM
Hiding Rows in a VBA macro sarcher Excel Discussion (Misc queries) 1 May 15th 06 03:39 PM
How do I view cell text without it visually hiding other cells? ldmci Excel Discussion (Misc queries) 1 May 27th 05 04:12 PM


All times are GMT +1. The time now is 10:54 AM.

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

About Us

"It's about Microsoft Excel"