KB 51769 Lab Manual - VBA Trend Manipulation
KB 51769 Lab Manual - VBA Trend Manipulation
3 of 13
Contents
Before you begin .........................................................................................................................................5
About this lab.................................................................................................................................................5
Tools & prerequisites.....................................................................................................................................5
Lab Setup ......................................................................................................................................................6
Document Conventions ..............................................................................................................................7
Starting FactoryTalk View Studio and the SE Client ...............................................................................8
Section 1: Trend Manipulation .................................................................................................................10
About This Section ......................................................................................................................................10
Observe Trending Display ...........................................................................................................................10
Add pens to the Trending Display ...............................................................................................................11
More trend options.......................................................................................................................................15
4 of 13
5 of 13
The following FactoryTalk View and RSLogix 5000 files are available for this example in the Lab Files
subdirectory:
1. A complete FactoryTalk View v5.0 SE application with many VBA examples, including the one detailed
in this technote. This can be found in: _Complete SE Application\VBA_Lab_v1_0.apa
or 2. If you do NOT want to install the complete application and instead want to view each component
individually, they have been separated and included here:
RSLogix 5000 file:
RSLogix 5000\VBA_Lab.ACD
SE Displays:
SE Displays\Trending.gfx
SE Displays\Trending_Completed.gfx
Lab Setup
SoftLogix/RS Emulate/ControlLogix
Load the RSLogix 5000 application into your controller. The examples in this manual use slot 2. Put
the controller in Run Mode.
FactoryTalk View SE
Restore the FactoryTalk View back-up apa file or manually create the SE application using the
individual files included (see above)
Ensure that your RSLinx Enterprise topic exists, points to the controller, and has alarms and events
enabled. The examples in this manual use the topic name SoftLogix.
6 of 13
Document Conventions
Throughout this workbook, we have used the following conventions to help guide you through the lab
materials.
Indicates:
Any item or button that you must click on, or a menu name
from which you must choose an option or command. This will
be an actual name of an item that you see on your screen or
in an example.
Note: If the mouse button is not specified in the text, you should click on the left mouse button.
7 of 13
3. Select the existing project called VBA_Lab and click the Open buttin
8 of 13
6. Expand the height of the diagnostics bar to show 5 or 6 lines.Change it from a single line like this
8. When prompted, select the C:\Lab Files\PV14 VBA Lab\VBA_Lab.cli configuration file.
9 of 13
To allow an operator to select different trend pens at runtime, you will add VBA code to the Trending
display. The Trending display has combo boxes that are initialized with trend pens. You will add VBA
code to the Refresh Trend button so that when the operator clicks the button, the existing trend pens will
be removed and the selected trend pens will be added to the trend object. At runtime, you can use the
preconfigured Display Keys. The F5 key will refresh the Trending display so you can quickly test your
work. The F12 key will open the Trending_Completed display so that you can see how your display
should work once you have completed this section.
10 of 13
2. Select the Trend Manipulation button from the Footer or the Main Menu display.
3. Observe that
the Load procedure for the Display object initializes the combo boxes with trend pens/tags
11 of 13
12 of 13
13 of 13
6. Select Debug > Compile Display Code from the VBA IDE menu.
7. Test your changes in View Studio, click the Test Display toolbar icon
8. Select pens and click the Refresh Trend button. Does it work?
9. Correct any errors you have until you get it working properly. If you need help, look at
Trending_Completed.
Note that pop up messages can easily be hidden by other windows. If it appears that nothing is
happening use the Alt-Tab key to look at open windows.
10. Click the Edit Display toolbar icon.
14 of 13
15 of 13