Macro To Avoid Link Update of Open Files

M

mjs

I have written a macro to update links to multiple files, most of which will
be closed at the time of update. If a file is open the macro halts. Is
there a way to call out the satus and not update those that are open? The
current macro is:
ActiveWorkbook.UpdateLink Name:= _
"O:Acct 1.xls", _
Type:=xlExcelLinks

ActiveWorkbook.UpdateLink Name:=
"O:Acct 2.xls", _
Type:=xlExcelLinks

ActiveWorkbook.UpdateLink Name:= _
"O:Acct 3.xls", _
Type:=xlExcelLinks

Thank you for the help,
Mark
 
R

ruic

There is a property of a workbook that is called ReadOnly. I believe that
the property gets set if the workbook is not a shared workbook whenever
someone opens it. So you could open the workbook and check the property and
if it true then skip it.

That would be my suggestion.
 
M

mjs

Rui,
Thanks for the response but I'm not sure how that will work. If the file is
closed or opened by another individual the update command will work. It is
only an issue if the file is open on the PC that is running the macro; the
macro halts. When an update is performed using the menu options
(Edit\Links\Update) it looks to see if the file is open and then does not
update if already open. I was hoping for some status that I could apply the
update command only if it was not open on the PC running the macro maybe
using "If" logic. Hope that helps better clarify. Thanks.
Mark
 

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

Similar Threads


Top