Macro doesn't work on another PC - URGENT

y2k

Board Regular
Joined
Feb 25, 2002
Messages
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
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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.
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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.

:)
 
Upvote 0
It is nice to hear that.

Anytime (you can check link below to find a new forum about VBA and other office applications)
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,027
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top