Solved

Excel 2007 VBA for Print to PDF

Posted on 2014-02-18
4
640 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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 use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

919 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now