K
K
KTG2016-10-19 11:28:39
Automation
KTG, 2016-10-19 11:28:39

How to scan to MFP from tray via WIA (VBA)?

Sub scan()
    Dim objCommonDialog As WIA.CommonDialog
    Dim objImage As WIA.ImageFile
    
        Dim dev As Device
        Dim itm As Item
        Dim dm As DeviceManager

     Set objCommonDialog = New WIA.CommonDialog
     Set dm = New WIA.DeviceManager
      
        Set dev = objCommonDialog.ShowSelectDevice(ScannerDeviceType, False, False)
        Set dev = dm.DeviceInfos(objCommonDialog.ShowSelectDevice.DeviceID).Connect
        Set itm = dev.GetItem(dev.Items(1).ItemID)
        Set objImage = objCommonDialog.ShowTransfer(itm)
            If Not objImage Is Nothing Then
                objImage.SaveFile "c:\test\" & ActiveCell.Value & ".TIF"
                Set objImage = Nothing
            End If
     Set objCommonDialog = Nothing
     
End Sub

I can not understand 2 things:
How to specify in the "no-dialogue" scanning that documents should be taken from the tray, and not from the tablet.
And do I understand correctly that Vector in WIA is responsible for scanning several papers into a multi-page file, for example, in TIF?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
KTG, 2016-11-29
@KTG

разобрался.
"objDev.Properties("Document Handling Select").Value = 1"
Полностью код в комментариях к вопросу
WIA ошибка при установке параметра PAGES (VBA). Почему?

N
Nikalay Gromihaylo, 2016-10-27
@theendcomplete

Is it important to do this through VBA?
For such a task, many years ago I created a batch file
set Path=\\Server666\PASSPORTS\%date%
set Temp=c:\TMP6
md %Temp%
md %Path%
"C:\Program Files (x86)\IrfanView\i_view32. exe" /scanhidden /convert=%Temp%\001.gif
copy %Temp%\001.gif %Path%\%random%.gif
del %Temp%\001.gif /Q /F
scans through irfanview, scan settings are set there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question