A recent server change in our office has exposed many Excel Workbooks with connection strings to obtain external data. Unfortunately, the hard-coded references are now broken so I thought I'd be smart and write a macro to change them all. I tested it without problem (i.e. it does change the strings) and then I included it in Workbook_Open, assuming the strings would be modified before they were executed. It seems that isn't the case. When the workbook opens, I get a dozen or so ugly messages telling me it can't resolve the old incorrect file references. It seems my new code then executes and changes the strings successfully, but too late to avoid the many errors.

Is there somewhere else I can put this code?