Hi!
This is my first post here, so bare with me.
I've done some incredibly extensive research and can't quite find what I need. I'm quite a novice when it comes to VBA and have been attempting to stumble my way through creating what I'd like to create. Either way, here goes.
I have a large Excel file with dozens of tabs that I'd like to create a Macro/Function for. On one tab, I have a "Create PDF" button which, when clicked, selects four specified tabs, and saves a PDF file to a folder on my C drive.
Sub PDF_Generator3()
'
' PDF_Generator3 Macro
'
'
Sheets(Array("Ancillary Performance", "Retail-Lease Performance", _
"Used Performance", "District KPIs")).Select
Sheets("Ancillary Performance").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="C:\Region Business Update\" & Range("C3"), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
ActiveWorkbook.Save
End Sub
I figured out how to create a function to name the file based on a cell reference, which is perfect, but I'm looking for something a little more in depth.
The Region Business Update folder may not exist on everyone's C drive who uses this Excel file, so this is what I'm looking for: I'd like the Macro/Function to perform the above action, but create the Region Business Update folder, if it doesn't already exist. If it does exist, I'd like it to move on and create a folder based on cell P8 on the Ancillary Performance tab, which is a Date (MM-YY). If the date already exists, I'd like it to move forward. Lastly, I'd like it to save the PDF file within the appropriate date folder.
If anyone can assist with this, I would SUPER appreciate it.
Thanks in advance and have a great day.
This is my first post here, so bare with me.
I've done some incredibly extensive research and can't quite find what I need. I'm quite a novice when it comes to VBA and have been attempting to stumble my way through creating what I'd like to create. Either way, here goes.
I have a large Excel file with dozens of tabs that I'd like to create a Macro/Function for. On one tab, I have a "Create PDF" button which, when clicked, selects four specified tabs, and saves a PDF file to a folder on my C drive.
Sub PDF_Generator3()
'
' PDF_Generator3 Macro
'
'
Sheets(Array("Ancillary Performance", "Retail-Lease Performance", _
"Used Performance", "District KPIs")).Select
Sheets("Ancillary Performance").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="C:\Region Business Update\" & Range("C3"), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
ActiveWorkbook.Save
End Sub
I figured out how to create a function to name the file based on a cell reference, which is perfect, but I'm looking for something a little more in depth.
The Region Business Update folder may not exist on everyone's C drive who uses this Excel file, so this is what I'm looking for: I'd like the Macro/Function to perform the above action, but create the Region Business Update folder, if it doesn't already exist. If it does exist, I'd like it to move on and create a folder based on cell P8 on the Ancillary Performance tab, which is a Date (MM-YY). If the date already exists, I'd like it to move forward. Lastly, I'd like it to save the PDF file within the appropriate date folder.
If anyone can assist with this, I would SUPER appreciate it.
Thanks in advance and have a great day.
Last edited: