Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Protect & Unprotect Several Worksheets
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
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
workbook macro help ditchy Excel Discussion (Misc queries) 2 December 27th 04 04:48 AM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 3 December 13th 04 08:43 PM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 1 December 13th 04 07:55 PM
excel macro inconsistency JM Excel Discussion (Misc queries) 2 December 9th 04 01:13 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 11:55 AM.

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"