M
MDW
I've got a workbook called sec_model.xls. This file contains a link to a file
called output.xls. This output.xls is created by a macro in another file.
I'm writing a macro to run several different scenarios in sec_model.xls, and
as part of that I programmatically change the link source. I know how to do
this. However, whenever I do that, the formulas that refer to the linked
sheet turn into #REF! errors.
Here is the code to change the link: ThisWorkbook.ChangeLink strOldInput,
strLoanOutput
For instance, a formula that says "='C:\[output.xls]loan cash flows'!C14"
will change to "='C:\[output.xls]#REF!'!C14" after I run the code.
I have tried running this code with the "output.xls" file open or closed,
and it doesn't make a difference. I can tell you that in 90% of cases,
strOldInput and strLoanOutput will be the same file (in other words, I'm
"changing" the link to be the exact same file it's already linked to).
However, I do that manually all the time and it doesn't cause a problem.
Any thoughts or ideas as to what the problem could be?
called output.xls. This output.xls is created by a macro in another file.
I'm writing a macro to run several different scenarios in sec_model.xls, and
as part of that I programmatically change the link source. I know how to do
this. However, whenever I do that, the formulas that refer to the linked
sheet turn into #REF! errors.
Here is the code to change the link: ThisWorkbook.ChangeLink strOldInput,
strLoanOutput
For instance, a formula that says "='C:\[output.xls]loan cash flows'!C14"
will change to "='C:\[output.xls]#REF!'!C14" after I run the code.
I have tried running this code with the "output.xls" file open or closed,
and it doesn't make a difference. I can tell you that in 90% of cases,
strOldInput and strLoanOutput will be the same file (in other words, I'm
"changing" the link to be the exact same file it's already linked to).
However, I do that manually all the time and it doesn't cause a problem.
Any thoughts or ideas as to what the problem could be?