title: Import string data into ControlLogix PLCs via VBA DDEPoke
body: <p>I'm working on a utility to update certain functional tag values in a ControlLogix processor. The tags are controller scope and I currently have the program running on an emulator locally. The goal is to transfer certain information from one column of the Excel table to a tag named in an adjacent column for two pieces of information, one a DINT and one a STRING. </p>
  
  <p>My VBA code triggers successfully off of a button click: </p>
  
  <pre><code>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 &lt;&gt; 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
  </code></pre>
  
  <p>This program runs without any issues and the dialog box to note the successful connection appears and displays the channel properly. </p>
  
  <p>I'm wondering if this might be a matter of incompatible datatypes (Hence the use of the type declarations at the top.) </p>
  
  <p>I'm new to both VBA and ControlLogix processors.</p>