Updating Links

G

Guest

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.
 
D

Dave Peterson

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:="three")

'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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top