I use the following macro to iterate through file paths stored in collection. On some test directory, total run time was 2,3 sec without setting openedApp and openedDoc to nothing and 2,75 with it. Is releasing both of these objects necessary in this case? I intend to use macro on a directory with thousands of files, so I would like to avoid any problems with memory which could cause errors or slow down macro execution.
Dim openedApp As Word.Application
Dim openedDoc As Word.Document
For Each filePath In filesCollection
Set openedApp = New Word.Application
Set openedDoc = openedApp.Documents.Open(filePath)
'openedApp.Visible = True
openedDoc.Close
openedApp.Quit
Set openedApp = Nothing: Set openedDoc = Nothing
Next filePath