I'm working on a macro that would save my Excel workbook as a PDF.
I'm saving as pdf with some options (ignore print area, save entire workbook)...
This file will be used by many different users so the line "C:\Users\myname\OneDrive - Company\Desktop\folder\trial.pdf" probably won't work as it has my name entered and also the file name (currently 'trial') is not always the same. I'd like the saved pdf file name to be the same as the Excel file and stored in the same location as the Excel file.
Any help would be appreciated!
I'm saving as pdf with some options (ignore print area, save entire workbook)...
This file will be used by many different users so the line "C:\Users\myname\OneDrive - Company\Desktop\folder\trial.pdf" probably won't work as it has my name entered and also the file name (currently 'trial') is not always the same. I'd like the saved pdf file name to be the same as the Excel file and stored in the same location as the Excel file.
Any help would be appreciated!
VBA Code:
Sub SavePDF()
ActiveWorkbook.Save
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\myname\OneDrive - Company\Desktop\folder\trial.pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=True, OpenAfterPublish:=False
End Sub