Macro doesn't work on another PC - URGENT
Prep for a pre-employment Excel test with Job Test Prep
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Macro doesn't work on another PC - URGENT

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Ireland
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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. #2
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Ireland
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #4
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #6
    Board Regular
    Join Date
    Feb 2002
    Location
    Ireland
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #7
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    799
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    It is nice to hear that.

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

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com