Multiple workbooks refresh from password-protected database. How to enter pwd/login just once?

rmgarrett

New Member
Joined
Mar 30, 2009
Messages
14
Hello,

Our organization has about fifty scorecards in Excel, with three data connections apiece. All of them refresh from the same password-protected database.

Is there a way to write a script that will open and refresh all the workbooks at once, wihtout having to type the login and password for each query in each workbook?

It is a security requirement that the user would have to enter their login/password at least once to kick off the process. We cannot hard-code it into the script.

Thank you for considering how to help us solve this.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Dear rmgarrett
Pls use below code:
Sub unprotect_all_sheets()
On Error GoTo booboo
unpass = InputBox("password")
For Each Worksheet In ActiveWorkbook.Worksheets
Worksheet.Unprotect Password:=unpass
Next
Exit Sub
End Sub


Sub protect_all_sheets()
On Error GoTo booboo
unpass = InputBox("password")
For Each Worksheet In ActiveWorkbook.Worksheets
Worksheet.Protect Password:=unpass
Next
Exit Sub
End Sub

'Noted: Password:=unpass

Thx
Mir
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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