• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Additional script to print multiple PDF's

bradmitchell

New Member
Hi I have copied VBA from user sgmpatnaik thankyou to this user, the code works great I just don't know how to add more pdf's to print at the same time.

what I have are multiple PDF's id like to print from a single button click, they are inductions for staff, different staff have different inductions, I want to set up several buttons to batch print the appropriate paperwork for the corresponding staff.

eg

I have this command
Code:
Option Compare Database
Private Sub Command4_Click()
Call testPrint
End Sub
and this module
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 = "X:\HR\02. INDUCTIONS"
strFile = "ANTI BULLYING PROCEDURE.pdf"

printThis = PrintThisDoc(0, strDir & "\" & strFile)


End Sub
I have another file in folder path X:\HR\02. INDUCTIONS\LOAD RESTRAINT.pdf that I would like to print on the same button click.

I dont know anything about how to move forward here as I have next to no skill with this, any assistance would be appreciated greatly
 
Last edited by a moderator:
Back
Top