Link to home
Start Free TrialLog in
Avatar of PeterFrb
PeterFrbFlag for United States of America

asked on

"ChangeLink" method in Excel fails

I have a set of Excel files that I am archiving, using code to simply copy the entire "Active" directory to a dated "Archive" directory.  Several of these spreadsheets contain only "rollup" values: summed values from other worksheets.  In all but a single instance, the files from which the rollups derive their sums are in the same directory as the rollup file.  When I copy these to a different place, the links automatically update themselves.  The exception is a "rollup of a rollup": values from the individual rollups are themselves summed into a grand-total file.  Because the grand total file is in a different directory than the files to which it is linked, the links remain pointed to the "Active" directory instead of their relative counterparts in the "Archive" directory.  

When attempting to correct this using code, I get an error when running the "ChangeLink" method.  The error says simply, "Run time error '1004'.  Method 'Changelink' of object '_Workbook' failed."  The same action I am able to perform manually fails in code, with no explanation other than it failed.  

Your feedback, as always, is greatly appreciated.
Peter Ferber
Avatar of SysExpert
SysExpert
Flag of Israel image

This should probalby be posted in the MS Office applications - Excel TA.

Also Post your code.

I hope this helps !
Avatar of PeterFrb

ASKER

I have it in three: Windows XP, Excel, and Visual Basic.  Do I need to rank them in order of importance?
No that's fine.  am sure someone will ahve a good answer after you have posted your present code.

ASKER CERTIFIED SOLUTION
Avatar of Jeroen Rosink
Jeroen Rosink
Flag of Netherlands 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
Thanks for that, Jeroen.  I spent quite a while adding a long list of patches that Microsoft recommended.  I have a built a workaround to solve the problem; but I will test the code again when I get a breathing space.  If it works, I'll credit you with the solution.

Thanks, Peter