Specifications
RSLinx – Training Guide A - 13
Example:
1. In RSLinx, configure an topic called "MyAlias". Within the alias configure
topics, configure topics "Topic1" through "Topic4". In Microsoft Excel, enter the
following formula:
=RSLinx|'MyAlias'!'Activetopic'
2. In order to control which topic is active, enter the following code into the
Microsoft VBA editor:
Public Sub SetMyActiveTopic()
'Dim variables for DDE channel and Active Topic
Dim usrChan As Long
Dim usrActiveTopic As String
'Open a channel to RSLinx
usrChan = DDEInitiate("RSLinx", "System")
'Open an input box to allow the operator to enter the desired topic
usrActiveTopic = InputBox("Enter Active Topic: ", "Topic Selection")
'Set the active topic based on the input box
Application.DDEExecute usrChan, "[Set_Alias(MyAlias," &
usrActiveTopic & ")]"
'Close the channel
Application.DDETerminate usrChan
End Sub
3. Finally, create a DDE link in one of Microsoft Excel's cells.
=RSLinx|'MyAlias'!'address'
where 'address' is a valid address in the PLC. Now run the VBA script from the
VBA editor. When the input box appears, enter the name of one of the topics
within MyAlias. When the script has finished running, the name of the topic that
was entered should appear in step 1.
For more help on Alias topics, see the RSLinx help file.
Legal Notice:
The information provided in the Rockwell Software Inc. (RSI) Knowledgebase is provided
"as is" without warranty of any kind. RSI disclaims all warranties, either expressed or implied
and in no event shall RSI be liable for any damages whatsoever including direct, indirect,
incidental, consequential, loss of profit or damage, even if RSI have been advised of the
possibility of such damages.
The foregoing limitation may not apply in those states that do not allow
the exclusion or limitation of liability for damages.
©1998 Rockwell Software Inc.. All rights reserved.