![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Ireland
Posts: 133
|
Please can somebody help me? I have a macro which requires a user to provide a password before they can unhide some sheets in a file. The workbook is protected and they must provide the password to unprotect it and then unhide the sheets. The macro works fine on my PC, but when somebody else uses it, they can enter any password and it will allow them view the sheets. Why is this. Please help. My code is:
Public Sub UnprotectandUnhide() Dim Pass As String Dim Sicktime Pass = InputBox("Please enter password to unhide sheets") Sicktime = Range("B10").Value On Error GoTo ErrorHandler ActiveWorkbook.Unprotect Pass If Sicktime >= "37622" Then H2003 Else If Sicktime >= "37257" Then H2002 Else If Sicktime >= "36892" Then H2001 Else End If Sicktime >= "37257" Then H2002 Else If Sicktime >= "36892" Then H2001 Else End If Sicktime >= "36892" Then H2001 Else End Exit Sub ErrorHandler: MsgBox "Wrong password, please re-enter" On Error GoTo 0 End Sub Please help. The other PC does have macros enabled... [ This Message was edited by: y2k on 2002-03-19 08:21 ] |
|
|
|
|
|
#2 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
Hi,
Is this routine stored in Personal.xls file? or any template just in your computer instead active workbook? Then you will need to move macro in main document or copy your template or personal macro workbook into the other PC. I hope it helps. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Ireland
Posts: 133
|
It's stored in my personal macro workbook, but I copied it to the user's PERSONAL.xls file also. Why won't it work?
|
|
|
|
|
|
#4 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
There is one more possibility which let user do that. May be you forgot password protecting xls file. because then it wouldnot cause error even user enters wrong password.
Or forgot setting a password. _________________ Oz ~ TheWordExpert [ This Message was edited by: smozgur on 2002-03-19 08:40 ] |
|
|
|
|
|
#5 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
I suggest you debugging code in user PC than you will easily see what is wrong.
_________________ Oz ~ TheWordExpert [ This Message was edited by: smozgur on 2002-03-19 08:43 ] |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: Ireland
Posts: 133
|
Yes, you're pretty close to the mark. I did set the password, but I left out Sturcture:= True, Windows:= False. I presume it didn't work because the structure wasn't protected. Either way it works now. thanks for your help.
|
|
|
|
|
|
#7 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
It is nice to hear that.
Anytime (you can check link below to find a new forum about VBA and other office applications) |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|