+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    05-04-2004
    Posts
    15

    Print to PDF Files????

    Hi

    After trying to figure this out for weeks, I am coming to you guys for help again

    Here's what I'm trying to do. I have a page in a workbook that needs to be printed out to pdf. Ten pages are printed, so the ranges are set, some of these are landscape, some are portrait.

    What is currently done: A macro prints based on settings described, and each page is printed, into ten different pdf files, requiring user to name each one each time and confirm printing...VERY TEDIOUS because this has to be done in at least 60 workbooks.

    What I changed it to do: Macro now prints to postcript first, so it automatically names the files and converts into pdf files.

    What I want it to do: The macro to print to postcript and name automatically works ok, but one problem...it doesn't maintain printing in landscape...is there a fix to this? It prints all pages as portrait.

    Also, is there a way I can automatically combine the 10 files into one pdf file?

    Thanks!

    The existing code works other than the landscape printing, I will attach it as a txt document in case anyone wants to look at it. I would love help though on printing landscape and combining the files.
    Attached Files Attached Files
    Last edited by VBA Noob; 12-19-2008 at 11:28 AM.

  2. #2
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,447
    I notice that you are manually changing printers, you can do this in the code. Something like this

    Code:
    Option Explicit
    
    
    Private Sub cmdCompanyPart1_Click()
    Dim DefaultPrinter As String
        'get default printer
        DefaultPrinter = Application.ActivePrinter
        ' change printer
        Application.ActivePrinter = "Adobe PDF Writer on CPW2:"
        'print sheet
       'your code here
        ' change back to default printer
        Application.ActivePrinter = DefaultPrinter
    End Sub
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  3. #3
    Registered User
    Join Date
    05-04-2004
    Posts
    15
    Thank you for that, I will definitely incorporate that into my code.

    Any help for the landscape issue or combining files?

    Thanks...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0