PDA

View Full Version : List printers in userform Word 2010



davisok
08-28-2013, 03:24 AM
I am having problems creating a combobox that will show a list of all available printers on a computer (like the list in wdDialogFilePrint but without setting the default printer) within my userform. What I would like is a combobox with the list that the user can then select the desired printer and then specify the trays for the letter to use. The trays part of the code seem to be working but I cannot get a list of printers in the combobox, I have searched this forum and the internet and no solution seems to work.

Any help would be appreciated.

Thanks

gmaxey
08-28-2013, 05:14 AM
See: http://word.mvps.org/faqs/macrosvba/AvailablePrinters.htm

davisok
08-28-2013, 05:49 AM
Thanks for that but that is one of the codes that I have tried, the code needed to be updated for a 64bit machine and still did not work. It gives data type mismatch errors.

gmaxey
08-28-2013, 06:56 AM
I don't have 64 bit Office. You might look here for help with defining the variables: http://www.jkp-ads.com/Articles/apideclarations.asp

davisok
08-28-2013, 09:49 AM
I have already updated that code for a 64 bit machine and it still did not work.

Jay Freedman
08-31-2013, 11:31 AM
I've installed the code from the AvailablePrinters.htm article -- without any changes -- in Word 2013 32-bit running on Windows 7 64-bit and on Windows 8 64-bit. It works as is, without any errors.

None of the three API functions in the AvailablePrinters code are listed in the API Declarations article or in the list of 64-bit API functions that it refers to (http://msdn.microsoft.com/en-us/library/aa383663%28VS.85%29.aspx).

It isn't clear what "64-bit" software you use, whether it's Windows or Office or both; exactly what function calls raised the data type mismatch errors; or what changes you made to try to fix them. "It doesn't work" is not enough information to go on. If you post more specifics, maybe we can get the problem sorted.