ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating Links (https://www.excelbanter.com/excel-programming/317290-updating-links.html)

hurlbut777

Updating Links
 
I have a consolidation file that has linked formulas from two other files (a
and b). Files a and b are password protected ( passwords are "one' and
"two", respectively), so when I open only the consolidation file and attempt
to update links, I have to key in the passwords. What I would like is a
macro assigned to a button that when clicked, would automatically open the
files, update the links, and then close the files.

Thanks.

Dave Peterson[_5_]

Updating Links
 
You can see the syntax in VBA's help:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter,
Editable, Notify, Converter, AddToMru, Local, CorruptLoad,
OpenConflictDocument)


option explict
sub auto_open()
dim wkbk1 as workbook
dim wkbk2 as workbook
dim wkbk3 as workbook

set wkbk1 = workbooks.open(filename:="c:\a.xls",password:="one ")
set wkbk2 = workbooks.open(filename:="c:\b.xls",password:="two ")
set wkbk3 = workbooks.open(filename:="c:\c.xls",password:="thr ee")

'wkbk3 is the real one!

wkbk1.close savechanges:=false
wkbk2.close savechanges:=false
'thisworkbook.close savechanges:=false
end sub

(I'd create a 4th workbook that opens the files in order and just closes the
first 2 and then itself.)




hurlbut777 wrote:

I have a consolidation file that has linked formulas from two other files (a
and b). Files a and b are password protected ( passwords are "one' and
"two", respectively), so when I open only the consolidation file and attempt
to update links, I have to key in the passwords. What I would like is a
macro assigned to a button that when clicked, would automatically open the
files, update the links, and then close the files.

Thanks.


--

Dave Peterson


All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com