Link to home
Start Free TrialLog in
Avatar of AndyAinscow
AndyAinscowFlag for Switzerland

asked on

Linked sheets not found when opening a workbook

When I open a workbook that has links to sheets in another workbook - fine.
However when the workbook being linked to (source) isn't present I get a dialog prompting to edit the links.

Does this come from a workbook event?  Can I trap and provide my own behaviour? If yes then how?

The real situation:  
I have a set of sheets that have the year as part of the name.  Each year there will be a copy put into archive and the year part of the name changed.  eg. SourceA_2010.xls becomes SourceA_2011.xls and so on.
I have the code required to change the links, I have just had the idea it would be nice to run that if required automatically - not having to cancel the default behaviour then run a custom macro.
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AndyAinscow

ASKER

Thanks.
I'll leave it open for a couple of days just in case someone knows different.

(I might explore using an app to copy/paste/rename and then automate excel to modify the paths - but that is something unrelated to this question)
You would have to turn off automatic updating of external links, then have your code run in the Open event, check the path for each link and then prompt to update if required.
Not an option :-(
That would affect all other workbooks.


Actually I write too quickly.
If I left the autocheck ON, cancel the dialog then at workbook open I could run my own code to test and fixup the links.
Hmmm, got to think a little about that.
HI AndyAinscow,

If I have understood correctly you are repeatadly being asked about external links when a workbook opens which you don't want. I assume you have updated / corrected all the cell links in your workbook. You might try checking the 'Named cell ranges' to see if any refer to an external workbook.

Theses are defined in menu option [Insert - Names - Define ...]. Some of these names may point to ranges in other sheets - in which case you can correct or delete them
>>If I have understood correctly you are repeatadly being asked about external links when a workbook opens which you don't want.

No.  Links are fine, they are required.  This is a one off behaviour because the links are being deliberately broken.

I'm having a rethink based on comments by rorya.  The following is the critical bit of my original question.

When I open a workbook that has links to sheets in another workbook - fine.
However when the workbook being linked to (source) isn't present I get a dialog prompting to edit the links.

Does this come from a workbook event?  Can I trap and provide my own behaviour? If yes then how?


Actually Workbook_Open is fired before this dialog (at least on my PC and excel version).  I check if a link is broken and then remake the links.  However now comes the dialog prompting for the edit links, with the OLD paths.  Cancel this dialog, save and close, open again and no dialog because the links are OK.