I'm fairly new to writing VBA macros and I'm sure I'm making a stupid mistake.. So I worked out this piece of code from bits I found on the internet to try and automate updating links to all files within a particular folder. When I try to run it I get the following error:
'Wrong number of arguments or invalid property assignment'.
Any help would be much appreciated.
Sub ChangeLink()
Dim wb As Workbook
Dim mergeObj As Object
Dim folderObj As Object
Dim filesObj As Object
Dim everyObj As Object
Set wb = ThisWorkbook
Set mergeObj = CreateObject("Scripting.FileSystemObject")
Set folderObj = mergeObj.Getfolder("W:\Finance\01 Draft2")
Set filesObj = folderObj.Files
For Each everyObj In filesObj
Set wb = Workbooks.Open(filesObj, UpdateLinks:=0)
ThisWorkbook.ChangeLink Name:="W:\06 Dec 19 AEF.xlsx", NewName:="W:\Finance\07 Jan 20 AEF.xlsx", Type:=xlExcelLinks
ThisWorkbook.Saved = True
ThisWorkbook.Close
Next
End Sub