bobkap
Active Member
- Joined
- Nov 22, 2009
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
I have created a macro that creates several different worksheets. I'm using the code below to output each of these newly-created sheets to a .PDF which is then stored in the same folder as the workbook.
I'd like to move these new sheets to a new folder created by VBA. This is payroll data that needs to be run twice per month. Ideally, I'd like to create some kind of folder name that has a constant name and then a variable ending showing the date. For example: payroll 091518.
Any help would be GREATLY appreciated as I've tried for days to figure this out myself and just decided to give in and ask for help.
Set wb = ThisWorkbook
For Each sh In wb.Worksheets
sh.Select
pdf_name = sh.Name & ".pdf"
If sh.Name <> "Input" And _
sh.Name <> "Mileages" And _
sh.Name <> "Payrates" And _
sh.Name <> "Rates" Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="Instructor Pay For" & " " & pdf_name, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End If
Next
'
I'd like to move these new sheets to a new folder created by VBA. This is payroll data that needs to be run twice per month. Ideally, I'd like to create some kind of folder name that has a constant name and then a variable ending showing the date. For example: payroll 091518.
Any help would be GREATLY appreciated as I've tried for days to figure this out myself and just decided to give in and ask for help.
Set wb = ThisWorkbook
For Each sh In wb.Worksheets
sh.Select
pdf_name = sh.Name & ".pdf"
If sh.Name <> "Input" And _
sh.Name <> "Mileages" And _
sh.Name <> "Payrates" And _
sh.Name <> "Rates" Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="Instructor Pay For" & " " & pdf_name, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End If
Next
'