I/O Handling and VBA

All your computer hardware and software questions in here please.

Moderator: Moderators

Post Reply
IDontBelieveIt
Senior Member
Posts: 2039
Joined: Tue Jul 29, 2008 5:11 pm
Location: North Hampshire
Has thanked: 0
Been thanked: 1 time

I/O Handling and VBA

Post by IDontBelieveIt »

Does anyone here know how to set about I/O handling within VBA (Excel in particular)?

In the old days you had to compile handlers or write handler in assembler and merge the .OBJ file but wandering if it is possible to handle directly these days.

What want to do is to use a Bar Code hand scanner plugged into one of the USB ports and read the ASCII string that they sends up directly into a VBA application.

Cheers
Old Gits Know Best ... I think
User avatar
Hoovie
Borders Bodger
Posts: 8168
Joined: Fri Jul 27, 2007 6:06 pm
Location: Scottish Borders & East Devon
Has thanked: 0
Been thanked: 4 times

Post by Hoovie »

like you said, in the olden days (Before Windows), you would use something like MASM to write a routine to read the data directly from the IO Port.

I would guess (and it is a guess) that you need to speak to the device driver rather then the device or port itself - maybe by finding the PID (that could be visible in the Device Manager or probably more easily in the .inf file) and referencing that.

I dusted off my Visual Basic 4 book and looked at the index - no entries for hardware, drivers or even I/O except for user I/O (keyboard/display!).

personally not done any machine code writing since 1984 (diagnostic noddy apps for Prime Computer bench repairs :roll: - any use? :lol: )
I went to a bookstore and asked the saleswoman, "Where's the self-help section?"
She said if she told me, it would defeat the purpose.
IDontBelieveIt
Senior Member
Posts: 2039
Joined: Tue Jul 29, 2008 5:11 pm
Location: North Hampshire
Has thanked: 0
Been thanked: 1 time

Post by IDontBelieveIt »

Thanks for that Hoovie, I rather suspected what you have said (sadly).

Indeed it may not be possible at all other than compiling the application, if so I wont bother. :cb

I remember Prime Computers (and a host of others). Well at least I have been writing in assembler more recently than you, last time I think was around 1995. I hated the old 'heap memory' management side of 86 coding love normal linear machines.

I will continue to explore, thanks again Hoovie...
Old Gits Know Best ... I think
IDontBelieveIt
Senior Member
Posts: 2039
Joined: Tue Jul 29, 2008 5:11 pm
Location: North Hampshire
Has thanked: 0
Been thanked: 1 time

Post by IDontBelieveIt »

Ah!! Just had a thought, you inspired me Hoovie (a wee dram also assisted).

I have just recalled that you can run other application programs for within VBA (did in back in 1997). The only 'problem' back in those days was to pass information between the other program and VBA.

So what I did was to do it using files. Within VBA I would search the entire system disc for a specific file and if I found it deleted it - all easy with VBA. I would then pass control from VBA to another applications and this application would, just before it closed would write the file previously cleared the I would extract information from within VBA again straightforward.

And so if I get a bar code hand scanner that writes a file, rather than send up an ascii string using a supplied utility then Bob's your Uncle I will use the same technique. Eureka !!

Thanks again Hoovie you have pushed me in the right (I hope) direction.
Old Gits Know Best ... I think
User avatar
Hoovie
Borders Bodger
Posts: 8168
Joined: Fri Jul 27, 2007 6:06 pm
Location: Scottish Borders & East Devon
Has thanked: 0
Been thanked: 4 times

Post by Hoovie »

yup - that would probably work (I recall using that kind of technique for making interactive DOS batch files and Basic/QBasic)

could be interested in the future in getting this routine from you (always fanced making a Library DB using a barcode scanner to read the ISBN code)
I went to a bookstore and asked the saleswoman, "Where's the self-help section?"
She said if she told me, it would defeat the purpose.
IDontBelieveIt
Senior Member
Posts: 2039
Joined: Tue Jul 29, 2008 5:11 pm
Location: North Hampshire
Has thanked: 0
Been thanked: 1 time

Post by IDontBelieveIt »

Will do Hoovie, it may be a while as it is a background task at work. I have the Wasp bar code generating software and a bar code reader but its not a stand-alone hand held unit so need to order one - which will be a task in itself - to find one that does as I described above that is, bound to exist.

Regards
Old Gits Know Best ... I think
kenjewell
Newly registered Member
Posts: 24
Joined: Tue Sep 30, 2008 10:53 am
Has thanked: 0
Been thanked: 0

Post by kenjewell »

IDontBelieveIt wrote:Will do Hoovie, it may be a while as it is a background task at work. I have the Wasp bar code generating software and a bar code reader but its not a stand-alone hand held unit so need to order one - which will be a task in itself - to find one that does as I described above that is, bound to exist.

Regards
Did you ever sort this out?

I had similar task using VB6 a couple of years ago, where I needed to use the parallel IO port for input capture. I ended up writing a DLL in VC++ for VB to access the port as a module.

Just a thought but maybe the barcode scanner has an API that can be used for further development into other applications then you could easily access it from VB or VBA?

It's worth checking with the manufacturer.

Regards,
KJ
Post Reply

Return to “Computers”