Prompt to Enter Workbook Password When Opening File

masouder

Board Regular
Joined
Jul 5, 2013
Messages
111
Office Version
  1. 2013
Platform
  1. Windows
I have code that opens all workbooks in a folder using the Open method. Several of the workbooks have links to another spreadsheet that is password protected. As each file opens the user is prompted for the password for the linked spreadsheet. Is there any way that I can prevent the password prompt? I played around with the
VBA Code:
Application.AskToUpdateLinks
setting but that did not work. Neither did
Code:
Application.DisplayAlerts
.

Any ideas are appreciated,
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Password protection wouldn't be worth very much if there was a way to easily override or ignore it! It is there for a reason!
Otherwise, you would have come up with a real simple way to get data out of a password protected worksheet without actually having the password (rendering the protection relatively worthless).

If you want to ignore that prompt, then have VBA supply the password when opening the file:
VBA Code:
Workbooks.Open Filename:="...\SomeFileName.xlsm", Password:="1234"
 
Upvote 0
Password protection wouldn't be worth very much if there was a way to easily override or ignore it! It is there for a reason!
Otherwise, you would have come up with a real simple way to get data out of a password protected worksheet without actually having the password (rendering the protection relatively worthless).

If you want to ignore that prompt, then have VBA supply the password when opening the file:
VBA Code:
Workbooks.Open Filename:="...\SomeFileName.xlsm", Password:="1234"
Thanks for the reply. I fully agree that we don't want to circumvent passwords. I was hoping for a way to not update links programmatically so that the file with the password would not be accessed and, therefore, remove the need for a password.

With regard to the suggestion to provide the password, how would this work? The code is opening File1 which has links to File2, and File2 is the one that is password protected. Is there a way to open File1 and provide a password for File2?
 
Upvote 0
Thanks for the reply. I fully agree that we don't want to circumvent passwords. I was hoping for a way to not update links programmatically so that the file with the password would not be accessed and, therefore, remove the need for a password.

With regard to the suggestion to provide the password, how would this work? The code is opening File1 which has links to File2, and File2 is the one that is password protected. Is there a way to open File1 and provide a password for File2?
Actually, I think I figured out a solution: open File2 first, providing the password, then open File1. As File2 will already be open there will be no need for File1 to try to open it.

I hope that works.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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