VB6 WIA Scanner Interface Problem With Document Feeder

Hi,

I have an interface that I had written in VB6 for HP Scanjet 6300 with auto document feeder.   The code scans the first page OK but then generates an error when it is suppose to load the next page.

The error I get is "438 Object doesn't support this property or method"  and this is the line that causes it:

NextNextWiaImg = WiaObj.ShowTransfer(itm)


Here is the rest of the code:



Private Sub cmdScan_Click()
Dim WiaObj As New WIA.CommonDialog
Dim WiaItm As WIA.Item
Dim WiaImg As New WIA.ImageFile
Dim wiadev As WIA.Device

If wiadev Is Nothing Then
' WiaDev is defined globally
Set wiadev = WiaObj.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, True, False)
End If

Dim itm As WIA.Item
Dim ItmProp As WIA.Property
For Each itm In wiadev.Items
For Each ItmProp In itm.Properties
Select Case ItmProp.PropertyID
Case 6147:   ' Horizontal Resolution
            ItmProp.Value = 150
Case 6148:   ' Vertical Resolution
            ItmProp.Value = 150
Case 6151:   ' Horizontal Extent (Scanning Area)
            ItmProp.Value = 1275
Case 6152:   ' Vertical Extent (Scanning Area)
            ItmProp.Value = 550
Case 6149:   ' Horizontal Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6150:   ' Vertical Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6146:   ' Current Intent
            ItmProp.Value = 4
            ' Text or Line Art
End Select
NextNextWiaImg = WiaObj.ShowTransfer(itm)
Next
Next
lnwrightAsked:
Who is Participating?
 
junglerover77Commented:
It's obvious that the following statement

NextNextWiaImg = WiaObj.ShowTransfer(itm)

should be outside the inner loop. Just change your code like:

Private Sub cmdScan_Click()
Dim WiaObj As New WIA.CommonDialog
Dim WiaItm As WIA.Item
Dim WiaImg As New WIA.ImageFile
Dim wiadev As WIA.Device

If wiadev Is Nothing Then
' WiaDev is defined globally
Set wiadev = WiaObj.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, True, False)
End If

Dim itm As WIA.Item
Dim ItmProp As WIA.Property
For Each itm In wiadev.Items
For Each ItmProp In itm.Properties
Select Case ItmProp.PropertyID
Case 6147:   ' Horizontal Resolution
            ItmProp.Value = 150
Case 6148:   ' Vertical Resolution
            ItmProp.Value = 150
Case 6151:   ' Horizontal Extent (Scanning Area)
            ItmProp.Value = 1275
Case 6152:   ' Vertical Extent (Scanning Area)
            ItmProp.Value = 550
Case 6149:   ' Horizontal Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6150:   ' Vertical Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6146:   ' Current Intent
            ItmProp.Value = 4
            ' Text or Line Art
End Select
Next
NextNextWiaImg = WiaObj.ShowTransfer(itm)   'Move it outside the inner Loop!
Next

Regards,
Jungle
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.