Method 'ChangeLink' of object '_Workbook' failed

maravi

New Member
Joined
Sep 12, 2017
Messages
6
I have the below partial code that is giving me the run-timer error 1004 Method 'ChangeLink' of object '_Workbook' failed. I have verified that both files are in the paths that they need to be.


Sub Link()
Dim curmonth As String
Dim oldmonth As String
Dim curfile As String
Dim oldfile As String

Application.Goto Reference:="export_area"
Selection.ClearContents

Range("FA42").Select
ActiveCell.FormulaR1C1 = _
"=R[-35]C[-156]&INDEX(R[-31]C[-156]:R[-18]C[-156],R[6]C[1]+1,1)"
Range("FA42").Select
Let curmonth = ActiveCell.Value
Range("FA44").Select
Let oldmonth = ActiveCell.Value
Let curfile = curmonth & "/REMIT.xls"
Let oldfile = oldmonth & "/REMIT.xls"
ChDir curmonth

ActiveWorkbook.ChangeLink Name:= _
oldfile, NewName:= _
curfile, Type:=xlExcelLinks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top