Results 1 to 1 of 1
2002-10-09, 22:37 #1
- Join Date
- Mar 2002
- Thanked 0 Times in 0 Posts
ChangeLink Reference error (w2kO2ksr1)
I've written a routine to reconstruct a workbook, throwing out all the hidden junk that builds up as the workbook is crafted. Usually this cuts the size of the workbook in half. The following piece of code used to work. Its purpose is to find all the references in the new workbook that refer to sheets in the old workbook, and reset them to the new workbook. These invalid references are created in the rebuild as you add new sheets that refer to old sheets. This code just substituted every reference to the old workbook with a similar reference to the new workbook. kOld and kNew are defined as workbooks.
sTest1 = kOld.FullName
sTest2 = kNew.FullName
kNew.ChangeLink sTest1, sTest2, xlLinkTypeExcelLinks
The locals display shows:
sTest1 : "Coc - CurrentVentureBuildersClients3 G Contact CentersFinancial Models3G Fin Model v30.xls" : String
sTest2 : "Coc - CurrentVentureBuildersClients3 G Contact CentersFinancial Models3G Fin Model v1-01.xls" : String
When I run this code with the values shown, I get "Error 1004 Invalid external reference"
Any idea why? Both of the files do exist. Both are open.