Located this simple line for exporting a excel workbook into a pdf format. What I would like to do is export only certain worksheets into black & white PDF format if possible. Assistance appreciated.
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, buildSaveDest
Goals for code: (failing code below)
1) Export searchable portions of daily workbook in pdf file format (prefer black & white to reduce file size) so use of find feature is possible to locate certain data in file
2) Significantly reduce file size for storage
3) Ability to code in where files to be saved. i.e. C:\Track\Tracing Archive
4) Save new file name same as current excel file name with the pdf extension i.e. Track Sept 6, 2011 Teller 1.pdf
5) Simple one button click to export the desired worksheets into the pdf file.
6) Leave Excel file open & produce message box indicating Archive file has generated successfully.
7) Sample worksheets to export are named 34, 43, 9400 & will be other so understanding how to embed additional sheets in the code beneficial an alternative to name a range of sheets would also be benificial.
Code below is 1st attempt but failing.
Sub CreateDailyTraceFile()
' Export specific worksheets within workbook to pdf file format
On Error Resume Next
Application.ScreenUpdating = False
ChDrive "C"
ChDir "C:\Track\Tracing Archive"
ActiveWorksheets ("34", "43", "9400").ExportAsFixedFormat xlTypePDF
ActiveWorksheets("34", "43", "9400").SaveAs Filename:="Current File Name" & (.pdf)
MsgBox "Current Day Tracing Files Have Generated"
ActiveWorkbook.Close False
Application.ScreenUpdating = True
Exit Sub
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, buildSaveDest
Goals for code: (failing code below)
1) Export searchable portions of daily workbook in pdf file format (prefer black & white to reduce file size) so use of find feature is possible to locate certain data in file
2) Significantly reduce file size for storage
3) Ability to code in where files to be saved. i.e. C:\Track\Tracing Archive
4) Save new file name same as current excel file name with the pdf extension i.e. Track Sept 6, 2011 Teller 1.pdf
5) Simple one button click to export the desired worksheets into the pdf file.
6) Leave Excel file open & produce message box indicating Archive file has generated successfully.
7) Sample worksheets to export are named 34, 43, 9400 & will be other so understanding how to embed additional sheets in the code beneficial an alternative to name a range of sheets would also be benificial.
Code below is 1st attempt but failing.
Sub CreateDailyTraceFile()
' Export specific worksheets within workbook to pdf file format
On Error Resume Next
Application.ScreenUpdating = False
ChDrive "C"
ChDir "C:\Track\Tracing Archive"
ActiveWorksheets ("34", "43", "9400").ExportAsFixedFormat xlTypePDF
ActiveWorksheets("34", "43", "9400").SaveAs Filename:="Current File Name" & (.pdf)
MsgBox "Current Day Tracing Files Have Generated"
ActiveWorkbook.Close False
Application.ScreenUpdating = True
Exit Sub