通过VBA DDEPoke将string数据导入到ControlLogix PLC中

我正在使用一个实用程序更新ControlLogix处理器中的某些function标记值。 标签是控制器范围,我目前有程序在本地运行在模拟器上。 目标是将某些信息从Excel表格的一列转移到相邻列中指定的标签,以获得两条信息,一条是DINT,另一条是STRING。

我的VBA代码触发button点击成功:

Sub CreateTags() Dim rslinx As Long Dim messageid As String Dim Message As String Dim severityid As String Dim severity As Long Dim channel As String rslinx = DDEInitiate("RSLinx", "TestAE2") channel = CStr(rslinx) 'Check if the connection was made If Err.Number <> 0 Then MsgBox "Error Connecting to topic" + channel, vbExclamation, "Error" rslinx = 0 'return false value for bad conn End If If Err.Number = 0 Then MsgBox "RSLinx Connection Established. Channel is " + channel, vbDialog, "Success!" End If For i = 0 To 550 On Error Resume Next messageid = Sheet3.Cells(6 + i, 7) severityid = Sheet3.Cells(6 + i, 8) Message = Sheet3.Cells(6 + i, 3) severity = Sheet3.Cells(6 + i, 2) Sheet3.Cells(2, 1) = severity Sheet3.Cells(2, 2) = Message DDEPoke rslinx, messageid, Message DDEPoke rslinx, severityid, severity Next i End Sub 

这个程序运行没有任何问题,并注意到成功的连接对话框出现,并正确显示通道。

我想知道这是否可能是一个不兼容的数据types的问题(因此使用顶部的types声明)。

我是VBA和ControlLogix处理器的新手。