I have the following code that allows a user to select a PDF File to Print. Once selected, the PDF File opens and the user selects the Print Icon, Clicks on Print and it prints
I need the code amended that after printing a message box will appear "Do you need another copy, yes/No ? If Yes then select Print or if user selects No , then close the PDF file
It would be appreciated if someone could kindly amend my code
I need the code amended that after printing a message box will appear "Do you need another copy, yes/No ? If Yes then select Print or if user selects No , then close the PDF file
It would be appreciated if someone could kindly amend my code
Code:
Sub PrintSelectedPDFFile()
Dim filePath As String
' Open file dialog to select PDF file
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select PDF file"
.Filters.Clear
.Filters.Add "PDF files", "*.pdf"
.InitialFileName = "C:\pull"
.AllowMultiSelect = False
If .Show = -1 Then ' if the user selects a file
filePath = .SelectedItems(1)
Else
Exit Sub ' user canceled selection
End If
End With
' Print the selected file using default application
If Len(filePath) > 0 Then
ShellExecute 0, "open", filePath, vbNullString, vbNullString, vbNormalFocus
End If
End Sub