How protect file but not ask for a password

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
626
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I created a macro-workbook that contains userforms. Once the user answer the questions on the userform, depending what was entered will determine what protected worksheet the information will added to but everytime this file opens up it asks for a password, shown in the image. How can I prevent this from even showing up and still run the userforms and still protect any sheet from being modified? Thanks.
 

Attachments

  • SnipImage.JPG
    SnipImage.JPG
    8.8 KB · Views: 13

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
It sounds like you have protected the workbook with a password. If that is the case, unprotect the workbook and restrict the protection to the individual worksheets.
 
Upvote 0
@mumps
Maybe I am doing something wrong because when I try to unprotect workbook. All I did was protected the worksheets with code.
VBA Code:
Sub Protect_All_Sheets()

   For Each Worksheet In ActiveWorkbook.Worksheets
      Worksheet.Protect
   Next
   Exit Sub

End Sub

Sub Unprotect_All_Sheets()

   For Each Worksheet In ActiveWorkbook.Worksheets
      Worksheet.Unprotect
   Next
   Exit Sub

End Sub


Option Explicit
Dim wb As Workbook, ws As Worksheets, ws1 As Worksheets
Dim WeekNum As Integer
Dim DateRangeFrom As Date, DateRangeTo As Date
Dim LastRow As Long
Dim UserName As String


Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Set wb = ThisWorkbook
   
    Call Unprotect_All_Sheets
   
End Sub

Private Sub Workbook_Open()
   
    Call Unprotect_All_Sheets
       
    Set wb = ThisWorkbook
   
    Call Protect_All_Sheets
   
   
End Sub
 
Upvote 0
Manually unprotect the workbook.
 
Upvote 0
@mumps
Does it matter what machine I created this on? In other words, if I created this on my desktop at work and then try to work on it on my laptop at home, does this matter? I have office 365 at work and office 2010 at home.
 
Upvote 0
@mumps
Is there instructions how to do this manually. Every video I looked up did not work. When I made the changes shown on the video, I close the workbook. It then asks me if I want to save changes, I clicked yes. I then reopened the workbook and it still asks me for a password. Step by step instructions preferred.
 
Upvote 0
Try the following:
-hold down the ALT key and press the F11 key to open the Visual Basic Editor
-click 'Tools' in the menu at the top
-click 'VBAProjects Properties
-click the 'Protection' tab
-check if a password has been entered and delete it if it exists. Also uncheck the 'Lock Project....' box if it is checked.

If there is no password, perhaps you could upload a copy of your file (de-sensitized if necessary) to a site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.
 
Upvote 0
Would the code I added to this board, would that have anything to do with this problem?
 
Upvote 0
The code you posted protects and unprotects the worksheets not the workbook. Upload your file if you can.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top