UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Printing Pdf Files To Different Printers, Access 2016    
 
   
ccman69
post Jan 23 2020, 04:03 PM
Post#1



Posts: 459
Joined: 5-July 07



I need to print pdf file to a couple of different printers. I have a Hewlett-Packard HP Color LaserJet M452nw for the smaller pdf files and Canon Copier for the larger pdf files. I have been trying the code below to get the print-out, however it does not matter what the default printer is, it still prints to the Hewlett-Packard HP Color LaserJet M452nw:


Sub PrintThePDFs()
Dim CheckFile As String, FileFound As String, sDest As String, FileName As String, x As Long, sAcrobatReaderExe As String



CheckFile = "*.pdf"
On Error GoTo errorcatch

'The following lines of code use a network path for the source file :
sDest = "C:\Users\eCommerce\Documents\Cipherlab Documents\Print-Off's\" & CheckFile ' will be changed to CurrentProject.path & MAXIMOExports
'MsgBox sDest
ctr = 1
FileFound = Dir(sDest) ' Retrieving the first entry.
FileName = "C:\Users\eCommerce\Documents\Cipherlab Documents\Print-Off's\" & FileFound
If FileFound <> "" Then
MsgBox ctr & " - " & FileName
CreateObject("Shell.Application").Namespace(0).ParseName(FileName).InvokeVerb ("Print")
End If

Do Until FileFound = "" ' Start the loop.
ctr = ctr + 1
FileFound = Dir() ' Getting next entry.
FileName = "C:\Users\eCommerce\Documents\Cipherlab Documents\Print-Off's\" & FileFound

If FileFound <> "" Then
MsgBox ctr & " - " & FileFound
CreateObject("Shell.Application").Namespace(0).ParseName(FileName).InvokeVerb ("Print")
End If
Loop
MsgBox ctr & " .pdf files printed"
Exit Sub
errorcatch:

MsgBox "Error - " & Err.Description
End Sub

How can I get the first two document to print to the HP Printer and the third document to print to the copier? If it is even possible.

--------------------
ccman69
Go to the top of the page
 
June7
post Jan 23 2020, 04:40 PM
Post#2



Posts: 1,221
Joined: 25-January 16
From: The Great Land


Never mind, you are trying to set default printer to print an external document, not an Access report. I will have to do some research and testing.

Review this discussion https://www.UtterAccess.com/forum/index.php...owtopic=1982310

This post has been edited by June7: Jan 23 2020, 05:04 PM

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th February 2020 - 07:14 PM