Hi All:
I am playing around with a code that Trevor G (THANKS) posted for someone. I am wondering if something can be added to this code to DELETE ALL Excel Files in the folder after the code runs OR dlete the file after it has been printed. Here is the code:
Can this be done?
Any assistance would be GREATLY appreciated.
THANKS,
Mark
I am playing around with a code that Trevor G (THANKS) posted for someone. I am wondering if something can be added to this code to DELETE ALL Excel Files in the folder after the code runs OR dlete the file after it has been printed. Here is the code:
Code:
Sub Print_ADI_Files()
Dim MyFile As String
MyPath = "C:\ADIs To Be PRINTED\"
MyFile = Dir(MyPath)
Do While MyFile <> ""
If MyFile Like "*.xls" Then
Workbooks.Open MyPath & MyFile
Sheets(Journal).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWorkbook.Close True
[B][COLOR=#ff0000]'Now I would like to DELETE the printed file and move [/COLOR][/B]
[B][COLOR=#ff0000]'onto the next one[/COLOR][/B]
End If
MyFile = Dir
Loop
[COLOR=red][B]'Now I would like to DELETE ALL Excel files in the folder:[/B][/COLOR]
[B][COLOR=red]'C:\ADIs To Be PRINTED\[/COLOR][/B]
End Sub
Can this be done?
Any assistance would be GREATLY appreciated.
THANKS,
Mark