I have written a macro which is used to log the time a file is open. I would now like to save this macro into every file in a folder on the database. Is there a way I can do this using a macro?
I have located this maco which will loop through each file in a folder, but I am still unsure of how to say, "Save macro X in this file."
Set wbk = Workbooks.Open("E:\Work_Folders\empty_workbook_1.xls")
MyDir = wbk.Path
With Application.FileSearch
.NewSearch
.LookIn = MyDir
.SearchSubFolders = False
.Filename = ".UPC"
If .Execute > 0 Then
Application.ScreenUpdating = False
For Each vaFileName In .FoundFiles
'loop through each found workbook
ProcessData vaFileName
'pass workbook fullname to process routine
Next
Else
MsgBox "There were no files found."
End If
Application.ScreenUpdating = True
End With
Bookmarks