Home |
Search |
Today's Posts |
#1
|
|||
|
|||
How to protect my macro
I am using macro to protect and unprotect a multi worksheet-workbook, how can
I stop data entry person from running unprotect macro when it is protected? If I use private for my macro, how can I see them myself to run protect or unprotect when needed. Thanks |
#2
|
|||
|
|||
Maybe you could have your macro prompt you for a password:
if inputbox("what's the key") < "hiThere" then exit sub Or name the macro something no one else will guess. But instead of selecting it, you'll have to type it in the macro dialog box. == You could even have it check to see who's logged on to the network: Option Explicit Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Sub topsecret() If fOSUserName < "David Peterson" Then Exit Sub MsgBox "hi there" End Sub Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function Protect & Unprotect Several Worksheets wrote: I am using macro to protect and unprotect a multi worksheet-workbook, how can I stop data entry person from running unprotect macro when it is protected? If I use private for my macro, how can I see them myself to run protect or unprotect when needed. Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
workbook macro help | Excel Discussion (Misc queries) | |||
Record Macro Relative does not work? | Excel Discussion (Misc queries) | |||
Record Macro Relative does not work? | Excel Discussion (Misc queries) | |||
excel macro inconsistency | Excel Discussion (Misc queries) | |||
Macro and If Statement | Excel Discussion (Misc queries) |