Skip to main content
Inspiring
September 2, 2024
Question

Is there a way for MS Word VBA to change the printer in Acrobat?

  • September 2, 2024
  • 1 reply
  • 827 views

Hi,

I have a batch of pdf files which I want to print on 2 identical printers simultaneously in the correct order. Currently, I am using a Word vba macro to do this on a Windows 11 system. The macro opens each document in Adobe Acrobat and prints using OLE Automation and using Adobe Acrobat 10.0 Type Library. Here is my current workflow:

 

  1. Set Windows default printer to Printer1
  2. Open document in Acrobat
  3. Print document on Printer1
  4. Close document
  5. Close Adobe Acrobat
  6. Set Windows default printer to Printer2
  7. Open document in Acrobat
  8. Print document on Printer2
  9. Close document
  10. Close Adobe Acrobat

 

Then repeat these steps for the next document. And so on.

 

While this all works fine, it seems inefficient and slow, needing to open the same document twice to print to the two separate printers. On opening the document, Acrobat prints to the default Windows printer, hence the need to close it, change the default printer, then reopen it.

 

Surely, there must be a better way to do this. It should be possible to achieve this:

 

  1. Open document in Acrobat
  2. Print document to Printer1
  3. Print document to Printer2
  4. Close document
  5. Close Adobe Acrobat

 

My macro uses PrintPagesSilent to print the documents.

 

My question is:

 

Is there a command to select the printer in Acrobat before executing the .PrintPagesSilent command or a command that prints to a specific printer?

 

I can't seem to find one.

 

Based on some research, I have explored using a javascript object in VBA. Here's an extract:

 

If AcroAVDoc.Open(DocName, "") Then

Set acroPDDoc = AcroAVDoc.GetPDDoc

Set jso = acroPDDoc.GetJSObject
Set pp = jso.getPrintParams
pp.PrinterName = "Myprinter"
pp.interactive = pp.Constants.interactionLevel.automatic
jso.Print (pp)

AcroApp.CloseAllDocs

AcroApp.Exit

End If

 

However, this gets stuck on the last line: 'jso.Print (pp)'

 

I would be grateful for any assistance to streamline my workflow.

 

Many thanks!

This topic has been closed for replies.

1 reply

Inspiring
September 4, 2024

I have solved my issue. Please ignore this request. If possible, perhaps someone can delete this question. Thanks!