LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Listing Available Printers

I found this code that when you CTRL+G from Visual Basic it displays all my
printers:
Sub PrinterSelect_macro()
Dim wshNetwork As Object
Dim oDrives As Object
Dim oPrinters As Object
Dim iCount As Integer
Dim sCurrentprinter As String
sCurrentprinter = Application.ActivePrinter
Set wshNetwork = CreateObject("WScript.Network")
Set oDrives = wshNetwork.EnumNetworkDrives
Set oPrinters = wshNetwork.EnumPrinterConnections
For iCount = 0 To oPrinters.Count - 1 Step 2
Debug.Print "Printer Port " & oPrinters.Item(iCount) _
& " = " & oPrinters.Item(iCount + 1)
Next
Range("AI35") = sCurrentprinter 'I added this line and it pastes my HP
DeskJet in cell AI35
End Sub

I added the line where it pastes the printer name in AI35 (same sheet as
code). What I want it to do is, paste the next printer in AI36, then the
following in AI37 and so on. When I CTRL+G and run macro it shows 5
printers, I would like to allow for around 20 (AI35:AI54). I tried several
ways to loop it and move down to the next cell but I cannot get it to work.
So if I had 10 printers (network included) it would have all 10 listed from
cells AI35:AI44. Thank you for your help!

Mike Olson
 
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
Listing Printers in Excel RobC[_3_] Excel Programming 10 April 8th 06 10:14 PM
List of printers Jos Vens[_2_] Excel Programming 2 February 8th 06 11:43 AM
Printers Jason Zischke Excel Programming 4 December 1st 05 02:05 AM
List of available printers prizm1 New Users to Excel 3 June 12th 05 01:32 PM
Printers & LPT Tom Excel Programming 0 November 26th 03 05:39 PM


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