I want to control a scanner via VBA. For this purpose I am trying to implement WIA.

The user may have several scanners connected to her machine. I do not want to ask her to select the scanner for each scan, but rather to select a scanner once and store its DeviceId in my program's preferences. Then each time she will activate a scan through my program, the program will select the scanner based on this stored DeviceId.

I looked though the documentation and through the examples but didn't manage to find a way to do this so far.

I am thinking I can use the DeviceManager1.DeviceInfos collection to get device names and Ids in order to allow the user to select the right one to store in the preferences.

But how then to get the device object to reference this scanner based in its Id?

So my questions:
How can I return a deviceId from a selected scanner?
How can I operate a scanner based on this deviceID to retreive an image (may be multiple pages).

I will then use the ImageFile's SaveFile method in order to save this file appropriatly.

Thanks greatly