How to Implement Modbus TCP Protocol Using VBA with Excel

Thanks Garry, I Have tried reinstalling as well as trying to register the dll / osx components and the regsvr32 gives me errors when trying. i also tried soem reboots and repairing office install.



I Will give nodeRed a try, i was honestly planning some python scripting to accomplish this until i came across your VBA post and figured it may be simple to implement but it has proven not to on this computer (Not your fault)/



I Was also just taking a look while i was commissioning IO, as they were very slow but it Isnt an urgent matter. Startup is tomorrow, gotta do some networking yet so ill probably do that next then try nodeRed. Just figured it would be nice to Have the Runsheet auto-populate the values that we have Transmitters for (little one off site) Thanks again for the response.
 
wsTCP_OnDataArrival: how is it triggered

Hi,
I am trying to learn about Modbus TCP. The example is very helpful, thanks Garry!
One question: The Private sub wsTCP_OnDataArrival, where and how does it get triggered? I haven't found it yet, must be looking in the wrong place!?
Cheers
 
Last edited:
Thanks Garry, I see. (You can tell, that is all very new to me).


It's strange though, when I have the Dim WithEvents in Excel, all is well, in MS Access it's not valid. Does that mean it cannot run in MS Access VBA?
 
Hi Gary,

I am trying to run the same PLC code and the same VBA that you posted. I am getting this error. I have downloaded OSWinsock, and also added it as a Reference in the VB editor.

Error -2147221164: Class not registered
 
I would try to install the Ostosoft Winsock component again.
http://ostrosoft.com/oswinsck.aspx
If this does not work, you may have to register the component. This is a 32-bit component.
http://www.ctimls.com/Support/KB/How...gister_dll.htm
I hope this helps you out.

Keep in mind that this post was written several years ago. I will only use this method if you want to view data occasionally. A simpler method would be to use Node-RED with Modbus and SQLite database. Excel can then read the SQL database using ODBC.
https://accautomation.ca/series/node...ling-software/

Regards,
 

Similar Topics

Hi, We are doing the project on PLC-DCS interfacing. The main problem in this project is the protocol mismatch. We are using Messung's Xmp8-20 PLC...
Replies
1
Views
9,922
Guest
G
like using modscan we can use it as modbus master can we use it as slave????/ or is there any other sofware where we can send query through...
Replies
2
Views
6,745
Let's say I have an inverter fed three phase induction motor drive where in the braking phase (when the motor operates in a generator mode) the...
Replies
2
Views
124
I want to improve a semi custom product I am delivering to a customer with implementation of safety relays. The system is fairly simple with just...
Replies
5
Views
543
I'm struggling to implement the test case which is highlighted. What ends up happening is the servo starts when I turn the cycle on, but it...
Replies
3
Views
1,046
Back
Top Bottom