+ Reply to Thread
Results 1 to 5 of 5

Print sheet as PDF after selecting each of the option in validation list

  1. #1
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Print sheet as PDF after selecting each of the option in validation list

    Crew,

    I have this code, it works good, but how do I set it to select printer "Adobe PDF on Ne02:" so I can print to PDF and the file name to equal the selection in B3 (validation list as specified in the code) in this directory "C:\Temp"?
    Please Login or Register  to view this content.
    I have around 20 options in the drop down (validation list) in B3. So the code, loops thru each of the selection and prints the sheet (which changes after each selection). However the code prints to the default printer. I want to PDF them and save them in directory I stated before with the selection in B3 as the file name.

    Thanks,
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  2. #2
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Print sheet as PDF after selecting each of the option in validation list

    Ok, I found this:

    Please Login or Register  to view this content.
    Which will replace the active printout command, but I've read somewhere that you should avoid SendKeys commands in your code. Is there a way to avoid it here?

  3. #3
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Print sheet as PDF after selecting each of the option in validation list

    Actually, the addition of the code in post 2 to post 1 resulted in printing only the first page. The code then asked for a file name for all the other instances in the loop. What did I do wrong?

  4. #4
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Print sheet as PDF after selecting each of the option in validation list

    I don't know why it just printed the first page without prompting for user action, but I went a different way and used a feature which I believe is only available in Excel 2007 onwards (ExportAs); I may be wrong.
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Print sheet as PDF after selecting each of the option in validation list

    Someone inbox me a question: How to instruct the code to save the PDF in the workbook path rather than in C:\Temp\. Easy, just replace:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1