I have the following macro that takes a worksheet from the active file and inserts it into every workbook within a specific folder. Does anyone know how I can update this code so it works for other people as long as they have the folder called "Comp File Split" on their desktop? Right now it will only work for me since my desktop path is hard coded into the macro. I've highlighted the portion in question.
Sub AddTabIG()
'
'Add Tab called "Budget Rates"
Dim SrcBook As Workbook
Dim fso As Object 'File System Object
Dim f As Object 'Folder
Dim ff As Object 'Folder Files
Dim f1 As Object 'File to add template sheet
Dim fst As Object 'template worksheet
Application.ScreenUpdating = False
Set fst = ThisWorkbook.Worksheets("Budget Rates")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfolder("C:\users\SteveP\Desktop\Comp File Split\")
Set ff = f.Files
For Each f1 In ff
Set SrcBook = Workbooks.Open(f1)
'object reference
fst.Copy After:=SrcBook.Worksheets(1)
'copy template sheet
SrcBook.Worksheets(1).Activate
'activate first worksheet
SrcBook.Close True
'close file saving without prompt
Next
Application.ScreenUpdating = True
Set SrcBook = Nothing 'release system resources
Set fst = Nothing
Set fso = Nothing
Set f = Nothing
Set ff = Nothing
End Sub
Thanks,
Steve
Bookmarks