Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Identifying Printer Name

My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Identifying Printer Name

You can let the user decide, show him a list of printers...

If Application.Dialogs(xlDialogPrinterSetup).Show = True Then
'print something
MsgBox "selected a printer"
Else
'handle cancel
MsgBox "clicked cancel"
End If
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Marvin"
wrote in message
My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Identifying Printer Name

You can just print to the active printer. If you use
for examle: ActiveSheet.PrintOut it automatically
selects the ActivePrinter for that workstation.

"Marvin" wrote:

My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Identifying Printer Name

Thank you. What I want to do is remove the user from the decision process.
I want to save his printer name, select the ADOBE printer, print, then
restore his selected printer.

My experience with my users is that, if allowed, they will make errors.

"Jim Cone" wrote:

You can let the user decide, show him a list of printers...

If Application.Dialogs(xlDialogPrinterSetup).Show = True Then
'print something
MsgBox "selected a printer"
Else
'handle cancel
MsgBox "clicked cancel"
End If
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Marvin"
wrote in message
My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Identifying Printer Name

The ADOBE printer is likely not the ActivePrinter for these users. I need a
way to force the output to ADOBE.

"JLGWhiz" wrote:

You can just print to the active printer. If you use
for examle: ActiveSheet.PrintOut it automatically
selects the ActivePrinter for that workstation.

"Marvin" wrote:

My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Identifying Printer Name

You can also let the user provide the printer name and port with something
like this:

SelPrn = InputBox("TO SELECT A SPECIFIC PRINTER, ENTER THE SERVER NAME AND
PRINTER NAME IN THE FORMAT SHOWN IN THE SAMPLE BELOW:" & Chr(10) & Chr(10) &
"SAMPLE: \\PrtServer\" & ActivePrinter & Chr(10) & Chr(10) & "OR CLICK ON
CANCEL TO USE DEFAULT PRINTER.", "SELECT PRINTER")
SelPrn = UCase(SelPrn)
If SelPrn = False Or SelPrn = "" Then
Prn = ActivePrinter
Else
Prn = SelPrn
End If
ActiveSheet.PrintOut ActivePrinter:=Prn

Where PrtServer would be replaced with the users server name, and
ActivePrinter will show their current printer data.

"Marvin" wrote:

My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Identifying Printer Name

Yor are missing the point. I do NOT want user involvement in the selection.

"JLGWhiz" wrote:

You can also let the user provide the printer name and port with something
like this:

SelPrn = InputBox("TO SELECT A SPECIFIC PRINTER, ENTER THE SERVER NAME AND
PRINTER NAME IN THE FORMAT SHOWN IN THE SAMPLE BELOW:" & Chr(10) & Chr(10) &
"SAMPLE: \\PrtServer\" & ActivePrinter & Chr(10) & Chr(10) & "OR CLICK ON
CANCEL TO USE DEFAULT PRINTER.", "SELECT PRINTER")
SelPrn = UCase(SelPrn)
If SelPrn = False Or SelPrn = "" Then
Prn = ActivePrinter
Else
Prn = SelPrn
End If
ActiveSheet.PrintOut ActivePrinter:=Prn

Where PrtServer would be replaced with the users server name, and
ActivePrinter will show their current printer data.

"Marvin" wrote:

My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Identifying Printer Name

Dim iCtr as long
dim FoundIt as boolean

foundit = false
for ictr = 0 to 99
on error resume next
Application.activeprinter = "Adobe PDF 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

Marvin wrote:

My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Identifying Printer Name

'This is untested and printers must be on a network.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Sub WhichOneIsTheRightOneForMe()
Dim WshNetwork As Object
Dim oPrinters As Variant
Dim strPrinter As String
Dim i As Long

Set WshNetwork = CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 To oPrinters.Count - 1 Step 2
strPrinter = oPrinters.Item(i + 1) & " on " & oPrinters.Item(i)
If InStr(1, strPrinter, "Adobe PDF", vbTextCompare) 0 Then
Exit For
Else
strPrinter = vbNullString
End If
Next 'i
If Len(strPrinter) Then
MsgBox strPrinter
Else
MsgBox "Not found. "
End If
Set WshNetwork = Nothing
End Sub
'----------------


"Marvin"
wrote in message
Thank you. What I want to do is remove the user from the decision process.
I want to save his printer name, select the ADOBE printer, print, then
restore his selected printer.

My experience with my users is that, if allowed, they will make errors.

"Jim Cone" wrote:
You can let the user decide, show him a list of printers...

If Application.Dialogs(xlDialogPrinterSetup).Show = True Then
'print something
MsgBox "selected a printer"
Else
'handle cancel
MsgBox "clicked cancel"
End If
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Marvin"
wrote in message
My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?
Thanks.

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Identifying Printer Name

Here is an example

Dim activePtr
activePtr = Application.ActivePrinter
Application.ActivePrinter = "Auto HP Deskjet890C On PHILLSERVER:"
ActiveSheet.PrintOut
Application.ActivePrinter = activePtr


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Marvin" wrote in message
...
My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Identifying Printer Name

Bob-

Perhaps I am missing something, but I don't see how your code example helps
me identify the ADOBE printer unique to each of my users. Perhaps you can
add some verbage to your example.

Thanks.

"Bob Phillips" wrote:

Here is an example

Dim activePtr
activePtr = Application.ActivePrinter
Application.ActivePrinter = "Auto HP Deskjet890C On PHILLSERVER:"
ActiveSheet.PrintOut
Application.ActivePrinter = activePtr


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Marvin" wrote in message
...
My workbook is distributed to several users. In my macros, I have a
customized PRINT macto that prints to an ADOBE ACROBAT printer.

The printer has a different name on each of the PCs belonging to my users.
For example:
"Adobe PDF on Ne03:"
"Adobe PDF on Ne09:"
"Adobe PDF on Ne02:"
Is there any way I can programatically determine the printer name so that
the user does not have to customize the macro?

Thanks.




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
Identifying famdamly Excel Discussion (Misc queries) 2 February 26th 06 06:44 AM
Send printer escape commands to a printer using VBA mikeburg[_41_] Excel Programming 3 October 6th 05 07:36 PM
Identifying a value jtrevill[_4_] Excel Programming 1 November 18th 04 05:56 PM


All times are GMT +1. The time now is 11:19 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"