Solved

Excel 2007 VBA for Print to PDF

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

708 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

17 Experts available now in Live!

Get 1:1 Help Now