Password protection protection! - Page 3
Amazing chart utilities from Jon Peltier
Thanks Thanks:  0
Likes Likes:  0
Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Password protection protection!

  1. #21
    Board Regular
    Join Date
    Jun 2002
    Posts
    2,127
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I had to do the same thing. here's my code tied into a command button:

    Private Sub CommandButton1_Click()
    'unprotect workbook and sheets
    ActiveWorkbook.Unprotect ("pw")
    For i = 1 To Sheets.Count
    Sheets(i).Unprotect ("pw")
    Next i

    'run your code here
    ActiveWorkbook.RefreshAll

    Label1.Caption = "Last refreshed " & Now

    'reprotect everything
    For i = 1 To Sheets.Count
    Sheets(i).Protect Password:="pw"
    Next i

    ActiveWorkbook.Protect Password:="pw"

    End Sub
    0 0
     

  2. #22
    Board Regular
    Join Date
    Jun 2002
    Posts
    207
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Humm, can you explain what this do? Thanks.
    0 0
     

  3. #23
    Board Regular
    Join Date
    Jun 2002
    Posts
    2,127
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    This unprotects the workbook and every sheet in it.

    Then it runs my desired code, which happens to be refresh all queries, then add the refresh time to a label box.

    Then it reprotects the workbook and all worksheets with password = "pw"
    0 0
     

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