DDE Write Access From Excel

Kabir

Member
Join Date
Mar 2004
Posts
107
Is there any way that I can write data from Microsoft Excel into a AB PLC processor via a RXLINX DDE server if so what is the code instuction that I have use and what are the resk that I would be taking to do that
 
I'm not an expert in this so take this for what it's worth.
I'm trying to do the same thing, without much success. However, from what I have found you need to put something like this into your VBA script:

Value = DDEInitiate("RSLinx", "Target_Topic")
DDEPoke Value, "N7:10", 100
DDETerminate Value

DDEInitiate opens communication to a DDE server and defines an indentifier (in this case Value) that other DDE instructions will use to reference the server. In this example Target_Topic is an already defined topic in RSLinx.
DDEPoke is the instruction that sends a value from Excel to the DDE server identified by Value. The format is:
DDE identifier, target address, data value
DDETerminate closes the DDE link identified by Value.

As I said I'm a bit stuck myself as I'm only getting a zero return from DDEInitiate. So I have something wrong. But with any luck this will give you a start.

Keith
 
Hey guys. you can download my logger sheet here:
Click on MACROS, VB EDITOR to see the source code.
http://forum.mrplc.com/index.php?act=Downloads&CODE=02&id=134

Basically you can do it two ways:



Hot link or Cold Link

COLD LINK: Opens and Closes the channel

'opens a COLD DDE link
RSIchan = DDEInitiate("RSLinx", "YOUR TOPIC")

'assign PLC bit values to VB variant varibles
varLogging = DDERequest(RSIchan, "B3/163")
varCycle = DDERequest(RSIchan, "B3/161")

'close COLD DDE link
DDETerminate (RSIchan)

HOT LINK:
enter a forumla in a cell like so:
=RSLINX|'YOUR TOPIC'!'B3/161'
 
Sometimes I can be so DENSE!!!

Chako-
Thanks for the info but I think Kabir wants to go the other way using DDEPoke. I know I do.
I've done some searching on the web for DDEPoke examples but I never thought to look here! šŸ™ƒ
This thread will be very informative. Notice that the DDEPoke example gets the data from a cell. I was trying to send raw data entered as part of the DDEPoke instruction. That just never seemed to get through.

Keith
 
Ah...your right. He wants to WRITE from EXCEL to the PLC.

Not from PLC to EXCEL...

I did this TWICE. I actually wrote an HMI screen using EXCEL. I will look for my EXCEL HMI example I did a while back. I had some manual buttons on the spread sheet to toggle a B bit in the PLC. It was pretty crazy, I wouldn't recommend it unless you have nothing better to do... LOL....
 
Just an update...

I have my DDEPoke working. The trick was the cell reference for the data. And I learned a couple of things along the way.

The VBA code I used is similar to this:

Value = DDEInitiate("RSLinx", "Target_Topic")
DDEPoke Value, "N7:10", Cells(1,1)
DDETerminate Value

The example assumes a PLC5 or SLC. If you are using CLX or one of the other Logix processors just substitute the required tag name for N7:10.

Not all the data reference tools that work in VBA will get the correct data to the plc. I tried the above example using [A1].Value in place of Cells(1,1) and it didn't work.
Also, I read quite a few places that a DDEInitiate return value of 0 is not a valid channel identifier. From what I can see this is NOT true. My application is currently working correctly using only a channel identifier of 0 (since I terminate the connection after every write).

Keith
 

Similar Topics

I'm a fairly experienced DDE user, and use Excel spreadsheets to manage recipe variables on my machines. I have no problems reading an empty...
Replies
7
Views
3,239
I am sure there are people out there who use Excel to transfer data to and from a ControlLogix using DDE via custom VBA code. For those of you...
Replies
2
Views
5,006
Hi All Can anyone show me a code snippet in v.b. using DDE that can read tags from rslinx? Thanks
Replies
1
Views
3,737
I need to support some old data collection that is running on Excel, but I need to get it running on LibreOffice. The following statement works...
Replies
0
Views
85
Hey Friends. I am currently trying to write approximately 700 tags from FtView13 to an Logix Emulate 5000. I am using rslinx DDE/OPC to create an...
Replies
0
Views
395
Back
Top Bottom