Hello,
I am trying to write a macro that automatically updates all of the data links (to other Excel files) in all of the files in a folder. I tried to macro record pressing the data update button but it did not record anything. Here is what I have so far. Any help is greatly appreciated!
I am trying to write a macro that automatically updates all of the data links (to other Excel files) in all of the files in a folder. I tried to macro record pressing the data update button but it did not record anything. Here is what I have so far. Any help is greatly appreciated!
Sub Autoupdate()
Dim fPath As String
Dim fName As String
Dim wb As Workbook
'Setup
Application.ScreenUpdating = False
fPath = "O:\Hopson\Mark to Market\Mark to Market Source Files\" 'remember final \ in this string
fName = Dir(fPath & "*.xls") 'start a list of filenames
Do While Len(fName) > 0
Set wb = Workbooks.Open(fPath & fName) 'open found file
With ActiveSheet
What goes in between
End With
wb.Close True 'close/save
fName = Dir 'get next filename
Loop
Application.ScreenUpdating = True
End Sub