Hi All,
I need help to find a way via VBA to save a copy of an open worksheet to pdf format each time a cell value gets changed or a value added.
The workbook that needs to do this a new one created each day and comes in csv format(if that matters).
I already have found the code to do the saving and appending the pdf with a date value, but that's it as in the below code:
I need help to find a way via VBA to save a copy of an open worksheet to pdf format each time a cell value gets changed or a value added.
The workbook that needs to do this a new one created each day and comes in csv format(if that matters).
I already have found the code to do the saving and appending the pdf with a date value, but that's it as in the below code:
Code:
Sub RDB_Workbook_To_PDF1()
'Stop
Dim filename As String
'///////////////////////////////////////////////
Dim PDF_date As String
PDF_date = Format(Now, "dd-mmm-yy") & "_OV.pdf"
'
'
Application.DisplayAlerts = False '' turn warning messages off.
filename = RDB_Create_PDF(Source:=ActiveWorkbook, _
FixedFilePathName:="P:\?????\Daily?????" & PDF_date, _
OverwriteIfFileExist:=True, _
OpenPDFAfterPublish:=False)
'
'For a fixed file name use this in the FixedFilePathName argument
'FixedFilePathName:="C:\Users\Ron\Test\YourPdfFile.pdf"
'
'
If filename <> "" Then
' 'Ok, you find the PDF where you saved it
' 'You can call the mail macro here if you want
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
Application.DisplayAlerts = True '' turn warning messages on.
End Sub