fearmichaele
Registered User.
- Local time
- Today, 17:17
- Joined
- Jan 14, 2014
- Messages
- 34
I am working on a project which will eliminate several steps of the user to scan a document using a 3rd party software, manually naming the document using a predetermined naming convention, and placing it in a predermined folder.
i have successfully used a VBA scanner code from an earlier post that allows the user to scan, name and place in the folder without using 3rd party software. My issue i can not figure out is how to change the paper size. The scanner i am using is a fujitsu WIA compatable scanner. it is defaulting to 8.5 X 14 paper. i need it to default 8.5 X 11 paper. when i use the WIA interface on windows it defaults to LETTER but when i use it in VBA I get LEGAL size.
I have emailed the scanner company tech support for help but they have yet to respond.
here is my current code
Is there anyone out there who has solved a problem like this?
i have successfully used a VBA scanner code from an earlier post that allows the user to scan, name and place in the folder without using 3rd party software. My issue i can not figure out is how to change the paper size. The scanner i am using is a fujitsu WIA compatable scanner. it is defaulting to 8.5 X 14 paper. i need it to default 8.5 X 11 paper. when i use the WIA interface on windows it defaults to LETTER but when i use it in VBA I get LEGAL size.
I have emailed the scanner company tech support for help but they have yet to respond.
here is my current code
Code:
Private Sub Command77_Click()
'returned rx, scan and complete
Dim authnum As String
verifymsg = "You are scanning a prescription for " me.persons name & " Is this correct?"
response = MsgBox(verifymsg, vbYesNo, "Please verify Name")
If response = vbNo Then
GoTo skipscan
Else
msg = "Place document for " & me.persons name & " in scanner and press OK to proceed"
MsgBox (msg)
authnum = Mid$([auth number], 2, 7)
rxname = me.persons name & authnum & ".tif"
End If
On Error GoTo Errhand
Const wiaFormatBMP = "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}"
Const wiaFormatPNG = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}"
Const wiaFormatGIF = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}"
Const wiaFormatJPEG = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}"
Const wiaFormatTIFF = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}"
Const wia_ips_page_width = 8500
Const wia_ips_page_height = 11000
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
Set ComDialog = New WIA.CommonDialog
Set wiaScanner = ComDialog.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, False, False)
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
scanitem:
Set img = dev.Items(1).Transfer(wiaFormatTIFF)
img.SaveFile "\\filepath name where i store the documents" & rxname
Set img = Nothing
Set dev = Nothing
Set DevInfo = Nothing
Set DevMgr = Nothing
Set ComDialog = Nothing
GoTo finish
Errhand:
msg2 = "No Rx detected in scanner. Please place Rx in scanner to proceed"
MsgBox (msg2)
GoTo scanitem
skipscan:
GoTo finish
Finish:
end sub
[CODE]
this works but only scans 8.5 X 14 in paper and outputs 8.5 X 14 . I dont want the user to have to choose the paper size each time because that is what they are doing using the 3rd party software and I need to increase their effiecency by providing them a mechanism to use the database form they are constantly in and scan for them.
i have search all the other forums till my eyes are crossed (literally)
i have tried adding this code to my routine but get run time error 91.
[CODE]
With wiaScanner.Items(1)
.Properties("6151").Value = 2550
.Properties("6152").Value = 3300
End With
Is there anyone out there who has solved a problem like this?