I have searched here and tried about 50 different variations of "almost" what I am looking for but I cant get anything to work!
I already have a macro that is adding a picture for a watermark. It opens the workbook, adds the picture, and saves the workbook.
I want to run this macro on all workbooks in folders as well as the workbooks in the subfolders.
I get it to work on the workbooks that are loose in the folder but not the subfolders. AND i can only get it to run if i am in debug and step into then hit play. Its been 3 days and Im sooooo over it. Can anyone help me
code
Sub watermarkopenfiles()
'
' watermarkopenfiles Macro
'
'
ActiveSheet.Pictures.Insert( _
"C:\Users\sgtepkent\Desktop\OBSOLETE WATERMARK.png").Select
Selection.ShapeRange.IncrementLeft 33.6
Selection.ShapeRange.IncrementTop -321.6
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
Sub LoopThroughFiles()
FolderName = "W:\Flex-Tek\SGTE\Portland Gastite\Quality\Inspection Plans\Periodic Inspection Plans\OBSOLETE IP'S\acc solar bracket assembly"
If Right(FolderName, 1) <> Application.PathSeparator Then FolderName = FolderName & Application.PathSeparator
Fname = Dir(FolderName & "*.xls")
'loop through the files
Do While Len(Fname)
With Workbooks.Open(FolderName & Fname)
' here comes the code for the operations on every file the code finds
'HERE if you want to execute the second macro for every file in the loop
watermarkopenfiles
End With
' go to the next file in the folder
Fname = Dir
Loop
End Sub
I already have a macro that is adding a picture for a watermark. It opens the workbook, adds the picture, and saves the workbook.
I want to run this macro on all workbooks in folders as well as the workbooks in the subfolders.
I get it to work on the workbooks that are loose in the folder but not the subfolders. AND i can only get it to run if i am in debug and step into then hit play. Its been 3 days and Im sooooo over it. Can anyone help me
code
Sub watermarkopenfiles()
'
' watermarkopenfiles Macro
'
'
ActiveSheet.Pictures.Insert( _
"C:\Users\sgtepkent\Desktop\OBSOLETE WATERMARK.png").Select
Selection.ShapeRange.IncrementLeft 33.6
Selection.ShapeRange.IncrementTop -321.6
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
Sub LoopThroughFiles()
FolderName = "W:\Flex-Tek\SGTE\Portland Gastite\Quality\Inspection Plans\Periodic Inspection Plans\OBSOLETE IP'S\acc solar bracket assembly"
If Right(FolderName, 1) <> Application.PathSeparator Then FolderName = FolderName & Application.PathSeparator
Fname = Dir(FolderName & "*.xls")
'loop through the files
Do While Len(Fname)
With Workbooks.Open(FolderName & Fname)
' here comes the code for the operations on every file the code finds
'HERE if you want to execute the second macro for every file in the loop
watermarkopenfiles
End With
' go to the next file in the folder
Fname = Dir
Loop
End Sub