+ Reply to Thread
Results 1 to 10 of 10

Populate a combobox with a list of printers found on the (devices/printers) window

  1. #1
    Registered User
    Join Date
    04-11-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    6

    Populate a combobox with a list of printers found on the (devices/printers) window

    Hello everyone and thank you in advance for your help.
    I am trying to come up with a way to populate a combobox in a userform with a list of the printers that are available to that computer. I am able to program in either office 10 or 13. All the codes that I have been able to find thus far on the internet have not worked for me for one reason or another. I am pretty new to the world of VBA programing and everything I know I have learned through trial and error and the internet. As a bonus question if there is a way to have a certain page in a workbook printed to the printer that is selected in the combobox that would be awsome.

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    Try this,
    Make sure you name the combobox accordingly
    Please Login or Register  to view this content.
    Last edited by JapanDave; 04-11-2014 at 06:58 PM. Reason: Coding
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Registered User
    Join Date
    04-11-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    Dave, I get a runtime error 13 type mismatch error when I try and use your code. I narrowed it down to something in the with command. any idea what I might be doing wrong?

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    Where are you getting the error?

  5. #5
    Registered User
    Join Date
    04-11-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    I used the ' to cancel out lines and it loads with no errors except when I enable the with command. Granted there is no information in the combobox, but at least it loads the userform. It doesn't highlight any code lines like it does with normal errors.

  6. #6
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    I am not sure I follow. Where is the error occurring? What line?

    And you do realize that you will need some code to assign the printer selected in the combobox to a variable.

  7. #7
    Registered User
    Join Date
    04-11-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    Thats just it. I am not sure what the exact line is that is causing the problem. When I paste your code into a new userform code and have a userform with a combobox I get that error. Since there is no line of code highlighted for the failure I used the single quote mark at the beginning of each line to "cancel" that line of code out of the program. When I cancel out the lines in your code that have to do with the "with" function, I get a userform with a blank combobox. When I remove the quote from the lines for the with function I get the error stated above.

  8. #8
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    My Bad, Drunk again and I forgot to assign the array.

    Try this

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-11-2014
    Location
    phoenix, az
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    works great now thanks a ton man. been looking for an answer to this for a long time.

  10. #10
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Populate a combobox with a list of printers found on the (devices/printers) window

    No worries.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. list of printers in a combobox on a userform
    By davisok in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 08-29-2013, 05:39 AM
  2. Printers Not Available In List
    By EECOMAN in forum Excel General
    Replies: 0
    Last Post: 02-07-2012, 10:44 AM
  3. How Do I - Make ComboBox List Available Printers
    By PosseJohn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-27-2010, 02:42 AM
  4. List of printers
    By Jos Vens in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 07:50 AM
  5. [SOLVED] List of printers
    By Tom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1