Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default pdf printer on each laptop different name

Dear group members,

I got a macro here, which is running smoothly and printing the
worksheets as I like... sounds perfect, but as my colleagues tried to
us it, too, we discovered a bug. Here is the code:

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True

Application.ActivePrinter = "PDFCreator on Ne00:"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
ActivePrinter:= _
"PDFCreator on Ne00:", Collate:=True


End Sub

PDF Creator has been installed on all our laptops. However, some users
have installed 2 printer, some 3, some even 4. Now as PDF Creator was
installed, its name became not Ne00, but 02 or 04...
Could you help me with this? The macro should actually check/find out,
if the Name is "PDFCreator on Ne00:", "PDFCreator on Ne01:",
"PDFCreator on Ne02:" ect.

Thanks a lot for your help.

Regards,

Rico

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default pdf printer on each laptop different name

Dim iCtr as long
dim FoundIt as boolean

foundit = false
for ictr = 0 to 99
on error resume next
Application.activeprinter = "PDFCreator on Ne" & format(ictr,"00") & ":"
if err.number = 0 then
foundit = true
exit for
else
'keep looking
err.clear
end if
next ictr
on error goto 0

if foundit = false then
msgbox "No printer close to that name
else
'do the real work
end if

Untested, watch for typos.


ricowyder wrote:

Dear group members,

I got a macro here, which is running smoothly and printing the
worksheets as I like... sounds perfect, but as my colleagues tried to
us it, too, we discovered a bug. Here is the code:

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True

Application.ActivePrinter = "PDFCreator on Ne00:"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
ActivePrinter:= _
"PDFCreator on Ne00:", Collate:=True

End Sub

PDF Creator has been installed on all our laptops. However, some users
have installed 2 printer, some 3, some even 4. Now as PDF Creator was
installed, its name became not Ne00, but 02 or 04...
Could you help me with this? The macro should actually check/find out,
if the Name is "PDFCreator on Ne00:", "PDFCreator on Ne01:",
"PDFCreator on Ne02:" ect.

Thanks a lot for your help.

Regards,

Rico


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default pdf printer on each laptop different name

tom, there's a typo, a missing " around the colon s & :",

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1, Collate:=True
For i = 0 To 9
s = Format(i, "00")
On Error Resume Next
Application.ActivePrinter = "PDFCreator on Ne" & s & ":"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1, _
ActivePrinter:="PDFCreator on Ne" & s & ":", Collate:=True
If Err.Number = 0 Then Exit For
On Error GoTo 0
Next
End Sub

--


Gary


"Tom Ogilvy" wrote in message
...
Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True
for i = 0 to 9
s = format(i,"00")
On Error Resume Next
Application.ActivePrinter = "PDFCreator on Ne" & s & ":"
ThisWorkbook.Worksheets("01_NetRev").PrintOut _
Copies:=1,
ActivePrinter:="PDFCreator on Ne" & s & :", _
Collate:=True
if err.Number = 0 then exit for
On Error goto 0
Next

End Sub

--
Regards,
Tom Ogilvy

"ricowyder" wrote:

Dear group members,

I got a macro here, which is running smoothly and printing the
worksheets as I like... sounds perfect, but as my colleagues tried to
us it, too, we discovered a bug. Here is the code:

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True

Application.ActivePrinter = "PDFCreator on Ne00:"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
ActivePrinter:= _
"PDFCreator on Ne00:", Collate:=True


End Sub

PDF Creator has been installed on all our laptops. However, some users
have installed 2 printer, some 3, some even 4. Now as PDF Creator was
installed, its name became not Ne00, but 02 or 04...
Could you help me with this? The macro should actually check/find out,
if the Name is "PDFCreator on Ne00:", "PDFCreator on Ne01:",
"PDFCreator on Ne02:" ect.

Thanks a lot for your help.

Regards,

Rico




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default pdf printer on each laptop different name

Yes, thanks for picking up on that typo. Hopefully the OP already has.

Not sure that argument is even necessary, however - should have gone with my
first inclination and deleted it.

--
Regards,
Tom Ogilvy

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
tom, there's a typo, a missing " around the colon s & :",

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1, Collate:=True
For i = 0 To 9
s = Format(i, "00")
On Error Resume Next
Application.ActivePrinter = "PDFCreator on Ne" & s & ":"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1, _
ActivePrinter:="PDFCreator on Ne" & s & ":", Collate:=True
If Err.Number = 0 Then Exit For
On Error GoTo 0
Next
End Sub

--


Gary


"Tom Ogilvy" wrote in message
...
Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True
for i = 0 to 9
s = format(i,"00")
On Error Resume Next
Application.ActivePrinter = "PDFCreator on Ne" & s & ":"
ThisWorkbook.Worksheets("01_NetRev").PrintOut _
Copies:=1,
ActivePrinter:="PDFCreator on Ne" & s & :", _
Collate:=True
if err.Number = 0 then exit for
On Error goto 0
Next

End Sub

--
Regards,
Tom Ogilvy

"ricowyder" wrote:

Dear group members,

I got a macro here, which is running smoothly and printing the
worksheets as I like... sounds perfect, but as my colleagues tried to
us it, too, we discovered a bug. Here is the code:

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True

Application.ActivePrinter = "PDFCreator on Ne00:"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
ActivePrinter:= _
"PDFCreator on Ne00:", Collate:=True


End Sub

PDF Creator has been installed on all our laptops. However, some users
have installed 2 printer, some 3, some even 4. Now as PDF Creator was
installed, its name became not Ne00, but 02 or 04...
Could you help me with this? The macro should actually check/find out,
if the Name is "PDFCreator on Ne00:", "PDFCreator on Ne01:",
"PDFCreator on Ne02:" ect.

Thanks a lot for your help.

Regards,

Rico






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default pdf printer on each laptop different name

As well as the solution already suggested, you can read the registry key at
:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts

NickHK

"ricowyder" wrote in message
oups.com...
Dear group members,

I got a macro here, which is running smoothly and printing the
worksheets as I like... sounds perfect, but as my colleagues tried to
us it, too, we discovered a bug. Here is the code:

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True

Application.ActivePrinter = "PDFCreator on Ne00:"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
ActivePrinter:= _
"PDFCreator on Ne00:", Collate:=True


End Sub

PDF Creator has been installed on all our laptops. However, some users
have installed 2 printer, some 3, some even 4. Now as PDF Creator was
installed, its name became not Ne00, but 02 or 04...
Could you help me with this? The macro should actually check/find out,
if the Name is "PDFCreator on Ne00:", "PDFCreator on Ne01:",
"PDFCreator on Ne02:" ect.

Thanks a lot for your help.

Regards,

Rico





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default pdf printer on each laptop different name

no problem, someday i hope to know half as much as you.

--


Gary


"Tom Ogilvy" wrote in message
...
Yes, thanks for picking up on that typo. Hopefully the OP already has.

Not sure that argument is even necessary, however - should have gone with my
first inclination and deleted it.

--
Regards,
Tom Ogilvy

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
tom, there's a typo, a missing " around the colon s & :",

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1, Collate:=True
For i = 0 To 9
s = Format(i, "00")
On Error Resume Next
Application.ActivePrinter = "PDFCreator on Ne" & s & ":"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1, _
ActivePrinter:="PDFCreator on Ne" & s & ":", Collate:=True
If Err.Number = 0 Then Exit For
On Error GoTo 0
Next
End Sub

--


Gary


"Tom Ogilvy" wrote in message
...
Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True
for i = 0 to 9
s = format(i,"00")
On Error Resume Next
Application.ActivePrinter = "PDFCreator on Ne" & s & ":"
ThisWorkbook.Worksheets("01_NetRev").PrintOut _
Copies:=1,
ActivePrinter:="PDFCreator on Ne" & s & :", _
Collate:=True
if err.Number = 0 then exit for
On Error goto 0
Next

End Sub

--
Regards,
Tom Ogilvy

"ricowyder" wrote:

Dear group members,

I got a macro here, which is running smoothly and printing the
worksheets as I like... sounds perfect, but as my colleagues tried to
us it, too, we discovered a bug. Here is the code:

Sub PrintSheets()

ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
Collate:=True

Application.ActivePrinter = "PDFCreator on Ne00:"
ThisWorkbook.Worksheets("01_NetRev").PrintOut Copies:=1,
ActivePrinter:= _
"PDFCreator on Ne00:", Collate:=True


End Sub

PDF Creator has been installed on all our laptops. However, some users
have installed 2 printer, some 3, some even 4. Now as PDF Creator was
installed, its name became not Ne00, but 02 or 04...
Could you help me with this? The macro should actually check/find out,
if the Name is "PDFCreator on Ne00:", "PDFCreator on Ne01:",
"PDFCreator on Ne02:" ect.

Thanks a lot for your help.

Regards,

Rico








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
members on my network printer not able to print to default printer smeheut Excel Discussion (Misc queries) 0 June 18th 07 06:42 PM
Printer Multiple Worksheets with a particular Printer Setting PP[_2_] Excel Worksheet Functions 0 March 14th 07 02:02 PM
How do I change margins in Excel without a printer to my laptop? DRBoncze Excel Discussion (Misc queries) 2 September 4th 06 05:52 PM
Send printer escape commands to a printer using VBA mikeburg[_41_] Excel Programming 3 October 6th 05 07:36 PM
LAPTOP KEYPAD MARTIN TREMBLAY Excel Discussion (Misc queries) 1 June 28th 05 08:45 PM


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"