I found the code below online and use it to print a pdf file. This work perfectly with no issues. I would like to add the following if possible;
1. orientation=landscape
2. Page size = 11x17
3. Print only the first three pages
4. Print 2 copies.
This is beyond my ability in VBA, I just copied the code and changed the file location and name information. Any help would be appreciated.
1. orientation=landscape
2. Page size = 11x17
3. Print only the first three pages
4. Print 2 copies.
This is beyond my ability in VBA, I just copied the code and changed the file location and name information. Any help would be appreciated.
Code:
Option Explicit
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Function PrintThisDoc(formname As Long, FileName As String)
On Error Resume Next
Dim X As Long
X = ShellExecute(formname, "Print", FileName, 0&, 0&, 3)
End Function
Sub testPrint()
Dim printThis
Dim strDir As String
Dim strFile As String
strDir = "H:\Planning\Online Milestone"
strFile = "Milestone Indicators Dashboard.pdf"
printThis = PrintThisDoc(0, strDir & "\" & strFile)
End Sub