Changing PDF printers

Diamondeffect

New Member
Joined
Jun 16, 2014
Messages
5
Hi All,

I have recently written some excel code (mostly borrowed from the internet) to print a range of hidden sheets through a PDF printer (doPDF) for a document used by several members of my team (who use the company network). When we used Version 7 it worked fine but since some people moved to version 8 of doPDF it keeps failing.

The code I am using is:

Sub Select_page_only()
If IsEmpty(ActiveSheet.Range("G2")) Then
MsgBox ("Please enter a company/customer name!")
Exit Sub
End If
If ActiveSheet.Range("J20").Value = "CHECK" Then
MsgBox ("Please check handset price!")
Exit Sub
End If
Application.ScreenUpdating = False
Application.ActivePrinter = "doPDF v7 on DOP7:"
With Sheets("Printable Document")
.Visible = True
.PrintOut From:=3, To:=3, Copies:=1, Collate:=True
.Visible = False
End With
Application.ScreenUpdating = True
End Sub

It is the line in red I have an error on (DOP7 is the old printer port) but when I change it to the listed port for version 8 it will not work and suggests I use Ne01 when changing doPDF 8 to the active printer. However everyone has a different network port (Ne02, Ne03 etc) and I cannot seem to figure out how to unify this or why the previous method will simply not work when modified.

I am very new to all this so any help will be hugely apprieciated
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
you used to be able to cycle through NE01 onwards as a loop, but excel 2007 onwards prints directly to PDF

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\******\Documents\Book1.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
 
Upvote 0

Forum statistics

Threads
1,223,277
Messages
6,171,149
Members
452,382
Latest member
RonChand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top