Chuck Woodbury
Lifetime Supporting Member
I have a UDT with 166 Members,part of which has the 40P module definition. As part of the upgrade from a PowerFlex 40P to a PowerFlex 525, this tag gets deleted and recreated with the new datatype with the 525 module definition embedded. Uploading the data to excel is simple using the DDE Link available on the RSLinx OEM or Gateway. What is shown below is the vba code to use a command button to POKE that data back to the new tag.
I have set up my spreadsheet with all of the data for every VFD in the plant. All we have to do is enter the motor number in the cell and all of the Tags on Sheet 2 are changed and the data is populated using the VLookup from Sheet 1.
Push the CommandButton21 labeled "POKE" and it runs and populates the tag with that data. With over a thousand VFD's to upgrade, this cuts out any chance for fat fingering the data and reduces the amount of time it takes to upgrade a VFD.
Sorry about the way it copied to here but all of the REM statements begin '
Private Sub CommandButton21_Click()
'Set up Counter for the For/Next Loop
Dim LCounter As Integer
'Open the DDE Channel to the ControlLogix Processor via RSLinx
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="Trainer_Room")
'Begin For Next where the Tags begin at row 3 and end at row 168
For LCounter = 3 To 168
'Define the Tag as a DDEItem and where it is located so the first tag is at Cells(Row3(variable LCounter), ColumnC(3))
DDEItem = Cells(LCounter, 3).Value
'Set the RangeToPoke where the data has to be converted to a range and the cell the data is in is the variable row LCounter column H (8)
Set RangeToPoke = Worksheets("Sheet2").Range(Cells(LCounter, 8), Cells(LCounter, 8))
'Poke the Data from Range to Poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
'Step the counter and do it again
Next LCounter
'When the Counter finishes (168) terminate the DDE Connection
Application.DDETerminate DDEChannel
End Sub
I have set up my spreadsheet with all of the data for every VFD in the plant. All we have to do is enter the motor number in the cell and all of the Tags on Sheet 2 are changed and the data is populated using the VLookup from Sheet 1.
Push the CommandButton21 labeled "POKE" and it runs and populates the tag with that data. With over a thousand VFD's to upgrade, this cuts out any chance for fat fingering the data and reduces the amount of time it takes to upgrade a VFD.
Sorry about the way it copied to here but all of the REM statements begin '
Private Sub CommandButton21_Click()
'Set up Counter for the For/Next Loop
Dim LCounter As Integer
'Open the DDE Channel to the ControlLogix Processor via RSLinx
DDEChannel = Application.DDEInitiate(app:="RSLinx", topic:="Trainer_Room")
'Begin For Next where the Tags begin at row 3 and end at row 168
For LCounter = 3 To 168
'Define the Tag as a DDEItem and where it is located so the first tag is at Cells(Row3(variable LCounter), ColumnC(3))
DDEItem = Cells(LCounter, 3).Value
'Set the RangeToPoke where the data has to be converted to a range and the cell the data is in is the variable row LCounter column H (8)
Set RangeToPoke = Worksheets("Sheet2").Range(Cells(LCounter, 8), Cells(LCounter, 8))
'Poke the Data from Range to Poke
Application.DDEPoke DDEChannel, DDEItem, RangeToPoke
'Step the counter and do it again
Next LCounter
'When the Counter finishes (168) terminate the DDE Connection
Application.DDETerminate DDEChannel
End Sub