auto update from password protected files vba?

tmmellor1981

Board Regular
Joined
Jan 18, 2009
Messages
122
Hi all

i know this is possible but i'm a bit of a novice and can't get any of the code's i've copied to work, sure someone will find this pretty easy in here.

I have a workbook containing many vlookups to various other workbooks on a network, 2 of the workbooks i link to have passwords on. I would like the update links button on opening disabled and for excel to update all links on open and save the passwords for the 2 files so it requires no user input, for arguements sake lets say the files are:

s:\dashboard\test.xls - password of "password1"
s:\dashboard\numbers.xls password of "password2"

if this cannot be done automatically on open could it be assigned to a button?

hope i made sense to everyone thanks for you help as always :)
 

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.
Try:

Code:
Sub Open_Stuff()
Workbooks.Open Filename:="s:\dashboard\test.xls", UpdateLinks:=3, Password:="password1"
Workbooks.Open Filename:="s:\dashboard\numbers.xls", UpdateLinks:=3, Password:="password2"
End Sub

Dom
 
Upvote 0
Yes, that's correct. You can then add a button to one of your toolbars and attach the macro to it.

If you want to have it always available it would be worth creating a Personal Macro Workbook to hold the code.

Dom
 
Upvote 0
Hi again

thanks for you help it seems to work only issue is that both workbooks are in excess of 7 meg each and take forever to open is there any way of updating links without opening the files like that auto update does ?

regards
 
Upvote 0
sorry for the repeat questioning , is it possible then to have code automatically close the workbooks after links have updated ?
 
Upvote 0
Try:

Code:
Sub Open_Stuff()
Workbooks.Open Filename:="s:\dashboard\test.xls", UpdateLinks:=3, Password:="password1"
ActiveWorkbook.Close SaveChanges:=True
Workbooks.Open Filename:="s:\dashboard\numbers.xls", UpdateLinks:=3, Password:="password2"
ActiveWorkbook.Close SaveChanges:=True
End Sub

Dom
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,545
Members
449,089
Latest member
davidcom

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