Results 1 to 17 of 17

Protect / Unprotect Macro

Threaded View

  1. #1
    Forum Contributor jason.hampton's Avatar
    Join Date
    04-20-2012
    Location
    Republic of Texas
    MS-Off Ver
    2007, 2010, 2016
    Posts
    138

    Protect / Unprotect Macro

    Greetings! This is my first post.

    I am using Office 2007 Prof. I found a web site for a "Proect / Unprotect" macro instructions. http://www.ozgrid.com/VBA/excel-work...rotect-all.htm

    My question is, can the code in the above proceedure be modified so it asks you to enter your password twice to check for accuracy?

    ~*~*~*~*~*~*~*~*~*~
    Private Sub CommandButton1_Click()
    
    Dim wSheet As Worksheet
    
    	For Each wSheet In Worksheets
    
    		If wSheet.ProtectContents = True Then
    
    			wSheet.Unprotect Password:=TextBox1.Text
    
    		Else
    
    			wSheet.Protect Password:=TextBox1.Text
    
    		End If
    
    	Next wSheet
    
    Unload me
    
    End Sub
    ~*~*~*~*~*~*~*~*

    Best Regards,
    Jason Hampton
    Last edited by jason.hampton; 04-23-2012 at 05:41 PM. Reason: Needed to add [code]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1