I am hoping to find a solution (be it VBA or not) to my problem. I have a Word document with linked Excel tables in it. All links work correctly, but I have to manually open the Word document in order for it to refresh with the Excel data. The reason I am using Word instead of Excel is due to the large amounts of text.
Is there a way that I could program some sort of code that would go through all Word documents in a folder, open each document, refresh all links, save document, and move onto the next one?
Here's what I have so far
Sub OpenFiles()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "LOCATION"
MyFile = Dir(MyFolder & "\*.docx")
Do While MyFile <> ""
Documents.Open Filename:=MyFolder & "\" & MyFile
MyFile = Dir
Loop
End Sub
UPDATE
Ok I was able to make the open files command work! Now I am attempting to make it overwrite/save the file and close it.
Error Message: Object Required
Sub OpenFiles()
Dim MyFolder As String
Dim MyFile As String
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
MyFolder = "LOCATION"
MyFile = Dir(MyFolder & "\*.docx")
Do While MyFile <> ""
objWord.Documents.Open Filename:=MyFolder & "\" & MyFile
Application.DisplayAlerts = False
ActiveDocument.SaveAs Filename:=MyFile
Application.DisplayAlerts = True
MyFile = Dir
Loop
End Sub