LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Listing Printers in Excel

Yes, I knew that, but when Intellisense brings up the listing of dialogs the
two are right next to each other (I figured if he found one, he knows about
the other). I just don't see how the PrinterSetup will offer any significant
advantage over the regular Print dialog box if it is to the point that the
user has to select the printer (unless maybe you don't want to present the
user w/the option to cancel the print -but I don't think that was the
problem).

Thanks for posting the code, Tom. I will add it to my growing collection.


"Tom Ogilvy" wrote:

OP was using

xlDialogPrint

Lee is suggesting

xlDialogPrinterSetup

Although I agree with Steve on Intent.

Here is something similar to what Michel Pierron suggested in JM\B's link

Sub b()
Dim sConn as String, WshNetwork as Object, i as long
Dim avTmp as String
#If VBA6 Then
avTmp = Split(Excel.ActivePrinter, " ")
#Else
avTmp = Split97(Excel.ActivePrinter, " ")
#End If
sConn = " " & avTmp(UBound(avTmp) - 1) & " "
Set WshNetwork = CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 To oPrinters.Count - 1 Step 2
Debug.Print oPrinters.Item(i + 1) & _
sConn & oPrinters.Item(i)
Next
End Sub


Function Split97(sStr As String, sdelim As String) As Variant
Split97 = Evaluate("{""" & _
Application.Substitute(sStr, sdelim, """,""") & """}")
End Function

The avTmp part is to get the local version of the word "on" to cater to
international differences and was suggested by KeepItCool


--
Regards,
Tom Ogilvy




"JMB" wrote in message
...
According to the OP

I was hoping to get access to the list of printers then do some
manipulation to find PDF Writer, then choose this printer.


He already knows how to bring up the print dialog boxes as evidenced in

his
original posts.


"Lee Meadowcroft" wrote:

You dont need any of that complicated rubbish, try:

strOldActivePrinter = Application.ActivePrinter
Application.Dialogs(9).Show
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ActivePrinter = strOldActivePrinter

It saves the current printer name, prompts you to select the installed
PDF Printer, Prints and then restores the old printer.

Lee







 
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
Excel spreadsheet prints differently on different printers Derek Overton Excel Discussion (Misc queries) 4 August 24th 09 06:16 PM
Printing EXCEL tables with sophisticated HP Printers such as the D VAUTOUR 110 Excel Discussion (Misc queries) 1 June 3rd 09 09:58 PM
Excel 2007 Margins Cut Off Printing to Non-Physical Printers CEK Excel Discussion (Misc queries) 0 March 13th 08 03:46 PM
Excel 2007, Vista - losing printers Alan Excel Discussion (Misc queries) 0 June 19th 07 04:55 PM
Excel cannot find printers coopercat Excel Discussion (Misc queries) 0 November 30th 05 05:17 PM


All times are GMT +1. The time now is 12:11 PM.

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

About Us

"It's about Microsoft Excel"