Share via

Excel VBA Link Update Problem

Anonymous
2015-02-08T15:23:05+00:00

I have 2 workbooks, source and linked. The linked workbook contains a link to the source workbook.

I copy this from the VBA help system to the immediate window, I ensure the link workbook is active and the sample code fails.... why?

ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSourcesThe issue: i have legacy code with a name like Name:="M:\yadayada\file.xls" that fails.
Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2015-02-08T17:09:27+00:00

The help example is incorrect.

The text of the help article is correct but not entirely helpful.

To update all Excel links in the workbook, simplest is just

ActiveWorkbook.UpdateLink Type:=xlExcelLinks

To update a specific link, say the first Excel link source

ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources(xlExcelLinks)(1)

Was this answer helpful?

5 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2015-02-08T17:01:22+00:00

headlydotcom,

I tested in excel 2010.   I had a workbook with a link to a closed workbook as the activeworkbook and I ran the code you show in the immediate window and it caused no problem.

I then opened a new workbook with no links and made it the activeworkbook.  Again, no problem.

So I would suggest updating links manually and see if there is a problem. 

--

Regards,

Tom Ogilvy

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful