I am currently trying to use the sample provided by Lebans
http://www.lebans.com/reporttopdf.htm....but the only part I need is just the code below such that the file excel filename created in a folder can also be used to create a pdf file.
For example user is prompted from a msgbox: "Save this file to pdf"?
If user clicks the "Yes" button then create a folder "Excelpdf" folder int he current path and store
the excelfile.pdf in it. If "No" response from user then 'do nothing'.
In essence
1. saving the Excel file as pdf, then name the pdf file using the Excel filename that I am working on
2. If a popup shows when the pdf file already exists, turn off this warning and over write the file
without the prompt.
I am not sure this is possible... just experimenting
Here is the part I am mostly interested in joining to my current Excel code:
Dim blRet As Boolean
blRet = ConvertReportToPDF("Excelf
ilename", vbNullString, _
"C:\Test\Excelpdf\Excelfil
ename.pdf"
, False, True, 0, "", "", 0, 0)
which will be saved as
C:\Test\Excelpdf\Excelfile
name.pdf
' **************
Here is the function code:
' The function call is:
'Public Function ConvertReportToPDF( _
'Optional RptName As String = "", _
'Optional SnapshotName As String = "", _
'Optional OutputPDFname As String = "", _
'Optional ShowSaveFileDialog As Boolean = False, _
'Optional StartPDFViewer As Boolean = True, _
'Optional CompressionLevel As Long = 0, _
'Optional PasswordOwner As String = "", _
'Optional PasswordOpen As String = "", _
'Optional PasswordRestrictions As Long = 0, _
'Optional PDFNoFontEmbedding as Long = 0 _
') As Boolean
Dim blRet As Boolean
blRet = ConvertReportToPDF(Your Excel Name, vbNullString, "C:\Test\ExcelPdf" & Me.Excelfilename & ".pdf", False, True, 0, "", "", 0, 0)
Start Free Trial