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.
LVL 45
AndyAinscowFreelance programmer / ConsultantAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rory ArchibaldConnect With a Mentor Commented:
There isn't an event for that and the prompt occurs prior to any code (including Workbook_Open) running if you have automatic link updating enabled.
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
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)
0
 
Rory ArchibaldCommented:
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.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
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.
0
 
AL_XResearchCommented:
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
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
>>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?


0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
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.
0
All Courses

From novice to tech pro — start learning today.