alihussain
New member
- Local time
- Today, 05:37
- Joined
- Jul 1, 2020
- Messages
- 19
Hi All
how to modify this code to scan from a feeder, scan multiple documents, and convert jpg to pdf?
Any assistance you can give would be GREATLY appreciated.
how to modify this code to scan from a feeder, scan multiple documents, and convert jpg to pdf?
Any assistance you can give would be GREATLY appreciated.
Code:
Option Compare Database
Public PathOfFile As String
Private Const WIA_Format_JPEG As String = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}"
Public Function MyScan()
On Error Resume Next
Dim ComDialog As WIA.CommonDialog
Dim DevMgr As WIA.DeviceManager
Dim DevInfo As WIA.DeviceInfo
Dim dev As WIA.Device
Dim img As WIA.ImageFile
Dim i As Integer
Dim wiaScanner As WIA.Device
Dim PicFullName
Dim PicAdd1 As Integer
If Len(Dir(PathOfFile & Forms![Form1]![IDD], vbDirectory)) = 0 Then
MkDir PathOfFile & Forms![Form1]![IDD]
End If
PicFullName = PathOfFile & Forms![Form1]![IDD] & "\" & Forms![Form1]![IDD] & "-" & Format(Now, "dd-mm-yyyy_hh-nn-ss") & ".jpg"
Set ComDialog = New WIA.CommonDialog
Set wiaScanner = ComDialog.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, False, True)
Set DevMgr = New WIA.DeviceManager
For i = 1 To DevMgr.DeviceInfos().Count
If DevMgr.DeviceInfos(i).DeviceID = wiaScanner.DeviceID Then
Set DevInfo = DevMgr.DeviceInfos(i)
End If
Next i
Set dev = DevInfo.Connect
Set img = dev.Items(1).Transfer(WIA_Format_JPEG)
img.SaveFile PicFullName
Set img = Nothing
Set dev = Nothing