Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Password protection protection!

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

    Default

    Also if the user chose to disable the macro when opening the workbook, will any of the VBA methods such as the "Save As disable" work? Thanks.
    0 0
     

  2. #12
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You would need to create a button from the form tool bar then right click on the button and goto assign macro then assign it to Joes code above...

    Btw what stops someone from disabling macros then doing a saveas?

    Brett
    0 0
     

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

    Default

    Thanks. I don't think there's a way to stop someone from disabling the macro when he opens the workbook. It's part of the Excel virus protection tool. Is that correct? In that case, someone can just disable the macro and none of these VBA protection will work. Correct?
    0 0
     

  4. #14
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Simon,

    There are ways of forcing ppl to enable macros(if they want to use the wkb)

    U can hide all the sheets and unhide them with macro on entry(makes it useless unless macros are enabled)
    Make the file an addin(if no saving is needed) this then forces enable as well to use the wkb

    Brett
    0 0
     

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

    Default

    Hey, that hidding thing is a great idea! Thanks.
    0 0
     

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

    Default

    This is the unhide code I came up with:

    Private Sub auto_open()
    Sheets("Sheet1").Visible = True
    End Sub

    But how do you stop the user from manually unhiding the worksheet if they disable the macro?
    0 0
     

  7. #17
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi simon

    To stop manual unhidation.

    sheets("sheet1").visible = xlveryhidden

    to unhide

    sheets("sheet1").visible = xlsheetvisible

    when the sheet is set to xlveryhidden the sheet can then only be opened from the vba explorer(so u need to password this as well)

    set the sheets to unhide on open

    sub Auto_Open
    'your code here
    end sub
    0 0
     

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

    Default

    This is what I came up with:

    Private Sub auto_open()
    Sheets("Sheet2").Visible = xlSheetVisible
    Sheets("Sheet3").Visible = xlSheetVisible
    Sheets("Sheet1").Visible = xlVeryHidden
    End Sub

    Private Sub auto_close()
    Sheets("Sheet1").Visible = xlSheetVisible
    Sheets("Sheet2").Visible = xlVeryHidden
    Sheets("Sheet3").Visible = xlVeryHidden
    End Sub

    Basically if they Enable the Macro, they won't see Sheet1 until after they close the workbook. If they Disable the Macro, they'll see Sheet1. Sheet1 contains the warning to reopen the workbook with Macro Enable.

    Thanks for all your help, amigo.
    0 0
     

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

    Default

    The warning page is there because a workbook cannot be opened with no worksheet shown.
    0 0
     

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

    Default

    Oh, one minor glitch. Using this code, when the workbook is closed, all the worksheets are rehidden and the warning page is display. The problem is that instead of closing the workbook right away after Sheet1 is redisplay, I got a message asking me to save the changes or not. How do I disable this message?
    0 0
     

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
  •