Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!
Subscribe for Free Excel tips & more!

How To Remove Workbook Password.

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

Hi, I accidentally placed a password in my workbook. Now, every time I open the xlsm file, it requires me to input a password. (thankfully i was able to guess the password.) I tried protecting and unprotecting the workbook using the one under review tab, but it's still there. This happened after tinkering the macros. Any ideas?

View Answers     

Similar Excel Tutorials

Password Protect Excel Files
How to keep an Excel workbook safe by encrypting it with a password. This will make it so that a user cannot open ...
Allow Only Certain People to Edit Specific Cells in Excel
How to allow only certain people to edit certain cells or ranges in Excel. This is a security feature that you can ...
Password Protect Excel VBA Macros
How to password protect VBA code and macros in Excel so that a user cannot see the code or edit it or do anything ...
Prevent a User from Changing Any Data in Excel
I'll show you how to lock a spreadsheet so that nothing can be changed in it. This is a great feature to use when ...
Hide or Protect a Tab in Excel - 2 ways
You can create a little macro to assign a password in order to access or open a tab in a workbook. Macro Right clic ...
Make Users Enable Macros in Order to View a Workbook in Excel
Tutorial showing you how to make a user enable macros in a workbook in order to view the workbook. This is very im ...

Helpful Excel Macros

Protect and Unprotect All Worksheets at Once
- This will allow you to protect or unprotct all worksheets in a workbook at once. It doesn't allow you to input a passwor
Hide Formulas in a Worksheet and Prevent Deletion
- This macro will hide all formulas within a workbook and not allow them to be deleted. The page will not be protected li
Output the Name of the Current Excel Workbook Without the File Extension - UDF
- Free Excel UDF that displays the name of the Excel workbook without its extension. This is a great UDF (user defined fu
Output the File Path to and Name of a Workbook in Excel - UDF
- Free Excel UDF (user defined function) that displays the full file path and name of an Excel workbook. This function is
Close a Workbook after a Time Limit is Reached
- This macro will automatically close the workbook in which it is located after that workbook has been opened for a certai

Similar Topics

Hi All,
I Have a macro enabled workbook and i am trying to set it that only people with the password can open the file, I can set the password for modifying the file but when i set it for opening the file, i get this message;

"This workbook contains Excel 4.0 macros or Excel 5.0 modules. If you would like to password protect or restrict permission to this document, you need to remove these macros."

But i cannot remove these macros as they are integral to the sheet...!!!

Please help!!!


I am hoping you are able to assist.

I am trying to write a macro to open a workbook. The file requires a password to open it - this is my own workbook and i know the password.

Is it possible to write a code (similar to Workbooks.Open Filename etc) that allows you to enter the password automatically. I need to open the file when the macro runs, but not allow others to know the password.

I hope this makes sense.

Many thanks in advance,


I'm using one workbook (A) to contain VBA which needs to open another workbook (B). The workbook B has a password (to modify -- the password was applied via SAVE AS, TOOLS, GENERAL OPTIONS, Password to Modify) I can't seem to get the syntax right in the VBA to open workbook B by supplying the password as part of the WORKBOOKS.Open Filename:="C:\thatfile.xls" statement.

I have a workbook that contains a series of macros designed to compare various reports and spit out a report. I don't want my users to have to insert a password, but I want to keep my workbook protected. I've already protected the macros in the VBA Properties, so those are pretty safe, but the worksheets in the workbook are susceptible to changes that will hose my macros.

Setting the workbook to "Read Only" in Properties on our shared drive helps, but any user can change that at will. Within Excel, going to Options, Security, I can set a password so no-one can modify that workbook, but that pops up a password box when they open the workbook. I'd like to NOT have the password box pop up unless I need to make changes. Is there a way to do that? I've looked on the internet but can't find a solution on this one.

Thanks in advance.

Here's my dilemma;

I have a workbook which has a hidden worksheet where a password resides. My macro goes to this worksheet, collects the password and comes back to the current worksheet, unprotects it (with that password), imports data, and then reprotects the worksheet. Because the workbook is also protected, the sheet with the hidden password cannot be accessed.

Now I want the workbook to be "shared and protected" with "Track Changes". This will prevent the macro itself from being tampered with and will enable an audit trail of sorts on a 3rd worksheet within the workbook.

However, if the workbook is shared and protected, one needs to unshare and unprotect it first before unprotecting the worksheet that I need to import into. Sooooooooo,

I need to figure out how to (in VB) have the macro first unprotect and unshare the workbook (using the hidden password), then unprotect the worksheet (got that part figured out already), then reprotect the worksheet and the shared workbook. Any ideas on how I would do that?

I can send the current macro to those who wish to investigate.

Is there another way to protect the macros from being edited by someone with rights to the workbook?

Thanks in advance

hi all,

i'm relatively new to VBA code and would like to protect my workbook when the workbook is opened.

subsequently, i would like the user to be able to unprotect the workbook via clicking a button. this button would first ask the user for a password before unprotecting the workbook.

how can i code this through VBA?

i already built the following VBA code:

upon opening the workbook:

Private Sub Workbook_open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
ActiveWindow.DisplayWorkbookTabs = False
Sheets("1. Cover").Activate
ActiveWorkbook.Protect password:="AS CSM"
Application.ScreenUpdating = True
End Sub

upon pressing the button:

Sub Unprotect_workbook()
Dim psswrd As String
psswrd = InputBox("Please enter password", "Password required")
If psswrd = "" Then Exit Sub
On Error GoTo Error
ActiveWorkbook.Unprotect password:=psswrd
MsgBox "Workbook is unprotected"
Exit Sub
MsgBox "Incorrect password: workbook could not be unprotected"
Exit Sub
End Sub

this VBA code doesn't seem to function properly though... any help is more than welcome!!!



I want to unprotect my estimating workbook. My password works to open the
workbook but doesn't work to unprotect the workbook.
(1) If I choose tools>Protection>unprotect workbook and then enter my
password into the message box I get the message that the "password supplied
is not correct". Somewhere along the line my password became corrupt.
(2) If I choose File>Save As and click General Options>Passwords to Open and
highlight the asterisks then Delete then Click OK>Save>Yes to replace the
existing workbook and then I close the workbook. When I reopen the workbook
it is still protected.
How can I unprotect the workbook? My goal is to protect the Master copy of
the Estimating Workbook with a password to open so others can’t open the
Master Workbook and make changes. Then I want to open the Master Workbook and
save a copy of the workbook with a specific project name without the
protection. Then the estimators can use the project specific workbook without
the password. Thanks for your help.

how can i protect a macro enabled file with a password so that unless you enter the password no one can open that file...i have tried "save as" option and in the general tools i entered the password...but now the problem is when i open the password protected file...macros stop working...every time it says to enable the macro in security settings...i have already enabled them but it still doesn't work...i am using excel 2007 and i am trying to save this file in xlsm format...

help please


I'm working at linking 30 spreadsheets one sheet that combines the results from them. The problem I'm having is each workbook is password protected and it prompts me to enter the password for each spreadsheet each time I open the master sheet. Is there a way I can stop this. The good news is every workbook as the same password. Maybe some type of macro

Any help is excellent.

Can't Remove password protection
I inserted the following code into one of my workbooks to password protect the document before closing which works great, however when I reopen the workbook I type in the password the workbook opens and then I try to remove the protection but it is stuck and in the protection it keeps saying that the workbook isn't protected. I then removed all macro code from the workbook and saved it as a different file name however it still stays protected and there is no way to remove the protection, can someone please help with this.

Application.DisplayAlerts = False
ThisWorkbook.Password = "jaye"
Application.DisplayAlerts = True
ThisWorkbook.Saved = True


I need to open a password protected workbook using VBA.

I've tried the code below but I still get prompted for a password.


Workbooks.Open Filename:="\\HOME\Working\Report.xls" _
        , Password:="xxxx"

How do I get it to open automatically???

We have a shared workbook which is password protected. When a user opens the file, the password message box pops up asking for a password or read only. The problem is, if somebody leaves that message box up on their computer, it locks the file for everybody. (it took me a couple years to figure out that is what causes the "File is Locked" message) Is there anyway to put a timer on that message box?
If not, is there a way to get a user form to ask for a password? I would create a form in another workbook with links to this one.


Hi All.

I have a "master" file that several workbooks are linked to. Each individual workbook is password protected. I would like to be able to open and update the "master" file, however it is asking me for every individual password.

This is not ideal. Is there a way to include code in the master file that when i open this file as an administrator with password, it automatically opens each individual workbook without having me to type in each password?

Thank you.

how can i protect a macro enabled file with a password so that unless you enter the password no one can open that file...i have tried "save as" option and in the general tools i entered the password...but now the problem is when i open the password protected file...macros stop working...every time it says to enable the macro in security settings...i have already enabled them but it still doesn't work...

help please

Hello All,

I am looking to password protect a database password that I have stored in my excel file. (in the properties section of the Workbook Connections wizard)

I do not want to password protect the entire file, because my file is designed to run some VBA code that involves a database download when opened. It is completely autonomous because it runs as a scheduled task, but I need some more protection if it encounters an error.

Also, protecting the sheet where the connection is downloaded does not work.


Dear NG,

Please help me. I am trying to remove the "password to open a workbook"
using the code below. Although, it runs well during execution and does not
show any error messages, when I try to manually open my workbooks, it still
ask for password.



Sub RemoveOpenPassword(myFilepath As String, myFilename As String, _
myOpenPassword As String, myWritePassword As String)
Dim Wb As Workbook
Set Wb = Workbooks.Open(Filename:=myFilepath & "\" & myFilename,
Password:=myOpenPassword, _
WriteResPassword:=myWritePassword, AddToMru:=False)
With Wb
.Password = ""
.Close True
End With
Set Wb = Nothing
End Sub

Is it possible to open the encrypted file via vba macro? I encrypted the file with password :MY_PWD and I've to open same file. I tried with ActiveWorkbook.unprotect Password:="My_PWD" in workbook open() event. even if the macro is enabled it asks me to enter the password. can we bypass that problem? wont it take the password from the code or how can we give the password via VBA?

P Sukumaran


Please help me the following situation.

1 I created survey in 2003 version with password protection to change ( it will forbid people to change anything except some cells in the sheets). Not password protection for workbook (TOOLS/OPTIONS/Password to open)

2 But when people send back those surveys, some of them will covert that into 2007 versions (.XLSX)

3 So I open those 2007 version surveys (.XLSX), every time password prompt will appear before I can view anything. (actually I could give any password. The system will accept it)

4 I created macro to disabled that

Workbooks.Open Filename:=xxx, UpdateLinks:=0, password:="0"

It does not work. Please let me know if it is clear. I really appreciate it.


Using Excel 2000.
This is the situation...I have 17 different workbooks representing 17
people's salary all linking to a summary workbook for my Manager to
view. Each workbook is password protected and when opening up the
summary workbook it prompts you for a password for each of those
individual workbooks as the summary links to the individual sheets. Of
course should you decline the password in the summary workbook it does
not link the data. Is there anyway around this???

Yvon Aubé

i am trying to do a coding which automatically open password protected file.
Workbook.xls is password protected & the password is "password".

when i run the code, still there's a pop up asking for the password.


Sub OpenBookTest()
Dim myFile As String
Dim myPath As String
myPath = "C:\My Documents"
myFile = "My Workbook.xls"
Workbooks.Open myPath & "\" & myFile, password:="password"
End Sub

I have a model I need to amend that opens workbooks and summarises data from a number of workbooks into it.

The workbooks are password protected and a change of passwords has meant a number of possible passwords are correct for any workbook so I need a way of cycling through to see which works and then open the workbook so it can be used by the model.

To open each workbook the model uses the following code:

Workbooks.Open Finename:=file.Path, Update Links:=0, ReadOnly:=True Password:=strPassword (variable that picks password from sheet)

Could you please help with how code could loop through atleast 4 passwords and open using the correct password?

Thanks for your help in advance

I am currently using an input box for password protection to allow a user to
perform a function, that I want to be limited, via a button, assuming the
input password is correct. Example, you press a button and an input box
prompts you for a password to access the data you are requesting. The
question is can I change the input text the user types in the input box for
the "password" to display "*" characters for every input character, like you
would normally see in a password input field? Thanks.

so. need to open about 10 files. all password protected(diff passwords) so information can then be verified and then moved to another excel doc that isn't password protected. reason is i have a master doc that grabs the information from all those documents to get me stats. right now i'm opening the password protected files one at a time. copying the info to another excel doc that isn't password protected then running an update on my master doc to get all this info together. (no, not password protecting anything isn't an option) is there something i can do with this or am i stuck doing it the way i've been doing it so far? i've tried macro's but they don't seem to work.

The following code is what I have at this time to password protect an individual file when it is open.
When I run it it simply pops up a screen asking me to enter the password I want to protect the file with, I enter the file then click ok.

Sub Protect_sheets()
    Dim wSheet          As Worksheet
    Dim Pwd             As String
    Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
    For Each wSheet In Worksheets
        wSheet.Protect Password:=Pwd
    Next wSheet
End Sub

What I'm looking for is a a code that instead when run I want to 1st prompt me to select a directory and once selected have a 2nd prompt asking me to enter the password of my choice then lastly open each file within the chosen directory, protect it using the password just entered and saved. Can anyone assist?

How can I use vba to open an Excel workbook that has passwords for both opening and for modifying? I think this is close:

Workbooks.Open "Full Path Name", Password: ="XYZ"

However, using that prompts me for a second password (to modify the workbook)