WIA usage with MS Access

Deon Olivier 1 Reputation point

I have the following code:

Do While blnContScan = True
    DPI = 200
    PP = 1 'No of pages
    Set Scanner = Dialog1.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, False, False)
    With Scanner.Items(1)
        .Properties("6146").Value = 1 'Colour intent (1 for color, 2 for grayscale, 4 for b & w)
        .Properties("6147").Value = DPI 'DPI horizontal
        .Properties("6148").Value = DPI 'DPI vertical
        .Properties("6149").Value = 0 'x point to start scan
        .Properties("6150").Value = 0 'y point to start scan
        .Properties("6151").Value = 8.27 * DPI 'Horizontal extent
        .Properties("6152").Value = 11.69 * DPI     'Vertical extent for letter
    End With
    Set img = Dialog1.ShowTransfer(Scanner.Items(1), wiaFormatJPEG, True)

My issue is with the last line. As this code executes in a loop, each time that the last line is executed, it prompts the user to choose between the 4 scanners loaded.
Can I put this line somewhere else so that it is executed only once and the program remembers the selection?
If only 1 scanner is available to choose, the user is not prompt again.

The above loop only executes if there is multiple pages in the ADF.

Much appreciated

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,584 questions
0 comments No comments
{count} votes