Microsoft Office Forums Printer Listing

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-29-2019, 04:12 PM
hickeyt hickeyt is offline Printer Listing Windows 10 Printer Listing Office 2007
Novice
Printer Listing
 
Join Date: Apr 2019
Posts: 5
hickeyt is on a distinguished road
Default Printer Listing


Is there a way in Excel VBA to create a listing of all of the printers available to that PC. In other words, I'd like to be able to loop through all of the printers that are available in Device Manager so that I can select one that is not the default printer based on some criteria that I could define and print to it instead
Reply With Quote
  #2  
Old 04-29-2019, 06:29 PM
Alansidman's Avatar
Alansidman Alansidman is offline Printer Listing Windows 10 Printer Listing Office 2019
Advanced Beginner
 
Join Date: Apr 2019
Location: Steamboat Springs
Posts: 30
Alansidman is on a distinguished road
Default

https://docs.microsoft.com/en-us/off...alled-printers
Reply With Quote
  #3  
Old 04-30-2019, 07:10 AM
hickeyt hickeyt is offline Printer Listing Windows 10 Printer Listing Office 2007
Novice
Printer Listing
 
Join Date: Apr 2019
Posts: 5
hickeyt is on a distinguished road
Default Thanks

Thanks.


My version of Excel does not support the Printers property of the Application Object so I get an error on
Dim prtLoop As Printer
and
Printers.Count

Is there some other way that would work with an previous version of Excel?
Reply With Quote
  #4  
Old 04-30-2019, 07:32 AM
Debaser's Avatar
Debaser Debaser is offline Printer Listing Windows 7 64bit Printer Listing Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Posts: 166
Debaser is on a distinguished road
Default

No version of Excel supports a Printers property, but you can use WMI:

Code:
    Dim Printer As Object
    For Each Printer In GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2"). _
        ExecQuery("Select * from Win32_Printer")
    MsgBox Printer.Name
    Next
Reply With Quote
  #5  
Old 04-30-2019, 08:44 AM
hickeyt hickeyt is offline Printer Listing Windows 10 Printer Listing Office 2007
Novice
Printer Listing
 
Join Date: Apr 2019
Posts: 5
hickeyt is on a distinguished road
Default Thanks

Works perfectly. Thanks for the help
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer Listing listing johan-leroy Excel 1 11-26-2016 08:12 AM
Printer Problems-Need to reload printer each day jekronenfeld Windows 1 11-24-2014 12:35 AM
Printer Listing listing linked graphics eng1ne Drawing and Graphics 5 02-28-2012 06:42 AM
MS Word 2003, printer queue in 'printer properties' shows 1 job; no job in printer benhuxham Word 0 07-25-2011 06:58 PM
Printer Listing listing and counting words gencoglux Word 2 05-07-2010 05:10 PM


All times are GMT -7. The time now is 05:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft