Specifications
RSLinx – Training Guide 63
Training Section 8: Writing a Simple Microsoft Excel
Macro
Goal: In this section, we will go through the steps to write a macro that will write a piece
of data to a register in a PLC. The macro will be controlled by a typical windows button.
We will write a value to a timer preset. This lab assumes that you have completed
section six and that both RSLinx and Excel are active in your Windows environment. It
assumes that you have a valid working topic named “testsol” (connected to either a
PLC-5 or an emulated PLC-5).
Lab / Discussion:
1. If Excel is still running, close it and do not save changes - or if you wish to save
your changes, save them under a new name. Do not save them under the default
name of Book1.
2. Note: DO
NOT CLOSE RSLinx itself, only close Excel!
3. Start Excel again. Excel should open to a blank workbook named Book1, with a
blank spreadsheet named Sheet1 (you will see a tab in the lower left-hand corner of
your screen named Sheet1).
4. Rename the sheet you are looking at to “DDE_Sheet” by double clicking on the
“Sheet1” tab and entering the new name of DDE_Sheet.
5. Next, we will create a button. From
the View pulldown menu, choose
Toolbars/Control Toolbox. A small
toolbar should appear on your
spreadsheet. It should look like the
following example:
Note: It is very important that the following steps are taken exactly as described.
If one character is typed incorrectly, your macro may not work.
Command
Button