Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Macro for password protect

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I think I saw this somewhere but can't find it now.

    I am looking for a way to get a macro to password protect a workbook with a predetermined password.

    Thanks

    Scott

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Scott,

    If you want to do this with a UserForm Try This:
    Option Explicit
    Private Sub Workbook_Open
    If TextBox1 = "your pw" Then
    "your code, what to do next"
    Unload Me
    Else
    If TextBox1 <> "your pw" Then
    Msg"Password Failed!" vbOkOnly + vbCritical
    End If
    End If
    End Sub

    James

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I may not have explained that real clearly, but I found what I wanted.

    ActiveSheet.Protect("****")

    Thanks anyway.

    Scott

Some videos you may like

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
  •