• Auto protect on opening (excel xp)

    Author
    Topic
    #406028

    hello guys,

    can you guys give an example how to protect all sheets during the auto_open procedure ?

    something like

    sub auto_open()
    ????????
    ????????

    end sub

    i want to protect all my sheets everytime i open my file..thanks..

    Viewing 3 reply threads
    Author
    Replies
    • #838747

      Do you want to open a readonly version of the file?

      • #838767

        nope catherine..

        i just want to protect all my sheets everytime i open my file. thanks

      • #838768

        nope catherine..

        i just want to protect all my sheets everytime i open my file. thanks

    • #838748

      Do you want to open a readonly version of the file?

    • #838753

      Add this to the thisworkbook object

      Option Explicit
      Private Sub Workbook_Open()
          Dim sht
          For Each sht In Sheets
              sht.Protect
          Next
      End Sub

      Steve

      • #838763

        thanks steve…

        how to add the password..let say “abc”

        thanks

        • #838792

          (Edited by sdckapr on 10-Jun-04 14:43. added PS)

          Use the line:

          sht.Protect "abc"

          Instead of the one listed

          Steve
          PS if any of the sheets already have passwords, you will not get an error, but the sheets will be still have the old password, they will not be protected with the new password.

        • #838793

          (Edited by sdckapr on 10-Jun-04 14:43. added PS)

          Use the line:

          sht.Protect "abc"

          Instead of the one listed

          Steve
          PS if any of the sheets already have passwords, you will not get an error, but the sheets will be still have the old password, they will not be protected with the new password.

      • #838764

        thanks steve…

        how to add the password..let say “abc”

        thanks

    • #838754

      Add this to the thisworkbook object

      Option Explicit
      Private Sub Workbook_Open()
          Dim sht
          For Each sht In Sheets
              sht.Protect
          Next
      End Sub

      Steve

    Viewing 3 reply threads
    Reply To: Auto protect on opening (excel xp)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: