Chuck Woodbury
Lifetime Supporting Member
I am trying to poke data from excel into an array in ControlLogix.
From Rockwell's Knowledgebase I found code to do individual cells and an array with 10 columns. I need one column.
In the following code command button 1 works fine, command button 2 does not. I get no errors running the VB.
Anyone have any suggestions? Thank you.
Private Sub CommandButton1_Click()
Call DDE_Write_RSLinx
End Sub
Sub DDE_Write_RSLinx()
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="Home")
DDEItem = "TABLE_BRIX[0]"
Set RangeToPoke = ActiveCell
'Set RangeToPoke = ActiveCell 'Replace above line of code w/ this one to be able to highlight the cell w/ the value to poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
Application.DDETerminate DDEChannel
End Sub
Private Sub CommandButton2_Click()
Call DDE_Write_RSLinx1
End Sub
Sub DDE_Write_RSLinx1()
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="Home")
DDEItem = "TABLE_BRIX[0,800],L801,C1"
Set RangeToPoke = Worksheets("BRIX").Range("A1:A801")
'Set RangeToPoke = ActiveCell 'Replace above line of code w/ this one to be able to highlight the cell w/ the value to poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
Application.DDETerminate DDEChannel
End Sub
From Rockwell's Knowledgebase I found code to do individual cells and an array with 10 columns. I need one column.
In the following code command button 1 works fine, command button 2 does not. I get no errors running the VB.
Anyone have any suggestions? Thank you.
Private Sub CommandButton1_Click()
Call DDE_Write_RSLinx
End Sub
Sub DDE_Write_RSLinx()
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="Home")
DDEItem = "TABLE_BRIX[0]"
Set RangeToPoke = ActiveCell
'Set RangeToPoke = ActiveCell 'Replace above line of code w/ this one to be able to highlight the cell w/ the value to poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
Application.DDETerminate DDEChannel
End Sub
Private Sub CommandButton2_Click()
Call DDE_Write_RSLinx1
End Sub
Sub DDE_Write_RSLinx1()
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="Home")
DDEItem = "TABLE_BRIX[0,800],L801,C1"
Set RangeToPoke = Worksheets("BRIX").Range("A1:A801")
'Set RangeToPoke = ActiveCell 'Replace above line of code w/ this one to be able to highlight the cell w/ the value to poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
Application.DDETerminate DDEChannel
End Sub