Comm32 Logo
Home Button   

Topic:   How do I use this with Excel VBA

By: David Posted on: Jul 16 2019 at 07:27:40 AM
The set up information shows how to set up in VB6 but how does it work with VBA?

By: GuestPosted on: Jul 17 2019 at 11:27:02 AM
Use the forum search. There's a few pages about it. Here's one

Using SComm32 OCX in Office/MSAccess 365 (Access 2016)

By: Mike CilPosted on: May 8 2020 at 02:48:22 PM
I purchased an SComm32 license, which solved numerous problems in VBA, however, being that I am very new to this, I noticed the examples in communicating in Access VBA seem to be written in a C# format that is not easily converted to Excel VBA. Would anyone be so kind to share an example of the same thing in Excel, and I might be able to modify it to my program.
Also, I would like to send commands and receive the results from a scale over the 232 serial port, every 2 or 3 seconds. I don't seem to be able to do this with the typical "OnTime Now()+TimeValue("00:00:02")timer. I get an error that states " Can't execute code in break mode"
Ant guidance would be greatly appreciated.

By: SupportPosted on: May 10 2020 at 06:16:21 AM
Sorry. I don't understand your comment about C# code. That Access2016 sample is just VBA. Read the ReadMe file and it explains that there's two sample projects.

One of the sample projects has the SComm32 component on the form. This is the easiest way. Just drop the component on a form and use it almost like you would in standard VB6.

The other sample project declares the object in code. Maybe that 'CreateObject' syntax is unfamiliar - it's still standard VBA code though. Not C#


By: SupportPosted on: May 10 2020 at 06:22:59 AM
Your second question about using Excel's "OnTime" function. Now that's an excel problem - not an SComm32 problem. So excuse me if I'm not 100% about it. But I was curious so I setup a simple project and created a little clock display that ticks every second. Just took a screen grab off my desktop.

Top left corner is the form. Two buttons. Command1 (Start) and Command2 (Stop)
Below that is the code for the two button click events.
To the right is the code for Sheet1.

It's really very simple.


By: SupportPosted on: May 10 2020 at 06:26:20 AM
... and I suppose in that Tick_Event() you could write any code you wanted that read/writes data to/from UserForm1.Comm1