Suppressing Update Links Warning
Thanks, Barb and Dave.
Dave,
I had been doing the save and close in two steps:
With wb
.password = strnew
.save
.close
End wb
Do you know if
.close savechanges:=true
would be faster?
Sprinks
"Dave Peterson" wrote:
Look at workbooks.open in VBA's help. You can suppress the links by specifying
a parm in that statement.
set wkbk = workbooks.open(filename:=...., updatelinks:=0)
From xl2003's help:
UpdateLinks Optional Variant. Specifies the way links in the file are updated.
If this argument is omitted, the user is prompted to specify how links will be
updated. Otherwise, this argument is one of the values listed in the following
table.
Value Meaning
0 Doesn't update any references
1 Updates external references but not remote references
2 Updates remote references but not external references
3 Updates both remote and external references
======
ps. You may want to stop any workbook_open event from firing:
application.enableevents = false
set wkbk = workbooks.open( ....)
'do your stuff
wkbk.close savechanges:=true
application.enableevents = true
Just in case there's a workbook_Open event that runs and irritates, er, prompts
the user for something.
Sprinks wrote:
I recently launched a ResetPasswords macro for our Office Manager that allows
her to reset the passwords of all files in a given folder and its subfolders
to a new value. The program opens the file, sets the new password, saves,
then closes the file.
After thoroughly testing it on a variety of my own folders, it was a bit
embarassing that when we ran it for real, the program halted several times to
ask whether she wanted to update old links that existed. Can this warning be
suppressed?
Thank you.
Sprinks
--
Dave Peterson
|