News:

Happy New Year!

Main Menu

Save as 8.5 x 11 PDF

Started by Biomedmike, January 14, 2025, 01:11:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Biomedmike

Hello,

Using the attachment as an example, is it possible to have VBA code that results in a single PDF file that is QTY-10 pages each 8.5x11?

When I export the file it is 3 pages that do not follow the print size that is set up in each Visio page.

I need to format the Visio pages as shown in the attachment but when saved to PDF I want it to be separate 8.5x11 pages.

Thank you,

BiomedMike

Biomedmike

#1
I actually figured out something myself. (There is hope)

As simple as the code is, I feel like I earned a wing. Just 1 wing and I can't fly but it works!

The below code reads and stores the default printer. It then changes (via VBA) the default to the Microsoft Print to PDF. It saves it using the page setup in Visio and then resets the default Windows printer back.

Just in case anyone else needs to do this, the code is below and the copy of the sample is attached.


Private Sub CommandButton1_Click()

'GetInitialDefaultPrinterName.
    Dim defaultPrinterName As String
    defaultPrinterName = Application.ActivePrinter
     
' Temporarily set the default printer to Microsoft PDF Printer.
    Application.ActivePrinter = "Microsoft Print to PDF"
     
' Save (via Print)the document to a PDF with a manually entered file name.
    ThisDocument.PrintOut visPrintAll
 
' Reset the Default to printer to what it was.
    Application.ActivePrinter = defaultPrinterName
 
End Sub



BiomedMike

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 153 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1054KB.
Tokens: post-login.
Cache hits: 13: 0.00137s for 26,555 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]