MKEngineer
Member
Need more info on how you succeeded
What version of Windows do you have? Win7? XP? Is it 32bit or 64bit?
What version of RSLinx are you using? Which version of RSLogix5000?
Thanks for the tips guys!
As it turns out, the DDE option is ridiculously easy. With the help of this article I got it working in no time!
For anyone following along in the future, here's my code structure. My DDE topic was called EXCEL, and the data was in columns A through F, starting at Row 2.
Code:Private Function OpenRSLinx() On Error Resume Next 'Open the connection to RSLinx OpenRSLinx = DDEInitiate("RSLINX", "EXCEL") '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 Private Sub CommandButton1_Click() On Error GoTo ErrorHandling rslinx = OpenRSLinx() 'Open connection to RSlinx 'Loop through the cells and write values to the array tags For i = 0 To 299 DDEPoke rslinx, "Recipe_DB[" & i & "].ID", Cells(2 + i, 1) DDEPoke rslinx, "Recipe_DB[" & i & "].Name", Cells(2 + i, 2) DDEPoke rslinx, "Recipe_DB[" & i & "].Qty1", Cells(2 + i, 3) DDEPoke rslinx, "Recipe_DB[" & i & "].Tol1", Cells(2 + i, 4) DDEPoke rslinx, "Recipe_DB[" & i & "].Qty2", Cells(2 + i, 5) DDEPoke rslinx, "Recipe_DB[" & i & "].Tol2", Cells(2 + i, 6) Next i 'Terminate the DDE connection DDETerminate rslinx Exit Sub ErrorHandling: MsgBox "Error Writing Data", vbExclamation, "Error" DDETerminate rslinx End Sub
Thanks!
What version of Windows do you have? Win7? XP? Is it 32bit or 64bit?
What version of RSLinx are you using? Which version of RSLogix5000?