Auto select which scanner for WIA in VBA

wackywoo105

Registered User.
Local time
Yesterday, 22:39
Joined
Mar 14, 2014
Messages
203
I recently figured out how to select and manipulate a printer in VBA.

I have 2 printer/scanners installed. I would just like to use one to scan. Whenever I try to scan using WIA a dialog box pops up asking which scanner to use.

Is there a way I can select the one I want to use automatically or specify it prior to being asked?
 
you are using building library that as it's on dialog so no properties in the code
try making the scanner the default in windows
 
I still haven't found a solution to this. It occurs with the following line of code:

Code:
Set wiaScanner = wiaDialog.ShowSelectDevice

2016-10-07_zps2mib5u2g.png


I can't even use sendkeys as vba stops while it waits for you to choose.

When I only had one scanner installed it never showed the dialog.
 
Last edited:
I have managed to obtain the device ID's. I just need a way to modify so the scanner is selected automatically e.g.

Code:
Set wiaScanner.DeviceID = "#############"

However it errors as it is a read only property.
 
Last edited:
Ok I can create a vbs script and use shell to run it just before the:

Code:
Set wiaScanner = wiaDialog.ShowSelectDevice

So I can use sendkeys. However is there a more elegant way?
 

Users who are viewing this thread

Back
Top Bottom