excel vba to plc

ali makki

Member
Join Date
May 2015
Location
michigan
Posts
6
Is there any way that I can toggle a bit from Microsoft Excel into a AB PLC processor via a RXLINX DDE server if so what is the code instuction that I have to use
 
Taken from this thread (not my own code)

http://www.plctalk.net/qanda/showthread.php?t=75889

Posted by bmacattack33

Hi,
Are you using a DDEInitiate command to open the topic on the button-click code? Here's a template of how I've always used DDEPoke:

Code:
Code:
 
Private Sub MyButton_Click()
    rslinx = OpenRSLinx()
 
    DDEPoke rslinx, "N7:0", Cells(1, 1)
 
 
End Sub
 
Private Function OpenRSLinx()
    On Error Resume Next
 
    'Open the connection to RSLinx
    OpenRSLinx = DDEInitiate("RSLINX", "My_Topic")
 
    'Check if the connection was made
    If Err.Number <> 0 Then
        MsgBox "Error Connecting to topic", vbExclamation, "Error"
        OpenRSLinx = 0 'Return false if there was an error
    End If

End Function
For your application, just replace "My_Topic" with your topic name, and "N7:0" with the PLC address you are writing to, and "Cells(1, 1)" with the Cell in your worksheet that contains the value you are wanting to load in your PLC.

If this doesn't help, or you can't get it to work, post your vba code, and a screen-shot of your topic config in RSLinx would be helpful, and hopefully I or someone else can straighten it out for you.

Cheers,
Dustin
 

Similar Topics

Hello, I am looking for help writing to PLC tags from Excel. I am using Factory Talk Gateway as an OPC server and Excel VBA to write out to an...
Replies
5
Views
3,101
Hi. I have a task of creating checklists for a plant that contain many standard items. My idea is to do this in Excel, whereby in one sheet I...
Replies
11
Views
3,312
Hello. For a PLC data logging application at a candy factory, a customer requested me to setup an add-in for MS Excel called "MX Sheet" which is...
Replies
22
Views
7,976
Good evening, I'll start by explaining what i want to do and then what I've tried. We have an excel document at work that contains our material...
Replies
4
Views
2,279
I have not been able to crack this one out, even after much thinking and googling:banghead:. I would be so grateful if I can get some guidance...
Replies
11
Views
3,678
Back
Top Bottom