UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Question about Twain Scanner, Any Version    
 
   
alorenzini
post Mar 23 2018, 12:16 PM
Post#1



Posts: 791
Joined: 21-September 07
From: South Dakota


NOTE: This question was originally posted as a reply to this discussion from 2005.

I know this is old but I downloaded the class clsTwain but how do I get it to work?

--------------------
Thanks

Art Lorenzini
Sioux Falls, SD
Go to the top of the page
 
EspressoWillie
post Mar 23 2018, 03:08 PM
Post#2



Posts: 75
Joined: 12-March 06
From: Redmond, WA


I downloaded it and boy, it's confusing. Seems setup for another country.
I should have some code somewhere depending upon what you are trying to do.
If you could describe your project, that would be great.

--------------------
Cheers!!

Willie McClure
www.datarim.com
Talk's cheap, takes money to buy whiskey.
Go to the top of the page
 
GlenKruger
post Sep 15 2018, 02:07 PM
Post#3


Utterly Crispy UA Forum Administrator
Posts: 8,789
Joined: 29-September 01
From: Edmonton,Alberta,Canada


I was looking at it and I believe it came from a VB6 Forum possible maybe to search for VB6 Forum may lead to it.

--------------------
Human nature, it is a funny thing and the hardest thing to program to prevent.
Glen Kruger KNKConsulting
MS Access MVP 2013-2018| Wrox Techincal Contributor
Go to the top of the page
 
GlenKruger
post Sep 15 2018, 02:28 PM
Post#4


Utterly Crispy UA Forum Administrator
Posts: 8,789
Joined: 29-September 01
From: Edmonton,Alberta,Canada


This link to https://code.msdn.microsoft.com/Web-TWAIN-S...cument-259ee47c is in C# but maybe you could use it.

--------------------
Human nature, it is a funny thing and the hardest thing to program to prevent.
Glen Kruger KNKConsulting
MS Access MVP 2013-2018| Wrox Techincal Contributor
Go to the top of the page
 
cheekybuddha
post Sep 16 2018, 05:27 AM
Post#5


UtterAccess VIP
Posts: 10,342
Joined: 6-December 03
From: Telegraph Hill


Worked out of the box for me!

1. Save the class to your computer.
2. Open VBA editor
3. File -> Import File ...
4. Locate and choose saved clsTwain.cls file (It's important to do it this way rather than copy and paste the code in to a new class module)
5. Debug -> Compile
6 Create a function in a standard module:
CODE
Function TestScan() As Boolean

  Dim scanner As clsTwain, _
      strScannedFile As String, _
      iResolution As Integer, _
      blShowProgress As Boolean

  strScannedFile = "C:\Users\YOUR_USER_NAME\Desktop\test.jpg"                       ' Make sure you have a proper path here
  iResolution = 300                                                                 ' I guess this is DPI
  blShowProgress = True

  Set scanner = New clsTwain
  Scan = (scanner.ScanTwain(iResolution, RGB, strScannedFile, blShowProgress) = 0)  ' clsTwain.ScanTwain() Returns 0 for success, 1 for failure
  Set scanner = Nothing
  
End Function

7. Debug -> Compile
8. In the Immediate Window (Ctrl+G):
CODE
?TestScan()

Will return True for success / False for failure

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
GlenKruger
post Sep 16 2018, 11:25 PM
Post#6


Utterly Crispy UA Forum Administrator
Posts: 8,789
Joined: 29-September 01
From: Edmonton,Alberta,Canada


thanks.gif David for clearing this up.

--------------------
Human nature, it is a funny thing and the hardest thing to program to prevent.
Glen Kruger KNKConsulting
MS Access MVP 2013-2018| Wrox Techincal Contributor
Go to the top of the page
 
cheekybuddha
post Sep 17 2018, 07:47 AM
Post#7


UtterAccess VIP
Posts: 10,342
Joined: 6-December 03
From: Telegraph Hill


No problem, Glen!

I don't know whether Art is still following this thread, or whether he is still interested, but hopefully it will help others happening upon it. thumbup.gif

d

--------------------


Regards,

David Marten
Go to the top of the page
 
shadow
post Sep 17 2018, 08:57 PM
Post#8



Posts: 250
Joined: 19-April 04
From: Toronto


Well, I've tried the sample and it works great! I put it in my folder with samples that I might want to use one day.

For the past 6 years I've been scanning documents into Access using WIA rather than TWAIN. I use late binding so I don't need to set a reference. I've been reading up on the pros and cons of WIA vs TWAIN and it seems there is not necessarily a "better" way of doing it. That said, I did put this one into my sample folder in case I decide to TWAIN rather than WIA one day.

Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd September 2018 - 03:44 PM