Solved

Excel 2007 VBA for Print to PDF

Posted on 2014-02-18
4
650 Views
Last Modified: 2014-03-04
Hello,

Do you have a simple string of code for selecting worksheets in excel and having them print to pdf?  I found that the NE port is different on all computers at my company so the code I did find only works on my computer.  Everything I find online also has the NE port reference (along with recording a macro).  Any way around this?

Thanks!
0
Comment
Question by:Escanaba
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39867842
If you install PDFCreator (open source, free) you can just set

.ActivePrinter = "PDFCreator"

No need to fiddle with NE ports
0
 
LVL 1

Author Comment

by:Escanaba
ID: 39867857
Any other thoughts?  The financial company I work with has a strict policy of uploading new applications and to do so would take considerable amount of red tape.
0
 

Expert Comment

by:grasscake
ID: 39867873
I have the exact same issue and would be grateful for a solution.  The NE port is different for all computers, but installing PDFCreator is not an option.
0
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 39867907
In that case, I would enumerate ALL printer (see: http://word.mvps.org/FAQs/MacrosVBA/AvailablePrinters.htm )

and using a partial match (assuming it's always a unique name, but only the NE port is different, like "PDF printer on NE6:), select the correct one from that list.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question