WinCC Programming en-US en-US

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4862

SIMATIC HMI

WinCC V7.3
WinCC: Scripting (VBS, ANSI-C,
VBA)
System Manual

Print of the Online Help

06/2014

A5E34329928-AA

VBS for Creating Procedures


and Actions

VBS Reference

ANSI-C for Creating


Functions and Actions

ANSI-C function descriptions

VBA for Automated


Configuration

VBA Reference

Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will be
used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to property
damage.

Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions. Qualified
personnel are those who, based on their training and experience, are capable of identifying risks and avoiding
potential hazards when working with these products/systems.

Proper use of Siemens products


Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended or
approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.

Trademarks
All names identified by are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.

Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software described.
Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the information in
this publication is reviewed regularly and any necessary corrections are included in subsequent editions.

Siemens AG
Industry Sector
Postfach 48 48
90026 NRNBERG
GERMANY

A5E34329928-AA
08/2014 Subject to change

Copyright Siemens AG 2014.


All rights reserved

Table of contents
1

VBS for Creating Procedures and Actions.................................................................................................25


1.1

VBS for creating procedures and actions....................................................................................25

1.2

Using Visual Basic Script in WinCC............................................................................................26

1.3

Modules and Procedures............................................................................................................29

1.4

Actions.........................................................................................................................................32

1.5

Multiple Use of Procedures and Actions.....................................................................................34

1.6

Use of CrossReference...............................................................................................................36

1.7

Using Global Tags in VBS...........................................................................................................38

1.8
1.8.1
1.8.2
1.8.3
1.8.4
1.8.5

VBScript Editors..........................................................................................................................40
VBScript Editors..........................................................................................................................40
Global Script Editor.....................................................................................................................41
Working in an Editing Window.....................................................................................................44
Working with the Toolbars...........................................................................................................47
Deleting Actions or Procedures...................................................................................................49

1.9
1.9.1
1.9.2
1.9.3
1.9.4
1.9.5
1.9.6
1.9.7
1.9.8

Creating and Editing Procedures................................................................................................50


Creating and Editing Procedures................................................................................................50
Creating a New Procedure..........................................................................................................53
How to Write Procedure Codes...................................................................................................55
Using Standard and Project Procedures.....................................................................................58
How to add module-related information......................................................................................59
Protecting a Module with a Password.........................................................................................61
Saving a Procedure.....................................................................................................................62
Renaming a Procedure or Module..............................................................................................64

1.10
1.10.1
1.10.2
1.10.3
1.10.4
1.10.5
1.10.6
1.10.7
1.10.7.1
1.10.7.2
1.10.7.3
1.10.7.4
1.10.7.5
1.10.7.6
1.10.8

Creating and Editing Actions.......................................................................................................66


Creating and Editing Actions.......................................................................................................66
Creating a New Action.................................................................................................................70
How to Edit Actions.....................................................................................................................71
How to add action-related information.........................................................................................74
Protecting an Action with a Password.........................................................................................76
Saving Actions.............................................................................................................................77
Triggers.......................................................................................................................................78
Triggers.......................................................................................................................................78
Animation trigger.........................................................................................................................82
How to add a trigger of the type "Timer".....................................................................................84
How to add a trigger of the type "Tag"........................................................................................86
How to change a trigger..............................................................................................................88
How to delete a trigger................................................................................................................89
How to Rename an Action...........................................................................................................90

1.11

How to activate global actions in Runtime...................................................................................92

1.12

Diagnostics..................................................................................................................................94

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

1.12.1 Diagnostics..................................................................................................................................94
1.12.2 GSC Diagnostics.........................................................................................................................95
1.12.2.1 GSC Diagnostics.........................................................................................................................95
1.12.2.2 Inserting the GSC Diagnostics Window into a Picture................................................................96
1.12.2.3 GSC Diagnostics Attributes.........................................................................................................96
1.12.2.4 GSC Diagnostics Toolbar............................................................................................................97
1.12.3 GSC Runtime..............................................................................................................................98
1.12.3.1 GSC Runtime..............................................................................................................................98
1.12.3.2 How to insert the GSC Runtime Window into a Picture..............................................................99
1.12.3.3 GSC Runtime Attributes............................................................................................................100
1.12.4 Testing with the Debugger........................................................................................................101
1.12.4.1 Testing with the Debugger........................................................................................................101
1.12.4.2 How to Activate the Debugger...................................................................................................102
1.12.4.3 Principles of Debugging............................................................................................................103
1.12.4.4 Components of the Microsoft Script Debuggers........................................................................105
1.12.4.5 Structure of VBScript Files........................................................................................................107
1.12.4.6 Action and Procedure Names in the Debugger.........................................................................109
1.12.4.7 Selecting a Script for Editing.....................................................................................................110
1.12.4.8 Processing Scripts Step-by-Step...............................................................................................112
1.12.4.9 Setting Breakpoints...................................................................................................................113
1.12.4.10 Deleting Breakpoints............................................................................................................114
1.12.4.11 How to Set Bookmarks in Scripts.........................................................................................115
1.12.4.12 How to Determine and Modify Tag and Property Values.....................................................116
1.12.4.13 Executing Script Commands................................................................................................117
1.13

Printing VBScripts.....................................................................................................................119

1.14
VBS Reference..........................................................................................................................120
1.14.1 VBS Reference..........................................................................................................................120
1.14.2 Objects and Lists.......................................................................................................................123
1.14.2.1 Objects and Lists.......................................................................................................................123
1.14.2.2 Alarm object..............................................................................................................................126
1.14.2.3 Alarms object (list).....................................................................................................................126
1.14.2.4 AlarmLogs Object......................................................................................................................128
1.14.2.5 DataItem Object........................................................................................................................129
1.14.2.6 DataLogs Object........................................................................................................................130
1.14.2.7 DataSet Object (List).................................................................................................................132
1.14.2.8 HMIRuntime Object...................................................................................................................134
1.14.2.9 Item Object................................................................................................................................135
1.14.2.10 Layer Object.........................................................................................................................136
1.14.2.11 Layers Object (Listing).........................................................................................................137
1.14.2.12 Logging Object.....................................................................................................................138
1.14.2.13 ProcessValue Object............................................................................................................139
1.14.2.14 ProcessValues Object (List).................................................................................................140
1.14.2.15 Project Object.......................................................................................................................140
1.14.2.16 ScreenItem Object...............................................................................................................141
1.14.2.17 ScreenItems Object (List).....................................................................................................144
1.14.2.18 Screen Object......................................................................................................................146
1.14.2.19 Screens Object (List)............................................................................................................149
1.14.2.20 SmartTags Object................................................................................................................151
1.14.2.21 Tag Object............................................................................................................................152
1.14.2.22 Tags Object (List).................................................................................................................155
1.14.2.23 TagSet Object (List).............................................................................................................156

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

1.14.3 Object types of the ScreenItem object......................................................................................158


1.14.3.1 Object types of the ScreenItem object......................................................................................158
1.14.3.2 Standard objects.......................................................................................................................159
1.14.3.3 Smart objects............................................................................................................................184
1.14.3.4 Windows objects.......................................................................................................................215
1.14.3.5 Tube objects..............................................................................................................................229
1.14.3.6 Controls.....................................................................................................................................232
1.14.3.7 Customized Object....................................................................................................................301
1.14.3.8 Group........................................................................................................................................302
1.14.4 Properties..................................................................................................................................303
1.14.4.1 Properties..................................................................................................................................303
1.14.4.2 A................................................................................................................................................304
1.14.4.3 B................................................................................................................................................323
1.14.4.4 C................................................................................................................................................351
1.14.4.5 D................................................................................................................................................384
1.14.4.6 E................................................................................................................................................394
1.14.4.7 F................................................................................................................................................404
1.14.4.8 G................................................................................................................................................426
1.14.4.9 H................................................................................................................................................430
1.14.4.10 I............................................................................................................................................439
1.14.4.11 L...........................................................................................................................................444
1.14.4.12 M..........................................................................................................................................475
1.14.4.13 N...........................................................................................................................................496
1.14.4.14 O..........................................................................................................................................498
1.14.4.15 P...........................................................................................................................................515
1.14.4.16 Q..........................................................................................................................................533
1.14.4.17 R...........................................................................................................................................534
1.14.4.18 S...........................................................................................................................................544
1.14.4.19 T...........................................................................................................................................581
1.14.4.20 U...........................................................................................................................................657
1.14.4.21 V...........................................................................................................................................666
1.14.4.22 W..........................................................................................................................................682
1.14.4.23 X - Z.....................................................................................................................................687
1.14.5 Methods.....................................................................................................................................695
1.14.5.1 Methods.....................................................................................................................................695
1.14.5.2 Methods A to E..........................................................................................................................697
1.14.5.3 Get methods..............................................................................................................................705
1.14.5.4 Methods H to M.........................................................................................................................753
1.14.5.5 Methods N to R.........................................................................................................................764
1.14.5.6 Methods S to T..........................................................................................................................781
1.14.5.7 Methods U to Z..........................................................................................................................796
1.14.6 Appendix...................................................................................................................................804
1.14.6.1 Error Messages from Database Area........................................................................................804
1.15
1.15.1
1.15.2
1.15.2.1
1.15.2.2
1.15.2.3
1.15.2.4
1.15.2.5
1.15.2.6

Examples of VBScript................................................................................................................806
Examples of VBScript................................................................................................................806
Examples in WinCC..................................................................................................................806
Examples in WinCC..................................................................................................................806
Example: Accessing objects in Graphics Designer...................................................................807
Example: Defining the color of objects......................................................................................808
Example: How to Configure Language Changes......................................................................808
Example: Deactivating Runtime................................................................................................809
Example: Configuring change picture globally..........................................................................809

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

1.15.2.7 Example: Configuring Change Picture Via Property.................................................................810


1.15.2.8 Example: Configuring diagnostics output via Trace..................................................................810
1.15.2.9 Example: Writing tag values......................................................................................................811
1.15.2.10 Example: How to Read Tag Values.....................................................................................813
1.15.2.11 Example: Writing Object Properties.....................................................................................816
1.15.2.12 Example: How to Start an Action on the Server (Logging Object).......................................818
1.15.2.13 Dynamization of Controls.....................................................................................................820
1.15.3 General Examples.....................................................................................................................833
1.15.3.1 General examples for VBScript.................................................................................................833
1.15.3.2 Example: Configuring a Database Connection with VBS..........................................................834
1.15.3.3 Example: Using the MS Automation interface...........................................................................836
1.15.3.4 Example: Starting an external application.................................................................................837
1.16
1.16.1
1.16.2
2

Basic Principles of VBScript......................................................................................................839


Basic Principles of VBScript......................................................................................................839
VBScript Basics.........................................................................................................................839

VBS Reference.........................................................................................................................................841
2.1

VBS Reference..........................................................................................................................841

2.2
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.2.7
2.2.8
2.2.9
2.2.10
2.2.11
2.2.12
2.2.13
2.2.14
2.2.15
2.2.16
2.2.17
2.2.18
2.2.19
2.2.20
2.2.21
2.2.22
2.2.23

Objects and Lists.......................................................................................................................845


Objects and Lists.......................................................................................................................845
Alarm object..............................................................................................................................847
Alarms object (list).....................................................................................................................848
AlarmLogs Object......................................................................................................................849
DataItem Object........................................................................................................................850
DataLogs Object........................................................................................................................852
DataSet Object (List).................................................................................................................853
HMIRuntime Object...................................................................................................................855
Item Object................................................................................................................................856
Layer Object..............................................................................................................................857
Layers Object (Listing)..............................................................................................................858
Logging Object..........................................................................................................................859
ProcessValue Object.................................................................................................................860
ProcessValues Object (List)......................................................................................................861
Project Object............................................................................................................................862
ScreenItem Object.....................................................................................................................863
ScreenItems Object (List)..........................................................................................................866
Screen Object............................................................................................................................868
Screens Object (List).................................................................................................................871
SmartTags Object.....................................................................................................................873
Tag Object.................................................................................................................................874
Tags Object (List)......................................................................................................................877
TagSet Object (List)..................................................................................................................878

2.3
2.3.1
2.3.2
2.3.2.1
2.3.2.2
2.3.2.3
2.3.2.4
2.3.2.5
2.3.2.6

Object types of the ScreenItem object......................................................................................881


Object types of the ScreenItem object......................................................................................881
Standard objects.......................................................................................................................882
Ellipse........................................................................................................................................882
Ellipse arc..................................................................................................................................884
Ellipse segment.........................................................................................................................885
Circle.........................................................................................................................................887
Circular arc................................................................................................................................889
Pie segment..............................................................................................................................890

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

2.3.2.7
2.3.2.8
2.3.2.9
2.3.2.10
2.3.2.11
2.3.2.12
2.3.2.13
2.3.3
2.3.3.1
2.3.3.2
2.3.3.3
2.3.3.4
2.3.3.5
2.3.3.6
2.3.3.7
2.3.3.8
2.3.3.9
2.3.3.10
2.3.3.11
2.3.3.12
2.3.3.13
2.3.3.14
2.3.3.15
2.3.4
2.3.4.1
2.3.4.2
2.3.4.3
2.3.4.4
2.3.4.5
2.3.5
2.3.5.1
2.3.5.2
2.3.5.3
2.3.5.4
2.3.6
2.3.6.1
2.3.6.2
2.3.6.3
2.3.6.4
2.3.6.5
2.3.6.6
2.3.6.7
2.3.6.8
2.3.6.9
2.3.6.10
2.3.6.11
2.3.6.12
2.3.6.13
2.3.6.14
2.3.6.15
2.3.7
2.3.8

Line............................................................................................................................................892
Polygon.....................................................................................................................................894
Polyline......................................................................................................................................896
Rectangle..................................................................................................................................897
Rounded rectangle....................................................................................................................900
Static text...................................................................................................................................903
Connector..................................................................................................................................905
Smart objects............................................................................................................................907
3D Bar.......................................................................................................................................907
Application Window...................................................................................................................911
Bar.............................................................................................................................................912
Picture Window.........................................................................................................................917
Control.......................................................................................................................................919
I/O Field.....................................................................................................................................922
Faceplate Instance....................................................................................................................924
Graphic Object..........................................................................................................................925
Combobox.................................................................................................................................927
List Box......................................................................................................................................927
Multiple row text........................................................................................................................928
OLE object.................................................................................................................................929
Group Display............................................................................................................................931
Text list......................................................................................................................................934
Status display............................................................................................................................936
Windows objects.......................................................................................................................938
Button........................................................................................................................................938
Check box.................................................................................................................................942
Radio box..................................................................................................................................944
Round Button............................................................................................................................946
Slider.........................................................................................................................................949
Tube objects..............................................................................................................................952
Polygon Tube............................................................................................................................952
T-piece......................................................................................................................................953
Double T-piece..........................................................................................................................954
Tube Bend.................................................................................................................................954
Controls.....................................................................................................................................955
Controls.....................................................................................................................................955
List of controls...........................................................................................................................958
HMI Symbol Library...................................................................................................................976
WinCC AlarmControl.................................................................................................................978
WinCC Digital/Analog Clock......................................................................................................981
WinCC FunctionTrendControl...................................................................................................983
WinCC Gauge Control...............................................................................................................987
WinCC Media Control................................................................................................................990
WinCC OnlineTableControl.......................................................................................................990
WinCC OnlineTrendControl.......................................................................................................994
WinCC Push Button Control......................................................................................................998
WinCC RulerControl................................................................................................................1001
WinCC Slider Control..............................................................................................................1004
WinCC UserArchiveControl.....................................................................................................1007
Controls before WinCC V7......................................................................................................1011
Customized Object..................................................................................................................1023
Group......................................................................................................................................1025

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

2.4
2.4.1
2.4.2
2.4.2.1
2.4.2.2
2.4.2.3
2.4.3
2.4.3.1
2.4.3.2
2.4.3.3
2.4.4
2.4.4.1
2.4.4.2
2.4.4.3
2.4.5
2.4.5.1
2.4.5.2
2.4.6
2.4.6.1
2.4.6.2
2.4.6.3
2.4.6.4
2.4.6.5
2.4.6.6
2.4.6.7
2.4.6.8
2.4.6.9
2.4.6.10
2.4.6.11
2.4.6.12
2.4.6.13
2.4.6.14
2.4.6.15
2.4.6.16
2.4.6.17
2.4.6.18
2.4.6.19
2.4.6.20
2.4.6.21
2.4.6.22
2.4.6.23
2.4.6.24
2.4.6.25
2.4.6.26
2.4.6.27
2.4.6.28
2.4.7
2.4.7.1
2.4.7.2
2.4.8
2.4.8.1
2.4.8.2

Properties................................................................................................................................1027
Properties................................................................................................................................1027
A..............................................................................................................................................1027
Aa - Ad....................................................................................................................................1027
Al - Ap......................................................................................................................................1033
Ar - Ax.....................................................................................................................................1039
B..............................................................................................................................................1046
Ba............................................................................................................................................1046
Be - Bl......................................................................................................................................1055
Bo - Bu....................................................................................................................................1065
C..............................................................................................................................................1075
Ca - Cl.....................................................................................................................................1075
Co............................................................................................................................................1083
Cu............................................................................................................................................1105
D..............................................................................................................................................1108
Da............................................................................................................................................1108
De - Do....................................................................................................................................1111
E..............................................................................................................................................1118
Edit Property............................................................................................................................1118
Editable Property.....................................................................................................................1118
EditAtOnce Property................................................................................................................1118
Enabled Property.....................................................................................................................1119
EnableDelete property.............................................................................................................1119
EnableEdit property.................................................................................................................1120
EnableInsert property..............................................................................................................1120
EnablePopupMenu property....................................................................................................1120
EndAngle Property..................................................................................................................1120
EndTime Property...................................................................................................................1121
EndValue Property..................................................................................................................1121
EndX Property.........................................................................................................................1122
EndY Property.........................................................................................................................1122
ErrorDescription Property........................................................................................................1122
Exponent Property...................................................................................................................1123
ExportDirectoryChangeable property......................................................................................1124
ExportDirectoryname property................................................................................................1124
ExportFileExtension property..................................................................................................1124
ExportFilename property.........................................................................................................1124
ExportFilenameChangeable property......................................................................................1125
ExportFormatGuid property.....................................................................................................1125
ExportFormatName property...................................................................................................1125
ExportParameters property.....................................................................................................1125
ExportSelection property.........................................................................................................1126
ExportShowDialog property.....................................................................................................1126
ExportXML property................................................................................................................1126
ExtendedOperation Property...................................................................................................1127
ExtendedZoomingEnable Property.........................................................................................1127
F..............................................................................................................................................1128
Fe - Fl......................................................................................................................................1128
Fo - Fr......................................................................................................................................1141
G..............................................................................................................................................1149
GlobalColorScheme property..................................................................................................1149
GlobalShadow property...........................................................................................................1150

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

2.4.8.3 GraphDirection property (before WinCC V7)...........................................................................1150


2.4.8.4 GraphDirection Property..........................................................................................................1150
2.4.8.5 GridLineColor property............................................................................................................1151
2.4.8.6 GridLineHorz Property.............................................................................................................1151
2.4.8.7 GridLines Property..................................................................................................................1151
2.4.8.8 GridlinesValueX Property........................................................................................................1151
2.4.8.9 GridlinesValueY Property........................................................................................................1152
2.4.8.10 GridlinesX Property.................................................................................................................1152
2.4.8.11 GridlinesY Property.................................................................................................................1152
2.4.8.12 GridLineValue Property...........................................................................................................1153
2.4.8.13 GridLineVert Property..............................................................................................................1153
2.4.8.14 GridLineWidth property...........................................................................................................1153
2.4.9
H..............................................................................................................................................1154
2.4.9.1 Ha - Hi.....................................................................................................................................1154
2.4.9.2 Ho - Hy....................................................................................................................................1160
2.4.10 I...............................................................................................................................................1162
2.4.10.1 IconSpace property.................................................................................................................1162
2.4.10.2 IndependentWindow property.................................................................................................1162
2.4.10.3 Index Property.........................................................................................................................1162
2.4.10.4 InnerBevelOffset Property.......................................................................................................1163
2.4.10.5 InnerBevelStyle Property.........................................................................................................1164
2.4.10.6 InnerBevelWidth Property.......................................................................................................1164
2.4.10.7 InputValue property.................................................................................................................1164
2.4.10.8 InsertData Property.................................................................................................................1165
2.4.10.9 Instance property.....................................................................................................................1165
2.4.10.10 ItemBorderBackColor Property..........................................................................................1165
2.4.10.11 ItemBorderColor Property..................................................................................................1166
2.4.10.12 ItemBorderStyle Property...................................................................................................1166
2.4.10.13 ItemBorderWidth Property..................................................................................................1166
2.4.10.14 ItemProviderClsid Property................................................................................................1167
2.4.10.15 ItemVisible Property...........................................................................................................1167
2.4.11 L..............................................................................................................................................1167
2.4.11.1 Lab - Las.................................................................................................................................1167
2.4.11.2 Layer.......................................................................................................................................1171
2.4.11.3 Le - Li......................................................................................................................................1187
2.4.11.4 Lo............................................................................................................................................1193
2.4.12 M.............................................................................................................................................1199
2.4.12.1 Ma - Mc...................................................................................................................................1199
2.4.12.2 Me...........................................................................................................................................1205
2.4.12.3 Mi - Ms.....................................................................................................................................1217
2.4.13 N..............................................................................................................................................1219
2.4.13.1 Name Property........................................................................................................................1219
2.4.13.2 NeedleColor Property..............................................................................................................1220
2.4.13.3 NormalColor Property..............................................................................................................1221
2.4.13.4 NumberLines Property............................................................................................................1221
2.4.13.5 NumItems Property.................................................................................................................1221
2.4.14 O..............................................................................................................................................1222
2.4.14.1 Ob - On....................................................................................................................................1222
2.4.14.2 Op............................................................................................................................................1227
2.4.14.3 Or - Ou....................................................................................................................................1236
2.4.15 P..............................................................................................................................................1238
2.4.15.1 Pa - Pe....................................................................................................................................1238

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

2.4.15.2 Pi.............................................................................................................................................1245
2.4.15.3 Pl - Pr......................................................................................................................................1252
2.4.16 Q..............................................................................................................................................1257
2.4.16.1 QualityCode Property..............................................................................................................1257
2.4.17 R..............................................................................................................................................1258
2.4.17.1 Ra - Ri.....................................................................................................................................1258
2.4.17.2 Ro - Ru....................................................................................................................................1262
2.4.18 S..............................................................................................................................................1268
2.4.18.1 Sa - Sc.....................................................................................................................................1268
2.4.18.2 Se............................................................................................................................................1274
2.4.18.3 Sh - Sk.....................................................................................................................................1283
2.4.18.4 Sm - Sq...................................................................................................................................1291
2.4.18.5 St - Sy......................................................................................................................................1298
2.4.19 T..............................................................................................................................................1305
2.4.19.1 Ta -Tic.....................................................................................................................................1305
2.4.19.2 TimeAxis - TimeBase..............................................................................................................1313
2.4.19.3 TimeColumn............................................................................................................................1321
2.4.19.4 TimeFormat - Tolerance..........................................................................................................1330
2.4.19.5 Toolbar....................................................................................................................................1339
2.4.19.6 ToolTip - TrendLower..............................................................................................................1351
2.4.19.7 TrendMeasure - TrendVisible..................................................................................................1361
2.4.19.8 TrendWindow - TrendYAxis....................................................................................................1369
2.4.19.9 Type........................................................................................................................................1376
2.4.20 U..............................................................................................................................................1381
2.4.20.1 Un - Up....................................................................................................................................1381
2.4.20.2 Us............................................................................................................................................1385
2.4.21 V..............................................................................................................................................1390
2.4.21.1 Val - ValueAxis........................................................................................................................1390
2.4.21.2 ValueColumn - Vi....................................................................................................................1396
2.4.22 W.............................................................................................................................................1406
2.4.22.1 Warning Property....................................................................................................................1406
2.4.22.2 WarningColor Property............................................................................................................1406
2.4.22.3 WarningHigh Property.............................................................................................................1407
2.4.22.4 WarningLow Property..............................................................................................................1407
2.4.22.5 Width Property.........................................................................................................................1407
2.4.22.6 WinCCStyle property...............................................................................................................1408
2.4.22.7 WindowBorder Property..........................................................................................................1408
2.4.22.8 WindowPositionMode property................................................................................................1409
2.4.22.9 WindowsStyle property............................................................................................................1409
2.4.22.10 WindowsStyle Property......................................................................................................1409
2.4.22.11 WindowType Property........................................................................................................1410
2.4.22.12 WithAxes Property.............................................................................................................1410
2.4.22.13 WithLabels Property...........................................................................................................1410
2.4.23 X - Z.........................................................................................................................................1411
2.4.23.1 XAxisColor property (before WinCC V7).................................................................................1411
2.4.23.2 X/YAxisAdd property...............................................................................................................1411
2.4.23.3 X/YAxisAlign property..............................................................................................................1411
2.4.23.4 X/YAxisAutoPrecisions property..............................................................................................1412
2.4.23.5 X/YAxisAutoRange property....................................................................................................1412
2.4.23.6 X/YAxisBeginValue property...................................................................................................1412
2.4.23.7 X/YAxisColor property.............................................................................................................1413
2.4.23.8 X/YAxisEndValue property......................................................................................................1413

10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

2.4.23.9 X/YAxisExponentialFormat property.......................................................................................1413


2.4.23.10 X/YAxisInTrendColor property...........................................................................................1414
2.4.23.11 X/YAxisLabel property........................................................................................................1414
2.4.23.12 X/YAxisName property.......................................................................................................1414
2.4.23.13 X/YAxisPrecisions property................................................................................................1415
2.4.23.14 X/YAxisRemove property...................................................................................................1415
2.4.23.15 X/YAxisRepos property......................................................................................................1415
2.4.23.16 X/YAxisScalingType property.............................................................................................1415
2.4.23.17 X/YAxisTrendWindow property..........................................................................................1416
2.4.23.18 X/YAxisVisible property......................................................................................................1416
2.4.23.19 XAxisCount property..........................................................................................................1417
2.4.23.20 XAxisIndex property...........................................................................................................1417
2.4.23.21 XAxisRename property......................................................................................................1417
2.4.23.22 YAxisCount property..........................................................................................................1417
2.4.23.23 YAxisIndex property...........................................................................................................1417
2.4.23.24 YAxisRename property......................................................................................................1418
2.4.23.25 ZeroPoint Property.............................................................................................................1418
2.4.23.26 ZeroPointValue Property....................................................................................................1418
2.4.23.27 Zoom Property...................................................................................................................1419
2.5
2.5.1
2.5.2
2.5.2.1
2.5.2.2
2.5.2.3
2.5.2.4
2.5.2.5
2.5.2.6
2.5.2.7
2.5.2.8
2.5.2.9
2.5.2.10
2.5.2.11
2.5.2.12
2.5.2.13
2.5.2.14
2.5.3
2.5.3.1
2.5.3.2
2.5.3.3
2.5.3.4
2.5.3.5
2.5.3.6
2.5.3.7
2.5.3.8
2.5.3.9
2.5.3.10
2.5.3.11
2.5.3.12
2.5.3.13
2.5.3.14
2.5.3.15

Methods...................................................................................................................................1420
Methods...................................................................................................................................1420
Methods A to E........................................................................................................................1421
Activate Method.......................................................................................................................1421
ActivateDynamic method ........................................................................................................1422
Add Method.............................................................................................................................1423
AttachDB method....................................................................................................................1425
CalculateStatistic method........................................................................................................1425
CopyRows method..................................................................................................................1425
Create method.........................................................................................................................1426
CreateTagSet Method.............................................................................................................1426
CutRows method.....................................................................................................................1427
DeactivateDynamic method....................................................................................................1427
DeleteRows method................................................................................................................1428
DetachDB method...................................................................................................................1428
Edit method.............................................................................................................................1429
Export Method.........................................................................................................................1429
Get methods............................................................................................................................1430
GetColumn method.................................................................................................................1430
GetColumnCollection method.................................................................................................1431
GetHitlistColumn method........................................................................................................1432
GetHistlistColumnCollection method.......................................................................................1433
GetMessageBlock method......................................................................................................1434
GetMessageBlockCollection method......................................................................................1435
GetMessageColumn method...................................................................................................1436
GetMessageColumnCollection method...................................................................................1437
GetOperatorMessage method.................................................................................................1438
GetOperatorMessageCollection method.................................................................................1439
GetRow method......................................................................................................................1440
GetRowCollection method.......................................................................................................1442
GetRulerBlock method............................................................................................................1443
GetRulerBlockCollection method............................................................................................1444
GetRulerColumn method.........................................................................................................1445

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

11

Table of contents

2.5.3.16
2.5.3.17
2.5.3.18
2.5.3.19
2.5.3.20
2.5.3.21
2.5.3.22
2.5.3.23
2.5.3.24
2.5.3.25
2.5.3.26
2.5.3.27
2.5.3.28
2.5.3.29
2.5.3.30
2.5.3.31
2.5.3.32
2.5.3.33
2.5.3.34
2.5.3.35
2.5.3.36
2.5.3.37
2.5.3.38
2.5.3.39
2.5.3.40
2.5.3.41
2.5.3.42
2.5.3.43
2.5.4
2.5.4.1
2.5.4.2
2.5.4.3
2.5.4.4
2.5.4.5
2.5.4.6
2.5.4.7
2.5.4.8
2.5.4.9
2.5.4.10
2.5.4.11
2.5.4.12
2.5.4.13
2.5.4.14
2.5.4.15
2.5.4.16
2.5.4.17
2.5.4.18
2.5.4.19
2.5.5
2.5.5.1
2.5.5.2
2.5.5.3

12

GetRulerColumnCollection method.........................................................................................1446
GetRulerData method.............................................................................................................1447
GetSelectedRow method........................................................................................................1448
GetSelectedRows method.......................................................................................................1449
GetStatisticAreaColumn method.............................................................................................1450
GetStatisticAreaColumnCollection method.............................................................................1451
GetStatisticResultColumn method..........................................................................................1452
GetStatisticResultColumnCollection method...........................................................................1453
GetStatusbarElement method.................................................................................................1454
GetStatusbarElementCollection method.................................................................................1455
GetTimeAxis method...............................................................................................................1457
GetTimeAxisCollection method...............................................................................................1458
GetTimeColumn method.........................................................................................................1459
GetTimeColumnCollection method.........................................................................................1460
GetToolbarButton method.......................................................................................................1462
GetToolbarButtonCollection method.......................................................................................1463
GetTrend method....................................................................................................................1464
GetTrendCollection method....................................................................................................1465
GetTrendWindow method.......................................................................................................1466
GetTrendWindowCollection method........................................................................................1467
GetValueAxis method..............................................................................................................1468
GetValueAxisCollection method..............................................................................................1469
GetValueColumn method........................................................................................................1470
GetValueColumnCollection method........................................................................................1471
GetXAxis method....................................................................................................................1473
GetXAxisCollection method.....................................................................................................1474
GetYAxis method....................................................................................................................1475
GetYAxisCollection method.....................................................................................................1476
Methods H to M.......................................................................................................................1478
HideAlarm method...................................................................................................................1478
InsertData method...................................................................................................................1478
Item Method............................................................................................................................1479
LockAlarm method..................................................................................................................1480
LoopInAlarm method...............................................................................................................1480
MoveAxis method....................................................................................................................1481
MoveRuler...............................................................................................................................1481
MoveToFirst method...............................................................................................................1483
MoveToFirstLine method.........................................................................................................1484
MoveToFirstPage method.......................................................................................................1484
MoveToLast method................................................................................................................1484
MoveToLastLine method.........................................................................................................1485
MoveToLastPage method.......................................................................................................1485
MoveToNext method...............................................................................................................1486
MoveToNextLine method........................................................................................................1486
MoveToNextPage method.......................................................................................................1486
MoveToPrevious method........................................................................................................1487
MoveToPreviousLine method..................................................................................................1487
MoveToPreviousPage method................................................................................................1488
Methods N to R.......................................................................................................................1488
NextColumn method................................................................................................................1488
NextTrend method...................................................................................................................1488
OneToOneView method..........................................................................................................1489

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

2.5.5.4
2.5.5.5
2.5.5.6
2.5.5.7
2.5.5.8
2.5.5.9
2.5.5.10
2.5.5.11
2.5.5.12
2.5.5.13
2.5.5.14
2.5.5.15
2.5.5.16
2.5.5.17
2.5.6
2.5.6.1
2.5.6.2
2.5.6.3
2.5.6.4
2.5.6.5
2.5.6.6
2.5.6.7
2.5.6.8
2.5.6.9
2.5.6.10
2.5.6.11
2.5.6.12
2.5.6.13
2.5.6.14
2.5.6.15
2.5.6.16
2.5.6.17
2.5.6.18
2.5.6.19
2.5.6.20
2.5.6.21
2.5.6.22
2.5.6.23
2.5.6.24
2.5.6.25
2.5.6.26
2.5.6.27
2.5.6.28
2.5.6.29
2.5.6.30
2.5.6.31
2.5.6.32
2.5.6.33
2.5.6.34
2.5.7
2.5.7.1
2.5.7.2

PasteRows method.................................................................................................................1489
PreviousColumn method.........................................................................................................1490
PreviousTrend method............................................................................................................1490
Print method............................................................................................................................1490
QuitHorn method.....................................................................................................................1491
QuitSelected method...............................................................................................................1491
QuitVisible method..................................................................................................................1492
Read Method...........................................................................................................................1492
Read Tags method..................................................................................................................1496
Refresh Method.......................................................................................................................1496
Remove Method......................................................................................................................1497
RemoveAll Method..................................................................................................................1501
RemoveData method..............................................................................................................1502
Restore Method.......................................................................................................................1503
Methods S to T........................................................................................................................1506
SelectAll..................................................................................................................................1506
SelectRow...............................................................................................................................1506
SelectedStatisticArea method.................................................................................................1507
ServerExport method..............................................................................................................1508
ServerImport method...............................................................................................................1508
ShowColumnSelection method...............................................................................................1508
ShowComment method...........................................................................................................1509
ShowDisplayOptionsDialog method........................................................................................1509
ShowEmergencyQuitDialog method.......................................................................................1510
ShowHelp method...................................................................................................................1510
ShowHideList method.............................................................................................................1510
ShowHitList method................................................................................................................1511
ShowInfoText method.............................................................................................................1511
ShowInsertValue method........................................................................................................1512
ShowLockDialog method.........................................................................................................1512
ShowLockList method.............................................................................................................1512
ShowLongTermArchiveList method........................................................................................1513
ShowMessageList method......................................................................................................1513
ShowPercentageAxis method.................................................................................................1513
ShowPropertyDialog method...................................................................................................1514
ShowSelectArchive method....................................................................................................1514
ShowSelection method............................................................................................................1515
ShowSelectTimeBase method................................................................................................1515
ShowSelectionDialog method.................................................................................................1515
ShowShortTermArchiveList method........................................................................................1516
ShowSort method....................................................................................................................1516
ShowSortDialog method..........................................................................................................1517
ShowTagSelection method.....................................................................................................1517
ShowTimebaseDialog method................................................................................................1517
ShowTimeSelection method....................................................................................................1518
ShowTrendSelection method..................................................................................................1518
StartStopUpdate method.........................................................................................................1519
Stop Method............................................................................................................................1519
Trace Method..........................................................................................................................1520
Methods U to Z........................................................................................................................1520
UnhideAlarm method...............................................................................................................1520
UnlockAlarm method...............................................................................................................1521

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

13

Table of contents

2.5.7.3
2.5.7.4
2.5.7.5
2.5.7.6
2.5.7.7
2.5.7.8
2.5.7.9
2.5.7.10
2.5.7.11
2.5.7.12
2.5.7.13

UnselectAll..............................................................................................................................1521
UnselectRow...........................................................................................................................1521
Write Method...........................................................................................................................1522
WriteTags method...................................................................................................................1525
ZoomArea - Method................................................................................................................1526
ZoomInOut - Method...............................................................................................................1526
ZoomInOutTime method.........................................................................................................1526
ZoomInOutValues - Method....................................................................................................1527
ZoomInOutX method...............................................................................................................1527
ZoomInOutY - Method.............................................................................................................1528
ZoomMove method.................................................................................................................1528

2.6
2.6.1

Appendix.................................................................................................................................1529
Error Messages from Database Area......................................................................................1529

ANSI-C for Creating Functions and Actions...........................................................................................1531


3.1

Creating Functions and Actions with ANSI-C..........................................................................1531

3.2

Creating Functions and Actions..............................................................................................1532

3.3

Characteristics of Project Functions........................................................................................1535

3.4

Characteristics of Standard Functions....................................................................................1536

3.5

Characteristics of Internal Functions.......................................................................................1538

3.6

Characteristics of Local Actions..............................................................................................1539

3.7

Characteristics of Global Actions............................................................................................1540

3.8

How to Add Global Script Runtime to a Project's Startup List.................................................1541

3.9

Use of Global C-Tags..............................................................................................................1542

3.10

Use of DLLs in Functions and Actions....................................................................................1544

3.11
The Global Script Editor..........................................................................................................1546
3.11.1 The Global Script Editor..........................................................................................................1546
3.11.2 Working in the Edit Window....................................................................................................1548
3.11.2.1 Working in the Edit Window....................................................................................................1548
3.11.2.2 Editing Functions with the Keyboard.......................................................................................1549
3.11.2.3 Editing Functions with the Mouse............................................................................................1550
3.11.3 Working with the Toolbars.......................................................................................................1550
3.11.4 How to Set Different Views......................................................................................................1553
3.11.5 How to Set the Font Style........................................................................................................1553
3.11.6 How to Use "Save As..."..........................................................................................................1554
3.11.7 How to Delete Actions or Project and Standard Functions.....................................................1555
3.11.8 How to Generate a New Header.............................................................................................1555
3.11.9 How to Compile All Functions.................................................................................................1556
3.11.10 How to Search in Files............................................................................................................1557
3.11.11 Printing Functions and Actions................................................................................................1558
3.11.11.1 Printing Functions and Actions...........................................................................................1558
3.11.11.2 How to Set the Print Parameters........................................................................................1558
3.11.11.3 How to Open Page View....................................................................................................1559
3.11.11.4 How to Print the Project Documentation............................................................................1559
3.12
3.12.1

14

Creating and Editing Functions...............................................................................................1560


Creating and Editing Functions...............................................................................................1560

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

3.12.2
3.12.3
3.12.4
3.12.5
3.12.6
3.12.7
3.12.8
3.12.9
3.12.10

How to Create a New Function...............................................................................................1563


How to Write Function Code...................................................................................................1564
How to Use Internal Functions................................................................................................1565
How to Use Standard and Project Functions..........................................................................1566
Inserting Additional Function-Related Information..................................................................1567
How to Protect a Function Against Unauthorized Access.......................................................1568
How to Compile and Save a Function.....................................................................................1569
How to Rename a Function.....................................................................................................1570
How to Use Functions from Other Sources.............................................................................1571

3.13
3.13.1
3.13.2
3.13.3
3.13.4
3.13.5
3.13.6
3.13.7
3.13.8
3.13.8.1
3.13.8.2
3.13.8.3
3.13.8.4
3.13.8.5
3.13.9
3.13.10
3.13.11
3.13.12
3.13.13

Creating and Editing Actions...................................................................................................1573


How To Create and Edit Actions.............................................................................................1573
WinCC Coding Rule................................................................................................................1576
How to Create a New Action...................................................................................................1577
How to Edit Actions.................................................................................................................1578
How to add action-related information.....................................................................................1578
How to Protect an Action Against Unauthorized Access.........................................................1580
How to Compile and Save an Action.......................................................................................1581
Triggers...................................................................................................................................1582
Triggers...................................................................................................................................1582
How to Add a New Trigger of the "Timer" Type......................................................................1585
How to Add a New Trigger of the "Tag" Type.........................................................................1586
How to change a trigger..........................................................................................................1588
How to delete a trigger............................................................................................................1589
How to Assign Authorizations..................................................................................................1590
How to Export an Action..........................................................................................................1590
How to Import an Action..........................................................................................................1591
How to Rename an Action.......................................................................................................1592
How to Use Actions From Other Sources...............................................................................1593

3.14
3.14.1
3.14.2
3.14.2.1
3.14.2.2
3.14.2.3
3.14.2.4
3.14.3
3.14.3.1
3.14.3.2
3.14.3.3
3.14.3.4

Runtime Behavior of Actions...................................................................................................1595


Runtime Behavior of Actions...................................................................................................1595
GSC Runtime..........................................................................................................................1596
GSC Runtime..........................................................................................................................1596
How to Place GSC Runtime in a Process Picture...................................................................1599
Attributes of GSC Runtime......................................................................................................1600
How to Edit Actions.................................................................................................................1600
GSC Diagnose........................................................................................................................1601
GSC Diagnose........................................................................................................................1601
How to Place GSC Diagnose in a Process Picture?...............................................................1602
Attributes of GSC Diagnose....................................................................................................1603
The Toolbar of GSC Diagnose................................................................................................1603

3.15
3.15.1
3.15.2
3.15.2.1
3.15.2.2
3.15.2.3
3.15.2.4
3.15.2.5
3.15.2.6
3.15.2.7
3.15.3

ANSI-C function descriptions..................................................................................................1605


lpszPictureName.....................................................................................................................1605
Standard functions..................................................................................................................1605
Standard functions - short description.....................................................................................1605
Alarm.......................................................................................................................................1606
Graphics..................................................................................................................................1611
Obsolete functions...................................................................................................................1616
Report......................................................................................................................................1674
WinCC.....................................................................................................................................1676
Windows..................................................................................................................................1683
Internal functions.....................................................................................................................1684

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

15

Table of contents

3.15.3.1 Internal functions - short description.......................................................................................1684


3.15.3.2 allocate....................................................................................................................................1685
3.15.3.3 c_bib........................................................................................................................................1686
3.15.3.4 graphics...................................................................................................................................1770
3.15.3.5 tag...........................................................................................................................................2096
3.15.3.6 WinCC.....................................................................................................................................2207
3.15.4 Examples.................................................................................................................................2214
3.15.4.1 Examles - A to G.....................................................................................................................2214
3.15.4.2 Examples - GetAlarmHigh to GetPropChar.............................................................................2217
3.15.4.3 Examples - GetRangeMax to GetWidth..................................................................................2233
3.15.4.4 Examples - H to S...................................................................................................................2254
3.15.4.5 Examples - SetAlarmHigh to SetPropChar.............................................................................2256
3.15.4.6 Examples - SetRangeMax to SetWidth...................................................................................2266
3.15.4.7 Examples - T to Z....................................................................................................................2276
3.15.4.8 Examples of WinCC controls...................................................................................................2281
3.15.5 Lists.........................................................................................................................................2283
3.15.5.1 Bar direction............................................................................................................................2283
3.15.5.2 Bar Scaling..............................................................................................................................2284
3.15.5.3 Flash frequencies....................................................................................................................2284
3.15.5.4 I/O field, output format.............................................................................................................2284
3.15.5.5 I/O field, data type of the field content.....................................................................................2285
3.15.5.6 I/O field, field type....................................................................................................................2286
3.15.5.7 Element alignment in check boxes and radio boxes...............................................................2286
3.15.5.8 Color chart...............................................................................................................................2286
3.15.5.9 Format descriptors..................................................................................................................2287
3.15.5.10 Fill pattern..........................................................................................................................2288
3.15.5.11 Line styles..........................................................................................................................2289
3.15.5.12 Line end style.....................................................................................................................2289
3.15.5.13 List types............................................................................................................................2290
3.15.5.14 Language ID.......................................................................................................................2290
3.15.5.15 Text alignment....................................................................................................................2291
3.15.5.16 Tag statuses.......................................................................................................................2291
3.15.6 Structure definitions.................................................................................................................2292
3.15.6.1 Structure definition CCAPErrorExecute..................................................................................2292
3.15.6.2 Structure definition CCAPTime...............................................................................................2294
3.15.6.3 Structure definition CMN_ERROR..........................................................................................2295
3.15.6.4 Structure definition DM_TYPEREF.........................................................................................2295
3.15.6.5 Structure definition DM_VAR_UPDATE_STRUCT..................................................................2296
3.15.6.6 Structure definition DM_VAR_UPDATE_STRUCTEX.............................................................2297
3.15.6.7 Structure definition DM_VARKEY...........................................................................................2298
3.15.6.8 Structure definition LINKINFO.................................................................................................2299
3.15.6.9 Structure definition MSG_FILTER_STRUCT...........................................................................2300
3.15.6.10 Structure definition MSG_RTDATA_STRUCT...................................................................2303
4

16

ANSI-C function descriptions..................................................................................................................2305


4.1

lpszPictureName.....................................................................................................................2305

4.2
4.2.1
4.2.2
4.2.2.1
4.2.2.2
4.2.2.3

Standard functions..................................................................................................................2306
Standard functions - short description.....................................................................................2306
Alarm.......................................................................................................................................2306
AcknowledgeMessage............................................................................................................2306
AXC_SetFilter..........................................................................................................................2307
GCreateMyOperationMsg.......................................................................................................2308

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

4.2.2.4
4.2.3
4.2.3.1
4.2.3.2
4.2.3.3
4.2.3.4
4.2.3.5
4.2.3.6
4.2.3.7
4.2.4
4.2.4.1
4.2.4.2
4.2.4.3
4.2.5
4.2.5.1
4.2.5.2
4.2.5.3
4.2.5.4
4.2.6
4.2.6.1
4.2.6.2
4.2.6.3
4.2.6.4
4.2.6.5
4.2.6.6
4.2.6.7
4.2.6.8
4.2.7
4.2.7.1
4.2.7.2

GMsgFunction.........................................................................................................................2310
Graphics..................................................................................................................................2311
Graphics - short description....................................................................................................2311
GetLinkedVariable...................................................................................................................2312
GetLocalPicture.......................................................................................................................2312
GetParentPicture.....................................................................................................................2313
GetParentPictureWindow........................................................................................................2314
OpenPicture............................................................................................................................2315
Registry2.................................................................................................................................2316
Obsolete functions...................................................................................................................2317
Alarm.......................................................................................................................................2317
Report......................................................................................................................................2339
TagLog....................................................................................................................................2340
Report......................................................................................................................................2374
Report - short description........................................................................................................2374
RPTJobPreview.......................................................................................................................2374
RPTJobPrint............................................................................................................................2375
RptShowError..........................................................................................................................2375
WinCC.....................................................................................................................................2376
WinCC - short description.......................................................................................................2376
GetHWDiag.............................................................................................................................2376
GetHWDiagLevel.....................................................................................................................2377
GetKopFupAwl........................................................................................................................2379
GetKopFupAwlLevel................................................................................................................2380
OnDeactivateExecute..............................................................................................................2381
OnErrorExecute.......................................................................................................................2381
OnTime....................................................................................................................................2382
Windows..................................................................................................................................2383
Windows - short description....................................................................................................2383
ProgramExecute......................................................................................................................2383

4.3
4.3.1
4.3.2
4.3.2.1
4.3.2.2
4.3.3
4.3.3.1
4.3.3.2
4.3.3.3
4.3.3.4
4.3.3.5
4.3.3.6
4.3.3.7
4.3.3.8
4.3.4
4.3.4.1
4.3.4.2
4.3.4.3
4.3.5
4.3.5.1
4.3.5.2
4.3.5.3

Internal functions.....................................................................................................................2385
Internal functions - short description.......................................................................................2385
allocate....................................................................................................................................2385
SysFree...................................................................................................................................2385
SysMalloc................................................................................................................................2386
c_bib........................................................................................................................................2386
c_bib - short description..........................................................................................................2386
ctype........................................................................................................................................2387
math........................................................................................................................................2396
memory...................................................................................................................................2413
stdio.........................................................................................................................................2416
stdlib........................................................................................................................................2438
string........................................................................................................................................2452
time..........................................................................................................................................2464
graphics...................................................................................................................................2470
Graphics - short description....................................................................................................2470
get...........................................................................................................................................2471
set............................................................................................................................................2629
tag...........................................................................................................................................2797
tag - short description..............................................................................................................2797
get...........................................................................................................................................2798
set............................................................................................................................................2862

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

17

Table of contents

18

4.3.6
4.3.6.1
4.3.6.2
4.3.6.3
4.3.6.4
4.3.6.5
4.3.6.6

WinCC.....................................................................................................................................2908
WinCC - short description.......................................................................................................2908
system.....................................................................................................................................2909
FillDiagnoseInTags..................................................................................................................2912
GetServerTagPrefix.................................................................................................................2913
TraceText................................................................................................................................2914
TraceTime...............................................................................................................................2915

4.4
4.4.1
4.4.1.1
4.4.1.2
4.4.1.3
4.4.1.4
4.4.1.5
4.4.1.6
4.4.1.7
4.4.1.8
4.4.2
4.4.2.1
4.4.2.2
4.4.2.3
4.4.2.4
4.4.2.5
4.4.2.6
4.4.2.7
4.4.2.8
4.4.2.9
4.4.2.10
4.4.2.11
4.4.2.12
4.4.2.13
4.4.2.14
4.4.2.15
4.4.2.16
4.4.2.17
4.4.2.18
4.4.2.19
4.4.2.20
4.4.2.21
4.4.2.22
4.4.2.23
4.4.2.24
4.4.2.25
4.4.2.26
4.4.2.27
4.4.2.28
4.4.3
4.4.3.1
4.4.3.2
4.4.3.3
4.4.3.4
4.4.3.5

Examples.................................................................................................................................2916
Examles - A to G.....................................................................................................................2916
AcknowledgeMessage example..............................................................................................2916
AXC_OnBtnMsgFirst example.................................................................................................2916
Beispiel AXC_OnBtnMsgLast..................................................................................................2916
AXC_OnBtnScroll example.....................................................................................................2917
AXC_OnBtnSinglAckn example..............................................................................................2917
AXC_SetFilter example...........................................................................................................2917
DeactivateRTProject example.................................................................................................2918
ExitWinCC example................................................................................................................2918
Examples - GetAlarmHigh to GetPropChar.............................................................................2919
GetAlarmHigh example...........................................................................................................2919
GetBackColor example...........................................................................................................2919
GetBorderStyle example.........................................................................................................2920
GetFilling example...................................................................................................................2920
GetFillingIndex example..........................................................................................................2921
GetFillStyle example...............................................................................................................2921
GetFlashBackColor example...................................................................................................2922
GetFlashBackColorOn example..............................................................................................2923
GetFlashRateFlashPic example..............................................................................................2923
GetFocus example..................................................................................................................2924
GetFontBold example..............................................................................................................2924
GetFontSize example..............................................................................................................2925
GetHeight example..................................................................................................................2925
GetHiddenInput example.........................................................................................................2926
GetLanguage example............................................................................................................2926
GetLeft example......................................................................................................................2927
GetLink example.....................................................................................................................2927
GetLinkedVariable example....................................................................................................2928
GetLocalPicture example........................................................................................................2929
GetMarker example.................................................................................................................2929
GetOutputValueDouble example.............................................................................................2930
GetParentPicture example......................................................................................................2930
GetPictureDown example........................................................................................................2931
GetPictureName example.......................................................................................................2932
GetPictureUp example............................................................................................................2932
GetPosition example...............................................................................................................2933
GetPropBOOL example..........................................................................................................2934
GetPropChar example.............................................................................................................2934
Examples - GetRangeMax to GetWidth..................................................................................2935
GetRangeMax example...........................................................................................................2935
GetRangeMin example............................................................................................................2936
Beispiel GetScaling.................................................................................................................2936
GetServerTagPrefix example..................................................................................................2937
GetServerTagPrefix example..................................................................................................2938

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

4.4.3.6
4.4.3.7
4.4.3.8
4.4.3.9
4.4.3.10
4.4.3.11
4.4.3.12
4.4.3.13
4.4.3.14
4.4.3.15
4.4.3.16
4.4.3.17
4.4.3.18
4.4.3.19
4.4.3.20
4.4.3.21
4.4.3.22
4.4.3.23
4.4.3.24
4.4.3.25
4.4.3.26
4.4.3.27
4.4.3.28
4.4.3.29
4.4.3.30
4.4.3.31
4.4.4
4.4.4.1
4.4.4.2
4.4.4.3
4.4.4.4
4.4.4.5
4.4.4.6
4.4.5
4.4.5.1
4.4.5.2
4.4.5.3
4.4.5.4
4.4.5.5
4.4.5.6
4.4.5.7
4.4.5.8
4.4.5.9
4.4.5.10
4.4.5.11
4.4.5.12
4.4.5.13
4.4.5.14
4.4.5.15
4.4.5.16
4.4.5.17
4.4.5.18

GetTagBit example..................................................................................................................2939
GetTagBitStateQC example....................................................................................................2939
GetTagBitStateWait example..................................................................................................2940
GetTagChar example..............................................................................................................2941
GetTagCharStateQCWait example.........................................................................................2942
Beispiel GetTagCharStateWait...............................................................................................2942
GetTagFloat example..............................................................................................................2943
GetTagFloatStateQCWait example.........................................................................................2944
GetTagFloatStateWait example..............................................................................................2944
GetTagMultiStateQCWait example.........................................................................................2945
GetTagMultiStateWait example...............................................................................................2946
GetTagMultiWait example.......................................................................................................2947
GetTagPrefix example.............................................................................................................2947
GetTagRaw example...............................................................................................................2948
GetTagRawStateQCWait example..........................................................................................2948
GetTagRawStateWait example...............................................................................................2949
GetTagSByte example............................................................................................................2950
GetTagSByteStateQCWait example.......................................................................................2950
GetTagSByteStateWait example.............................................................................................2951
GetTagWord example.............................................................................................................2951
GetTagWordStateQCWait example........................................................................................2952
GetTagWordStateWait example..............................................................................................2952
GetText example.....................................................................................................................2953
GetTop example......................................................................................................................2954
GetVisible example.................................................................................................................2954
GetWidth example...................................................................................................................2955
Examples - H to S...................................................................................................................2955
InquireLanguage example.......................................................................................................2955
ProgramExecute example.......................................................................................................2956
ResetFilter example................................................................................................................2956
RPTJobPreview example........................................................................................................2957
RPTJobPrint example.............................................................................................................2957
SysMalloc example.................................................................................................................2957
Examples - SetAlarmHigh to SetPropChar.............................................................................2957
SetAlarmHigh example............................................................................................................2957
SetBackColor example............................................................................................................2958
SetBorderEndStyle example...................................................................................................2958
SetBorderStyle example..........................................................................................................2959
SetColorAlarmHigh example...................................................................................................2959
Example - SetCursorMode......................................................................................................2960
SetFilling example...................................................................................................................2960
SetFillingIndex example..........................................................................................................2960
SetFillStyle example................................................................................................................2961
SetFlashBackColor example...................................................................................................2961
SetFlashBackColorOn example..............................................................................................2961
SetFlashRateFlashPic example..............................................................................................2962
SetFocus example...................................................................................................................2962
SetFontBold example..............................................................................................................2962
SetFontSize example..............................................................................................................2963
SetHeight example..................................................................................................................2963
SetHiddenInput example.........................................................................................................2963
SetLanguage example............................................................................................................2964

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

19

Table of contents

20

4.4.5.19
4.4.5.20
4.4.5.21
4.4.5.22
4.4.5.23
4.4.5.24
4.4.5.25
4.4.5.26
4.4.5.27
4.4.5.28
4.4.6
4.4.6.1
4.4.6.2
4.4.6.3
4.4.6.4
4.4.6.5
4.4.6.6
4.4.6.7
4.4.6.8
4.4.6.9
4.4.6.10
4.4.6.11
4.4.6.12
4.4.6.13
4.4.6.14
4.4.6.15
4.4.6.16
4.4.6.17
4.4.6.18
4.4.6.19
4.4.6.20
4.4.6.21
4.4.6.22
4.4.7
4.4.7.1
4.4.7.2
4.4.7.3
4.4.7.4
4.4.7.5
4.4.7.6
4.4.7.7
4.4.7.8
4.4.7.9
4.4.8
4.4.8.1
4.4.8.2

SetLeft example......................................................................................................................2964
SetLink example......................................................................................................................2964
SetMarker example.................................................................................................................2965
SetOutputValueDouble example.............................................................................................2965
SetPictureDown example........................................................................................................2966
SetPictureName example........................................................................................................2966
SetPictureUp example.............................................................................................................2966
SetPosition example................................................................................................................2967
SetPropBOOL example...........................................................................................................2967
SetPropChar example.............................................................................................................2967
Examples - SetRangeMax to SetWidth...................................................................................2968
SetRangeMax example...........................................................................................................2968
SetRangeMin example............................................................................................................2968
SetScaling example.................................................................................................................2968
SetTagBit example..................................................................................................................2969
Beispiel SetTagBitStateWait...................................................................................................2969
SetTagChar example..............................................................................................................2970
SetTagCharStateWait example...............................................................................................2970
SetTagFloat example..............................................................................................................2970
SetTagFloatStateWait example...............................................................................................2971
SetTagMultiStateWait example...............................................................................................2971
SetTagMultiWait example.......................................................................................................2972
SetTagPrefix example.............................................................................................................2973
SetTagRaw example...............................................................................................................2973
SetTagRawStateWait example...............................................................................................2974
SetTagSByte example.............................................................................................................2974
Beispiel SetTagSByteStateWait..............................................................................................2975
SetTagWord example..............................................................................................................2975
Beispiel SetTagWordStateWait...............................................................................................2976
SetText example.....................................................................................................................2976
SetTop example......................................................................................................................2977
SetVisible example..................................................................................................................2977
SetWidth example...................................................................................................................2977
Examples - T to Z....................................................................................................................2978
TlgGetNumberOfColumns example........................................................................................2978
TlgGetNumberOfColumns example........................................................................................2978
TlgGetNumberOfRows example.............................................................................................2979
TlgGetRulerTimeTrend example.............................................................................................2980
TlgGetRulerVariableNameTrend example..............................................................................2980
TlgTrendWindowPressOpenDlgButton example.....................................................................2981
TlgTrendWindowPressStartStopButton example....................................................................2982
TlgTrendWindowPressZoomInButton example.......................................................................2982
TlgTrendWindowPressZoomOutButton example....................................................................2982
Examples of WinCC controls...................................................................................................2983
How to add elements to a WinCC OnlineTrendControl...........................................................2983
How to add elements to a WinCC OnlineTrendControl ..........................................................2984

4.5
4.5.1
4.5.2
4.5.3
4.5.4
4.5.5

Lists.........................................................................................................................................2986
Bar direction............................................................................................................................2986
Bar Scaling..............................................................................................................................2986
Flash frequencies....................................................................................................................2986
I/O field, output format.............................................................................................................2987
I/O field, data type of the field content.....................................................................................2988

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

4.5.6
4.5.7
4.5.8
4.5.9
4.5.10
4.5.11
4.5.12
4.5.13
4.5.14
4.5.15
4.5.16

I/O field, field type....................................................................................................................2988


Element alignment in check boxes and radio boxes...............................................................2988
Color chart...............................................................................................................................2989
Format descriptors..................................................................................................................2989
Fill pattern................................................................................................................................2990
Line styles...............................................................................................................................2991
Line end style..........................................................................................................................2992
List types.................................................................................................................................2992
Language ID............................................................................................................................2993
Text alignment.........................................................................................................................2994
Tag statuses............................................................................................................................2994

4.6
4.6.1
4.6.2
4.6.3
4.6.4
4.6.5
4.6.6
4.6.7
4.6.8
4.6.9
4.6.10

Structure definitions.................................................................................................................2996
Structure definition CCAPErrorExecute..................................................................................2996
Structure definition CCAPTime...............................................................................................2997
Structure definition CMN_ERROR..........................................................................................2998
Structure definition DM_TYPEREF.........................................................................................2999
Structure definition DM_VAR_UPDATE_STRUCT..................................................................3000
Structure definition DM_VAR_UPDATE_STRUCTEX.............................................................3001
Structure definition DM_VARKEY...........................................................................................3002
Structure definition LINKINFO.................................................................................................3002
Structure definition MSG_FILTER_STRUCT...........................................................................3004
Structure definition MSG_RTDATA_STRUCT.........................................................................3007

VBA for Automated Configuration..........................................................................................................3009


5.1

Automated configuration.........................................................................................................3009

5.2
5.2.1
5.2.2
5.2.3
5.2.4
5.2.5

Introduction: Using VBA in WinCC..........................................................................................3010


Introduction: Using VBA in WinCC..........................................................................................3010
Differentiation: Using VBA.......................................................................................................3010
Organizing VBA Code in a WinCC Project..............................................................................3011
How to export and import VBA code.......................................................................................3014
Executing VBA Macros in Graphics Designer.........................................................................3015

5.3
5.3.1
5.3.2
5.3.2.1
5.3.2.2
5.3.2.3
5.3.2.4
5.3.3
5.3.3.1
5.3.3.2
5.3.3.3
5.3.3.4
5.3.4
5.3.4.1
5.3.4.2
5.3.4.3
5.3.4.4
5.3.5
5.3.5.1
5.3.5.2

VBA in the Graphics Designer.................................................................................................3017


VBA in the Graphics Designer.................................................................................................3017
Adapting the Graphics Designer with VBA..............................................................................3019
Adapting the Graphics Designer with VBA..............................................................................3019
Language-Dependent Configuration with VBA........................................................................3020
Creating Customized Menus and Toolbars.............................................................................3022
Accessing the component library with VBA.............................................................................3042
Editing Pictures with VBA........................................................................................................3049
Editing Pictures with VBA........................................................................................................3049
How to Create Picture-specific Menus and Toolbars..............................................................3050
Editing Layers with VBA..........................................................................................................3052
Editing a Copy of a Picture with VBA......................................................................................3053
Editing Objects with VBA.........................................................................................................3055
Editing Objects with VBA.........................................................................................................3055
Default objects, Smart objects, Windows objects and Tube objects.......................................3057
Group Objects.........................................................................................................................3069
Customized Objects................................................................................................................3076
Creating Dynamics with VBA..................................................................................................3081
Creating Dynamics with VBA..................................................................................................3081
Configuring Dynamics in the Properties of Pictures and Objects............................................3082

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

21

Table of contents

5.3.5.3
5.3.5.4
5.3.6
5.3.7
5.3.7.1
5.3.7.2

Configuring Event-Driven Actions with VBA............................................................................3094


Editing Triggers.......................................................................................................................3102
Event Handling........................................................................................................................3105
Accessing External Applications with VBA..............................................................................3108
Accessing External Applications with VBA..............................................................................3108
Example: Accessing MS Excel with VBA................................................................................3109

5.4
5.4.1
5.4.2
5.4.3
5.4.4
5.4.4.1
5.4.4.2

AddIns.....................................................................................................................................3115
AddIns.....................................................................................................................................3115
Linking Add Ins........................................................................................................................3115
How to Configure an AddIn in the Graphics Designer.............................................................3118
Example: Creating Add Ins......................................................................................................3119
Example: Creating Add Ins......................................................................................................3119
Example: Creating an Add In with Visual Basic 6.0................................................................3120

5.5
5.5.1
5.5.1.1
5.5.1.2
5.5.1.3
5.5.1.4
5.5.1.5
5.5.1.6
5.5.1.7
5.5.1.8
5.5.2
5.5.2.1
5.5.2.2
5.5.2.3
5.5.2.4
5.5.2.5

VBA Reference........................................................................................................................3126
The object model of the Graphics Designer............................................................................3126
VBA Reference........................................................................................................................3126
VBA Reference: ActionDynamic..............................................................................................3128
VBA Reference: HMIObjects...................................................................................................3130
VBA Reference: Languages....................................................................................................3132
Events.....................................................................................................................................3133
Methods...................................................................................................................................3167
Objects and Lists.....................................................................................................................3269
Properties................................................................................................................................3472
VBA in Other WinCC Editors...................................................................................................3889
VBA in Other WinCC Editors...................................................................................................3889
VBA in Tag Management........................................................................................................3891
VBA im Tag Logging...............................................................................................................3902
VBA in the Text Library...........................................................................................................3935
VBA in Alarm Logging.............................................................................................................3948

VBA Reference.......................................................................................................................................3963
6.1
6.1.1
6.1.2
6.1.3
6.1.4
6.1.5
6.1.5.1
6.1.5.2
6.1.6
6.1.6.1
6.1.6.2
6.1.6.3
6.1.7
6.1.7.1
6.1.7.2
6.1.7.3
6.1.7.4
6.1.8
6.1.8.1
6.1.8.2

22

The object model of the Graphics Designer............................................................................3963


VBA Reference........................................................................................................................3963
VBA Reference: ActionDynamic..............................................................................................3965
VBA Reference: HMIObjects...................................................................................................3967
VBA Reference: Languages....................................................................................................3969
Events.....................................................................................................................................3970
A-D..........................................................................................................................................3970
F-Z...........................................................................................................................................3987
Methods...................................................................................................................................4004
A-C..........................................................................................................................................4004
D-M..........................................................................................................................................4046
O-Z..........................................................................................................................................4081
Objects and Lists.....................................................................................................................4106
0-9, A-C...................................................................................................................................4106
D-I............................................................................................................................................4152
L-Q..........................................................................................................................................4204
R-Z..........................................................................................................................................4254
Properties................................................................................................................................4310
A..............................................................................................................................................4310
B..............................................................................................................................................4332

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Table of contents

6.1.8.3
6.1.8.4
6.1.8.5
6.1.8.6
6.1.8.7
6.1.8.8
6.1.8.9
6.1.8.10
6.1.8.11
6.1.8.12
6.1.8.13
6.1.8.14
6.1.8.15
6.1.8.16
6.1.8.17
6.1.8.18

C..............................................................................................................................................4368
D..............................................................................................................................................4408
E..............................................................................................................................................4416
F..............................................................................................................................................4425
G-H..........................................................................................................................................4458
I - K..........................................................................................................................................4468
L..............................................................................................................................................4481
M.............................................................................................................................................4510
N-O..........................................................................................................................................4533
P-Q..........................................................................................................................................4547
R..............................................................................................................................................4578
S..............................................................................................................................................4586
T..............................................................................................................................................4610
U..............................................................................................................................................4638
V..............................................................................................................................................4646
W - Z........................................................................................................................................4718

6.2
6.2.1
6.2.2
6.2.2.1
6.2.2.2
6.2.2.3
6.2.2.4
6.2.2.5
6.2.2.6
6.2.2.7
6.2.3
6.2.3.1
6.2.3.2
6.2.3.3
6.2.3.4
6.2.3.5
6.2.3.6
6.2.3.7
6.2.3.8
6.2.3.9
6.2.3.10
6.2.3.11
6.2.3.12
6.2.3.13
6.2.3.14
6.2.3.15
6.2.3.16
6.2.3.17
6.2.3.18
6.2.3.19
6.2.4
6.2.4.1
6.2.4.2
6.2.4.3
6.2.4.4
6.2.4.5

VBA in Other WinCC Editors...................................................................................................4727


VBA in Other WinCC Editors...................................................................................................4727
VBA in Tag Management........................................................................................................4729
VBA in Tag Management........................................................................................................4729
CloseTag Function..................................................................................................................4732
CommitTag Function...............................................................................................................4733
CreateTag Function.................................................................................................................4734
DeleteTag Function.................................................................................................................4736
GetTag Function......................................................................................................................4737
ListTag function.......................................................................................................................4738
VBA im Tag Logging...............................................................................................................4740
VBA in Tag Logging................................................................................................................4740
CloseTlgArchive Function.......................................................................................................4747
CloseTlgTag Function.............................................................................................................4749
CloseTlgTrigger function.........................................................................................................4750
CommitTlgArchive Function....................................................................................................4751
CommitTlgTag Function..........................................................................................................4752
CommitTlgTrigger function......................................................................................................4754
CreateTlgArchive Function......................................................................................................4754
CreateTlgTag Function............................................................................................................4757
CreateTlgTrigger function........................................................................................................4761
DeleteTlgArchive Function......................................................................................................4763
DeleteTlgTag Function............................................................................................................4764
DeleteTlgTrigger function........................................................................................................4765
GetTlgArchive Function...........................................................................................................4766
GetTlgTag Function.................................................................................................................4767
GetTlgTrigger function.............................................................................................................4768
ListTlgArchive Function...........................................................................................................4769
ListTlgTag Function.................................................................................................................4770
ListTlgTrigger function.............................................................................................................4772
VBA in the Text Library...........................................................................................................4772
VBA in the Text Library...........................................................................................................4772
CreateTextLanguage Function................................................................................................4773
CreateText Function................................................................................................................4775
DeleteText Function................................................................................................................4776
DeleteTextLanguage Function................................................................................................4778

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

23

Table of contents

6.2.4.6
6.2.4.7
6.2.4.8
6.2.4.9
6.2.5
6.2.5.1
6.2.5.2
6.2.5.3
6.2.5.4
6.2.5.5
6.2.5.6
6.2.5.7

GetText Function.....................................................................................................................4779
GetTextID Function.................................................................................................................4780
ListText Function.....................................................................................................................4782
ModifyText Function................................................................................................................4783
VBA in Alarm Logging.............................................................................................................4785
VBA in Alarm Logging.............................................................................................................4785
CloseSingleAlarm Function.....................................................................................................4788
CommitSingleAlarm Function..................................................................................................4789
CreateSingleAlarm Function...................................................................................................4790
DeleteSingleAlarm Function....................................................................................................4793
GetSingleAlarm Function........................................................................................................4795
ListSingleAlarm Function.........................................................................................................4796

Index.......................................................................................................................................................4799

24

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.1

VBS for creating procedures and actions

Contents
WinCC provides the possibility of dynamizing the Runtime environment using the Visual Basic
Script. It is possible to use VBS to program global actions and procedures as well as
dynamizing graphic objects and triggering actions in Runtime.
This chapter will show you
How to work with VBScript editors
How to create and edit procedures
How to create and edit actions
How to activate VBScripts in Runtime
How to execute diagnostics on scripts in Runtime
The object model of graphic Runtime system
Detailed examples on using VBScript

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

25

VBS for Creating Procedures and Actions


1.2 Using Visual Basic Script in WinCC

1.2

Using Visual Basic Script in WinCC

Introduction
In addition to the C script, WinCC also provides the VBScript program language as a
programming interface in order to make the WinCC Runtime environment dynamic.

Target Group of the Documentation


This documentation is aimed at project engineers with experience of Visual Basic or WinCC
Scriptings (C) used to date.

Application Options
VBScript (VBS) provides access to tags and objects of the graphical Runtime system at
Runtime and can execute picture-independent functions:
Tags: Tag values can be read and written in order, for example, to specify tag values for
the PLC by clicking the mouse when positioned on a button.
Objects: Object properties can be made dynamic using actions and actions can be triggered
by events influencing objects.
Picture-independent Actions: Picture-independent actions can be triggered cyclically or
according to tag values, e.g. for the daily transfer of values into an Excel table.
VBS can be used at the following points in WinCC:
In the Global Script Editor: This is used to configure picture-independent actions and
procedures. The procedures can be used in picture-dependent and picture-independent
actions. Several procedures are compiled in a topic-related module.
In Graphics Designer: Picture-dependent actions can be configured with which the
properties of graphic objects can be made dynamic or caused to respond to events in
Runtime.
In user-defined menus and toolbars: Here you configure procedures called in Runtime using
the menu and toolbars.
Note
Updating Changed Configuration in Runtime
A changed VB script that is connected with "Menus and toolbars" is only updated after
Runtime is restarted.
If you change the properties of "Menus and toolbars" in Runtime, the changes are only
applied in the following cases:
After a picture change, if the configuration change does not affect the basic picture.
When you load another configuration file and reload the modified configuration file.

26

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.2 Using Visual Basic Script in WinCC

Registered Tags in Menus and Toolbars


The registered tags in the scripts of "Menus and toolbars" remain registered when you unselect
the picture. If you read indirectly from a process mapping the tags are registered and
unregistered again when you unselect the picture. However, registered tags in the scripts of
"Menus and toolbars" remain registered when you unselect the picture.

Application Scenarios
VBS can be used in Runtime, for example:
to configure setpoint value specification for tags for the operation of a graphic object in
order to define a value for the PLC by clicking a mouse, for example.
to configure switching the Runtime language for the operation of a graphic object.
to configure the change of color, e.g. cyclically (flashing) or to display statuses (motor on).
Apart from the specific WinCC applications, the general functionality of VBS can also be used
to customize the Windows environment, e.g.:
to transfer data to another application (e.g. Excel).
to start external applications from WinCC.
to create files and folders.
The automation objects in your environment are available with which to customize the Windows
environment.
Note
All the objects supplied with the Windows Script Host (WSH) from Microsoft can be integrated
in the environment using the standard VBS method CreateObject. However, there is no direct
access to the WSH object itself using VBS from WinCC.
There is no guarantee nor WinCC support for the VBS functionality with regard to its
adaptation to the Windows environment.

Limits to Other Programming Languages in WinCC


VBS and C
VBScript can be used in WinCC parallel to C-Script, but do not mix the script types:
VBScripts and C-scripts can be configured within a picture and project.
C-scripts cannot be invoked in VBScripts and vice versa.
VBS provides internal interfaces to tags and picture objects while the C environment
enables access to other WinCC subsystems (e.g. the report system).
VBS and VBA
VBA is used in WinCC Configuration during the configuration in order to adapt Graphics
Designer to your individual requirements and to simplify and automate configuration. VBA
programs only run in the WinCC configuration environment.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

27

VBS for Creating Procedures and Actions


1.2 Using Visual Basic Script in WinCC
As opposed to VBA, VB scripts only run in WinCC Runtime and, from there, enable access to
graphic objects and tags. Objects and pictures can be neither created nor modified on a
permanent basis in VBS, as opposed to VBA.
The main language-related differences between VBA and VBS are e.g.:
VBS was developed for use in Internet, VBA for the automation of software applications.
The data type of VBS tags is always VARIANT. VBA, on the other hand, differentiates the
individual data types such as INT, DOUBLE, STRING, etc.
Certain language constructs from VBA have been removed from or added to VBS.
Errors are handled differently in VBS compared to VBA.
A complete list of the differences between VBA and VBS is provided in the Appendix in "Basic
Principles of VBScript".

Procedures, Modules and Actions


VBS in WinCC allows the use of procedures, modules and actions to make the Runtime
environment dynamic:
Procedures: Codes are stored in procedures which are then used at several points in the
configuration. Retrieve the code or another procedure in an action by invoking the
procedure name. Procedures can be created in WinCC with or without return values.
Procedures do not have their own trigger, they are always retrieved by an action.
Modules: It is advantageous to compile related procedures to units in modules. Create
modules for procedures, for example, which must be used in a specific picture or belong
to a specific topic, such as auxiliary mathematical functions or database access functions.
Actions: Actions are always activated by a trigger, namely a triggering event. Actions are
configured in graphic object properties, in events which occur on a graphic object or globally
in a project. Codes used several times can be called, in the form of procedures, in actions.

28

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.3 Modules and Procedures

1.3

Modules and Procedures

Introduction
Procedures are used to make code, created only once, available at several points in a project.
Instead of entering the code several times, simply call in the corresponding procedure. The
code is clearer and easier to maintain.

Related procedures should be stored in modules. When a certain procedure is retrieved via
an action in Runtime, the module that contains that procedure is loaded. Observe the following
when structuring the modules and procedures:
The more modules that must be loaded when a picture is called in, the worse the
performance in Runtime.
The larger a module, the more procedures are contained and, thus, the longer the loading
time for the module.
Organize the modules sensibly, e.g. a module with procedures for a specific system part/
picture.
Another type of structuring of procedures in modules is the functional structuring, e.g. a module
containing mathematical functions. Use this structure, for example, for modules which should
be used globally for projects. The following example illustrates a module containing
mathematical functions derived from the standard functions:
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

29

VBS for Creating Procedures and Actions


1.3 Modules and Procedures

Procedure Features
The procedures in WinCC have the following properties:
They are created and modified by the user.
They can be protected against modification and viewing by means of a password.
They do not have a trigger.
They are stored in a module.
WinCC does not provide predefined procedures, but does provide code templates and
Intellisense, for example, to simplify programming. Procedures differ according to module
assignment in:
Standard procedures apply globally to projects located on the computer on which they were
created.
Project procedures can only be used within the project in which they were created.

30

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.3 Modules and Procedures

Module Features
A module is a file in which one or procedures is stored. The modules in WinCC have the
following properties:
They can be protected against modification and viewing by means of a password.
The have the file extension *.bmo.
Modules differ according to the validity of their procedures in:
Standard Modules: Contain procedures which are globally available to the project. Standard
modules are stored in the WinCC file system under: <WinCC-Installationsverzeichnis>
\ApLib\ScriptLibStd\<Modulname>.bmo
Project Modules: Contain project-specific procedures. Project modules are stored in the
WinCC file system under: <Projektverzeichnis>\ScriptLib\<Modulname>.bmo. Since the
project modules are stored in the project directory, they are copied when the WinCC project
is copied.
Note
If WinCC must be reinstalled and the standard procedures and modules need to be used
again, save the module files prior to the reinstallation in a different directory and copy them
in the relevant WinCC directory after the reinstallation has been completed. Otherwise,
the standard modules in the WinCC installation directory are deleted during the installation
routine.

Using Procedures and Modules


Procedures are used in:
Actions (in Graphics Designer and Global Script)
Other procedures (in Global Script)
User-defined menus and toolbars
Procedures are structured in modules.

See also
Creating and Editing Procedures (Page 50)
VBScript Editors (Page 40)
Basic Principles of VBScript (Page 839)
Actions (Page 32)
Using Visual Basic Script in WinCC (Page 26)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

31

VBS for Creating Procedures and Actions


1.4 Actions

1.4

Actions

Introduction
An action is always started by a trigger. An action, for example, is triggered in Runtime when
an object is operated by a mouse click, a certain time has occurred or a tag has been modified.

Action Features
Actions are defined once in Global Script and then available independent of the picture. Global
Script actions are only valid in the project in which they were defined. Actions linked to a graphic
object are only valid in the picture in which they were defined.
Note
VBS does not currently allow the creation of computer-specific actions.
The following applies for clients in a multi-user system: All global actions configured on a
server are also executed on a client when a project is opened.
The following applies to clients in a distributed system: If actions should be used on a client
computer, copy all the action files in the corresponding project directory on the client.
Actions have the following properties:
Actions are created and modified by the user.
Actions in Global Script can be protected against modification and viewing by means of a
password.
Actions have at least one trigger.
Actions in Global Script have the file extension *.bac.
Global Script actions are stored in the WinCC file system under: <Projektverzeichnis>
\ScriptAct\Aktionsname.bac

Action Trigger
Triggers are required to execute actions in Runtime. A trigger is linked to an action thus forming
the triggering event which calls the action. Actions without triggers will not be carried out.
The following trigger types are available in WinCC:
Timer: Acyclic or cyclic trigger, e.g. for calling a picture or every hour.
Tags: Change of value
Event: Modification of object properties (e.g. change of color) or event on an object (e.g.
mouse click).

32

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.4 Actions

Processing of Actions in Runtime


In Graphics Designer
Two actions of the same type can be executed simultaneously in Runtime. In order, for
example, that cyclic actions are not hindered by an action executed by a mouse click, event
triggered actions and cyclic/tag triggered actions in Graphics Designer are executed
independently of each other.
Note
Please note that synchronization between both action types in WinCC may only be executed
by the DataSet object or by internal WinCC tags. As a result of the separate processing, no
common data area exists between event triggered and cyclic/tag triggered actions.
If processing cyclic actions in pictures, for example, is prevented by a high system load or
another action, the action is started once at the next opportunity. Cycles which are not executed
are not retained in a queue but rejected.
After a change of picture, scripts still running are automatically stopped 1 minute after the
change of picture.
Scripts which are still running when Runtime is terminated are stopped after 5 seconds.
In Global Script
Picture-independent actions from Global Script are executed in Runtime in succession after
being triggered. If an action is triggered while another action is in progress, the second action
is retained in a queue until it can be executed.
Note
Please note that synchronization between actions in Global Script and in Graphics Designer
may only be executed by the DataSet object or by internal WinCC tags. There is no common
data area between the actions in Graphics Designer and in Global Script.

Using the Actions


Actions can be used as follows:
In Global Script The global actions defined here run picture-independent in Runtime.
In Graphics Designer: The actions defined here only run in the configured picture. An action
is configured in Graphics Designer on an object property or an event on a graphic object.

See also
Creating and Editing Actions (Page 66)
Basic Principles of VBScript (Page 839)
Modules and Procedures (Page 29)
Using Visual Basic Script in WinCC (Page 26)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

33

VBS for Creating Procedures and Actions


1.5 Multiple Use of Procedures and Actions

1.5

Multiple Use of Procedures and Actions

Introduction
An action configured with VBS in WinCC is always valid for the project in which it was defined.
Procedures have the following areas of application:
Standard procedures apply globally to projects located on the computer on which they were
created.
Project procedures can only be used in the project in which they were created. If a project
is copied, the project procedures (modules) are copied together with the project.

Multiple Use of Procedures and Actions


If actions or procedures/modules are to be used in other projects or on other computers, it is
possible either to:
use the "Save As" function to store the action or module in a different project directory or,
for example, on a disk.
to copy the action or module file in Windows Explorer and paste it in the corresponding
project or standard directory on the target computer.
The properties and trigger configured are retained during copying. Copied modules are directly
available in Runtime. Copied actions are executed in Runtime after they have been opened
and stored once.
Note
Tags used in an action or procedure must also be available on the target computer. If the tag
is not available, the action or procedure is not executed.
Procedures which are called in an action must be available on the target computer. If the
procedure is not available, a Runtime error occurs during Runtime.

Storing Procedures
If procedures need to be copied in other project directories in order to be able to use then in
other projects or different computers, observe the storage path of the procedures in the WinCC
file system:
Standard procedures: <WinCC-Installationsverzeichnis>\ApLib\ScriptLibStd
\Modulname.bmo
Project procedures: <Projektverzeichnis>\ScriptLib\Modulname.bmo
Note
Since procedures are always stored in modules, always copy the module (*.bmo) in which
the procedure is contained.

34

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.5 Multiple Use of Procedures and Actions
The copied procedures/modules are visible after updating the Global Script navigation window
(context menu command "Update") or restarting the editor.

Storing Actions
If actions need to be copied in other project directories in order to be able to use then in other
projects or different computers, observe the storage path of the actions in the WinCC file
system:
<Projektverzeichnis>\ScriptAct\Aktionsname.bac
Each action is stored in a separate file. When an action is copied, all the triggers related to it
are also copied.
Note
Only actions created in Global Script are stored in the WinCC file system. Actions which are
programmed in Graphics Designer are always stored with the current picture and cannot be
transferred individually. If a Graphics Designer picture is copied into another project directory,
the actions stored with the picture are also copied.
The copied actions are visible after updating the Global Script navigation window (context
menu command "Update") or restarting the editor.

See also
Modules and Procedures (Page 29)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Creating and Editing Procedures (Page 50)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

35

VBS for Creating Procedures and Actions


1.6 Use of CrossReference

1.6

Use of CrossReference

CrossReference and Tag Trigger


The CrossReference from WinCC can be used to quickly find all the application points of tags,
even in VBS actions. Tag triggers in actions in Graphics Designer can be "linked" using
CrossReference, i.e. replaced by other tags at all or selected points.
Note
Tags can also be directly linked in Graphics Designer by marking the graphic object and
selecting the "Linking ..." command from the shortcut menu.
Further information on CrossReference is available in the WinCC documentation.

Actions and CrossReference


All the actions used in a picture can be displayed by means of the picture properties. To do
this mark the picture in WinCC Explorer and select the "Properties" shortcut menu command.
After double clicking on an entry, detailed information on the type of dynamics appears.
It is also possible to display all the tags and pictures used in actions by means of the WinCC
CrossReference. CrossReference can also be used for the to link tag connections of Graphics
Designer actions easily.

Tags and CrossReference


All tags addressed with the following standard formulation are automatically compiled by the
CrossReference of WinCC and then listed in the picture properties.

' VBS1
HMIRuntime.Tags("Tagname")

If tags are addressed with different formulations in the code, this can be notified by the following
section of the CrossReference:

' WINCC:TAGNAME_SECTION_START
Const TagNameInAction = "TagName"
' WINCC:TAGNAME_SECTION_END

The section can be inserted in VBS actions as often as required.


Note
It is not possible to guarantee the compilation of combined tag names from the
CrossReference.

36

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.6 Use of CrossReference

Pictures and CrossReference


All pictures addressed with the following standard formulation are automatically compiled by
the CrossReference of WinCC and then listed in the picture properties.

'VBS2
HMIRuntime.BaseScreenName = "Screenname"

If pictures are addressed with different formulations in the code, this can be notified by the
following section of the CrossReference:

' WINCC:SCREENNAME_SECTION_START
Const ScreenNameInAction = "ScreenName"
' WINCC:SCREENNAME_SECTION_END

The section can be inserted in VBS actions as often as required.


Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

See also
VBS Reference (Page 120)
VBScript Editors (Page 40)
Basic Principles of VBScript (Page 839)
Actions (Page 32)
Modules and Procedures (Page 29)
Using Visual Basic Script in WinCC (Page 26)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

37

VBS for Creating Procedures and Actions


1.7 Using Global Tags in VBS

1.7

Using Global Tags in VBS

Introduction
Global tags can be defined in the Global Script Editor which can then be used in all actions
and procedures.

Using Global Tags in Graphics Designer and Global Script


Observe the following conditions when using global tags in Graphics Designer and Global
Script:
In order to use a global tag in an action in Graphics Designer, call in the procedure in which
the tag is defined so that the associated module is loaded in Runtime.
In order to use a global tag in an action in Global Script, at least one procedure must be
activated from the module in at least one global action in which the tag is defined so that
the module is loaded in Global Script Runtime. This does not need to be the procedure in
which the tag was defined.
This process is necessary because actions from Global Script and Graphics Designer are
processed independently of each other in Runtime. There is no common data area between
the two Runtime systems.
If you need to synchronize actions from Global Script and Graphics Designer, use the DataSet
object or internal WinCC tags.

Using Global Tags in Graphics Designer


When using global tags in Graphics Designer, observe the following conditions:
In order to use a global tag in cyclic or tag triggered action in Graphics Designer, call in the
procedure in which the tag is defined. This also applies when the tag has already been
called in an event triggered action.
In order to use a global tag in an event triggered action in Graphics Designer, call in the
procedure in which the tag is defined. This also applies when the tag has already been
called in a cyclic or tag triggered action.
This process is necessary because the cyclic/tag triggered actions and the event triggered
actions in Graphics Designer in Runtime are processed independently of each other in
Runtime. There is no common data area between the two types of action.
If you need to synchronize cyclic or tag-triggered actions and event-triggered actions, use the
DataSet object or internal WinCC tags.
In the case of Graphics Designer, it is also possible to define global tags in a separate
declaration section. Because event-triggered and cyclic/tag-triggered actions are processed
separately in Runtime, the global tags can only be jointly addressed within the event-triggered
or cyclic/tag-triggered actions.

38

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.7 Using Global Tags in VBS

See also
Basic Principles of VBScript (Page 839)
Structure of VBScript Files (Page 107)
Creating and Editing Actions (Page 66)
Creating and Editing Procedures (Page 50)
VBScript Editors (Page 40)
Use of CrossReference (Page 36)
Actions (Page 32)
Modules and Procedures (Page 29)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

39

VBS for Creating Procedures and Actions


1.8 VBScript Editors

1.8

VBScript Editors

1.8.1

VBScript Editors

Introduction
VBScripts can be programmed at two points in WinCC:
In Global Script Global Script is the central editor for VBS programming. Call it in via WinCC
Explorer.

In Graphics Designer: Graphics Designer can be used to program actions related to object
properties or events related to graphic objects. The action editor in Graphics Designer is
called in via the context menu in the Properties dialog of a graphic object.

40

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.8 VBScript Editors

Restrictions, Global Script - Graphics Designer


Graphics Designer can be used to program actions and picture-specific procedures but not
global procedures valid for the entire project. However, global procedures which were
programmed in Global Script can be called in.
Note
This documentation is used primarily to describe Global Script and, if necessary, makes
reference to deviations in the functionality compared to Graphics Designer. A detailed
description of the Graphics Designer action editor is provided in the WinCC help topic
"Dynamization".

Further Information
Further information on "Dynamization" is available in the WinCC documentation.

See also
Global Script Editor (Page 41)

1.8.2

Global Script Editor

Introduction
Global procedures and actions are created and edited in the Global Script editor.
Global Script provides a similar range of functions to that of the C script editor in WinCC.
Note
A detailed description of the action editor for the creation of picture-based actions and
procedures in Graphics Designer is provided under the WinCC help topic "Dynamics".

Starting Global Script


Global Script is started using the shortcut menu "Open" command in the WinCC Explorer
project window.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

41

VBS for Creating Procedures and Actions


1.8 VBScript Editors
Global Script is also automatically started when a module or action is opened by means of a
double click in WinCC Explorer.

Design of Global Script


Global Script editor is designed in accordance with the Windows standards.
The action editor in the Graphics Designer provides a similar range of functions to that of Global
Script. A description of the Graphics Designer action editor is provided in the WinCC help topic
"Dynamization".




Menu bar (1) and toolbars (2)


All the commands required to create procedures and actions are provided in the menu bar and
toolbars.
The toolbars can be displayed and hidden using the "View" > "Toolbars" command and can
be moved to any position within the editor.
Navigation window (3)
In the navigation window you manage your procedures, modules and actions. In addition you
can find here code templates which you can insert by drag&drop into your action or procedure.
A procedure can be called in another procedure or action by dragging them from the navigation
window and dropping them at the relevant point in the code.

42

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.8 VBScript Editors
The display in the navigation window is always updated during the saving of the edited
document. If you change a file, this will be displayed by a * behind the file name.
The procedures contained in a module are displayed in the navigation window underneath the
module file. The Actions tab control also displays the trigger and procedures configured for an
action, if necessary those directly defined in an action module.
The navigation window can still be used to:
Create subdirectories for structuring the scripts.
Move, copy, paste, delete and rename modules and directories directly.
The display in the navigation window can be individually configured with the "View" >
"Workplace" menu commands. It is possible to select whether all file types, only script files or
only syntactically correct files should be displayed. The navigation window can be shown or
hidden with the "View" > "Workplace" > "Display" menu commands.
Editing window (4)
You write and edit your actions in the editing window. Each procedures or action will be opened
in its own editing window. Several editing windows can be open at the same time.
The user is supported by in the editing window by Highlight Syntax and Intellisense. All general
editor functions (e.g. Undo/Redo, Find/Replace, Copy, Paste, Cut, Font Settings, Printer
Settings) remain available.
Output window (5)
Error messages are displayed in the output window following the syntax check. Double click
on the corresponding error line to access the related point in the code.
Status bar (6)
The status bar contains information on the currently selected functionality or hints on
programming.
Note
If information on individual editor commands or icons is required, select the "?" menu icon.
> "What's This?". Then click the mouse button on the corresponding icon/command. This
provides fast, direct help on all the operating elements in the editors. Press "ESC" to exit
"What's This?" help mode.

Window docking
Window docking is a useful tool for the flexible arrangement of windows. It lets you reposition
windows to obtain separate windows, or group windows in tab groups. For example, you can
arrange your actions horizontally, vertically, or as tab group. You can automatically hide
windows and show them again when needed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

43

VBS for Creating Procedures and Actions


1.8 VBScript Editors

See also
Deleting Actions or Procedures (Page 49)
Working with the Toolbars (Page 47)
Working in an Editing Window (Page 44)

1.8.3

Working in an Editing Window

Introduction
Procedures and actions are edited in the editing window.

Declaration Areas in Actions (Graphics Designer only)


If you create actions in the Action Editor of Graphics Designer, you can display the declaration
.
area of the action in the editing window using the button
The declaration area can also be used to make general settings to be used globally for the
current picture, e.g.:
Tag Definitions
Procedures which you only want to use in this picture
Note
Do not create any directly executable codes in the declaration area!
Please note that when creating a tag, it must not contain a value (Value = VT_EMPTY).
Initialize the tags after declaration with the corresponding value.
When making definitions in the declaration area, pay attention to the structure of the Script
files, as described under "Structure of VBScript files".

"Option explicit" in Actions


When creating a new action, the "Option explicit" instruction is automatically set and cannot
be deleted in the declaration area (Graphics Designer) or entered in the first line of an action
(Global Script). The instruction is necessary as it prevents errors caused by the incorrect
notation of tags without declaration. The instruction requires that tags are always defined in
your code with the "Dim" instruction.
Note
Do not use the "Option explicit" instruction in the code because it may cause Runtime errors.

User Support in the Editing Window


The following functions are available to support working in the editing window.

44

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.8 VBScript Editors
Color coding and indentation in the editing window
Certain parts of the code have the following default colors:
Color

Description

Example

blue

Key words
Functions

Sub, End Sub, Next

green

Comments

' is a comment

red

Strings (character strings and


digits)

"Object1"

dark blue

Preprocessor statements

--

bold black

Constants

vbTrue, vbFalse

black

Other codes

--

The color coding in the editing window can be customized by means of the editor settings.
Select the "Tools" > "Options" menu commands and the "Script Editor Options" dialog to define
the settings.
In order to organize the codes clearly, they can be structured by indentations. The "Script Editor
Options" dialog can also be used to define the tabulator distance and Automatic Indent while
writing.
Intellisense and Highlight Syntax
During text entry, context-sensitive lists appear containing the properties, methods, and objects
possible at the current code position. If you insert an element from the list, the required syntax
is also indicated automatically.
Note
Full intellisense for all objects can only be utilized in the Graphics Designer if the list is
accessed using the object name and the result is assigned to a tag. Otherwise, only a list of
standard properties is offered.
Example of full intellisense:
Dim Tag
Set Variable = ScreenItems ("Kreis1")
Tag.
If picture window limits are exceeded during addressing, it is once again only the standard
properties which are offered since the picture of the picture window is not loaded.
Highlight Syntax can be activated and deactivated in the "Script Editor Options" dialog. The
dialog can be called in using the "Tools" > "Options" menu commands.
General VBS Functions
Use the "Function List" command of the shortcut menu in the editing window to display a list
of general VBS functions.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

45

VBS for Creating Procedures and Actions


1.8 VBScript Editors
Lists of Objects, Properties and Methods
Using the shortcut menu in the editing window, you can view a list of the possible objects by
calling the "Object List" command in Graphics Designer. Global Script only provides the
"HMIRuntime" object in this list because there is no direct access to the objects of Graphics
Designer.
Use the "Properties/Methods" command of the shortcut menu to call in a list of possible
properties and methods.
The same lists can be called in with the key combination <CTRL + SPACEBAR> according to
the context of the script.
Code Templates
In the "Code templates" tab in the Navigation window of the Editor, you will find a selection of
frequently used instructions, e.g., for loops and conditional instructions. The templates can be
inserted in the procedure code with "drag-and-drop".
If you want to insert a code template into your code, you have to replace the "_XYZ_"
placeholder in the templates with the respective data.
Selection Dialogs
If WinCC tags or objects are used in the code, the following selection dialogs are available for
use:

Opens a tag selection dialog and returns the selected tag name as the return value.

Opens a tag selection dialog and returns the tag name with an associated reference.

Opens a picture/object browser in which you can select a picture/object whose name is
then used for the return value.

Opens a picture selection dialog for pictures and returns the picture name with the server
prefix, if necessary.

Bookmarks
Bookmarks can be set in the code to find certain parts in the code more easily:

Sets a bookmark in the line where the cursor is currently located.

Deletes all bookmarks in the active editing window.

Jumps ahead to the next bookmark in the code.

Jumps back to the last bookmark in the code.

See also
Structure of VBScript Files (Page 107)
Global Script Editor (Page 41)

46

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.8 VBScript Editors

1.8.4

Working with the Toolbars

Purpose
In their default position, the toolbars are located below the menu bar, at the top of the VBS
editor. The buttons arranged on the toolbars enable quick, easy access to the functions
provided in Global Script and the action editor in Graphics Designer.
Global Script/Graphics Designer provide the following toolbars:

"Standard" toolbar
Button

Function

Key combination

Creates a new project module (Global Script only)

<ALT+F1>

Creates a new standard module (Global Script only)

<ALT+F2>

Creates a new global action (Global Script only)

<ALT+F3>

Opens an existing action or existing module (Global Script only)

<CTRL+O>

Saves the content of the active editing window. This function is only available if
an editing window is open. After saving the display in the navigation window is
refreshed. (Global Script only)

<CTRL+S>

Prints the contents of the active editing window as project documentation. This
function is only available if an editing window is open.

<CTRL+P>

Cuts the selected text and copies it to the clipboard. This function is only
available if text has been selected.

<CTRL+X>

Copies the selected text to the clipboard. This function is only available if text
has been selected.

<CTRL+C>

Pastes the contents of the clipboard at the location of the cursor. This function
is only available if the clipboard is not empty.

<CTRL+V>

Undoes the last of a maximum of 30 editor actions. This function is only available
if an editor action has been executed.

<CTRL+Z>

Redoes the last editor action that was undone. This function is only available if
an editor action has been undone.

<CTRL+Y>

Activates the direct help

F1

"Editor" Toolbar Content


Button

Function

Key combination

Indents the line, in which the cursor is located, one position to the right.

--

Indents the line, in which the cursor is located, one position to the left.

--

Marks the lines selected by the mouse as comments. If no lines have been
selected by the mouse, the line in which the cursor is located is marked as a
comment.

--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

47

VBS for Creating Procedures and Actions


1.8 VBScript Editors
Button

Function

Key combination

Removes the comment marking from the lines selected by the mouse. If no lines
have been selected by the mouse, the comment marking in the line in which the
cursor is located is removed.

--

Sets a bookmarks in the current line. Actuating again removed the bookmark
from the current line.

<CTRL+F9>

Removes all bookmarks from the current code in the editing window.

<CTRL+SHIFT+F9>

Moves the cursor one bookmark further.

<F9>

Moves the cursor one bookmark back.

<SHIFT+F9>

Opens the "Find" dialog for text search in the code.

<CTRL+F>

Opens the "Replace" dialog for search and replace in the code.

<CTRL+H>

Repeats the search process.

<F3>

Opens the "Script editor options" dialog.

--

Content of the "Edit" Toolbar


Button

Function

Key combination

Selects the file in the navigation window to which the current editing window
belongs (Global Script only).

--

Displays all the files in the navigation window (Global Script only).

--

Only displays the Script files in the navigation window (Global Script only).

--

Only displays the syntactically correct files in the navigation window (Global Script
only).

--

Executes a Syntax Check in the code of the current editing window.

<F7>

Opens a tag selection dialog returns the selected tag name as the return value.

<CTRL+U>

Opens a tag selection dialog and returns the tag name with an associated
reference.

<CTRL+W>

Opens a picture/object browser in which a picture/object can be selected whose


name is then used for the return value.

<CTRL+Q>

Opens a picture selection dialog for pictures and returns the picture name, with
the server prefix if necessary.

<CTRL+B>

Opens the "Info/Trigger" dialog.

<CTRL+T>

Additional Buttons in Graphics Designer


In addition to the buttons provided by Global Script, the action editor in Graphics Designer also
has the following buttons:

48

Displaying the declaration area (<CTRL+E>)

Hiding the declaration area (<CTRL+A>)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.8 VBScript Editors

See also
Global Script Editor (Page 41)

1.8.5

Deleting Actions or Procedures

Introduction
If an action, procedure or a module is deleted in a script editor, the code and corresponding
file are deleted in the project directory.
Be careful only to delete procedures which are no longer used in other procedures or actions.
If an action attempts to call in a procedure which no longer exists, the action is stopped in
Runtime at the fault point. A non-existing reference in the code is not detected by the syntax
check.
Note
Procedures can only be deleted within a module by deleting the code, not in the editor's
navigation window.

Procedure
1. Open Global Script.
2. Select the action or module to be deleted in the navigation window.
3. Select the "Delete" command from the context menu.
4. To delete a procedure: Open the relevant module and delete the corresponding code in
the editing window.

See also
Actions (Page 32)
Modules and Procedures (Page 29)
Global Script Editor (Page 41)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

49

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

1.9

Creating and Editing Procedures

1.9.1

Creating and Editing Procedures

Introduction
Projects and standard procedures can be programmed in WinCC using VBS:
Project procedures can only be retrieved in the current project. Since procedures are stored
in the project directory, they are automatically copied when a project is copied.
Standard procedures can be called in by all computers linked to a project. When a project
is copied onto another computer, the standard procedures must be copied into the
corresponding directory on the target computer manually.
The copied procedures are directly available for use in Runtime. The become visible in the
editor when the view is updated.
Apart from the procedures programmed by yourself, general VBS functions can also be used
(e.g. Abs, Array,... Year). These general VBS functions can be invoked in the code using the
"Function List" command from the context menu.
In addition, WinCC provides the most popular instructions as code templates (e.g. If...Then,
When...While). The code templates can be moved from the navigation window's Code
Templates tab control directly into your code via drag&drop.
If you insert a code template into your code, it is important to note that, for example, conditions
in the templates are identified by "_XYZ_". You must replace these placeholders with the
appropriate information.

Using Procedures
Procedures are used for the central creation and maintenance of codes which are to be
implemented at several point in the configuration. Codes are written and saved in a procedure
and the procedure is called in with the current parameters in actions or other procedures
instead of repeatedly entering the same code.
Create procedures for repeated functionalities, e.g.
Calculations with different starting values (procedure with return value)
Checking tag values (procedure with return value)
Executing tasks (procedure with return value)
This is linked to the following advantages:
The code is only programmed once.
Modifications are only made at one point, namely in the procedure, not in each action.
The action code is shorter and, thus, remains clearer.
Related procedures should be stored in modules in WinCC.

50

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

Procedures are loaded in Runtime when the calling action is executed.


If a procedure (module) used in a picture is modified, the modification is applied the next time
the picture is loaded. This means that a picture currently displayed only works with the modified
procedure after the picture has been reloaded.
After having a changed project module and saved the file in the VBS Editor, you must also
open and save the corresponding process picture in Graphics Designer. You changes are not

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

51

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures
activated in Runtime unless you completed this action. By saving the the picture, you activate
the information in the picture file by means of the necessary project modules.
Note
Procedures can be used in actions in Global Script and Graphics Designer.
In order to use a global tag defined in Global Script in an action in Graphics Designer, observe
the following:
In order that access can be made to the tag, it is necessary to call in the procedure in which
the tag is defined.
In order to use a global tag in picture-independent actions in Global Script, observe the
following:
In order that access can be made to the tag, at least one procedure in the module containing
the tag must be called in at least one global action.

Procedure - Action Restrictions


Global procedures valid for the entire project can only be created in Global Script. Graphics
Designer can only be used to create picture-specific procedures and call in global procedures
in actions. Picture-specific procedures in Graphics Designer are defined in the declaration area
of an action.
A procedure is not executed without an action.

File Name and Procedure Name


The procedure name is entered in the first line of the procedure code. The procedure is
displayed in the navigation window and called in actions under this name. Procedures do not
have a file name of their own but are stored in a module.
Module names are assigned in the editor's navigation window. Use the "Save As" command
to save a module under another name in the project directory.
Since procedures in Global Script are valid for the entire project, procedure names must always
be unique. Module names can be used more than once within a project, e.g. in different
subdirectories or stored separately in the standard and project directories.

Displaying Procedures and Modules


If you save a module that contains at least one syntactically incorrect procedure, this will
be displayed in the navigation window with this adjacent symbol.
Note
If a module contains a syntactically incorrect procedure, the module can no longer be loaded.
Procedures can no longer be called from the module.
If you save a module that contains only syntactically incorrect procedures, this will be
displayed in the navigation window with this adjacent symbol.

52

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

Procedures and Modules


Procedures are classified as standard or project procedures according to their assignment to
standard or project modules. Standard and project modules are located o the corresponding
tab controls in the Global Script navigation window.
Use the modules in order to compile procedures to practical function groups. Observe the
following when structuring the modules and procedures:
The more modules that must be loaded when a picture is called in, the worse the
performance in Runtime.
The larger a module, the more procedures are contained and, thus, the longer the loading
time for the module.
Organize the modules sensibly, e.g. a module with procedures for a specific system part/
picture.

See also
Multiple Use of Procedures and Actions (Page 34)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Examples of VBScript (Page 806)
Modules and Procedures (Page 29)

1.9.2

Creating a New Procedure

Introduction
Standard projects and procedures can be programmed with Global Script in WinCC.
The type of procedure is defined by the assignment to a project or standard module. The
procedure to create standard or project procedures is identical.
On creating a new procedure, WinCC automatically assigns a standard name "procedure#",
in which case # represents a continuos number. If the procedure is edited in the editing window,

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

53

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures
assign the procedure a corresponding name via which the procedure can be called in an action
later. The name appears in the navigation window when the procedure is saved.
Note
Procedure names must be unique within a project. If a procedure with the same name already
exists, the module is identified as syntactically incorrect. Module names can be used twice
when the modules are stored in different directories.
Global procedures (valid for the for entire project) can only be programmed Global Script.
Procedures can be called via actions in Graphics Designer and picture-related procedures
created in the declaration area of an action. Using a global action in Global Script, it is possible
to create procedures directly in the code which are then only applicable for this action.
An action must be programmed in order to call in a procedure.

Procedure
The following procedure describes the creation of a new procedure in Global Script:
1. Open Global Script.
2. In the navigation window, select the standard modules or project modules tab control
according to whether a standard procedure or project procedure is to be created.
3. Open an existing module or create a new module using the menu commands "File" > "New"
> "Project Module" or "File" > "New" > "Standard Module".
4. After having created a new module, the structure of a procedure without return value is
already entered in the editing window:
5. Enter the procedure name direct in the code: Sub "Procedure name".
6. To insert one procedure in an existing module: Select the module in the navigation window
and then select the "Insert New Procedure" context menu item.
The dialog "New Procedure" is displayed:
7. Enter a procedure name and select whether the procedure should have a return value
parameter. The definition of a tag for the return value is then entered in the code (Dim
RetVal).
8. Confirm your settings with OK.
Note
A new procedure can also be entered directly in a module. In the case of procedures without
return value, always begin with the instruction "Sub " and <Procedure Name> and conclude
with "End Sub". In the case of procedures with return value, always begin with the instruction
"Function " and <Procedure Name> and conclude with "End Function". The new procedure
is displayed in the navigation window when the module is saved.

54

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

See also
Creating and Editing Procedures (Page 50)
Multiple Use of Procedures and Actions (Page 34)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)
How to Write Procedure Codes (Page 55)
Modules and Procedures (Page 29)

1.9.3

How to Write Procedure Codes

Introduction
Procedure codes are written in the Global Script editor window. The code of each procedure
can call in other procedures via their procedure names.
Procedures can be created with or without return values. Use the return value to receive
information about successful execution of the procedure, for example.
If you modify a procedure in a picture, the modification will not take effect until the next time
you load the picture.

Functions in Global Script


Global Script provides the following functions to support the creation of procedure codes:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

55

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures
Intellisense and Highlight Syntax
During text entry, context-sensitive lists appear containing the properties, methods, and objects
possible at the current code position. If you insert an element from the list, the required syntax
is also entered automatically.
Note
Full intellisense for all objects can only be utilized in the Graphics Designer if the list is
accessed using the object name and the result is assigned to a tag. Otherwise, you are only
offered a list of standard properties.
Example of a full intellisense:
Dim Variable
Set Variable = ScreenItems ("Circle1")
Variable.<Intellisense selection>
If picture window limits are exceeded during addressing, it is once again only the standard
properties which are offered since the picture of the picture window is not loaded.
General VBS Functions
Use the "Function List" command of the shortcut menu in the editing window to display a list
of general VBS functions.
Lists of Objects, Properties and Methods
Using the shortcut menu in the editing window, you can view a list of the possible objects by
calling the "Object List" command in Graphics Designer. Global Script provides only the
"HMIRuntime" object in this list because there is no direct access to the objects of Graphics
Designer.
Use the "Properties/Methods" command of the shortcut menu to call a list of possible properties
and methods.
The same lists can be called in with the key combination <CTRL + SPACEBAR> according to
the context of the script.
Code Templates
In the "Code templates" tab in the Navigation window of the Editor, you will find a selection of
frequently used instructions, e.g. for loops and conditional instructions. The templates can be
inserted in the procedure code with "drag-and-drop".
If you want to insert a code template into your code, you have to replace the "_XYZ_"
placeholder in the templates with the respective data.
Selection Dialogs
If WinCC tags or WinCC objects are used in the code, the following selection dialogs are
available for use:

56

Opens a tag selection dialog and returns the selected tag name as the return value.

Opens a tag selection dialog and returns the tag name with an associated reference.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

Opens a picture/object browser in which a picture/object can be selected whose name


is then used for the return value.

Opens a picture selection dialog for pictures and returns the picture name, with the server
prefix if necessary.

Syntax Check
Global Script supports you with a syntax check which you can perform after the code has been
created. Syntax errors in the code are displayed in the output window of the editor. You can
move to the erroneous point in the code by double-clicking the error in the output window.
Note
The syntax check can only detect syntax errors in the code. Programming errors, such as
missing references, only become visible in Runtime. You should therefore also always check
your scripts in the Runtime environment.

Changing a Procedure
If a procedure is modified during Runtime, the modification becomes active at the following
times:
Procedures called from actions or other procedures in pictures become active following a
picture change.
Procedures in Global Script become active directly after being called again.

Procedure
1. Open Global Script.
2. Open the module containing the procedure to be edited.
3. After double clicking on the procedure in the navigation window, the cursor skips to the
beginning of the required procedure.
4. Edit the procedure. If you create a procedure with a return parameter, e.g. to program
recurring evaluations or reviews, indicate the return value with "procedurename = RetVal"
at the end of the procedure.

See also
How to Write Procedure Codes (Page 55)
Multiple Use of Procedures and Actions (Page 34)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
Creating a New Procedure (Page 53)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

57

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures
Modules and Procedures (Page 29)
Creating and Editing Procedures (Page 50)

1.9.4

Using Standard and Project Procedures

Introduction
Use the drag&drop function in the navigation window or the context menu to insert a procedure
in the current code.
Project procedures can only be used within the current project, standard procedures are
available for all projects on the computer.
Procedures, once created, can be used in other projects or on other computers. To do this,
copy the module containing the procedures in the appropriate project or standard directory.

Using Procedures in Graphics Designer and Global Script


Procedures defined in Global Script can be called in actions in Global Script and Graphics
Designer. On executing the action in Runtime, the entire module which contains the procedure
is loaded.
Please observe the following in order to use a global tag defined in a procedure in Global
Script:
When using Graphics Designer, always call the procedure in which the tag is defined so that
the tag can be used. I the procedure is not called in, the corresponding module is not loaded
and access cannot be made to the tag.
In the case of picture-independent actions in Global Script, at least one procedure in the module
containing the tag must be called in at least one global action.
Note
In the general declaration part of screens, no check is made whether a procedure or function
name has already been assigned. Therefore, a name could occur several times and it is not
defined which function will be executed. This is standard behavior of the MS Scripting Engine.

Procedure
1. Open the procedure or action in which the procedure should be inserted.
2. Use the drag&drop function to move the procedure to be inserted from the navigation
window to the correct position in the code.
or
3. Place the cursor at the position in the code where you would like to insert teh procedure.
4. Mark the procedure in the navigation window with the mouse.
5. Choose pop-up menu command "Transfer Procedure Retrieval".

58

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

See also
Creating and Editing Procedures (Page 50)
Multiple Use of Procedures and Actions (Page 34)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Modules and Procedures (Page 29)

1.9.5

How to add module-related information

Introduction
Related information can be added to each module in order to quickly recognize the functionality
of the module or the procedures contained in it when edited at a later date. If several operators
are involved in configuring a project, you should provide module-related information for your
colleagues.
When a new module is created, the creation date is entered in the module-related information
automatically and is unchangeable. The Module is also assigned the version number 1.0. The
version numbers can be individually assigned when editing a module. When a module is
changed and saved, the current date of change is entered automatically and is unchangeable.
The following information can be added:
"Created by"
"Changed by"
"Comments" e.g. module functionality/procedures contained
It is still possible to define a password for the module. Further information on assigning
passwords is provided in "Protecting Modules with a Password".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

59

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

Procedure
1. Open Global Script.
2. Select the module in which information is to be added in the navigation window.
3.

Click the "Info/Trigger" toolbar button, or select the "Info" menu command. The
"Properties..." dialog appears.

Enter the required information.


Note
The "Info/Trigger" dialog can also be called if an open procedure is selected in the navigation
window. The information stored in this dialog is always valid for the entire module and all the
procedures contained in it.

See also
Multiple Use of Procedures and Actions (Page 34)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Modules and Procedures (Page 29)
Creating and Editing Procedures (Page 50)

60

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

1.9.6

Protecting a Module with a Password

Introduction
A module can be assigned a password to protect it from unauthorized access. The password
is a part of the module-related information.
Note
If a module is protected by a password, all the procedures contained in it are also protected
by the password.

Procedure
1. Open Global Script.
2. Select the module to be assigned a password in the navigation window.
3.

Click the button "Info/Trigger" in the toolbar or choose the pop-up menu command "Info".
The "Properties..." dialog appears.

4. Activate the check box "Password".


The dialog "Enter Password" is displayed.
5. Enter a password and confirm it.
6. Confirm your settings with OK.
Result
If an attempt is made to open the module or a procedure contained in it, a prompt appears
requesting the password.
Deactivate Password Protection
To clear the password protection, disable the "Password" check box.
Change Password
To change the password, open in the Properties dialog and click the "Change" button. Then
enter the new password.
Note
If you forget the module password, the module cannot be edited.
Note
The "Info/Trigger" dialog can also be called if an open procedure is selected in the navigation
window. The information stored in this dialog is always valid for the entire module and all the
procedures contained in it.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

61

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

See also
Multiple Use of Procedures and Actions (Page 34)
Renaming a Procedure or Module (Page 64)
Saving a Procedure (Page 62)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Modules and Procedures (Page 29)
Creating and Editing Procedures (Page 50)

1.9.7

Saving a Procedure

Introduction
Individual procedures are never stored but the module in which the procedure has been
programmed.
Before saving a module, check the code is syntactically correct. When saving a module, the
procedures contained are automatically checked and, in the case of syntax errors, a prompt
appears as to whether the module should be saved with the errors or not. In this way, for
example, modules and procedures can be saved which are not fully programmed. Syntactically
incorrect procedures do not run in Runtime.
Note
If a module contains a syntactically incorrect procedure, the module can no longer be loaded.
Procedures can no longer be called from the module.
Note
The syntax check can only detect syntax errors in the code. Programming errors, such as
missing references, only become visible in Runtime. Therefore, always check the scripts in
the Runtime environment and use a debugger, if necessary, to detect and eliminate errors.
Only syntactically correct modules are called in Runtime.
A list of all the possible syntax errors is available in the Appendix under " Basic Principles of
VBScript".

If a procedure is subjected to a syntax check prior to saving, any errors are displayed in the
lower part of the editor window. Double click on an error line to access the error position in the
code directly.

62

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

Use the "Save As" command to store the module under another name. Note that the new
module is only displayed in the navigation window after updating the view.

Requirement
The procedure/module to be saved must be open in the editor window.

Procedure
1. Click

in the toolbar.

2. If syntax errors appear in the output window, double click on the error line and correct the
error in the code. Repeat steps 1 and 2 until the code is correct.
3. Save the module by clicking

in the toolbar.

Note
Pictures with modified procedures must be opened and saved once again in Graphics
Designer
In addition to saving in the VBS editor, the corresponding picture must be opened and saved
once again in Graphics Designer when the project module is changed. The change is then
applied in Runtime. Only once the picture has been saved is the information applied to the
picture file via the required project modules.

See also
Diagnostics (Page 94)
Multiple Use of Procedures and Actions (Page 34)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Modules and Procedures (Page 29)
Creating and Editing Procedures (Page 50)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

63

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures

1.9.8

Renaming a Procedure or Module

Introduction
Procedures and modules are renamed in the following cases:
When a standard name (procedure# or Modul#), which was automatically assigned when
the new module/new procedure was created, is changed to a self-explanatory name.
When a module or procedure is copied in order, for example, to create a new module with
similar content from an existing one.
Please note that procedure names must be unique within a project. Procedure names which
exist twice are issued as errors during the syntax check.
Contrary to procedure names, the same name can be applied to modules when the modules
are stored in different directories.
Note
The module name is always identical to the file name in the WinCC file system. If a module
name is changed, e.g. in Windows Explorer, the new module name is taken over from Global
Script in the navigation window.

Procedure
Renaming Procedures
1. Open the procedure to be renamed.
2. Enter the new name in the header of the procedure.
3. Save the procedure so that the name is transferred to the navigation window. Procedure
names are always unique and may not be used more than once.
Renaming Modules
1. Close the module to be renamed.
2. Select the module in the navigation window and choose the "Rename" option from the
context menu.
3. Enter the new name in the navigation window. Module names are always unique at directory
level and may not be used more than once.

See also
Multiple Use of Procedures and Actions (Page 34)
Saving a Procedure (Page 62)
Protecting a Module with a Password (Page 61)
How to add module-related information (Page 59)
Using Standard and Project Procedures (Page 58)

64

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.9 Creating and Editing Procedures
How to Write Procedure Codes (Page 55)
Creating a New Procedure (Page 53)
Modules and Procedures (Page 29)
Creating and Editing Procedures (Page 50)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

65

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

1.10

Creating and Editing Actions

1.10.1

Creating and Editing Actions

Introduction
When using VBS in WinCC, there is no differentiation between local (valid for entire project)
and global (valid on all computers) actions, as opposed to C. A configured action is always
valid globally.
A copied action is available for use in Runtime following a restart or opening and saving the
action. The become visible in the editor when the view is updated.
VBS actions can be used in to make graphic objects and object properties dynamic in Runtime
or to execute picture-independent actions.
Note
Please note that the object name length of objects made dynamic in Graphics Designer is
limited to approx. 200 characters, and each special character used in an object name is
converted to five characters in the script files. The special characters are represented by a
four-place hexadecimal code behind the preceding X. If the name of an object made dynamic
is too long, a corresponding error message appears. Further information is available in this
help under "Structure of VBScript Files".
Note
If you make an object property dynamic with a VBS action via the return value of a script, the
value of the object property is written only if it has changed in relation to the last script run.
It is not considered if the value had been changed from another location.
Therefore it is illegal to change properties which have been made dynamic by VBS action via
the return value from another location (e.g., other C scripts or VBS scripts).
if you do not observe this, wrong values can be the results.

Using the Actions


Actions can be used as follows:
On graphic objects in Graphics Designer
Making properties dynamic (action with return value), e.g.:
Function BackColor_Trigger(ByVal Item)
'VBS143
BackColor_Trigger = RGB(125,0,0)
End Function
Triggered by an event on an object (action without return value), e.g.:

66

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
Sub OnClick(ByVal Item)
'VBS144
Item.BackColor = RGB(255,0,0)
End Sub
Picture-independent in Global Script
As a cyclic action, e.g. incrementing a tag:
Option Explicit
Function action
'VBS145
Dim objTag1
Dim lngValue
Set objTag1 = HMIRuntime.Tags("Tag1")
lngValue = objTag1.Read
objTag1.Write lngValue + 1
action = CLng(objTag1.value)
End Function

Executing Actions
An action can be assigned several triggers. The action is always executed when one of the
triggering events occurs. Observe the following:
Actions in Global Script cannot be executed simultaneously. The action triggered last is
held in a queue until the action currently being performed is completed.
When using Graphics Designer, cyclically and tag-driven actions cannot be triggered
simultaneously. If the execution of a tag-driven action hinders the execution of a cyclic
action, the cyclic action is executed when the tag-driven action has finished. The cyclic
action is held in a queue during the non-execution phase. When the current action is
completed, the cyclic action is executed with the normal cycle.
In Graphics Designer, event-driven actions cannot be executed simultaneously.
The action types mentioned do not prevent each other being executed: The execution of
actions in Global Script has no influence on actions in Graphics Designer. In the same way,
in Graphics Designer, the execution of cyclically or tag-driven actions has no effect on the
execution of event-driven actions.
Note
Actions in pictures which are still running one minute after the picture has been deselected
are terminated by the system. This is recorded in a logfile entry.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

67

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

Locating Actions
All the actions used in a picture can be displayed by means of the picture properties. To do
this mark the picture in WinCC Explorer and select the "Properties" context menu command.
After double clicking on an entry, detailed information on the type of dynamics appears.
It is also possible to display all the tags and pictures used in actions by means of the WinCC
CrossReference. CrossReference can also be used for the to link tag connections of Graphics
Designer actions easily.
Note
Use the standard formulations
HMIRuntime.BaseScreenName = "Screenname" and HMIRuntime.Tags("Tagname") when
addressing pictures and tags in your code in order to ensure that the pictures and tags are
registered by the CrossReference.

Procedure - Action Restrictions


Actions can be used to program instructions and call procedures. Codes are programmed
within in procedures for use at several points in a configuration. Contrary to procedures, actions
always have a trigger.

Creating and Editing Actions


Actions can be configured in Global Script and Graphics Designer. Use Global Script to
configure global actions which can be executed independently of the picture currently open.
Graphics Designer is used to configure actions related to graphic objects which should be
executed when the picture is opened in Runtime or when the configured trigger occurs.

68

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
The script editors in WinCC provide the option of checking that scripts have a correct syntax
without executing them. Errors in the script are displayed in the output window under the editor
window. Double click on the corresponding error line to access the related point in the code.
Note
The syntax check can only check objects known to the system at the moment of execution.
Therefore, the tags and objects addressed in the scripts must be created in WinCC.
Only syntactically correct actions are executed in Runtime.
The automation objects "PDLRuntime" and "WinCC Runtime Project" cannot be used in VBS
actions.

Display of Actions
If you save a syntactically incorrect action, it will be displayed in the navigation window with
this adjacent symbol.
If you save a syntactically correct action without trigger, it will be displayed in the Global
Script navigation window with this adjacent symbol.
If you save a syntactically correct action with trigger, it will be displayed in the Global Script
navigation window with this adjacent symbol.
Note
Actions can only be saved in the Graphics Designer if they have the correct syntax. If an
action with errors should still be retained and exited, however, enter the comments.

System behavior if actions are changed, deleted and saved at Runtime


If a local action is stored at runtime, then all local and global actions of the computer are reset
on the computer to which the local action belongs.
If a global action is stored during runtime, then all local and global actions for the entire project
and thus on all computers are reset.
Such a reset might reinitialize for examples tags and times that are used as triggers for actions,
triggering the action at that stage.
Static tags used in the reset actions are reinitialized.

See also
Structure of VBScript Files (Page 107)
Action and Procedure Names in the Debugger (Page 109)
How to Rename an Action (Page 90)
Saving Actions (Page 77)
Protecting an Action with a Password (Page 76)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

69

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
How to add action-related information (Page 74)
How to Edit Actions (Page 71)
Creating a New Action (Page 70)
Triggers (Page 78)
Actions (Page 32)

1.10.2

Creating a New Action

Introduction
When a new action is created, the editor automatically suggests a file name (Action#.bac),
which can be changed.
Actions can be configured in Global Script and Graphics Designer.
Global Script is used to configure actions which can be executed, picture-independently,
in Runtime. Open Global Script via WinCC Explorer.
Graphics Designer is used to configure a new action, related to the properties of a graphic
object, by clicking on the right mouse button in the "Dynamic" column of the Properties tab
control and selecting VBS Action. An action, related to an event, is created in the same
way using the Events tab control.
In both cases, the Action Editor of the Graphics Designer opens.
Note
The precise procedure for linking actions with graphic objects is described under the WinCC
help topic "Dynamics".

Procedure
1. Open Global Script.
2. Activating the Actions Tab Control in the Navigation Window.
3. Click
in the toolbar or choose the menu command "File" > "New" > "Action".
A new action is opened in the editor window. The action appears in the navigation window
after it has been saved.
Note
When creating a new action, the "Option explicit" instruction is automatically entered in the
declaration area and cannot be deleted. The instruction is necessary as it prevents errors
caused by the incorrect notation of tags without declaration.
The instruction requires that tags are always defined in your code with the "Dim" instruction.
Do not use the "Option explicit" instruction in the code because it may cause Runtime errors.

70

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

See also
How to Rename an Action (Page 90)
Saving Actions (Page 77)
Protecting an Action with a Password (Page 76)
How to add action-related information (Page 74)
How to Edit Actions (Page 71)
Triggers (Page 78)
Creating and Editing Actions (Page 66)
Actions (Page 32)

1.10.3

How to Edit Actions

Introduction
An action is edited in the same way as a procedure in the editor window of the editor or in the
Graphics Designer action editor.
In order that an action can be executed in Runtime, it requires a trigger. Actions which are
triggered by an event in Graphics Designer do not require the assignment of a trigger.
If an action is modified during Runtime, the change is applied when the picture is reloaded (in
the case of actions in Graphics Designer) or the next time the action is called (in the case of
actions in Global Script).
Note
A change in the code in Runtime cannot be applied when another action is being carried out
at the same time.
A procedure call can be inserted in the action by dragging the procedure from the editor
navigation window with "drag-and-drop" and dropping it in the corresponding position of the
code in the editor window. C scripts cannot be called in VBS actions.

Declaration Area in Actions


If you create actions in Graphics Designer, you can display the declaration area of the action
using the button
. When creating a new action, the "Option explicit" instruction is
automatically entered in the declaration area and cannot be deleted. The instruction is
necessary as it prevents errors caused by the incorrect notation of tags without declaration.
The instruction requires that tags are always defined in your code with the "Dim" instruction.
Do not use the instruction "Option explicit" in your code as this can cause Runtime errors.
In the declaration area, you can also make general settings which you want to use globally for
the current picture, e.g.:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

71

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
Tag Definitions
Procedures which you only want to use in this picture
In the declaration area of the actions, you may define global tags independent of each other
in the areas "Event" and "Properties" of an object. There is no link between global tags of
identical names in both areas.
Note
Always make sure that the procedures in the declaration area have correct syntax, i.e. with
"Sub" - "End Sub". Do not create directly executable codes in the declaration area as this
can cause Runtime errors.
If global tags are used in the declaration area of actions Graphics Designer, note that the
event-driven and cyclic/tag-driven actions are processed separately in Runtime. There is no
synchronization of global tags between the two Runtime systems in Runtime. If
synchronization of tags is required, configure these using the DataSet object or internal
WinCC tags.
When making definitions in the declaration area, pay attention to the structure of the Script
files, as described under "Structure of VBScript files".

Functions for Editing Actions


The script editors provide the following functions to assist you in creating action code:
Intellisense and Highlight Syntax
During text entry, context-sensitive lists appear containing the properties, methods, and objects
possible at the current code position. If you insert an element from the list, the required syntax
is also indicated automatically.
Note
Full intellisense for all objects can only be utilized in the Graphics Designer if the list is
accessed using the object name and the result is assigned to a tag. Otherwise, only a list of
standard properties is offered.
Example of full intellisense:
Dim Variable
Set Variable = ScreenItems ("Circle1")
Variable.<Intellisense>
If picture window limits are exceeded during addressing, it is once again only the standard
properties which are offered since the picture of the picture window is not loaded.
General VBS Functions
Use the "Function List" command of the shortcut menu in the editing window to display a list
of general VBS functions.

72

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
Lists of Objects, Properties and Methods
Using the shortcut menu in the editing window, you can view a list of the possible objects by
calling the "Object List" command in Graphics Designer. Global Script only provides the
"HMIRuntime" object in this list because there is no direct access to the objects of Graphics
Designer.
Use the "Properties/Methods" command of the shortcut menu to call in a list of possible
properties and methods.
The same lists can be called in with the key combination <CTRL + SPACEBAR> according to
the context of the script.
Code Templates
In the "Code templates" tab in the Navigation window of the Editor, you will find a selection of
frequently used instructions, e.g., for loops and conditional instructions. The templates can be
inserted in the procedure code with "drag-and-drop".
If you want to insert a code template into your code, you have to replace the "_XYZ_"
placeholder in the templates with the respective data.
Selection Dialogs
If WinCC tags or WinCC objects are used in the code, the following selection dialogs are
available for use:

Opens a tag selection dialog and returns the selected tag name as the return value.

Opens a tag selection dialog and returns the tag name with an associated reference.

Opens a picture/object browser in which a picture/object can be selected whose name


is then used for the return value.

Opens a picture selection dialog for pictures and returns the picture name with the server
prefix, if necessary.

Syntax Check
Global Script supports you by providing a syntax check which you can perform after the code
has been created. Syntax errors in the code are displayed in the output window of the editor.
You can move to the erroneous point in the code directly by double-clicking the error in the
output window.
Note
The syntax check can only detect syntax errors in the code. Programming errors, such as
missing references, only become visible in Runtime. Therefore, always check the scripts in
the Runtime environment and use a debugger, if necessary, to detect and eliminate errors.
The way to test scripts with a debugger is described in this documentation under the topics
"Diagnostics" > "Testing with the Debugger".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

73

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

Procedure
1. Open Global Script.
2. Double click on the action on the Action tab control in the navigation window.
3. Edit the action.

See also
Using Global Tags in VBS (Page 38)
Testing with the Debugger (Page 101)
Structure of VBScript Files (Page 107)
How to Rename an Action (Page 90)
Saving Actions (Page 77)
Protecting an Action with a Password (Page 76)
How to Edit Actions (Page 71)
Creating a New Action (Page 70)
Triggers (Page 78)
Creating and Editing Actions (Page 66)
Actions (Page 32)

1.10.4

How to add action-related information

Introduction
Related information can be added to every action in Global Script in order that the function of
an action can be recognized at a later date when editing. If several operators are involved in
configuring a project, you should provide action-related information for your colleagues.
When a new action is created, the creation date is entered in the action-related information
automatically and is unchangeable. The action is also assigned version number 1.0. The
version numbers can be individually assigned when editing an action. When an action is
changed and saved, the current date of change is entered automatically and is unchangeable.
The following information can be added:
"Created by"
"Changed by"
"Comments:" e.g. functionality of the action

74

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
It is also possible to define a password for the action. Further information on assigning
passwords is provided in "Protecting Actions with a Password".
Note
Additional information can only be made available actions in Global Script, not for actions in
Graphics Designer.

Procedure
1. Open Global Script.
2. Open the action for which information should be added.
3.

Click the "Info/Trigger" toolbar button, or select the "Info" menu command. The
"Properties..." dialog appears.

4. Enter your information.

See also
How to Rename an Action (Page 90)
Saving Actions (Page 77)
Protecting an Action with a Password (Page 76)
How to Edit Actions (Page 71)
Creating a New Action (Page 70)
Triggers (Page 78)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

75

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
Creating and Editing Actions (Page 66)
Actions (Page 32)

1.10.5

Protecting an Action with a Password

Introduction
An action in Global Script can be protected against unauthorized access by assigning a
password to it. The password is a part of the action-related information.
Note
Only actions in Global Script can be assigned a password, not actions in Graphics Designer.

Procedure
1. Open Global Script.
2.

Open the action to be protected by a password.

3. Click the button "Info/Trigger" in the toolbar or choose the pop-up menu command "Info".
The "Properties..." dialog appears.
4. Select the "Password" check box.
5. Click the "Change" button. The "Enter Password" window opens.
6. Enter a password and confirm it.
7. Confirm your settings with OK.
Result
If an attempt is made to open the action, the system requests the password is entered.
Deactivate Password Protection
To clear the password protection, disable the "Password" check box.
Change Password
To change the password, open in the Properties dialog and click the "Change" button. Then
enter the new password.
Note
If you forget the action password, the action cannot be edited.

76

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

See also
How to Rename an Action (Page 90)
Saving Actions (Page 77)
How to add action-related information (Page 74)
How to Edit Actions (Page 71)
Creating a New Action (Page 70)
Triggers (Page 78)
Creating and Editing Actions (Page 66)
Actions (Page 32)

1.10.6

Saving Actions

Introduction
Before an action can be run in Runtime, it must be saved. Save an action as any other Windows
file using the "File" > "Save" commands or the corresponding icon.
Note
Actions in Graphics Designer are automatically applied on closing the action editor with the
picture. Functions can only be saved in the Graphics Designer if they have the correct syntax.
If an action with errors should still be retained and exited, however, enter the comments.
A list of all the possible syntax errors is available in the Appendix under " Basic Principles of
VBScript".
In order to save an action under a different name, e.g. to use an action as a basis for another
action, use the "Save As" command.
Note that, when using "Save As", only the file name is changed and not the action name.

Prior to Saving
Before saving an action, check the code is syntactically correct. The syntax errors in the code
are displayed in the output window of Global Script. Double click on an error line to access the
error position in the code directly.
Note
The syntax check can only detect syntax errors in the code. Programming errors, such as
missing references, only become visible in Runtime. Therefore, always check the scripts in
the Runtime environment and use a debugger, if necessary, to detect and eliminate errors.
If actions are saved without running a syntax check beforehand, the editor comments that a
syntactically incorrect action will be saved which cannot subsequently be run in Runtime.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

77

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
Syntactically incorrect actions are displayed with the adjacent icon in the navigation window.

Procedure
1. Click

in the toolbar.

2. If errors are displayed in the lower part of the editor window, double click on the error line
and correct the error in the code. Repeat steps 1 and 2 until the code is correct.
3. Save the action by clicking

in the toolbar.

See also
Actions (Page 32)
How to Rename an Action (Page 90)
Protecting an Action with a Password (Page 76)
How to add action-related information (Page 74)
How to Edit Actions (Page 71)
Creating a New Action (Page 70)
Triggers (Page 78)
Creating and Editing Actions (Page 66)

1.10.7

Triggers

1.10.7.1

Triggers

Definition and use


Triggers are used to execute actions at Runtime. To do this, a trigger is linked to an action,
forming the triggering event for calling the action. Actions without triggers will not be carried
out.
The triggers defined for an action are displayed in the Global Script navigation window .

78

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

Trigger types
The following trigger types are available:
Acyclic triggers
They consist of the specification of date and time. The action specified by such a trigger is
performed once at the date and time specified.
Cyclic triggers
They consist of the specification of a time interval and start time. The following types of cyclic
triggers are available:
Default cycle. The start of the first time interval coincides with the start of Runtime. The
length of the interval is determined by the cycle.
Hourly. The start of the interval is specified as minute and second. The length of the interval
is an hour.
Daily. The start of the interval is specified by the time (hour, minute and second) festgelegt.
The length of the interval is a day.
Weekly. The start of the interval is specified by the day of the week (Monday, Tuesday,
etc.) and the time. The length of the interval is a week.
Monthly. The start of the interval is specified by the day and time. The length of the interval
is a month.
Annual. The start of the interval is specified by the day, month and time. The length of the
interval is a year.
Time-controlled triggers are used for actions Global Script and for actions to make graphic
objects dynamic.
Tag triggers
They consist of one or more specified tags. The action associated with such a trigger is
performed each time a change in the value of one of these tags is detected.
How the tag values are queried may be customized for each tag. Select from the following
modes:
Cyclic query of the tag value: Specify a standard cycle. The tag value is queried at the
defined intervals (e.g. every 2 seconds). The action is triggered when the system detects
a change of the tag value.
Depending on the size of the cycle, it is possible that the tag value is changed but it is not
detected by the system.
If, for example, a cycle of 5 minutes has been set, the tag value may change several times
within the 5 minute period but only the value set when the next query is made is detected.
The value changes between the two queries are not registered.
Changes in the tag value: Each change in the tag value is detected by the system. The
action is executed each time the tag value changes.
Tag triggers are used for actions Global Script and for actions to make graphic objects dynamic.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

79

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
Event-driven
When an action is configured related to an event on a graphic object, the action is triggered
when a specific event has occurred, e.g. following a mouse click or the change of the
background color due to another action.
Animation cycle
As of WinCC V7.0, the "animation cycle" trigger art is available for the dynamization of objects
with VBS. The animation cycle allows you to switch actions on and off in Runtime and to change
the time, in which the trigger is executed.
You can find additional information in the "Animation trigger" section.

Effects of triggers on actions


If the action is associated with only one trigger, then the action is performed as soon as the
triggering event occurs.
However, an action may be associated with multiple triggers, such as a cyclic trigger and a
tag trigger. Here the action is performed whenever one of the two triggering events occurs. If
two events occur simultaneously, then the action is executed twice sequentially. If two tag
triggers fire at the same time, the action will be performed only once.
Processing actions in Graphics Designer
The following rules apply to processing actions in Graphics Designer:
No event-driven actions can be executed as long as another event-driven action is running.
No cyclic/tag triggered actions can be executed as long as another cyclic/tag triggered
action is running.
The two action types do not affect each other: An event-driven action can also be executed
when a cyclic action is already in progress.
If the execution of actions is blocked by other actions (e.g. a cyclic action by a tag-triggered
action), each action which is blocked is executed once at the next possible moment. Cyclic
actions then run in their normal intervals after the one-off execution.
Processing actions in Global Script
Picture-based actions from Global Script are executed in Runtime in succession after being
triggered. When an action is triggered while another action is in progress, the second action
is kept in a queue until it can be executed.
Actions in Global Script and Graphics Designer do not affect each other.
Note
If the action should not be executed at each event, it is possible to define a condition in the
action, the result of which controls whether the action is executed or not.

80

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

Notes on configuring triggers


Depending on the system, it cannot be guaranteed that an action with a cyclic trigger will be
carried out at exactly the specified time. If this is a requirement, then the task (such as a check)
should be implemented on the automation device.
The tag triggers should have priority over cyclic triggers: With cyclic actions, the action is
always executed, e.g. every 20 seconds. The tag trigger only executes the action if a change
in the value of the tag has been detected in the case of cyclic queries. This reduces the load
on the system and increases performance.

If a tag trigger is used, configure the "Upon Change" cycle to start as seldom as possible. This
query cycle causes the tag to trigger the action following every change. This causes high
system loads.

Linking tag triggers


The CrossReference from WinCC can be used to quickly find all the application points of tags,
even in VBS actions. Tag triggers in actions in Graphics Designer can be "linked" using
CrossReference, i.e. replaced by other tags at all or selected points.
Note
Tags can also be directly linked in Graphics Designer by marking the graphic object and
selecting the "Linking ..." command from the context menu.
Use the standard formulations
HMIRuntime.BaseScreenName = "Screenname" and
HMIRuntime.Tags("Tagname") when addressing pictures and tags in your code in order
to ensure that the pictures and tags are registered by the CrossReference.
Further information on CrossReference is available in the WinCC documentation.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

81

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

See also
Actions (Page 32)
How to delete a trigger (Page 89)
How to change a trigger (Page 88)
How to add a trigger of the type "Tag" (Page 86)
How to add a trigger of the type "Timer" (Page 84)
Creating and Editing Actions (Page 66)

1.10.7.2

Animation trigger

Introduction
As of WinCC V7.0, the "animation cycle" trigger art is available for the dynamization of objects
with VBS. The animation cycle allows you to switch actions on and off in Runtime and to change
the time in which the trigger is executed.

Animation cycles
Name

Cycle

Name

Cycle

CycleTime125ms

125 ms

CycleUser1

User cycle 1

CycleTime250ms

250 ms

CycleUser2

User cycle 2

CycleTime500ms

500 ms

CycleUser3

User cycle 3

CycleTime1s

1s

CycleUser4

User cycle 4

CycleTime2s

2s

CycleUser5

User cycle 5

CycleTime5s

5s

CyclePicture

Picture cycle

CycleTime10s

10 s

CycleWindow

Window Cycle

CycleTime1min

1 min

CycleTime5min

5 min

CycleTime10min

10 min

CycleTime1h

1h

You use the trigger by writing an action and using the "animation cycle" trigger type. This action
can be activated or deactivated in Runtime with the "ActivateDynamic" and
"DeactivateDynamic" methods. The methods are described in the VBS reference of the WinCC
Information System. The correct syntax of the methods deviates from the description in the
VBS reference and is shown in the following two examples.

Example
With an action at the determined property "Position X" (left), the rectangle is shifted 5 pixels
to the right. Select the "animation cycle" event in the action as the trigger.
Enter the following as action in the "Left" property:

82

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

item.Left = item.Left + 5

You can switch the action on and off at the property "Position X" with the following methods.
The trigger is switched on in Runtime with the "ActivateDynamic" method:

Dim obj
Set obj = ScreenItems.Item("Rectangle1")
obj.ActivateDynamic "Left", "CycleTime1s"

The trigger is switched off in Runtime with the "DeactivateDynamic" method:

Dim obj
Set obj = ScreenItems.Item("Rectangle1")
obj.DeactivateDynamic "Left"

Note
The WinCC tags remain requested even when the trigger is switched off.

See also
ActivateDynamic method (Page 698)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

83

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

1.10.7.3

How to add a trigger of the type "Timer"

Introduction
"Timer" type triggers execute an action at a certain time. "Timer" type triggers can be cyclic or
acyclic triggers.
Acyclic triggers Trigger an action once at the configured time.
Cyclic triggers Trigger an action at regular intervals. The time interval and start time for the
time must be triggered. If a standard cycle is selected as the cyclic trigger, the start time is
always the start of Runtime. User-specific cycles can also be selected as standard cycles.
Note
Cyclic triggers guarantee a high updating rate of the system but require high system loads.
Choose cyclic triggers only for those actions, where the update is very important.
With high system loads, some actions may not be executable.
"Timer" type triggers are used to make the properties in Graphics Designer dynamic and
execute global actions.

Procedure
1. Open the action.
2.

Click the button "Info/Trigger" in the toolbar or choose the pop-up menu command "Info".
The "Properties..." dialog appears.

3. Select the "Triggers" tab.


4. Select the "Timer" trigger and then select the trigger type to be created: cyclic or acyclic.
5. Click on the "Add" button. The "Add Trigger" dialog appears.

84

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
6. If the "acyclic" trigger type has been selected: Enter a relevant trigger name and define the
time at which the action should be executed.

7. If the "cyclic" trigger type has been selected: Enter a relevant trigger name and define the
start time at which the action should be executed for the first time. Enter a cycle at which
the action should be repeated.
Click OK to confirm your entries.
Note
An action can be assigned several triggers. The action is always executed when one of the
triggering events occurs.

See also
How to delete a trigger (Page 89)
How to add a trigger of the type "Tag" (Page 86)
Triggers (Page 78)
Creating and Editing Actions (Page 66)
Actions (Page 32)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

85

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

1.10.7.4

How to add a trigger of the type "Tag"

Introduction
"Tag" type triggers execute an action following the change of a tag value. Any internal or
external tag stored in WinCC can be used as a trigger tag.
Actions with tag triggers can be executed at the following times:
On change of tag: The action is executed each time the tag value changes. Since this
setting causes a very high system utilization, the updating rate should be set as low as
possible.
Query the tag status according to standard cycle (including user cycles): Define a cycle in
whose intervals the tag value should be queried. The action is only executed when the tag
value has changed when queried. When the query status is a large value, it is possible that
the tag value changes but it is not detected by the system. In this case the action will not
be performed.
If an action is linked with several tags, the action is executed when one of the tag values
changes.

Procedure
1. Open the action.
2.

Click the button "Info/Trigger" in the toolbar or choose the pop-up menu command "Info".
The "Properties..." dialog appears.

3. Select the "Triggers" tab.


4. Select "Trigger" as the tag.
5. Click on the "Add" button. The "Add Trigger" dialog appears.

86

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
6. Enter the name of the tag to be used as the trigger or click the button beside the "Tag Name"
field in order to select a tag from the tag selection dialog.

7. Double click on the "Standard cycle" field to open the selection dialog for the tag update
cycle:

Select a cycle and click on OK to confirm the selection.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

87

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

See also
How to delete a trigger (Page 89)
How to add a trigger of the type "Tag" (Page 86)
How to add a trigger of the type "Timer" (Page 84)
Triggers (Page 78)
Creating and Editing Actions (Page 66)
Actions (Page 32)

1.10.7.5

How to change a trigger

Introduction
A defined trigger can be modified at any time, even during Runtime.

Procedure
1. Open the action whose triggers should be modified.
2.

Click the button "Info/Trigger" in the toolbar


or choose the pop-up menu command "Info/Trigger". The "Properties..." dialog appears.
Alternatively, call in the dialog without executing the action by double clicking on the trigger
in the navigation window.

3. Select the "Triggers" tab.


4. Select the trigger to be modified and click the "Change" button.

5. Modify the trigger can confirm the entries with OK.

88

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

See also
Triggers (Page 78)
How to delete a trigger (Page 89)
How to add a trigger of the type "Tag" (Page 86)
How to add a trigger of the type "Timer" (Page 84)
Creating and Editing Actions (Page 66)
Actions (Page 32)

1.10.7.6

How to delete a trigger

Introduction
Defined triggers can be deleted at any time. Triggers can also be deleted during Runtime.
If a trigger is deleted in Runtime, it only takes effect after the action is saved.
Note
Actions without trigger are not executed in Runtime. None of the actions which used the
deleted trigger are executed any longer.

Procedure
1. Open the Global Script Editor or the Graphics Designer action editor.
2. Open the action.
3.

Click the "Info/Trigger" toolbar button or select the "Info/Trigger" menu command. The
"Properties..." dialog appears.

4. Select the "Triggers" tab.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

89

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions
5. Select the trigger to be deleted and click the "Delete" button.

6. The trigger is deleted immediately.


Note
Triggers can also be deleted directly in the Global Script navigation window using the "Delete"
command in the context menu.

See also
Actions (Page 32)
How to change a trigger (Page 88)
How to add a trigger of the type "Tag" (Page 86)
How to add a trigger of the type "Timer" (Page 84)
Triggers (Page 78)
Creating and Editing Actions (Page 66)

1.10.8

How to Rename an Action

Introduction
Actions can be renamed in Global Script. When an action is renamed, the action name and
file name are changed.
The action to be renamed must not be open in the editor window.

90

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.10 Creating and Editing Actions

Procedure
1. Open Global Script.
2. Select the name of the action to be renamed in the editor's navigation window.
3. Select the "Rename" command from the context menu.
4. Enter a new name for the action with the extension *.bac.

See also
Protecting an Action with a Password (Page 76)
Saving Actions (Page 77)
How to add action-related information (Page 74)
How to Edit Actions (Page 71)
Creating a New Action (Page 70)
Triggers (Page 78)
Creating and Editing Actions (Page 66)
Actions (Page 32)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

91

VBS for Creating Procedures and Actions


1.11 How to activate global actions in Runtime

1.11

How to activate global actions in Runtime

Introduction
Scripts defined in Global Script are always executed when the configured trigger occurs.
Scripts in the graphical Runtime system are executed when the picture is called in and the
configured event or trigger occurs.
In order that the picture-independent, Global Script global actions can be executed, the Global
Script Editor must be registered in the startup list of the Runtime computer.

Procedure
1. Select the "Properties" command in the computer's context menu WinCC Explorer. The
"Computer properties" dialog will open.
2. Click on the "Startup" tab
3. Selection option "Global Script Runtime".

4. Click OK to confirm your entries.

92

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.11 How to activate global actions in Runtime

See also
Creating and Editing Actions (Page 66)
Creating and Editing Procedures (Page 50)
VBScript Editors (Page 40)
Using Visual Basic Script in WinCC (Page 26)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

93

VBS for Creating Procedures and Actions


1.12 Diagnostics

1.12

Diagnostics

1.12.1

Diagnostics

Introduction
If the scripts are executed and tested in Runtime, the Diagnostics window can be used to
display an analysis quickly.

Diagnostics Tools
WinCC provides a range of tools with which to analyze the behavior of actions in Runtime:
The GSC Runtime and GSC Diagnostics application windows
Use of a debugger
GSC Runtime and GCS Diagnostics
The GSC Runtime and GSC Diagnostics application window are used by inserting them in a
process screen. This can be a process screen developed for diagnostics purposes which is
called in Runtime.
The application windows are used for different strategies:
While Runtime is active, GSC Runtime provides information on the dynamic behavior of all
(Global Script) actions, enables the individual startup as well as log on and off of each individual
action and offers the access point to the Global Script Editor.
GSC Diagnostics issues the Trace methods contained in the actions in the chronological
sequence they are called. This also applies to Trace instructions in procedures which are called
in actions. The targeted implementation of Trace instructions, e.g. for the output of tag values,
enables the progress of actions and the procedures called in them to be traced. The Trace
instructions are entered in the form "HMIRuntime.Trace(<Ausgabe>)".
The GSC Diagnostics displays trace output from C and VBS.
Note
Runtime errors in VBS are not displayed
Some script errors are neither output via trace nor displayed via the error dialog. Use the
Microsoft Script Debugger.
Debugger
In order to test the scripts in Runtime, a debugger can be used instead of the Diagnostics
window. The utilization of the Microsoft Script Debugger is described in chapter "Testing with
the Debugger".
The Microsoft Script Debugger is located in the Microsoft Download-Center under the following
URL:

94

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
http://www.microsoft.com/downloads/Search.aspx?displaylang=en
Use the "Search" field to search for "Script Debugger" and select the required download.

See also
Testing with the Debugger (Page 101)
GSC Runtime (Page 98)
GSC Diagnostics (Page 95)
Microsoft Download Center (http://www.microsoft.com/downloads/Search.aspx?
displaylang=en)

1.12.2

GSC Diagnostics

1.12.2.1

GSC Diagnostics

Introduction
GSC Diagnostics displays the chronological sequence of calls of the trace methods contained
in the actions in the Diagnostics window. This also applies to Trace instructions in procedures
which are called in actions. The targeted implementation of Trace instructions, e.g. for the
output of tag values, enables the progress of actions and the procedures called in them to be
traced.

Application
In order to use GSC Diagnostics, insert a GSC Diagnostics type application window in a
process screen. The GSC Diagnostics attributes can be used to control the appearance of the
GSC Diagnostics window.
In the case of a picture change, the content of the GSC Diagnostics window is deleted.
Note
Messages are also displayed in the "GSC Diagnostics" window when the debugger is
activated.

See also
GSC Diagnostics Toolbar (Page 97)
GSC Diagnostics Attributes (Page 96)
Inserting the GSC Diagnostics Window into a Picture (Page 96)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

95

VBS for Creating Procedures and Actions


1.12 Diagnostics

1.12.2.2

Inserting the GSC Diagnostics Window into a Picture

Introduction
In order to use GSC Diagnostics, insert a GSC Diagnostics process screen. The process
screen can be an existing picture or a picture which serves customized diagnostics purposes.
GSC Diagnostics cannot be inserted directly in the process screen as an application but is
inserted as an application in an application window. In this case, the application window is a
component part of the process screen.

Requirements
Graphics Designer has been started and the process screen is open.

Procedure
1. Use the "Smart Objects" object palette to insert the "Application Window" in the picture.
2. Select the "Global Script" option from the "Window Contents" dialog and confirm the
selection with "OK".
3. Select the "GSC Diagnostics" option from the "Templates" dialog.
4. Confirm the selection with OK in order to insert the Diagnostics window.

See also
GSC Diagnostics Toolbar (Page 97)
GSC Diagnostics Attributes (Page 96)
GSC Diagnostics (Page 95)

1.12.2.3

GSC Diagnostics Attributes

Overview
GSC Diagnostics has attributes which affect the appearance of the GSC Diagnostics window
in Runtime. These relate to the geometric attributes, particularly to the following:
Display: This attribute defines whether the window should be visible or hidden. The attribute
can be made dynamic with the name Visible.
Sizeable: This attribute defines whether the size of the window should be changeable in
Runtime.
Movable: This attribute defines whether the window should be moveable or not during
Runtime.
Border: This attribute defines whether the without is provided with a border. If the window
has a border, its height and width can be modified in Runtime.
Title: This defines whether the window has a title bar.

96

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
Can be maximized: This attribute defines whether the title bar should contain the button to
maximize the window.
Can be closed: This attribute defines whether the title bar should contain the button to close
the window.
Foreground: This attribute defines whether the window should always be in the foreground.

See also
GSC Diagnostics Toolbar (Page 97)
Inserting the GSC Diagnostics Window into a Picture (Page 96)
GSC Diagnostics (Page 95)

1.12.2.4

GSC Diagnostics Toolbar

Overview
The GSC Diagnostics toolbar enables the output in the diagnostics window to be controlled
and to save, print and open window content:

1: Delete the content of the diagnostics window


2: Stop the window being updated
3: Activate the window being updated
4: Opens a text file in the window
5: Saves the window contents in a text file
6: Print the window contents

See also
GSC Diagnostics Attributes (Page 96)
Inserting the GSC Diagnostics Window into a Picture (Page 96)
GSC Diagnostics (Page 95)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

97

VBS for Creating Procedures and Actions


1.12 Diagnostics

1.12.3

GSC Runtime

1.12.3.1

GSC Runtime

Introduction
GSC Runtime is a window which displays the dynamic behavior of all Global Script actions in
Runtime. In addition, GSC Runtime can also be used during Runtime to influence the execution
of each individual action and provide access to the Global Script editor.

Actions
C actions and VBS actions are differentiated in the GSC Runtime window:

Symbolizes a C action

Symbolizes a VBS action

The following information is issued:


Action name: The name of the action
ID: Action ID. They are used internally by the system. GSC Runtime supplies the
corresponding action name together with the Action ID. The link between ID and action
name is only valid until Runtime is stopped or, during Runtime, until an action is saved.
Status: Provides information on the current status of the action. Refer to the table below
for the possible statuses.
Activation Interval: The time in the form Hour:Minute:Second, which should elapse between
the action being called.
Return Value: The return value of the action
Started On: Date and time the current action was started
Next Start: Date and time the action will be started again
Error message: Contains the error text in the case of an error

Actions Status
Possible action status:
Action was activated.
Action was deactivated
Action was stopped.
Action in progress
Error logging on the action!
Error executing the action!

98

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics

Pop-Up Menu
The following functions are available for every action in the pop-up menu:
Log off: The relevant action will not be executed again when the current execution has
finished.
Log on: The relevant action will be executed again when the next trigger event occurs
Start: The relevant action will be executed once.
Edit: The relevant action will be opened in the Global Script editor for editing. Runtime will
remain active. If the edited action is compiled (when necessary) and saved the changes
will be applied by the Runtime system immediately.
The option of opening the pop-up menu for every action can be controlled by assigning an
authorization.
In order to use GSC Runtime, insert a GSC Runtime type application window in a process
screen. The GSC Runtime attributes can be used to control the appearance of the GSC
Runtime window.
Note
Updating the GSC Runtime window increases the system load. The system load is dependent
on how many actions are visible in the window. The system load can be lowered by reducing
the height of the window so that fewer lines are visible.

See also
How to insert the GSC Runtime Window into a Picture (Page 99)
GSC Runtime Attributes (Page 100)

1.12.3.2

How to insert the GSC Runtime Window into a Picture

Introduction
In order to use GSC Runtime, insert a GSC Runtime process screen. The process screen can
be an existing picture or a picture which serves customized diagnostics purposes. GSC
Runtime cannot be inserted directly in the process screen but is inserted as an application in
an application window. In this case, the application window is a component part of the process
screen.

Requirements
Graphics Designer has been started and the process screen is open.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

99

VBS for Creating Procedures and Actions


1.12 Diagnostics

Procedure
1. Use the "Smart Objects" object palette to insert the "Application Window" in the picture.
2. Select the "Global Script" option from the "Window Contents" dialog and confirm the
selection with "OK".
3. Select the "GSC Runtime" option from the "Templates" dialog.
4. Confirm the selection with OK in order to insert the Diagnostics window.

See also
GSC Runtime (Page 98)
GSC Runtime Attributes (Page 100)

1.12.3.3

GSC Runtime Attributes

Overview
GSC Runtime has attributes which affect the appearance of the GSC Runtime window in
Runtime. These relate to the geometric attributes, particularly to the following:
Display: This attribute defines whether the window should be visible or hidden. The attribute
can be made dynamic with the name Visible.
Sizeable: This attribute defines whether the size of the window should be changeable in
Runtime.
Movable: This attribute defines whether the window should be moveable or not during
Runtime.
Border: This attribute defines whether the without is provided with a border. If the window
has a border, its height and width can be modified in Runtime.
Title: This defines whether the window has a title bar.
Can be maximized: This attribute defines whether the title bar should contain the button to
maximize the window.
Can be closed: This attribute defines whether the title bar should contain the button to close
the window.
Foreground: This attribute defines whether the window should always be in the foreground.

See also
GSC Runtime (Page 98)
How to insert the GSC Runtime Window into a Picture (Page 99)

100

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics

1.12.4

Testing with the Debugger

1.12.4.1

Testing with the Debugger

Overview
A debugger can be used to test the VBScripts in Runtime, e.g.:
Microsoft Script Debugger
Debugger "InterDev" (contained in scope of installation material supplied with Developer
Studio )
Microsoft Script Editor (MSE) Debugger (contained in material supplied with Microsoft
Office)
The following description relates exclusively to handling the Microsoft Script Debugger.

Download the Microsoft Script Debugger


The Microsoft Script Debugger is located in the Microsoft Download-Center under the following
URL:
http://www.microsoft.com/downloads/Search.aspx?
displaylang=en833a6a92-961e-4ce1-9069-528d22605127
Use the "Search" field to search for "Script Debugger" and select the required download.

Notes on the MSE Debugger


The following settings must be changed when using the MSE Debugger so that the running
processes will be displayed:
1. Select the "Properties" button in the "Processes" window.
2. Activate the option "Just-In-Time-Debugging" in the "Debuffer properties" dialog.
3. Restart the computer.
4. Deactivate the "Disable script debugging" option in the MS Internet Explorer so that the
Internet Explorer cannot prevent the WinCC debugging procedure.

See also
Principles of Debugging (Page 103)
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

101

VBS for Creating Procedures and Actions


1.12 Diagnostics
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
How to Activate the Debugger (Page 102)
Diagnostics (Page 94)
Microsoft Download Center (http://www.microsoft.com/downloads/Search.aspx?
displaylang=en)

1.12.4.2

How to Activate the Debugger

Principle
There are several ways of activating the debugger:
Automatic activation of the debugger when an error occurs in Runtime.
Opening an error box in Runtime via which the debugger can be activated.
Starting the debugger from the Start menu and opening a running Runtime scripts.

Requirements
The Microsoft Script Debugger must be installed on the configuration computer.

Procedure
The following procedure describes the first two points, activating the debugger in WinCC.
1. In the computer's pop-up menu in WinCC Explorer, select the command "Properties". The
"Computer Properties" dialog appears.
2. Select the "Runtime" tab control.
3. Activate the required debug options. The debug behavior for actions in Global Script and
Graphics Designer can be set independently of each other:

4. Select "Start debugger" when the debugger should be started directly following an error in
the Runtime.

102

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
5. Select "Display Error Dialog", if you do not want to start the Debugger directly but wish to
display an error dialog with information about the error. The debugger can be started from
the error box by means of a button.
6. Click OK to confirm your entries.

Starting the Debugger and Opening a Running Script


The debugger can also be started up later and linked to the system currently running. Define
a connection in the debugger to the respective processes, "pdlrt.exe" for the Graphical Runtime
System and "gscrt.exe" for the Global Runtime System. The way to open a running script in
the debugger is described under the topic "Select Script".

Exiting the Debuggers


It is possible to stop the debugger without exiting the WinCC Runtime.

See also
How to Set Bookmarks in Scripts (Page 115)
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.3

Principles of Debugging

Introduction
The Microsoft Script Debugger can be used to debug the VBScripts. The Microsoft Script
Debugger can be used to:
View the script source code to be debugged
Step-by-step processing of the scripts to be checked

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

103

VBS for Creating Procedures and Actions


1.12 Diagnostics
Display and modify tag and property values
View and monitor the script progress
Note
Please note that the code displayed in the debugger is write-protected. The code cannot
be changed directly in the debugger but only test the necessary changes.

Error types
A distinction is made between the following types of error by the debug:
Syntax errors
Syntax errors occur, for example, when a key word is written incorrectly or a parenthesis is
not closed. When a syntax check from WinCC is used, syntax errors can be excluded before
testing the scripts in Runtime. In principle, only syntactically correct scripts can be saved in
Graphics Designer. The WinCC syntax check also checks:
Whether the procedure names are unique in Global Script
Whether an action module in Global Script contains only one procedure
Whether the action part in Graphics Designer contains only one procedure
As a result of the syntax check in WinCC, the script is parsed without being executed. The
script is parsed again directly before executing in Runtime. All the script parts are parsed, even
those which are executed after a certain action has been executed at a later time.
If the script contains syntax errors, the script is not executed in Runtime.
Runtime error
A Runtime error occurs when an attempt is made to execute an invalid/erroneous action, e.g.
because a tag has not been defined. In order to intercept Runtime errors, use the "On Error
Resume Next" command in the VBScript. The command causes the subsequent command to
be executed following a Runtime error. The error code can subsequently be checked using
the Err object. In order to deactivate the processing of Runtime errors in the script, use the
"On Error Goto 0" command.
Logical errors
The debugger is particularly helpful in clearing up logical errors. A logical error occurs when
an unexpected result is received because, for example, a condition was incorrectly checked.
To clear logical errors, go through the scripts step-by-step in order to detect the part which
does not function properly.

Basic Procedure
When an error has occurred and the debugger is open, the script appears in a window, writeprotected. It is possible to navigate through the script document, set breakpoints, execute the
script again in Runtime and to process the script step-by-step.
The most important steps for successful debugging of the scripts are described under
"Processing Scripts Step-by-Step".

104

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
The source codes of the scripts cannot be edited directly in the scripts. When an error has
been detected, the error can be corrected in the original script in WinCC, e.g. load the picture
again and update it in the debugger.
Note
Tips and tricks for debugging, frequently occurring error codes and other information is
available in the Microsoft Script Debugger online help.

Change Picture During Debug


If a picture change is executed during debugging, the script document of the "old" picture
remains open but is no longer valid. If necessary, invalid errors are displayed because the
objects called following the picture change are no longer available.

See also
Testing with the Debugger (Page 101)
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
How to Activate the Debugger (Page 102)
Diagnostics (Page 94)

1.12.4.4

Components of the Microsoft Script Debuggers

Introduction
The Microsoft Script Debugger offers several components which assist in debugging:
"Command Window"
The "Command Window" is called in using the "View" > "Command Window" menu commands.
While a script is running in Runtime, the "Command Window" of the debugger can be used,
for example, to compile and modify values of tags and properties in the script currently running.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

105

VBS for Creating Procedures and Actions


1.12 Diagnostics
Changes made in the "Command Window" are effected directly in the running script so that
planned changes can be tested immediately.
The following actions can be executed in the "Command Window":
Enter commands: Commands can be entered and executed directly in VBScript.
Change tag values: Tag values can be compiled and modified directly in the "Command
Window". This relates to both tags in the current script as well as global tags.
Modify properties: It is possible to read and write the properties of all objects in the current
script context.
The "Command Window" can always be used when a script has reached a breakpoint or a
skip has been made from a breakpoint to other commands.
Note
Please note that the changes executed in the "Command Window" have no effect on the
source code of the script but only serve for test purposes in the debugger.
"Running Documents" Window
The "Running Documents" window is called via the "View" > "Running Documents" menu
command.
This window displays all the scripts currently running in WinCC Runtime, separated according
to scripts, from Global Script ("Global Script Runtime") and scripts from the graphical Runtime
system ("PDLRT"). All the running Global Script Runtime actions and modules are displayed.
In the graphical Runtime system, the scripts are separated according to trigger-controlled
actions (picturename_trigger) and event-controlled actions (picturename_events).
"Call Stack" Window
The "Call Stack" window is called via the "View" > "Call Stack" menu command.
This window displays a list of all running actions and called procedures. When a procedure is
called, for example, the name is added to the "Call Stack" list. When the procedure has finished,
the name is removed from the list. A procedure can be selected from the list in order to skip
to the corresponding position in the script document at which the procedure was called.

See also
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)

106

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.5

Structure of VBScript Files

Principle
In order not to hinder the simultaneous processing of cyclic and event-driven scripts in the
graphical Runtime system, the event-driven actions and cyclic/tag-driven actions are strictly
separated during processing. In this way, a cyclic action, for example, cannot hinder the
execution of an action initiated by clicking a button.
To ensure this, the event-driven actions and the cyclic/tag-driven actions are stored in separate
script files when saving a picture. If a global picture section has been defined in actions in
Graphics Designer, this is copied into both scripts. In the same way, modules which are used
in an action are also copied in both script files.
If a tag from a module should be used, the corresponding module must be called in. Otherwise,
the module is not copied in the script file and an error is generated.
Note
Since the two script files are handled separately, they have no common data area. Therefore,
there is no synchronization of global tags between the two script files. If synchronization is
required, implement this using the DataSet object or internal WinCC tags.

Structure of the Script Files


When scripts are debugged with a debugger, the script files always open the different Runtime
systems.
In the case of the graphical Runtime system, this means that you receive two script files per
picture:
<Bildname>.pdl_events: Contains the event-driven actions.
<Bildname>.pdl_triggers: Contains the cyclic and tag-controlled actions.
The following section describes how the script files are structured:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

107

VBS for Creating Procedures and Actions


1.12 Diagnostics
Graphical Runtime system

Global Script Runtime

Note
Please note that the actions and procedures of the graphic Runtime system are not displayed
with the action name in the script file under which it was saved in WinCC. The name
conventions for actions and procedures in the script files sate described in "Action and
Procedure Names in the Debugger".

See also
How to Activate the Debugger (Page 102)
Executing Script Commands (Page 117)

108

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.6

Action and Procedure Names in the Debugger

Action and Procedure Names in the Debugger


The names of procedures and actions in debugger script files differ from the names under
which they were saved by the scripts in WinCC.
The action and procedure names in the script files are compiled according to the following
rules:
Action type

Name of the script file

Cyclic or tag-driven actions on a property

ObjectName_PropertyName_Trigger

Mouse events

ObjektName_OnClick
ObjektName_OnLButtonDown
ObjektName_OnLButtonUp
ObjektName_OnRButtonDown
ObjektName_OnRButtonUp

Keyboard events

ObjektName_OnKeyDown
ObjektName_OnKeyUp

Object events

ObjektName_OnObjectChanged
ObjektName_OnSetFocus

Events on properties

ObjektName_PropertyName_OnPropertyChanged
ObjektName_PropertyName_OnPropertyStateCha
nged

Picture events

Document_OnOpen
Document_OnClosed

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

109

VBS for Creating Procedures and Actions


1.12 Diagnostics

Permitted length of action names


The names of the actions in the script files are limited to 255 characters. Each special character
used in an object name is converted to five characters. The special characters are represented
by a four-place hexadecimal code behind the preceding X. If, for example, an action is
configured on a button with the name "PushHere" per mouse click, the script in the script file
appears as "PushHere_OnClick".
If the object name compiled is too long, an error message is issued during the syntax check
in WinCC. As a result of this restriction, graphic object names cannot be selected with any
length during configuration.
Note
If you wish to determine the name of an object in Runtime, press <CTRL+ALT+SHIFT> and
position the mouse over the corresponding object. The picture name and object name then
appears in a tooltip.

See also
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Selecting a Script for Editing (Page 110)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.7

Selecting a Script for Editing

Introduction
If the Microsoft Script Debugger is called from the Windows Start menu instead of automatic
activation using WinCC, scripts which are currently running can be called in for editing in
Runtime.

110

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics

Prerequisite
Runtime is activated, the picture to be debugged is active.

What to do
1. Start the debugger from the Windows Start menu ("Start" > "Programs" > "Options" >
"Microsoft Script Debugger").
2. Activate the "View" > "Running Documents" commands from the menu bar.
The "Running Documents" window is opened. This window displays all the scripts currently
running in WinCC Runtime, separated according to scripts, from Global Script ("Global
Script Runtime") and scripts from the graphical Runtime system ("PDLRT").

The example above, "Startbild.pdl" is active and only event-driven scripts are available in
the start picture.
3. Double click on the script document in the "Running Documents" window that is to be
debugged.
The script document is opened "read-only" in the Debugger window.

See also
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Processing Scripts Step-by-Step (Page 112)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

111

VBS for Creating Procedures and Actions


1.12 Diagnostics
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.8

Processing Scripts Step-by-Step

Introduction
The Microsoft Script Debugger can be used to process the scripts step-by-step in order, for
example, to locate logical errors systematically. The effect of each individual script line can be
tested in Runtime.

The Procedure in Principle


1. Activate the document to be debugged in Runtime.
2. Start the debugger manually from the Start menu and open the required script file or activate
the debugger in WinCC. When activated in WinCC, the debugger automatically opens when
an attempt is made to execute an erroneous script.
3. Set a breakpoint in the script file. Breakpoints are normally set in front of code lines in which
errors are suspected.
4. Switch to WinCC Runtime and trigger an action which causes the script to run.
The Debugger stops at the first breakpoint and marks the current line.
5. In order to go through the script document step-by-step, select one of the following menu
commands:
"Debug" > "Step Into": Skip to the next code line. If the script calls a procedure in this line,
it skips to the procedure using the "Step Into" command. The procedure called can then be
processed step-by-step.
"Debug" > "Step Over": Skips the procedure called. The procedure is called but the
debugger does not stop at the individual lines of the procedure. Instead, it moves to the
next line of the current script after the procedure has been executed.
6. To interrupt the step-by-step processing of a procedure, select the "Debug" > "Step Out"
menu commands. The debugger then skips to the next action.
7. Proceed step-by-step to the end of the document or select the "Debug" > "Run" menu items
to start the script again in Runtime.

See also
Principles of Debugging (Page 103)
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)

112

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.9

Setting Breakpoints

Introduction
Breakpoints can be set in a script to stop at specific points when processing it and to start the
debugger. Set a breakpoint in front of a line, for example, which you suspect contains a script
error.
It is possible to:
Set breakpoints at specific lines to locate logical errors in the script step-by-step.
Set a breakpoint and call the debugger before the next line in the script is processed. These
procedure is used, for example, for events such as "Change picture".
When a script file is updated in the debugger, all the breakpoints are lost.
If a breakpoint is set in one of the script files "<Bildname>.pdl_trigger" or
"<Bildname>.pdl_event", all the trigger-driven or all event-driven procedures are stopped,
respectively, in Runtime.

Requirements
Runtime is activated, the picture to be debugged is active.

Procedure
Setting a breakpoint
1. Start the debugger and select the script. If automatic activation of the debuggers in WinCC
has been selected, the debugger is called in as soon as an erroneous script is executed.
2. Position the cursor on the action in which a breakpoint should be set.
3. Open the "Debug" menu and select the "Toggle Breakpoint" item or the icon
toolbar.
The next executable line will be marked by a red dot.

from the

4. Switch to WinCC Runtime and execute the action you wish to debug.
The Debugger stops at the first breakpoint it finds in the script. The current line is displayed
on a yellow background. The script can then be processed step-by-step.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

113

VBS for Creating Procedures and Actions


1.12 Diagnostics

See also
Deleting Breakpoints (Page 114)
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Setting Breakpoints (Page 113)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.10 Deleting Breakpoints


Introduction
When an error has been cleared properly, the breakpoints in a script can be cleared individually
or all together.

Procedure
1. Position the cursor in the line whose breakpoint is to be deleted.
2. Open the "Debug" menu and select the "Toggle Breakpoint" item or the icon
toolbar.
The next line will be displayed without a mark.

from the

3. To delete all the breakpoints in a script, open the "Debug" menu and select the "Clear all
from the toolbar.
Breakpoints" entry or the icon

See also
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Setting Breakpoints (Page 113)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)

114

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.11 How to Set Bookmarks in Scripts


Introduction
During the debug routine, bookmarks can be set on code lines so that they can be found easier
again one line later.
Setting or deleting bookmarks
Position the mouse pointer in the row where you wish to set a bookmark, and click <CTRL+F9>
to set a bookmark or <CTRL+SHIFT+F9> to delete one.
Skipping to the next bookmark
Press <F9> to go to the next bookmark in the script.
Skipping to the previous bookmark
Press <SHIFT+F9> to go to the previous bookmark in the script.

See also
Executing Script Commands (Page 117)
How to Determine and Modify Tag and Property Values (Page 116)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

115

VBS for Creating Procedures and Actions


1.12 Diagnostics

1.12.4.12 How to Determine and Modify Tag and Property Values


Introduction
While a script is running in Runtime, the "Command Window" of the debugger can be used,
for example, to compile and modify values of tags or properties in the script currently running.
It is possible, for example, to reset a process value for a script to zero without having to stop
the process.
Note
If you wish to determine the name of a WinCC object in Runtime, click <CTRL+ALT+SHIFT>
and position the mouse over the corresponding object. The picture name and object name
then appears in a tooltip.

Requirements
The script runs in Runtime and the debugger is opened.

Procedure
1. Set at least one breakpoint in the current script.
2. Switch to WinCC Runtime and trigger an action which causes the script to be executed.
The Debugger stops at the first breakpoint.
3. Open the "View" menu and activate the "Command Window" entry.
The "Command Window" opens.
4. In order to determine the value of a tag or property, enter a "?" followed by a Space and
the name of the tag or property whose value is to be determined, e.g. "?myTag".
Press <RETURN> to execute the command.
5. In order to modify the value of a tag/property, assign a value in the VBS syntax.

See also
Principles of Debugging (Page 103)
Executing Script Commands (Page 117)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Selecting a Script for Editing (Page 110)
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
How to Activate the Debugger (Page 102)

116

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.12 Diagnostics
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

1.12.4.13 Executing Script Commands


Introduction
While a script is running in Runtime, the "Command Window" of the debugger can be used to
execute script commands directly and thus manipulate the running of the current script. The
script commands can be executed directly for test purposes without creating the command in
a script and activating it. It is possible, for example:
To retrieve methods
To retrieve procedures
To manipulate object properties
"Command Window" can basically be used to execute all commands which can also be
executed from a VBScript.

Requirements
The script runs in Runtime and the debugger is opened.

Procedure
1. Set at least one breakpoint in the current script.
2. Switch to WinCC Runtime and trigger an action which causes the script to be executed.
The Debugger stops at the first breakpoint.
3. Open the "View" menu and activate the "Command Window" entry.
The "Command Window" opens.
4. Enter the required command and press "ENTER".
Note
If a faulty command is entered in the Command window, no error message is issued in
Runtime. The message "<Script Error> appears in the Command window instead.

See also
How to Determine and Modify Tag and Property Values (Page 116)
How to Set Bookmarks in Scripts (Page 115)
Deleting Breakpoints (Page 114)
Setting Breakpoints (Page 113)
Selecting a Script for Editing (Page 110)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

117

VBS for Creating Procedures and Actions


1.12 Diagnostics
Action and Procedure Names in the Debugger (Page 109)
Structure of VBScript Files (Page 107)
Components of the Microsoft Script Debuggers (Page 105)
Principles of Debugging (Page 103)
How to Activate the Debugger (Page 102)
Testing with the Debugger (Page 101)
Diagnostics (Page 94)

118

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.13 Printing VBScripts

1.13

Printing VBScripts

Principle
The actions and procedures configured in both Global Script and in Graphics Designer can be
documented in WinCC.
The documentation options are distinguished between:
Print Feedback Doc: In Graphics Designer, all the configured actions are printed with the
feedback of the current picture. The Feed Back contains the C-actions and VBS actions,
located beside each other, differentiated by the source text (C or VBScript).
Print current script: The Feed Back in Global Script always contains the currently open
procedure or action.
WinCC provided predefined print layouts for the layout of the Feed Back. Customized print
layouts can also be developed and linked to the Print Job tab control with "Project
Documentation - Setup".

Procedure
1. Open Global Script or Graphics Designer according to the scripts to be documented.
2. Configure the print job, if necessary, using the "Project Documentation - Setup" command.
3. Use the "View Project Documentation" command to preview the data to be printed.
4. Select the menu commands "File" > "Print Project Documentation" to print the data.

See also
Creating and Editing Actions (Page 66)
Creating and Editing Procedures (Page 50)
VBScript Editors (Page 40)
Using Visual Basic Script in WinCC (Page 26)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

119

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14

VBS Reference

1.14.1

VBS Reference

VBS object model in WinCC


The WinCC object model of the graphic Runtime system enables access to graphic objects
and tags in Runtime.
When you click on an object name, you are shown a detailed description.

120

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

$FWLYH3URMHFW
7DJV

7DJ6HW

7DJ

7DJ

+0,5XQWLPH

$FWLYH6FUHHQ

6FUHHQV
6FUHHQ

$FWLYH6FUHHQ,WHP
6FUHHQ,WHPV
6FUHHQ,WHP
/D\HUV
/D\HU
'DWD6HW
'DWD,WHP

/RJJLQJ

'DWDORJV
$ODUPORJV

$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

Object and List


Object
Property provided by an object

The VBS object model in a faceplate type


The VBS object model is not valid for WinCC in a Faceplate type. It is replaced by a completely
new model.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

121

VBS for Creating Procedures and Actions


1.14 VBS Reference
The VBS object model of the Faceplate type provides you with access to the graphic objects
and Faceplate tags of the Faceplate type in Runtime.

Objects
Objects and lists are provided for access to all the objects in the graphic Runtime systems:
Graphic objects, pictures, layers and tags.

Properties
The properties of the individual objects can be used to modify specific graphic objects and
tags in Runtime , e.g. activating an operating element per mouse click or triggering a color
change by modifying a tag value.

Methods
Methods, which are applied to individual objects, can be used to read tag values for further
processing or display diagnostics messages in Runtime.

See also
ActiveScreen Property (Page 305)
Object types of the ScreenItem object (Page 158)
Methods (Page 695)
Properties (Page 303)
Objects and Lists (Page 123)
AlarmLogs Object (Page 128)
DataItem Object (Page 129)
DataLogs Object (Page 130)
DataSet Object (List) (Page 132)
HMIRuntime Object (Page 134)
Layer Object (Page 136)
Layers Object (Listing) (Page 137)
ScreenItem Object (Page 141)
ScreenItems Object (List) (Page 144)
Screen Object (Page 146)
Screens Object (List) (Page 149)
Tag Object (Page 152)
Tags Object (List) (Page 155)
TagSet Object (List) (Page 156)
ActiveProject Property (Page 305)

122

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ActiveScreenItem Property (Page 306)
Logging Object (Page 138)
Alarm object (Page 126)
Alarms object (list) (Page 126)
ProcessValue Object (Page 139)
ProcessValues Object (List) (Page 140)

1.14.2

Objects and Lists

1.14.2.1

Objects and Lists

Overview
The objects and lists provided in WinCC object models enables access to graphic objects and
tags in Runtime.

Navigation in Object Models


Access is made to objects in the VBS object model in hierarchical sequence. If, for example,
a picture element is accessed within a picture, access is made to the picture element in the
picture via its parent object (the surrounding picture).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

123

VBS for Creating Procedures and Actions


1.14 VBS Reference
Example:

Only the basic picture name is issued in this example.

Access to Graphic Objects


In WinCC, access is made to pictures, layers and graphic objects in Runtime using the
superordinate "HMIRuntime" object. Access to objects and layers is always made via the
picture (screen) in which they are contained.

Access to Tags
In WinCC, tags are accessed directly in Runtime using the superordinate "HMIRuntime" object.
Tag values can be read out or set anew.

124

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Lists
Lists of WinCC object models behave in the same way as standard collections of VBS.
Exception: The "Tags" list has no Enum function.

Available Objects
Alarm
Alarms
AlarmLogs
DataItem
DataLogs
DataSet
HMIRuntime
Item
Layer
Layers
Logging
ProcessValues
ProcessValue
Project
ScreenItem
ScreenItems
Screen
Screens
Tag
Tags
TagSet

See also
ScreenItems Object (List) (Page 144)
TagSet Object (List) (Page 156)
Tags Object (List) (Page 155)
Tag Object (Page 152)
Screens Object (List) (Page 149)
Screen Object (Page 146)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

125

VBS for Creating Procedures and Actions


1.14 VBS Reference
Layers Object (Listing) (Page 137)
Layer Object (Page 136)
Item Object (Page 135)
HMIRuntime Object (Page 134)

1.14.2.2

Alarm object

Description
+0,5XQWLPH

$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

The alarm object is used to access the Alarms object list.


Note
The properties of the alarm object are not automatically updated when the values of the
properties change.

See also
Alarms object (list) (Page 126)

1.14.2.3

Alarms object (list)

Description
+0,5XQWLPH

$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

Use the alarm object to trigger existing messages.

126

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
Using the "Alarms" list you can:
Access a message in the list (Item method)
Create a new alarm object (Create method)
Read the alarm ID of the message (AlarmID attribute)
Read the status of a message (State property)
Read the time stamp of the message (Timestamp property)
Generate an instance of the alarm object (Instance property)
Read the name of the computer on which the message came (ComputerName property)
Read or set the name of the user who triggered the message (UserName property)
Read or set the name of the process value blocks (ProcessValues property)
Read or set the message commentary (Comment property)
Read or set the message server prefix (Context property)

Example
In the following example, the message with the alarm number "1" configured in the Alarm
Logging Editor will be triggered:

'VBS360
Dim MyAlarm
Set MyAlarm = HMIRuntime.Alarms(1)
MyAlarm.State = 5 'hmiAlarmStateCome + hmiAlarmStateComment
MyAlarm.Comment = "MyComment"
MyAlarm.UserName = "Hans-Peter"
MyAlarm.ProcessValues(1) = "Process Value 1"
MyAlarm.ProcessValues(4) = "Process Value 4"
MyAlarm.Create "MyApplication"

See also
TimeStamp Property (Page 609)
ComputerName property (Page 379)
Context property (Page 380)
State property (Page 574)
AlarmID property (Page 309)
Instance property (Page 442)
Comment property (Page 378)
UserName property (Page 662)
ProcessValue property (Page 532)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

127

VBS for Creating Procedures and Actions


1.14 VBS Reference
Alarm object (Page 126)
ProcessValues Object (List) (Page 140)
Create method (Page 701)
Item Method (Page 754)

1.14.2.4

AlarmLogs Object

Description
/RJJLQJ

$ODUPORJV
'DWDORJV

Using the object, swapped archive segments of Alarm Logging may be reconnected to
Runtime, or previously swapped archive segments of Alarm Logging may be deleted again.
Therein
Archive segments to be swapped are copied to the common archiving directory of the
WinCC project, or
previously swapped archive segments are deleted in the common archiving directory.
Using parameters you may control from where archive segments are to be swapped. You may
also specify the time period over which archive segments are to be swapped or deleted. Archive
segments are copied to the common archiving directory of the project.
If an error occurred during the operation with archiving segments, the method used returns an
error message. Additional information may be found under the subject heading "Error
Messages from Database Area".

Usage
Previously swapped archive segments of Alarm Logging may be connected with Runtime
("Restore" method).
Previously swapped archive segments of Alarm Logging may be deleted from the Runtime
project ("Remove" method).

Example:
In the following example, archive segments from Alarm Logging are swapped and the return
value is output as Trace.

'VBS187
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.AlarmLogs.Restore("D:
\Folder","2004-09-14","2004-09-20",-1) & vbNewLine

128

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Error Messages from Database Area (Page 804)
Restore Method (Page 778)
Remove Method (Page 773)
DataLogs Object (Page 130)
Logging Object (Page 138)

1.14.2.5

DataItem Object

Description
+0,5XQWLPH

'DWD6HW
'DWD,WHP
6FUHHQV

'DWD6HW

6FUHHQ

'DWD,WHP

The DataItem object is used to access the contents of the DataSet list. Values or object
references are stored in the list as DataItem.
Access uses the name under which the value was added to the list. Single access using an
index is not recommended since the index changes during adding or deleting of values. The
index may be used to output the complete contents of the list. The output is in alphabetical
order.
Note
For object references it must be ascertained that objects are multiread-enabled.

Example:
The example shows how the value of 'Motor1' is output as Trace.

'VBS163
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

129

VBS for Creating Procedures and Actions


1.14 VBS Reference

The following example enumerates all DataItem objects of the DataSet list. Name and value
are output as Trace.

'VBS164
Dim data
For Each data In HMIRuntime.DataSet
HMIRuntime.Trace data.Name & ": " & data.Value & vbNewLine
Next

Note
For objects, value may possibly not be output directly

See also
Screen Object (Page 146)
HMIRuntime Object (Page 134)
DataSet Object (List) (Page 132)
Value Property (Page 666)
Name Property (Page 496)

1.14.2.6

DataLogs Object

Description
/RJJLQJ

$ODUPORJV
'DWDORJV

Using the object, swapped archive segments of Tag Logging may be reconnected to Runtime,
or previously swapped archive segments of Tag Logging may be deleted again. Therein
Archive segments to be swapped are copied to the common archiving directory of the
WinCC project, or
previously swapped archive segments are deleted in the common archiving directory.
Using parameters you may control from where archive segments are to be swapped. You may
also specify the time period over which archive segments are to be swapped or deleted. In
addition, you may set the archive type ("Tag Logging Fast", "Tag Logging Slow", "Tag Logging

130

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Fast and Tag Logging Slow"). Archive segments are copied to the common archiving directory
of the project.
If an error occurred during the operation with archiving segments, the method used returns an
error message. Additional information may be found under the subject heading "Error
Messages from Database Area".

Usage
Previously swapped archive segments of Tag Logging may be connected with Runtime
("Restore" method).
Previously swapped archive segments of Tag Logging may be deleted from the Runtime
project ("Remove" method).

Example:
In the following example, fast archive segments from Tag Logging are swapped and the return
value is output as Trace.

'VBS188
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.DataLogs.Restore("D:
\Folder","2004-09-14","2004-09-20",-1,1) & vbNewLine

See also
Error Messages from Database Area (Page 804)
Restore Method (Page 778)
Remove Method (Page 773)
AlarmLogs Object (Page 128)
Logging Object (Page 138)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

131

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.2.7

DataSet Object (List)

Description
+0,5XQWLPH

'DWD6HW
'DWD,WHP
6FUHHQV

'DWD6HW

6FUHHQ

'DWD,WHP

Using the DataSet object, data may be exchanged across several actions.
A DataSet object is global and defined by the Screen object. Any VBS action may access the
data.
The DataSet object at the Screen object must be addressed according to picture hierarchy
and shall persist as long as the picture is displayed. The global object persists over the entire
Runtime time period.
Access uses the DataItem object.
Note
Objects of type Screen, Screens, ScreenItem, ScreenItems, Tag and TagSet cannot be
included in the DataSet list.
The DataSet object does not support any classes.

Usage
Using the "DataSet" list, you may:
Output or process (enumerate) all objects in the list.
Output the number of elements contained ("Count" property).
To process a specific object in the list ("Item" method).
Add an object to the list ("Add" method).
Remove a specific object from the list ("Remove" method).
Remove all objects from the list ("RemoveAll" method).
Access to list elements uses:

132

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

HMIRuntime.DataSet("Itemname")

For a picture-specific list, access uses:

HMIRuntime.Screens("Screenname").DataSet("Itemname")

In a picture, you may access the DataSet object of the picture by using:

DataSet("Itemname")

If upon access the stated name does not exist in the list, VT_Empty is returned and an
Exception is triggered.

Example:
The example shows how to add a value to the list, how to read it and remove it. It make sense
to perform this in several different actions.

'VBS162
HMIRuntime.DataSet.Add "motor1", 23
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine
HMIRuntime.DataSet.Remove("motor1")

See also
DataItem Object (Page 129)
RemoveAll Method (Page 776)
Remove Method (Page 773)
Item Method (Page 754)
Count Property (Page 381)
Add Method (Page 698)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

133

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.2.8

HMIRuntime Object

Description
+0,5XQWLPH

$FWLYH3URMHFW
7DJV
7DJ
$FWLYH6FUHHQ
6FUHHQV
6FUHHQ
/RJJLQJ
$ODUPV
$ODUP
The HMIRuntime object represents the graphic Runtime environment.

Usage
The "HMIRuntime" object can be used for the following, for example:
Read or set the current Runtime language ("Language" property).
Read or set the name of the current base picture ("BaseScreenName" property).
Read the path of the active Runtime project ("ActiveProject" property).
Access tags ("Tags" property).
Access tags of a list ("DataSet" property).
Exit Runtime ("Stop" method).
Display messages in a diagnostics window ("Trace" method).

134

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
The following command terminates WinCC Runtime:

'VBS3
HMIRuntime.Stop

See also
Screens Object (List) (Page 149)
TagSet Object (List) (Page 156)
Tags Object (List) (Page 155)
Logging Object (Page 138)
DataSet Object (List) (Page 132)
Visible Property (Page 681)
Trace Method (Page 795)
Tags Property (Page 583)
Stop Method (Page 794)
AlignmentLeft Property (Page 311)
Logging Property (Page 471)
Language Property (Page 446)
DataSet Property (Page 386)
CurrentContext Property (Page 382)
BaseScreenName Property (Page 330)
ActiveProject Property (Page 305)
ActiveScreen Property (Page 305)
MenuToolBarConfig Property (Page 482)
Alarms object (list) (Page 126)

1.14.2.9

Item Object

Description
The "Item" object provides a reference to the current object.

Usage
The "Item" object is used, for example, to address the properties of the object currently selected
in Graphics Designer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

135

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
In the following example, a rectangle has been created. When the object has been selected,
all the properties of the current object can be set a background color red:

'VBS195
Item.BackColor = RGB(255,0,0)

See also
Objects and Lists (Page 123)

1.14.2.10 Layer Object


Description
6FUHHQV
6FUHHQ

/D\HUV
/D\HU
The layer object returns the result of access to the layers list.

Parent Object
Picture, in which the picture layer is.

Usage
Depending on certain events, the Layer object can be used to obtain access to the properties
of a complete layer in order, for example, to hide or unhide a layer with operating elements
according to the operator authorization.
The "Layer" object can be used to:

136

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
To activate or deactivate the visualization of a layer ("Visible" property).
To read out the name of a layer ("Name" property).
Note
The layer property specifies the layer in which the object is located. The layer "0" is output
as "Layer0".
When accessed, the layers are counted up from 1 in VBS. Therefore, the layer "1" must
be addressed with "layers(2)".

Example:
In the following example, Layer 1 is set invisible:

'VBS4
Layers(2).Visible = vbFalse

See also
Layer Object (Page 136)
Visible Property (Page 681)
Parent Property (Page 515)
Name Property (Page 496)

1.14.2.11 Layers Object (Listing)


Description
6FUHHQV
6FUHHQ

/D\HUV
/D\HU
The Layers list enables access to all 32 layers of the graphical Runtime system.

Parent Object
Picture, in which the picture layer is.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

137

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
The "Layers" list can be used to:
Process all layers in the list ("_NewEnum" property).
Count all layers contained in the list ("Count" property).
Process a layer from the list ("Item" method).
The properties represent default properties and methods of a list and are not described in detail
in the WinCC documentation.

See also
Parent Property (Page 515)
Item Method (Page 754)
Count Property (Page 381)
Layer Object (Page 136)

1.14.2.12 Logging Object


Description
+0,5XQWLPH

/RJJLQJ

$ODUPORJV
'DWDORJV

Using the object, swapped archive segments may be reconnected to Runtime, or previously
swapped archive segments may be deleted again. Therein
Archive segments to be swapped are copied to the common archiving directory of the
WinCC project, or
previously swapped archive segments are deleted in the common archiving directory.
Using parameters you may control from where archive segments are to be swapped. You may
also specify the time period over which archive segments are to be swapped or deleted. Archive
segments are copied to the common archiving directory of the project.
If an error occurred during the operation with archiving segments, the method used returns an
error message. Additional information may be found under the subject heading "Error
Messages from Database Area".

Usage
Previously swapped archive segments of Alarm Logging and Tag Logging may be connected
with Runtime ("Restore" method).

138

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Previously swapped archive segments of Alarm Logging and Tag Logging may be deleted
from the Runtime project ("Remove" method).

Example:
In the following example, archive segments from Alarm Logging and Tag Logging are swapped
and the return value is output as Trace.

'VBS189
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Restore("D:
\Folder","2004-09-14","2004-09-20",-1) & vbNewLine

See also
Error Messages from Database Area (Page 804)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)
Restore Method (Page 778)
Remove Method (Page 773)
DataLogs Property (Page 386)
AlarmLogs Property (Page 310)

1.14.2.13 ProcessValue Object


Description
$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

The ProcessValue object is used to access the ProcessValues object list.


Note
Only the 10 predefined ProcessValues are supported.

See also
ProcessValues Object (List) (Page 140)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

139

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.2.14 ProcessValues Object (List)


Description
$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

Usage
Using the "ProcessValues" list, you can:
Edit a ProcessValue from the list ("Item" method)
Display or edit all the objects in the list (_NewEnum attribute)
Count all ProcessValues contained in the list (Count property)
Read or set the values of the ProcessValue object (Value property)
The properties represent default properties and methods of a list and are not described in detail
in the WinCC documentation.

See also
Alarms object (list) (Page 126)
ProcessValue Object (Page 139)
Count Property (Page 381)
Value Property (Page 666)
Item Method (Page 754)

1.14.2.15 Project Object


Description
+0,5XQWLPH

$FWLYH3URMHFW
Using the object, information may be requested from the current Runtime project.
The project object is returned as the result of ActiveProject.

140

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
Using the "Project" object, you may:
Read the path of the current Runtime project ("Path" property).
Read the name of the current Runtime project, without path or file extension ("Name"
property).

Example:
The following example returns name and path of the current Runtime project as Trace:

'VBS159
HMIRuntime.Trace "Name: " & HMIRuntime.ActiveProject.Name & vbNewLine
HMIRuntime.Trace "Path: " & HMIRuntime.ActiveProject.Path & vbNewLine

See also
ActiveProject Property (Page 305)
Name Property (Page 496)
Path Property (Page 517)

1.14.2.16 ScreenItem Object


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
The ScreenItem object returns the result of access to the ScreenItem list.

Parent Object
Picture containing the picture element.

Usage
The ScreenItem object can be used to access the properties of graphic objects within a picture
according to certain events.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

141

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "ScreenItem" object can be used for the following, for example:
To activate or deactivate the visualization of an object ("Visible" property).
To release or block the operation of an object ("Enabled" property).
Change the width and height of an object ("Height" and "Width" properties).
Change the position of an object ("Top" and "Left" properties).
Read and define a layer in which a graphic object is located ("Layer" property).
Read or define the name of a graphic object ("ObjectName" property).
Define a reference to the superordinate picture ("Parent" property).
Using the "Activate" method, the focus is set on the respective ScreenItem object. If the focus
cannot be set because the object is non-operable, for example, an error is generated. Using
error processing (On Error Resume Next), the error may be evaluated.

Possible features of ScreenItem


The "ScreenItem" object can contain the following object types:

142

Standard
objects

Smart objects Windows


objects

Tube objects Controls

Others

Ellipse

3D bar

Button

Double Tpiece

Siemens HMI
Symbol Library

Customized
Object

Ellipse arc

Application
window

Check box

Polygon
tube

WinCC
AlarmControl

Group

Ellipse
segment

Bar

Radio box

Tube bend

WinCC digital/
analog clock
control

Circle

Picture
window

Round button

T-piece

WinCC
FunctionTrendCon
trol

Circular arc

Control

Slider

Pie segment

I/O field

WinCC
OnlineTrendContr
ol

Line

Faceplate
Instance

WinCC
OnlineTableContr
ol

Polygon

Graphic
object

WinCC push
button control

Polyline

Combo box

WinCC
RulerControl

Rectangle

List box

WinCC slider
control

Rounded
rectangle

Multiple row
text

WinCC
UserArchiveContr
ol

Connector

OLE object

WinCC gauge
control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Standard
objects

Smart objects Windows


objects

Tube objects Controls

Others

Group display
Text list
Status display

Detailed descriptions of the individual object types is provided under "ScreenItem Object
Types". The ScreenItem object's "Type" property can be used to address the object types via
the VBS Type ID.

Object properties
The "ScreenItem" object has different properties according to the features. The following
section describes the properties which all ScreenItem object types have:

When a specific object type is addressed, certain further properties are added to the standard
properties:

The additional properties are indicated in the descriptions of the individual object types.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

143

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example
In the following example, the radius of a circle is set to 2 in Runtime per mouse click:

Sub OnClick(ByVal Item)


'VBS5
Dim objCircle
Set objCircle= ScreenItems("Circle1")
objCircle.Radius = 2
End Sub

See also
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
Parent Property (Page 515)
Left Property (Page 464)
Layer Property (Page 447)
Height Property (Page 431)
Enabled Property (Page 395)
Activate Method (Page 697)
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
Properties (Page 303)
Objects and Lists (Page 123)
Object types of the ScreenItem object (Page 158)

1.14.2.17 ScreenItems Object (List)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP

144

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "ScreenItems" list can be used to reference an object in the picture.

Parent Object
Picture containing the picture element.

Usage
The "ScreenItems" list can be used to:
To display or edit all objects in the list (i.e. all objects within a picture) ("_NewEnum"
property).
To count the objects in a picture ("Count" property).
To process a specific object in the list ("Item" method).
The properties are standard properties and methods of a collection and are not described in
detail in the WinCC documentation.

Special features of the ScreenItem object


If an external control (ActiveX control or OLE object) is embedded in WinCC, it is possible that
the properties of the embedded controls have the same name with the general properties of
the ScreenItem object. In such cases, the ScreenItem properties have priority.
The properties of the embedded controls can also be addressed via the "object" property:
The "object" property is only provided by ActiveX controls and OLE objects.
Example:

'Control1 is an embedded ActiveX-Control with property "type"


'VBS196
Dim Control
Set Control=ScreenItems("Control1")
Control.object.type
'Control1 is a WinCC-Control
'VBS197
Dim Control
Set Control=ScreenItems("Control1")
Control.type

Example
In the following example, the name of the objects in the current picture are displayed in a
message box:

Sub OnClick(ByVal Item)


'VBS6

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

145

VBS for Creating Procedures and Actions


1.14 VBS Reference

Dim lngAnswer
Dim lngIndex
lngIndex = 1
For lngIndex = 1 To ScreenItems.Count
lngAnswer = MsgBox(ScreenItems(lngIndex).Objectname, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next
End Sub

See also
Count Property (Page 381)
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
ScreenItem Object (Page 141)
Parent Property (Page 515)
Item Method (Page 754)

1.14.2.18 Screen Object


Description
+0,5XQWLPH

6FUHHQV
6FUHHQ

$FWLYH6FUHHQ,WHP
6FUHHQ,WHPV
6FUHHQ,WHP
/D\HUV
/D\HU
'DWD6HW
'DWD,WHP

The Screen object returns the result of access to the Screen list. All the properties and methods
of this object can also be edited directly in Runtime. The "Screen" object represents a WinCC
picture in Runtime and contains all the properties of the picture document and picture view.

146

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "Screen" object also contains the following:
A list of all the graphic objects contained in the addressed picture which can be addressed
by the "ScreenItems" object.
A list of all the layers contained in the addressed picture which can be addressed by the
"Layers" object.

Parent Object
A picture window in which the Screen object is embedded.
When the Screen object is the basic picture, the Parent object is not defined and set to zero.

Usage
The "Screen" object can be used for the following, for example:
To release or block the operation of a screen ("Enabled" property).
Change the width and height of a screen ("Height" and "Width" properties).
Zoom a picture ("Zoom" property).
Modify the fill pattern, background color and fill pattern color ("Fillstyle", "Backcolor" and
"Fillcolor" properties).
Note
If a Change Picture is executed, all the open references are invalid for pictures no longer
open. It is then no longer possible to work with these references.

Example:
In the following example, the width of the first picture in Runtime is increased by 20 pixels:

'VBS7
Dim objScreen
Set objScreen = HMIRuntime.Screens(1)
MsgBox "Screen width before changing: " & objScreen.Width
objScreen.Width = objScreen.Width + 20
MsgBox "Screen width after changing: " & objScreen.Width

Notes on Cross References


All the pictures which are addressed with the standard formulation
HMIRuntime.BaseScreenName = "Screenname"
are automatically compiled by the CrossReference of WinCC and then listed in the picture
properties.
If pictures are addressed with different formulations in the code, this can be notified by the
following section of the CrossReference:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

147

VBS for Creating Procedures and Actions


1.14 VBS Reference

' ' WINCC:SCREENNAME_SECTION_START


Const ScreenNameInAction = "ScreenName"
' WINCC:SCREENNAME_SECTION_END
The section can be inserted in VBS actions as often as required.

Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

See also
ScreenItems Property (Page 548)
Refresh Method (Page 772)
Activate Method (Page 697)
Zoom Property (Page 694)
Width Property (Page 683)
Parent Property (Page 515)
ObjectSizeDeclutteringMin Property (Page 501)
ObjectSizeDeclutteringMax Property (Page 500)
ObjectSizeDeclutteringEnable Property (Page 500)
ObjectName Property (Page 499)
Layers Property (Page 463)
DataSet Property (Page 386)
LayerDeclutteringEnable Property (Page 463)
Height Property (Page 431)
FillStyle Property (Page 408)
FillColor Property (Page 406)
ExtendedZoomingEnable Property (Page 404)
Enabled Property (Page 395)
BackColor Property (Page 323)
ActiveScreenItem Property (Page 306)
AccessPath Property (Page 304)

148

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.2.19 Screens Object (List)


Description
+0,5XQWLPH

6FUHHQV
6FUHHQ

$FWLYH6FUHHQ,WHP
6FUHHQ,WHPV
6FUHHQ,WHP
/D\HUV
/D\HU
'DWD6HW
'DWD,WHP

By using the picture window technique, several windows can be opened simultaneously in
WinCC Runtime but only one basic picture exists. The "Screens" list enables access to all
open pictures in Runtime using the picture names. The Screens list contains all invisible
pictures.

Usage
When configuring a multi-user project, it is essential to specify the server prefix to access a
picture which is not on the local computer.
The "Screens" list can be used to:
Display or edit all the pictures within the list ("_NewEnum" property).
To count the pictures in a project ("Count" property).
To process a specific picture in the list ("Item" method).
Initiate new drawing of all visible pictures ("Refresh" method).
The properties are standard properties and methods of a collection and are not described in
detail in the WinCC documentation.
The access code, required in the VBS environment in the
HMIRuntime.Screens(<Zugriffsschlssel>) instruction, must fulfill the syntax requirements:
[<Grundbildname>.]<Bildfenstername>[:<Bildname>] ...
.<Bildfenstername>[:<Bildname>]
This means:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

149

VBS for Creating Procedures and Actions


1.14 VBS Reference
The access code expresses the picture hierarchy.
The picture names in the code can be omitted at any point.
The "AccessPath" property of the "Screen" object corresponds to the full access code.
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.
The basic picture can be addressed by the access code ".
In addition, it has been defined that the basic picture can be addressed with Index 1.

Examples
The pictures are addressed by the hierarchy information in the list. There are two options here,
with or without use of the picture name. In the following examples, a basic picture
"BaseScreenName" is configured with a picture window "ScreenWindow". The picture window
contains the picture "ScreenName".
Addressing with the picture name

'VBS8
Set objScreen = HMIRuntime.Screens("BaseScreenName.ScreenWindow:ScreenName")

Addressing without the picture name

'VBS9
Set objScreen = HMIRuntime.Screens("ScreenWindow")

Referencing the basic picture in various ways

'VBS10
Set objScreen = HMIRuntime.Screens(1)
'VBS11
Set objScreen = HMIRuntime.Screens("")
'VBS12
Set objScreen = HMIRuntime.Screens("BaseScreenName")

See also
ScreenItem Object (Page 141)
Refresh Method (Page 772)

150

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Item Method (Page 754)
Count Property (Page 381)

1.14.2.20 SmartTags Object


Description
The "HMIRuntime" component was deactivated in the faceplate type. The new "SmartTags"
component was added for the faceplate type. With the SmartTags object you can dynamize
the faceplate type. You can only access the faceplate variables and the properties of the
faceplate type. You cannot access the normal WinCC tag management system. The normal
WinCC tag management system is not available in the faceplate type.

Usage
Using the "SmartTags" object, you can:
Access the faceplate tags in a faceplate type.
Syntax: SmartTags("<tagname>")
Access the properties of a faceplate type.
Syntax: SmartTags("Properties\<propertyname>")

Example 1
Insert a rectangle and a button in a faceplate type. Define a faceplate variable var1. Connect
the "Width" property of the rectangle to faceplate variable var1. Dynamize the "OnClick" event
of the button as follows with VBS.

'VBS306
Dim w
w = SmartTags("var1")
w = w + 10
SmartTags("var1") = w

When you activate Runtime, the faceplate variable is incremented by 10 every time you click
the button. This increases the rectangle width by 10.
Direct reading and writing with object reference
In the following example, the SmartTags object is used to create an object reference "w" to
"var1".
Referencing offers the advantage of being able to access the "var1" tag.

'VBS307
Dim w
Set w = SmartTags("var1")
w.value = w.value + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

151

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example 2:
Insert a rectangle and a button in a faceplate type. Define the instance-specific property "wide".
Link the "Width" property of the rectangle to the instance-specific property "wide". Dynamize
the "OnClick" event of the button as follows with VBS:

'VBS308
Dim w
w = SmartTags("Properties\wide")
SmartTags("Properties\wide") = w + 50

When you activate Runtime, the instance-specific property "wide" is increased by 50 every
time you click the button. This increases the rectangle width by 50.

See also
SmartTag property (Page 568)

1.14.2.21 Tag Object


Description
+0,5XQWLPH

7DJV

7DJ6HW

7DJ

7DJ

A tag object is returned via the "Tags" list. A tag object can be used to address all the properties
and methods of a tag.
When creating a tag object, all the properties are installed with the following values:
Value = VT_EMPTY
Name = Tag name
QualityCode = BAD NON-SPECIFIC
TimeStamp = 0
LastError = 0
ErrorDescription = " "
Note
A summary of possible Quality Codes may be found in WinCC Information System under
key word "Communication" > "Diagnostics" or "Communication" > "Quality Codes".

152

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
The "Tag" object can be used to:
Read out information on the tag ("Name", "QualityCode", "TimeStamp", "LastError" and
"ErrorDescription" properties)
Set a value for a tag ("Write" method, "Value" property)
Read a value for a tag ("Read" method, "Value" property)
Read the value of a "Tag1" tag:

'VBS13
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read()
MsgBox objTag.Value

Declaration of tags in WinCC


Always define internal tags in VB script using the "Dim" instruction in order to prevent writing
tags wrongly.
When creating a new action, the "Option explicit" instruction is automatically entered in the
declaration area and cannot be deleted.
Do not use the "Option explicit" instruction in the code because it may cause Runtime errors.
Example: Declaration of a VBScript "lngVar" tag:

'VBS14
Dim lngVar
lngVar = 5
MsgBox lngVar

Note
Tag names must not contain any special characters.
Please note that when creating a tag, it must not contain a value (Value = VT_EMPTY).
Initialize the tags after declaration with the corresponding value.

Notes on Cross References


All the pictures which are addressed with the standard formulation

HMIRuntime.Tags("Tagname")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

153

VBS for Creating Procedures and Actions


1.14 VBS Reference

are automatically compiled by the CrossReference of WinCC and then listed in the picture
properties.
If tags are addressed with different formulations in the code, this can be notified by the following
section of the CrossReference:

' ' WINCC:TAGNAME_SECTION_START


Const TagNameInAction = "TagName"
' WINCC:TAGNAME_SECTION_END

The section can be inserted in VBS actions as often as required.


Note
It is not possible to guarantee the compilation of combined tag names from the
CrossReference.

See also
Name Property (Page 496)
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
Write Method (Page 797)
Read Method (Page 768)
Value Property (Page 666)
TimeStamp Property (Page 609)
QualityCode Property (Page 533)
LastError Property (Page 446)
ErrorDescription Property (Page 399)

154

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.2.22 Tags Object (List)


Description
+0,5XQWLPH

7DJV

7DJ6HW

7DJ

7DJ

The "Tags" list enables access to tags in WinCC Runtime. The result of access to the "Tags"
list is returned by an object of the type "Tag". The Tag object can be used to access all the tag
properties and methods.
Note
"Tags" is a list with a restricted functional scope. The tags in the list cannot be accessed via
the index but only by using the tag names. The standard methods get_Count and
get_NewEnum cannot be used in the Tags list.

Usage
Tags in the list are accessed via:

HMIRuntime.Tags("Tagname")

The Tags list is used to declare tags (tag objects) for read and write access. To ensure that
read and write access is carried out without errors, the corresponding tags must be available
in WinCC tag management.
In VBS you can address tags directly via the name and set and read values. If you want to
access additional tag properties, request the quality code, for example, you will always have
to address tags via the tag listing. The tag object returned enables access to all tag properties
and methods. You have to form an instance for the object, to write a binary tag with
HMIRuntime.Tags("Variable").Value=TRUE, for example.
The "CreateTagSet" method can be used to generate a "TagSet" object that enables
simultaneous access to several tags.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

155

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
There are two options when creating tags:
With specification of the server prefix: For tags in multi-user systems which are not stored
locally.
Direct use of the tag name: For tags stored locally on the computer.
Specification of the server prefix

'VBS15
Dim objTag
Set objTag = HMIRuntime.Tags("Serverprefix::Tagname")
If the server prefix is entered directly, the "ServerPrefix" property is assigned the
corresponding value.

Specification of the tag name

'VBS16
Dim objTag
Set objTag = HMIRuntime.Tags("Tagname")
If just the tag name is used, the "ServerPrefix" and "TagPrefix" properties are assigned
the values from the current context (current picture window).

See also
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
Item Method (Page 754)
CreateTagSet Method (Page 702)
Tag Object (Page 152)

1.14.2.23 TagSet Object (List)


Description
The object "TagSet" enables simultaneous access to several tags in one call. This features
better performance and lower communication load that single access to various tags.

156

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
Using the TagSet object, you may:
Add tags to the list ("Add" method)
Access tag objects contained in the list, and their properties ("Item" method)
Write all tags of the list ("Write" method)
Read all tags of the list ("Read" method)
Remove single tags from the list ("Remove" method)
Remove all tags from the list ("RemoveAll" method)
Tags in the list are accessed via:

'VBS169
Dim myTags
myTags = HMIRuntime.Tags.CreateTagSet
myTags("Tagname")

In order to have error-free read/write access to tags (tag objects) of the list, the respective tags
must exist in WinCC tag management.
If an error occurred during read/write access, the method used will return an error message
using the "LastError" and "ErrorDescription" properties.
Synchronous writing and reading of the tags is possible. The optional "Writemode" parameter
can be used to write process tags directly to the AS with "1", for example, "group.Write 1". Use
the optional "Readmode" parameter to read process tags with "1" directly from the AS or
channel, for example, "group.Read 1".

Example:
The following example shows how to generate a TagSet object, how to add tags, and how to
write values.

'VBS168
Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
'Add Tags to the Collection
group.Add "Motor1"
group.Add "Motor2"
'Set the Values of the Tags
group("Motor1").Value = 3
group("Motor2").Value = 9
'Write the Values to the DataManager
group.Write

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

157

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
LastError Property (Page 446)
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
Write Method (Page 797)
RemoveAll Method (Page 776)
Remove Method (Page 773)
Read Method (Page 768)
Item Method (Page 754)
ErrorDescription Property (Page 399)
Count Property (Page 381)
Add Method (Page 698)
Tags Object (List) (Page 155)
Tag Object (Page 152)

1.14.3

Object types of the ScreenItem object

1.14.3.1

Object types of the ScreenItem object

Introduction
The following section lists all the available types of the "ScreenItem" object.
The features of the "ScreenItem" object represent all the graphic objects available in WinCC
Graphics Designer.
The object types are divided into the following groups according to their arrangement in
Graphics Designer:
Standard objects
Smart objects
Windows objects
Tube objects
Controls
There are also the object types
Customized Object
Group

158

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Group (Page 302)
Customized Object (Page 301)
Controls (Page 232)

1.14.3.2

Standard objects

Ellipse
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Ellipse"

Type Identifier in VBS


HMIEllipse

Usage
In the following example, the object with the name "Ellipse1" is moved 10 pixels to the right:

'VBS17
Dim objEllipse
Set objEllipse = ScreenItems("Ellipse1")
objEllipse.Left = objEllipse.Left + 10

See also
FillStyle Property (Page 408)
Activate Method (Page 697)
Properties (Page 303)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

159

VBS for Creating Procedures and Actions


1.14 VBS Reference
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
RadiusWidth Property (Page 535)
RadiusHeight Property (Page 534)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 447)

160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Ellipse arc
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Ellipse Arc"

Type Identifier in VBS


HMIEllipticalArc

Usage
In the following example, the object with the name "EllipseArc1" is moved 10 pixels to the right:

'VBS18
Dim objEllipseArc
Set objEllipseArc = ScreenItems("EllipseArc1")
objEllipseArc.Left = objEllipseArc.Left + 10

See also
RadiusHeight Property (Page 534)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
StartAngle Property (Page 574)
RadiusWidth Property (Page 535)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

161

VBS for Creating Procedures and Actions


1.14 VBS Reference
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashBorderColor Property (Page 412)
EndAngle Property (Page 397)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
Layer Property (Page 447)

Ellipse segment
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Ellipse Segment"

Type Identifier in VBS


HMIEllipseSegment

162

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "EllipseSegment1" is moved 10 pixels to
the right:

'VBS19
Dim objEllipseSeg
Set objEllipseSeg = ScreenItems("EllipseSegment1")
objEllipseSeg.Left = objEllipseSeg.Left + 10

See also
Layer Object (Page 136)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
StartAngle Property (Page 574)
RadiusWidth Property (Page 535)
RadiusHeight Property (Page 534)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

163

VBS for Creating Procedures and Actions


1.14 VBS Reference
EndAngle Property (Page 397)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 447)

Circle
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Circle".

Type Identifier in VBS


HMICircle

Usage
In the following example, the object with the name "Circle1" is moved 10 pixels to the right:

'VBS20
Dim objCircle
Set objCircle= ScreenItems("Circle1")
objCircle.Left = objCircle.Left + 10

164

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Properties (Page 303)
BorderStyle Property (Page 344)
Activate Method (Page 697)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Radius Property (Page 534)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

165

VBS for Creating Procedures and Actions


1.14 VBS Reference
BackColor Property (Page 323)
Layer Property (Page 447)

Circular arc
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Circular Arc"

Type Identifier in VBS


HMICircularArc

Usage
In the following example, the object with the name "CircularArc1" is moved 10 pixels to the
right:

'VBS21
Dim objCircularArc
Set objCircularArc = ScreenItems("CircularArc1")
objCircularArc.Left = objCircularArc.Left + 10

See also
StartAngle Property (Page 574)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)

166

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Top Property (Page 628)
ToolTipText Property (Page 627)
Radius Property (Page 534)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashBorderColor Property (Page 412)
EndAngle Property (Page 397)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
Layer Property (Page 447)

Pie segment
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Pie Segment"

Type Identifier in VBS


HMICircleSegment

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

167

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "PieSegment1" is moved 10 pixels to the
right:

'VBS22
Dim objCircleSeg
Set objCircleSeg = ScreenItems("PieSegment1")
objCircleSeg.Left = objCircleSeg.Left + 10

See also
Type Property (Page 652)
BorderColor Property (Page 342)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Top Property (Page 628)
ToolTipText Property (Page 627)
StartAngle Property (Page 574)
Radius Property (Page 534)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)

168

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
EndAngle Property (Page 397)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 447)

Line
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Line"

Type Identifier in VBS


HMILine

Usage
In the following example, the object with the name "Line1" is moved 10 pixels to the right:

'VBS23
Dim objLine
Set objLine = ScreenItems("Line1")
objLine.Left = objLine.Left + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

169

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
PasswordLevel Property (Page 517)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
RotationAngle Property (Page 539)
ReferenceRotationTop Property (Page 536)
ReferenceRotationLeft Property (Page 536)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashBorderColor Property (Page 412)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderEndStyle Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
Layer Property (Page 447)

170

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Polygon
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Polygon"

Type Identifier in VBS


HMIPolygon

Usage
In the following example, the object with the name "Polygon1" is moved 10 pixels to the right:

'VBS24
Dim objPolygon
Set objPolygon = ScreenItems("Polygon1")
objPolygon.Left = objPolygon.Left + 10

See also
ReferenceRotationTop Property (Page 536)
BackFlashColorOn Property (Page 326)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
RotationAngle Property (Page 539)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

171

VBS for Creating Procedures and Actions


1.14 VBS Reference
ReferenceRotationLeft Property (Page 536)
PointCount Property (Page 528)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Index Property (Page 439)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
ActualPointTop Property (Page 307)
ActualPointLeft Property (Page 307)
Layer Property (Page 447)

172

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Polyline
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Polyline"

Type Identifier in VBS


HMIPolyLine

Usage
In the following example, the object with the name "Polyline1" is moved 10 pixels to the right:

'VBS25
Dim objPolyline
Set objPolyline = ScreenItems("Polyline1")
objPolyline.Left = objPolyline.Left + 10

See also
Layer Object (Page 136)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
RotationAngle Property (Page 539)
ReferenceRotationTop Property (Page 536)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

173

VBS for Creating Procedures and Actions


1.14 VBS Reference
ReferenceRotationLeft Property (Page 536)
PointCount Property (Page 528)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Index Property (Page 439)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashBorderColor Property (Page 412)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderEndStyle Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
ActualPointTop Property (Page 307)
ActualPointLeft Property (Page 307)
Layer Property (Page 447)

Rectangle
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Rectangle"

174

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Type Identifier in VBS


HMIRectangle

Usage
In the following example, the object with the name "Rectangle1" is moved 10 pixels to the right:

'VBS26
Dim objRectangle
Set objRectangle = ScreenItems("Rectangle1")
objRectangle.Left = objRectangle.Left + 10

Notes on Error Handling


The rectangle and rounded rectangle are mapped to an "HMIRectangle" type in the object
model. Since the two objects have different properties, the availability of the property (dynamic
type compilation in Runtime) should be queried via an exception measure. The exception
measure is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

175

VBS for Creating Procedures and Actions


1.14 VBS Reference

Examples of error handling

Sub OnClick(ByVal Item)


'VBS27
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If "HMIRectangle" = objScreenItem.Type Then
'
'=== Property "RoundCornerHeight" only available for RoundRectangle
objScreenItem.RoundCornerHeight = objScreenItem.RoundCornerHeight * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.Name & ": no RoundedRectangle" & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

See also
Properties (Page 303)
BorderFlashColorOn Property (Page 344)
Activate Method (Page 697)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)

176

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 447)

Rounded rectangle
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Rounded Rectangle".

Type Identifier in VBS


HMIRoundRectangle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

177

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "RoundedRectangle1" is moved 10 pixels
to the right:

'VBS28
Dim objRoundedRectangle
Set objRoundedRectangle = ScreenItems("RoundedRectangle1")
objRoundedRectangle.Left = objRoundedRectangle.Left + 10

Notes on Error Handling


The rectangle and rounded rectangle are mapped to an "HMIRectangle" type in the object
model. Since the two objects have different properties, the availability of the property (dynamic
type compilation in Runtime) should be queried via an exception measure. The exception
measure is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(ByVal Item)

178

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

'VBS29
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If "HMIRectangle" = objScreenItem.Type Then
'
'=== Property "RoundCornerHeight" available only for RoundRectangle
objScreenItem.RoundCornerHeight = objScreenItem.RoundCornerHeight * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no RoundedRectangle" & vbCrLf
Err.Clear
'Delete errormessage
End If
End If
Next
On Error Goto 0
'Deactivation of errorhandling
End Sub

See also
FlashBackColor Property (Page 411)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
RoundCornerWidth Property (Page 540)
RoundCornerHeight Property (Page 540)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FillStyle Property (Page 408)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

179

VBS for Creating Procedures and Actions


1.14 VBS Reference
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 447)

Static text
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Static Text"

Type Identifier in VBS


HMITextField

Usage
In the following example, the object with the name "StaticText1" is moved 10 pixels to the right:

'VBS30
Dim objStaticText
Set objStaticText = ScreenItems("StaticText1")

180

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

objStaticText.Left = objStaticText.Left + 10

See also
ObjectName Property (Page 499)
BorderFlashColorOn Property (Page 344)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Text list (Page 211)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
Orientation Property (Page 513)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
ForeFlashColorOn Property (Page 424)
ForeFlashColorOff Property (Page 423)
ForeColor Property (Page 423)
FontUnderline Property (Page 422)
FontSize Property (Page 421)
FontName Property (Page 421)
FontItalic Property (Page 420)
FontBold Property (Page 420)
FlashRateForeColor Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashForeColor Property (Page 412)
FlashBorderColor Property (Page 412)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

181

VBS for Creating Procedures and Actions


1.14 VBS Reference
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)
Layer Property (Page 447)

Connector
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Connector"

Type Identifier in VBS


HMIConnector

182

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "Connector1" is moved 10 pixels to the right:

'VBS31
Dim objConnector
Set objConnector = ScreenItems("Connector1")
objConnector.Left = objConnector.Left + 10

See also
ScreenItems Object (List) (Page 144)
Activate Method (Page 697)
Properties (Page 303)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
TopConnectedObjectName Property (Page 629)
TopConnectedConnectionPointIndex Property (Page 629)
Top Property (Page 628)
ToolTipText Property (Page 627)
Parent Property (Page 515)
Orientation Property (Page 513)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Property (Page 447)
Height Property (Page 431)
Enabled Property (Page 395)
BottomConnectedObjectName Property (Page 345)
BottomConnectedConnectionPointIndex Property (Page 345)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

183

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.3.3

Smart objects

3D Bar
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "3D Bar"

Type Identifier in VBS


HMIBar

Usage
In the following example, the object with the name "3DBar1" is moved 10 pixels to the right:

'VBS32
Dim objBar
Set objBar = ScreenItems("3DBar1")
objBar.Left = objBar.Left + 10

Notes on Error Handling


Bars and 3D bars are imaged in the object model on a "HMIBar" type. Since the two objects
have different properties, the availability of the property (dynamic type compilation in Runtime)
should be queried via an exception measure. The exception measure is activated for the
corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

184

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

'VBS148
Sub OnClick(ByVal Item)
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If "HMIBar" = objScreenItem.Type Then
'
'=== Property "Layer00Value" only available for 3D bar
objScreenItem.Layer00Value = objScreenItem.Layer00Value * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.Name & ": no 3D bar" & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

See also
Type Property (Page 652)
Layer08Color Property (Page 455)
BorderStyle Property (Page 344)
Activate Method (Page 697)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

185

VBS for Creating Procedures and Actions


1.14 VBS Reference
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
ZeroPointValue Property (Page 694)
Width Property (Page 683)
Visible Property (Page 681)
Top Property (Page 628)
ToolTipText Property (Page 627)
Process Property (Page 531)
PredefinedAngles Property (Page 530)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Min Property (Page 493)
Max Property (Page 475)
LightEffect Property (Page 465)
Left Property (Page 464)
Layer10Value Property (Page 462)
Layer09Value Property (Page 462)
Layer08Value Property (Page 462)
Layer07Value Property (Page 462)
Layer06Value Property (Page 461)
Layer05Value Property (Page 461)
Layer04Value Property (Page 461)
Layer03Value Property (Page 460)
Layer02Value Property (Page 460)
Layer01Value Property (Page 460)
Layer00Value Property (Page 460)
Layer10Color Property (Page 455)
Layer09Color Property (Page 455)
Layer07Color Property (Page 454)
Layer06Color Property (Page 454)
Layer05Color Property (Page 454)
Layer04Color Property (Page 453)
Layer03Color Property (Page 453)

186

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Layer02Color Property (Page 453)
Layer01Color Property (Page 452)
Layer00Color Property (Page 452)
Layer10Checked Property (Page 452)
Layer09Checked Property (Page 451)
Layer08Checked Property (Page 451)
Layer07Checked Property (Page 451)
Layer06Checked Property (Page 450)
Layer05Checked Property (Page 450)
Layer04Checked Property (Page 450)
Layer03Checked Property (Page 449)
Layer02Checked Property (Page 449)
Layer01Checked Property (Page 449)
Layer00Checked Property (Page 448)
Layer Object (Page 136)
Height Property (Page 431)
Enabled Property (Page 395)
Direction Property (Page 392)
BorderWidth Property (Page 344)
BorderColor Property (Page 342)
BaseY Property (Page 331)
BaseX Property (Page 331)
BarWidth Property (Page 329)
BarHeight Property (Page 329)
BarDepth Property (Page 328)
Background Property (Page 326)
BackColor Property (Page 323)
Axe Property (Page 322)
AngleBeta Property (Page 314)
AngleAlpha Property (Page 313)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

187

VBS for Creating Procedures and Actions


1.14 VBS Reference

Application Window
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Application Window"

Type Identifier in VBS


HMIApplicationWindow

Usage
In the following example, the object with the name "ApplicationWindow1" is moved 10 pixels
to the right:

'VBS33
Dim objAppWindow
Set objAppWindow = ScreenItems("ApplicationWindow1")
objAppWindow.Left = objAppWindow.Left + 10

See also
Properties (Page 303)
Activate Method (Page 697)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
WindowBorder Property (Page 684)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
Template Property (Page 584)
Parent Property (Page 515)

188

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
OnTop Property (Page 503)
ObjectName Property (Page 499)
Moveable Property (Page 494)
MaximizeButton Property (Page 476)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
Enabled Property (Page 395)
CloseButton Property (Page 360)
Caption Property (Page 351)
Application Property (Page 315)

Bar
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Bar"

Type Identifier in VBS


HMIBar

Usage
In the following example, the object with the name "Bar1" is moved 10 pixels to the right:

'VBS34
Dim objBar
Set objBar = ScreenItems("Bar1")
objBar.Left = objBar.Left + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

189

VBS for Creating Procedures and Actions


1.14 VBS Reference

Notes on Error Handling


Bars and 3D bars are imaged in the object model on a "HMIBar" type. Since the two objects
have different properties, the availability of the property (dynamic type compilation in Runtime)
should be queried via an exception measure. The exception measure is activated for the
corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

'VBS147
Sub OnClick(ByVal Item)
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If "HMIBar" = objScreenItem.Type Then
'
'=== Property "LimitHigh4" only available for bar
objScreenItem.LimitHigh4 = objScreenItem.LimitHigh4 * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.Name & ": no bar" & vbCrLf

190

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0
'Deactivation of errorhandling
End Sub

See also
ToolTipText Property (Page 627)
Layer Object (Page 136)
ColorChangeType Property (Page 364)
Average Property (Page 322)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
ZeroPointValue Property (Page 694)
ZeroPoint Property (Page 694)
Width Property (Page 683)
WarningLow Property (Page 683)
WarningHigh Property (Page 683)
Visible Property (Page 681)
TypeWarningLow Property (Page 656)
TypeWarningHigh Property (Page 656)
TypeToleranceLow Property (Page 656)
TypeToleranceHigh Property (Page 656)
TypeLimitLow5 Property (Page 655)
TypeLimitLow4 Property (Page 655)
TypeLimitHigh5 Property (Page 655)
TypeLimitHigh4 Property (Page 654)
TypeAlarmLow Property (Page 654)
TypeAlarmHigh Property (Page 654)
Type Property (Page 652)
LTrendColor property (before WinCC V7) (Page 632)
Trend Property (Page 630)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

191

VBS for Creating Procedures and Actions


1.14 VBS Reference
Top Property (Page 628)
ToleranceLow Property (Page 615)
ToleranceHigh Property (Page 614)
ScalingType Property (Page 546)
Scaling Property (Page 545)
ScaleTicks Property (Page 545)
ScaleColor Property (Page 545)
RightComma Property (Page 538)
Process Property (Page 531)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Min Property (Page 493)
Max Property (Page 475)
Marker Property (Page 475)
LongStrokesTextEach Property (Page 473)
LongStrokesSize Property (Page 472)
LongStrokesOnly Property (Page 472)
LongStrokesBold Property (Page 472)
LimitLow5 Property (Page 466)
LimitLow4 Property (Page 466)
LimitHigh5 Property (Page 465)
LimitHigh4 Property (Page 465)
LeftComma Property (Page 464)
Left Property (Page 464)
HysteresisRange Property (Page 438)
Hysteresis Property (Page 438)
Height Property (Page 431)
FontSize Property (Page 421)
FontName Property (Page 421)
FontBold Property (Page 420)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)

192

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
FillStyle2 Property (Page 409)
FillStyle Property (Page 408)
FillColor Property (Page 406)
Exponent Property (Page 400)
Enabled Property (Page 395)
Direction Property (Page 392)
ColorWarningLow Property (Page 367)
ColorWarningHigh Property (Page 367)
ColorToleranceLow Property (Page 366)
ColorToleranceHigh Property (Page 366)
ColorLimitLow5 Property (Page 366)
ColorLimitLow4 Property (Page 365)
ColorLimitHigh5 Property (Page 365)
ColorLimitHigh4 Property (Page 365)
ColorAlarmLow Property (Page 364)
ColorAlarmHigh Property (Page 363)
CheckWarningLow Property (Page 358)
CheckWarningHigh Property (Page 358)
CheckToleranceLow Property (Page 358)
CheckToleranceHigh Property (Page 357)
CheckLimitLow5 Property (Page 357)
CheckLimitLow4 Property (Page 357)
CheckLimitHigh5 Property (Page 356)
CheckLimitHigh4 Property (Page 356)
CheckAlarmLow Property (Page 356)
CheckAlarmHigh Property (Page 355)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor3 Property (Page 324)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

193

VBS for Creating Procedures and Actions


1.14 VBS Reference
BackColor2 Property (Page 324)
BackColor Property (Page 323)
AxisSection Property (Page 322)
Alignment Property (Page 311)
AlarmLow Property (Page 310)
AlarmHigh Property (Page 310)

Picture Window
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Picture Window"

Type Identifier in VBS


HMIScreenWindow

Usage
In the following example, the object with the name "ScreenWindow1" is moved 10 pixels to
the right:

'VBS35
Dim objScrWindow
Set objScrWindow = ScreenItems("ScreenWindow1")
objScrWindow.Left = objScrWindow.Left + 10

See also
ServerPrefix Property (Page 559)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)

194

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ScreenItem Object (Page 141)
Zoom Property (Page 694)
WindowBorder Property (Page 684)
Width Property (Page 683)
Visible Property (Page 681)
UpdateCycle Property (Page 659)
Type Property (Page 652)
Top Property (Page 628)
TagPrefix Property (Page 583)
ScrollPositionY Property (Page 549)
ScrollPositionX Property (Page 549)
ScrollBars Property (Page 549)
ScreenName Property (Page 547)
Screens Property (Page 548)
Parent Property (Page 515)
OnTop Property (Page 503)
OffsetTop Property (Page 502)
OffsetLeft Property (Page 501)
ObjectName Property (Page 499)
Moveable Property (Page 494)
MaximizeButton Property (Page 476)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
Enabled Property (Page 395)
CloseButton Property (Page 360)
CaptionText Property (Page 353)
Caption Property (Page 351)
AdaptSize Property (Page 309)
AdaptPicture Property (Page 308)
MenuToolBarConfig Property (Page 482)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

195

VBS for Creating Procedures and Actions


1.14 VBS Reference

Control
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Control"
The Control object type always assumes the properties of the Control type selected. In the
case of controls provided by WinCC, the properties are indicated under the description of the
corresponding Control.
In the case of controls from external suppliers, the control properties are supplied and thus not
a part of this description. However, the control properties can be queried using the "Item"
property.

Type Identifier in VBS


Special WinCC type descriptions or version-independent ProgID

Usage
In the following example, the object with the name "Control1" is moved 10 pixels to the right:

'VBS36
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left + 10

Special feature
The controls provided by WinCC return a special ID as the type. It can be found under the
topic "Type Identification in VBS" in the individual descriptions of the WinCC Controls.

Use of Controls from External Suppliers


In the case of non-WinCC controls, the version-independent ProgID is returned as the type.

196

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "Control1" is a control embedded in the picture which already
returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.
Determine the version-dependent ProgID as follows:

'VBS37
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("Control1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

Note
In order that example above works, a multimedia control should be inserted in the picture.
Determine the UserFriendlyName as follows:

'VBS38
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("Control1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that example above works, a multimedia control should be inserted in the picture.
If a non-WinCC control is used, it is possible that the properties provided by the control have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an external control supplier can be
accessed using the additional "object" property. Address the properties of an external control
supplier as follows:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

197

VBS for Creating Procedures and Actions


1.14 VBS Reference

Control.object.type

The properties of the ScreenItem object are used in the case of identical names, if you use
the following form:

Control.type

WinCC controls available


WinCC Alarm Control
WinCC Digital/Analog Clock
WinCC FunctionTrendControl
WinCC Gauge Control
WinCC Media Control
WinCC OnlineTableControl
WinCC OnlineTrendControl
WinCC Push Button Control
WinCC Slider Control
WinCC UserArchiveControl
HMI Symbol Library

See also
Object Property (Page 498)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Property (Page 447)

198

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Height Property (Page 431)
Enabled Property (Page 395)

I/O Field
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "I/O Field"

Type Identifier in VBS


HMIIOField

Usage
In the following example, the object with the name "IOField1" is moved 10 pixels to the right:

'VBS39
Dim objIOField
Set objIOField = ScreenItems("IOField1")
objIOField.Left = objIOField.Left + 10

See also
OperationMessage Property (Page 504)
EditAtOnce Property (Page 395)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

199

VBS for Creating Procedures and Actions


1.14 VBS Reference
Top Property (Page 628)
ToolTipText Property (Page 627)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
OutputValue Property (Page 514)
OutputFormat Property (Page 514)
Orientation Property (Page 513)
OperationReport Property (Page 512)
ObjectName Property (Page 499)
LimitMin Property (Page 467)
LimitMax Property (Page 466)
Left Property (Page 464)
Layer Object (Page 136)
HiddenInput Property (Page 432)
Height Property (Page 431)
ForeFlashColorOn Property (Page 424)
ForeFlashColorOff Property (Page 423)
ForeColor Property (Page 423)
FontUnderline Property (Page 422)
FontSize Property (Page 421)
FontName Property (Page 421)
FontItalic Property (Page 420)
FontBold Property (Page 420)
FlashRateForeColor Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashForeColor Property (Page 412)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillColor Property (Page 406)
Enabled Property (Page 395)
DataFormat Property (Page 385)
CursorControl Property (Page 383)
ClearOnNew Property (Page 359)

200

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ClearOnError Property (Page 359)
BoxType Property (Page 346)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AssumeOnFull Property (Page 317)
AssumeOnExit Property (Page 317)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

Faceplate Instance
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "faceplate instance" graphic object.

Type identifier in VBS


HMIFaceplateObject

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

201

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "FaceplateInstance1" is moved 10 pixels
to the right:

'VBS309
Dim objFaceplateObject
Set objFaceplateObject = ScreenItems("FaceplateInstance1")
objFaceplateObject.Left = objFaceplateObject.Left + 10

Graphic Object
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Graphic Object"

Type Identifier in VBS


HMIGraphicView

Usage
In the following example, the object with the name "GraphicObject1" is moved 10 pixels to the
right:

'VBS40
Dim objGraphicView
Set objGraphicView= ScreenItems("GraphicObject1")
objGraphicView.Left = objGraphicView.Left + 10

See also
Parent Property (Page 515)
Activate Method (Page 697)
Properties (Page 303)

202

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
PicUseTransColor Property (Page 527)
PictureName Property (Page 525)
PicTransColor Property (Page 523)
PicReferenced Property (Page 522)
PasswordLevel Property (Page 517)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

203

VBS for Creating Procedures and Actions


1.14 VBS Reference

Combobox
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Combobox" graphic object.

Type Identifier in VBS


HMIComboBox

Usage
In the following example, the object with the name "ComboBox1" is moved 10 pixels to the
right:

'VBS21
Dim objComboBox
Set objComboBox = ScreenItems("ComboBox1")
objComboBox.Left = objComboBox.Left + 10

List Box
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "List Box" graphic object.

204

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Type Identifier in VBS


HMIListBox

Usage
In the following example, the object with the name "ListBox1" is moved 10 pixels to the right:

'VBS21
Dim objListBox
Set objListBox = ScreenItems("ListBox1")
objListBox.Left = objListBox.Left + 10

Multiple row text


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Multiline Text" graphic object.

Type Identifier in VBS


HMIMultiLineEdit

Usage
In the following example, the object with the name "MultiLineEdit1" is moved 10 pixels to the
right:

'VBS21
Dim objMultiLineEdit
Set objMultiLineEdit = ScreenItems("MultiLineEdit1")
objMultiLineEdit.Left = objMultiLineEdit.Left + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

205

VBS for Creating Procedures and Actions


1.14 VBS Reference

OLE object
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "OLE Element". The return
value is a STRING type.

Type Identifier in VBS


Version-independent ProgID

Usage
In the following example, the object with the name "OLEElement1" is moved 10 pixels to the
right:

'VBS41
Dim objOLEElement
Set objOLEElement = ScreenItems("OLEElement1")
objOLEElement.Left = objOLEElement.Left + 10

Special feature
In the case of OLE Elements, the version-independent ProgID is returned as the type.
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "OLEObject1" is a control embedded in the picture which
already returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.
Determine the version-dependent ProgID as follows:

206

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

'VBS42
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("OLEElement1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

Note
In order that the example above works, a Word document should be embedded in the picture
as an OLE Element.
Determine the User Friendly Name as follows:

'VBS43
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("OLEElement1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that the example above works, a Word document should be embedded in the picture
as an OLE Element.

Using OLE Elements


If an OLE Element is used, it is possible that the properties provided by the OLE Element have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an OLE Element can be accessed using
the additional "Object" property. Address the properties of an OLE Element as follows:

OLEObjekt.object.type

Only use the form

OLEObjekt.type

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

207

VBS for Creating Procedures and Actions


1.14 VBS Reference
In the case of identical names, the properties of the ScreenItem object are used.

See also
Height Property (Page 431)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Parent Property (Page 515)
Object Property (Page 498)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Property (Page 447)
Enabled Property (Page 395)

Group Display
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Group Display"

Type Identifier in VBS


HMIGroupDisplay

208

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "GroupDisplay1" is moved 10 pixels to the
right:

'VBS44
Dim objGroupDisplay
Set objGroupDisplay = ScreenItems("GroupDisplay1")
objGroupDisplay.Left = objGroupDisplay.Left + 10

See also
Activate Method (Page 697)
MCKQBackColorOn Property (Page 480)
FontBold Property (Page 420)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
UserValue4 Property (Page 664)
UserValue3 Property (Page 663)
UserValue2-Eigenschaft (Page 663)
UserValue1 Property (Page 663)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
SignificantMask Property (Page 566)
SameSize Property (Page 544)
Relevant Property (Page 537)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
MessageClass Property (Page 490)
MCText Property (Page 481)
MCKQTextFlash Property (Page 481)
MCKQTextColorOn Property (Page 481)
MCKQTextColorOff Property (Page 480)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

209

VBS for Creating Procedures and Actions


1.14 VBS Reference
MCKQBackFlash Property (Page 480)
MCKQBackColorOff Property (Page 479)
MCKOTextFlash Property (Page 479)
MCKOTextColorOn Property (Page 479)
MCKOTextColorOff Property (Page 479)
MCKOBackFlash Property (Page 478)
MCKOBackColorOn Property (Page 478)
MCKOBackColorOff Property (Page 478)
MCGUTextFlash Property (Page 477)
MCGUTextColorOn Property (Page 477)
MCGUTextColorOff Property (Page 477)
MCGUBackFlash Property (Page 477)
MCGUBackColorOn Property (Page 476)
MCGUBackColorOff-Eigenschaft (Page 476)
LockTextColor Property (Page 471)
LockText Property (Page 471)
LockStatus Property (Page 471)
LockBackColor Property (Page 470)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FontUnderline Property (Page 422)
FontSize Property (Page 421)
FontName Property (Page 421)
FontItalic Property (Page 420)
FlashRate Property (Page 414)
Enabled Property (Page 395)
CollectValue Property (Page 362)
Button4Width Property (Page 351)
Button3Width Property (Page 351)
Button2Width Property (Page 350)
Button1Width Property (Page 350)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)

210

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Text list
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Text List"

Type Identifier in VBS


HMISymbolicIOField

Usage
In the following example, the object with the name "TextList1" is moved 10 pixels to the right:

'VBS45
Dim objSymIO
Set objSymIO = ScreenItems("TextList1")
objSymIO.Left = objSymIO.Left + 10

See also
Type Property (Page 652)
FontUnderline Property (Page 422)
BackFlashColorOff Property (Page 325)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
UnselTextColor Property (Page 659)
UnselBGColor Property (Page 658)
Top Property (Page 628)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

211

VBS for Creating Procedures and Actions


1.14 VBS Reference
ToolTipText Property (Page 627)
SelTextColor Property (Page 556)
SelBGColor Property (Page 551)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
OutputValue Property (Page 514)
Orientation Property (Page 513)
OperationReport Property (Page 512)
OperationMessage Property (Page 504)
ObjectName Property (Page 499)
NumberLines Property (Page 497)
ListType Property (Page 469)
Left Property (Page 464)
Layer Object (Page 136)
LanguageSwitch Property (Page 445)
ItemBorderWidth Property (Page 443)
ItemBorderStyle Property (Page 443)
ItemBorderColor Property (Page 442)
ItemBorderBackColor Property (Page 442)
Height Property (Page 431)
ForeFlashColorOn Property (Page 424)
ForeFlashColorOff Property (Page 423)
ForeColor Property (Page 423)
FontSize Property (Page 421)
FontName Property (Page 421)
FontItalic Property (Page 420)
FontBold Property (Page 420)
FlashRateForeColor Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashForeColor Property (Page 412)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillColor Property (Page 406)

212

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Enabled Property (Page 395)
EditAtOnce Property (Page 395)
CursorControl Property (Page 383)
BoxType Property (Page 346)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BitNumber Property (Page 335)
BackFlashColorOn Property (Page 326)
BackColor Property (Page 323)
AssumeOnExit Property (Page 317)
Assignments Property (Page 316)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

Status display
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Status Display"

Type Identifier in VBS


HMIGraphicIOField

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

213

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "StatusDisplay1" is moved 10 pixels to the
right:

'VBS46
Dim objGraphicIO
Set objGraphicIO= ScreenItems("StatusDisplay1")
objGraphicIO.Left = objGraphicIO.Left + 10

See also
Layer Object (Page 136)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Index Property (Page 439)
Height Property (Page 431)
FlashRateFlashPic Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashPicUseTransColor Property (Page 414)
FlashPicture Property (Page 413)
FlashPicTransColor Property (Page 413)
FlashPicReferenced Property (Page 413)
FlashFlashPicture Property (Page 412)
FlashBorderColor Property (Page 412)
Enabled Property (Page 395)
BorderWidth Property (Page 344)

214

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BasePicUseTransColor Property (Page 330)
BasePicture Property (Page 330)
BasePicTransColor Property (Page 329)
BasePicReferenced Property (Page 329)

1.14.3.4

Windows objects

Button
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Button"

Type Identifier in VBS


HMIButton

Usage
In the following example, the object with the name "Button1" is moved 10 pixels to the right:

'VBS47
Dim cmdButton
Set cmdButton = ScreenItems("Button1")
cmdButton.Left = cmdButton.Left + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

215

VBS for Creating Procedures and Actions


1.14 VBS Reference

Notes on Error Handling


Buttons and pushbuttons are mapped in the object model to an "HMIButton" type. Since the
objects have different properties, the availability of the property (dynamic type compilation in
Runtime) should be queried via an exception measure. The exception measure is activated
for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(ByVal Item)


'VBS48
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = "HMIButton" Then
'
'=== Property "Text" available only for Standard-Button
objScreenItem.Text = "Windows"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Windows-Button" & vbCrLf
Err.Clear
'Delete error message
End If

216

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

End If
Next
On Error Goto 0
End Sub

'Deactivation of errorhandling

See also
Top Property (Page 628)
FlashBorderColor Property (Page 412)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
WindowsStyle Property (Page 685)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
ToolTipText Property (Page 627)
Text list (Page 211)
PictureUp Property (Page 526)
PictureDown Property (Page 524)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
Orientation Property (Page 513)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Hotkey Property (Page 437)
Height Property (Page 431)
ForeFlashColorOn Property (Page 424)
ForeFlashColorOff Property (Page 423)
ForeColor Property (Page 423)
FontUnderline Property (Page 422)
FontSize Property (Page 421)
FontName Property (Page 421)
FontItalic Property (Page 420)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

217

VBS for Creating Procedures and Actions


1.14 VBS Reference
FontBold Property (Page 420)
FlashRateForeColor Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashForeColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColorTop Property (Page 343)
BorderColor Property (Page 342)
BorderColorBottom Property (Page 343)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

218

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Check box
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Check Box"

Type Identifier in VBS


HMICheckBox

Usage
In the following example, the object with the name "CheckBox1" is moved 10 pixels to the right:

'VBS49
Dim chkCheckBox
Set chkCheckBox = ScreenItems("CheckBox1")
chkCheckBox.Left = chkCheckBox.Left + 10

See also
FontSize Property (Page 421)
BackColor Property (Page 323)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Text list (Page 211)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

219

VBS for Creating Procedures and Actions


1.14 VBS Reference
Process Property (Page 531)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
Orientation Property (Page 513)
OperationMessage Property (Page 504)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Index Property (Page 439)
Height Property (Page 431)
ForeFlashColorOn Property (Page 424)
ForeFlashColorOff Property (Page 423)
ForeColor Property (Page 423)
FontUnderline Property (Page 422)
FontName Property (Page 421)
FontItalic Property (Page 420)
FontBold Property (Page 420)
FlashRateForeColor Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashForeColor Property (Page 412)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BoxCount Property (Page 346)
BoxAlignment Property (Page 345)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)

220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

Radio box
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Radio Box"

Type Identifier in VBS


HMIOptionGroup

Usage
In the following example, the object with the name "RadioBox1" is moved 10 pixels to the right:

'VBS50
Dim objOptionGroup
Set objOptionGroup = ScreenItems("RadioBox1")
objOptionGroup.Left = objOptionGroup.Left + 10

See also
ForeColor Property (Page 423)
BackFlashColorOn Property (Page 326)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

221

VBS for Creating Procedures and Actions


1.14 VBS Reference
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Text list (Page 211)
Process Property (Page 531)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
Orientation Property (Page 513)
OperationMessage Property (Page 504)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Index Property (Page 439)
Height Property (Page 431)
ForeFlashColorOn Property (Page 424)
ForeFlashColorOff Property (Page 423)
FontUnderline Property (Page 422)
FontSize Property (Page 421)
FontName Property (Page 421)
FontItalic Property (Page 420)
FontBold Property (Page 420)
FlashRateForeColor Property (Page 416)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashForeColor Property (Page 412)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)

222

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
BoxCount Property (Page 346)
BoxAlignment Property (Page 345)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

Round Button
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Round Button"

Type Identifier in VBS


HMISwitch

Usage
In the following example, the object with the name "RoundButton1" is moved 10 pixels to the
right:

'VBS51
Dim objSwitch
Set objSwitch= ScreenItems("RoundButton1")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

223

VBS for Creating Procedures and Actions


1.14 VBS Reference

objSwitch.Left = objSwitch.Left + 10

Sub OnClick(ByVal Item)


'VBS52
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = "HMIButton" Then
'
'=== Property "Text" available only for Standard-Button
objScreenItem.Text = "Windows"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Windows-Button" & vbCrLf
Err.Clear
'Delete error message
End If
'
'=== Property "Radius" available only for RoundButton
objScreenItem.Radius = 10
If 0 <> Err.Number Then
HMIRuntime.Trace ScreenItem.ObjectName & ": no RoundButton" & vbCrLf
Err.Clear
End If
End If
Next
On Error Goto 0
'Deactivation of errorhandling
End Sub

See also
PicDownUseTransColor Property (Page 522)
BorderColorTop Property (Page 343)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Toggle Property (Page 614)
Radius Property (Page 534)
Pressed Property (Page 530)

224

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
PicUpUseTransColor Property (Page 527)
PicUpTransparent Property (Page 527)
PicUpReferenced Property (Page 526)
PictureUp Property (Page 526)
PictureDown Property (Page 524)
PictureDeactivated Property (Page 524)
PicDownTransparent Property (Page 522)
PicDownReferenced Property (Page 522)
PicDeactUseTransColor Property (Page 521)
PicDeactTransparent Property (Page 521)
PicDeactReferenced-Eigenschaft (Page 521)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
Enabled Property (Page 395)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderColorBottom Property (Page 343)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

225

VBS for Creating Procedures and Actions


1.14 VBS Reference
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)

Slider
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Slider"

Type Identifier in VBS


HMISlider

Usage
In the following example, the object with the name "Slider1" is moved 10 pixels to the right:

'VBS53
Dim sldSlider
Set sldSlider = ScreenItems("Slider1")
sldSlider.Left = sldSlider.Left + 10

Notes on Error Handling


Sliders and WinCC slider controls are mapped in the object model to an "HMISlider" type.
Since the objects have different properties, the availability of the property (dynamic type
compilation in Runtime) should be queried via an exception measure. The exception measure
is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.

226

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(Byval Item)


'VBS194
Dim ScreenItem
' activating error handling:
On Error Resume Next
For Each ScreenItem In ScreenItems
If ScreenItem.Type = "HMISlider" Then
'=== Property "BevelColorUp" only exists for a WinCC Slider Control
ScreenItem.BevelColorUp = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no Windows-Slider" + vbCrlf)
' delete error message
Err.Clear
End If
'=== Property "BorderStyle" only exists for a Windows-Slider
ScreenItem.BorderStyle = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no WinCC Slider Control" + vbCrlf)
Err.Clear
End If
End If
Next
On Error GoTo 0 ' deactivating error handling
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

227

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Height Property (Page 431)
BackColorBottom Property (Page 325)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
WindowsStyle Property (Page 685)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
SmallChange Property (Page 567)
Process Property (Page 531)
PasswordLevel Property (Page 517)
Parent Property (Page 515)
OperationReport Property (Page 512)
OperationMessage Property (Page 504)
ObjectName Property (Page 499)
Min Property (Page 493)
Max Property (Page 475)
Left Property (Page 464)
Layer Object (Page 136)
FlashRateBorderColor Property (Page 415)
FlashRateBackColor Property (Page 415)
FlashBorderColor Property (Page 412)
FlashBackColor Property (Page 411)
FillStyle Property (Page 408)
FillingIndex Property (Page 407)
Filling Property (Page 407)
FillColor Property (Page 406)
ExtendedOperation Property (Page 403)
Enabled Property (Page 395)
Direction Property (Page 392)

228

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ColorTop Property (Page 366)
ColorBottom Property (Page 364)
ButtonColor Property (Page 346)
BorderWidth Property (Page 344)
BorderStyle Property (Page 344)
BorderFlashColorOn Property (Page 344)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 342)
BorderBackColor Property (Page 342)
BackFlashColorOn Property (Page 326)
BackFlashColorOff Property (Page 325)
BackColorTop Property (Page 325)
BackColor Property (Page 323)

1.14.3.5

Tube objects

Polygon Tube
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Polygon Tube" graphic object.

Type Identifier in VBS


HMITubePolyline

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

229

VBS for Creating Procedures and Actions


1.14 VBS Reference

Usage
In the following example, the object with the name "TubePolyline1" is moved 10 pixels to the
right:

'VBS24
Dim objTubePolyline
Set objTubePolyline = ScreenItems("TubePolyline1")
objTubePolyline.Left = objTubePolyline.Left + 10

T-piece
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "T-piece" graphic object.

Type Identifier in VBS


HMITubeTeeObject

Usage
In the following example, the object with the name "TubeTeeObject1" is moved 10 pixels to
the right:

'VBS21
Dim objTubeTeeObject
Set objTubeTeeObject = ScreenItems("TubeTeeObject1")
objTubeTeeObject.Left = objTubeTeeObject.Left + 10

230

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Double T-piece
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Double T-piece" graphic object.

Type Identifier in VBS


HMITubeDoubleTeeObject

Usage
In the following example, the object with the name "TubeDoubleTeeObject1" is moved 10
pixels to the right:

'VBS21
Dim objTubeDoubleTeeObject
Set objTubeDoubleTeeObject = ScreenItems("TubeDoubleTeeObject1")
objTubeDoubleTeeObject.Left = objTubeDoubleTeeObject.Left + 10

Tube Bend
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Tube Arc" graphic object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

231

VBS for Creating Procedures and Actions


1.14 VBS Reference

Type Identifier in VBS


HMITubeArcObject

Usage
In the following example, the object with the name "TubeArcObject1" is moved 10 pixels to the
right:

'VBS24
Dim objTubeArcObject
Set objTubeArcObject = ScreenItems("TubeArcObject1")
objTubeArcObject.Left = objTubeArcObject.Left + 10

1.14.3.6

Controls

Controls
Special features with controls
In the case of non-WinCC controls, the version-independent ProgID is returned as the type.
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "Control1" is a control embedded in the picture which already
returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.
Determine the version-dependent ProgID as follows:

'VBS153
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("Control1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

232

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
In order that example above works, a multimedia control should be inserted in the picture.
Determine the User Friendly Name as follows:

'VBS154
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("Control1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that example above works, a multimedia control should be inserted in the picture.

Restrictions of VBS for Dynamization by Controls


If Controls are to be dynamized with, the following conditions must be fulfilled:
Methods
The "ByRef" declaration may only be implemented as a "Variant" (ByRef xxx as Variant)
The "ByVal" declaration may only be implemented with tag types (ByVal xxx as Long)
Properties
The "ByRef" declaration may only be implemented as a "Variant" (ByRef xxx as Variant)
The "ByVal" declaration may only be implemented with tag types (ByVal xxx as Long)
Events
The "ByRef" declaration is not permitted.
The "ByVal" declaration may only be implemented as a "Variant" (ByVal xxx as Variant)
Arrays
If arrays are used, they must be declared with (ByRef xxx As Variant).
In order that arrays can be transferred in variants, variant tag must also be inserted as an
intermediate tag according to the following scheme:

'VBS151
Dim arrayPoints(200)
Dim vArrayCoercion

'Variant for array Coercion

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

233

VBS for Creating Procedures and Actions


1.14 VBS Reference

' Make the VBS Array compatibile with the OLE Automation
vArrayCoercion = (arrayPoints)
objTrendControl.DataXY = vArrayCoercion
' this array will occur in the control

Use of Controls from External Suppliers


If a non-WinCC control is used, it is possible that the properties provided by the control have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an external control supplier can be
accessed using the additional "object" property. Address the properties of an external control
supplier as follows:

Control.object.type

If you use the following form, the properties of the ScreenItem object are used in the case of
identical names:

Control.type

Double parameter
When using a Control which is not an internal WinCC control, it is possible that the event
prototypes contain a parameter with the name "Item". In this case, the name of the parameter
is renamed according to "ObjectItem" in the VBS prototype submitted. If this name already
exists, the name is differentiated by numbers being appended.

WinCC controls available


HMI Symbol Library
WinCC AlarmControl
WinCC Alarm Control (before WinCC V7)
WinCC Digital/Analog Clock
WinCC FunctionTrendControl
WinCC Function Trend Control (before WinCC V7)
WinCC Gauge Control
WinCC Media Control
WinCC OnlineTableControl
WinCC Online Table Control (before WinCC V7)
WinCC OnlineTrendControl

234

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
WinCC Online Trend Control (before WinCC V7)
WinCC Push Button Control
WinCC RulerControl
WinCC Slider Control
WinCC UserArchiveControl

See also
HMI Symbol Library (Page 253)
WinCC Slider Control (Page 281)
WinCC Push Button Control (Page 275)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Gauge Control (Page 264)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Digital/Analog Clock (Page 258)
WinCC Alarm Control (before WinCC V7) (Page 288)
WinCC UserArchiveControl (Page 285)
WinCC RulerControl (Page 278)
WinCC OnlineTrendControl (Page 271)
WinCC OnlineTableControl (Page 267)
WinCC FunctionTrendControl (Page 260)
WinCC AlarmControl (Page 255)

List of controls
Column object (list)
Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the properties of the columns in the WinCC
UserArchiveControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

235

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC UserArchiveControl (Page 285)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "colobj.ColumnName", the listing name "Column" is dropped:
"colobj.Name".
ColumnAlias (Page 368)

ColumnFlagUnique
(Page 370)

ColumnPosition (Page 372)

ColumnSort (Page 375)

ColumnAlign (Page 368)

ColumnHideText (Page 370)

ColumnPrecisions
(Page 372)

ColumnSortIndex
(Page 375)

ColumnAutoPrecisions
(Page 368)

ColumnHideTitleText
(Page 371)

ColumnReadAccess
(Page 373)

ColumnStartValue
(Page 376)

ColumnCaption (Page 369)

ColumnIndex (Page 371)

ColumnReadonly (Page 373)

ColumnStringLength
(Page 376)

ColumnCount (Page 369)

ColumnLeadingZeros
(Page 371)

ColumnRepos (Page 373)

ColumnTimeFormat
(Page 376)

ColumnDateFormat
(Page 369)

ColumnLength (Page 371)

ColumnShowDate
(Page 374)

ColumnType (Page 377)

ColumnDMVarName
(Page 369)

ColumnMaxValue
(Page 372)

ColumnShowIcon
(Page 374)

ColumnVisible (Page 377)

ColumnExponentialFormat
(Page 370)

ColumnMinValue (Page 372)

ColumnShowTitleIcon
(Page 375)

ColumnWriteAccess
(Page 378)

ColumnFlagNotNull
(Page 370)

ColumnName (Page 372)

See also
GetColumn method (Page 705)
GetColumnCollection method (Page 706)

HitlistColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "HitlistColumn" listing object to configure the message blocks used in the hitlist of
WinCC AlarmControl.

236

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "hitlistobj.HitlistColumnName", the listing name
"HitlistColumn" is dropped: "hitlistobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
HitlistColumnAdd (Page 433)

HitlistColumnRepos (Page 434)

HitListMaxSourceItems (Page 435)

HitlistColumnCount (Page 433)

HitlistColumnSort (Page 434)

HitListMaxSourceItemsWarn
(Page 436)

HitlistColumnIndex (Page 433)

HitlistColumnSortIndex (Page 434)

HitListRelTime (Page 436)

HitlistColumnName (Page 433)

HitlistColumnVisible (Page 435)

HitListRelTimeFactor (Page 436)

HitlistColumnRemove (Page 433)

HitListDefaultSort (Page 435)

HitListRelTimeFactorType (Page 436)

See also
GetHitlistColumn method (Page 707)
GetHistlistColumnCollection method (Page 708)

MessageBlock object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "MessageBlock" listing object to configure the message blocks in WinCC
AlarmControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

237

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "messageobj.MessageBlockName", the listing name
"MessageBlock" is dropped: "messageobj.Name".
MessageBlockAlign
(Page 482)

MessageBlockFlashOn
(Page 485)

MessageBlockLength
(Page 487)

MessageBlockShowIcon
(Page 488)

MessageBlockAutoPrecision
s (Page 483)

MessageBlockHideText
(Page 485)

MessageBlockName
(Page 487)

MessageBlockShowTitleIcon
(Page 488)

MessageBlockCaption
(Page 483)

MessageBlockHideTitleText
(Page 485)

MessageBlockPrecisions
(Page 487)

MessageBlockTextId
(Page 489)

MessageBlockCount
(Page 483)

MessageBlockID (Page 486)

MessageBlockSelected
(Page 487)

MessageBlockTimeFormat
(Page 489)

MessageBlockDateFormat

MessageBlockIndex
(Page 486)

MessageBlockShowDate
(Page 488)

MessageBlockType
(Page 489)

MessageBlockExponentialFo MessageBlockLeadingZeros
rmat (Page 484)
(Page 486)

See also
GetMessageBlock method (Page 709)
GetMessageBlockCollection method (Page 710)

MessageColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "MessageColumn" listing object to configure the message blocks used in the message
lists of WinCC AlarmControl.

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "messagecol.MessageColumnName", the listing name
"MessageColumn" is dropped: "messagecol.Name".

238

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
MessageColumnAdd (Page 490)

MessageColumnName (Page 491)

MessageColumnSort (Page 492)

MessageColumnCount (Page 490)

MessageColumnRemove (Page 491)

MessageColumnSortIndex (Page 492)

MessageColumnIndex (Page 491)

MessageColumnRepos (Page 491)

MessageColumnVisible (Page 492)

See also
GetMessageColumn method (Page 711)
GetMessageColumnCollection method (Page 712)

OperatorMessage object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "OperatorMessage" listing object to configure the operator messages displayed in
WinCC AlarmControl.

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "opmessobj.OperatorMessageName", the listing name
"OperatorMessage" is dropped: "opmessobj.Name".
OperatorMessageID (Page 504)

OperatorMessageSource5 (Page 507)

OperatorMessageSourceType3
(Page 510)

OperatorMessageIndex (Page 504)

OperatorMessageSource6 (Page 507)

OperatorMessageSourceType4
(Page 510)

OperatorMessageName (Page 505)

OperatorMessageSource7 (Page 508)

OperatorMessageSourceType5
(Page 510)

OperatorMessageNumber (Page 505)

OperatorMessageSource8 (Page 508)

OperatorMessageSourceType6
(Page 511)

OperatorMessageSelected (Page 506)

OperatorMessageSource9 (Page 508)

OperatorMessageSourceType7
(Page 511)

OperatorMessageSource1 (Page 506)

OperatorMessageSource10 (Page 509)

OperatorMessageSourceType8
(Page 511)

OperatorMessageSource2 (Page 506)

OperatorMessageSourceType1
(Page 509)

OperatorMessageSourceType9
(Page 512)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

239

VBS for Creating Procedures and Actions


1.14 VBS Reference
OperatorMessageSource3 (Page 506)

OperatorMessageSourceType2
(Page 509)

OperatorMessageSourceType10
(Page 512)

OperatorMessageSource4 (Page 507)

See also
GetOperatorMessage method (Page 714)
GetOperatorMessageCollection method (Page 715)

Row object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Row" listing object to access the rows of the table-based controls. The Row object
refers to the runtime data in the tables.

Use in the controls


WinCC AlarmControl (Page 255)

WinCC OnlineTableControl (Page 267)

WinCC RulerControl (Page 278)

WinCC UserArchiveControl (Page 285)

Available methods of the object


SelectAll (Page 781)

SelectRow (Page 782)

UnselectAll (Page 796)

UnselectRow (Page 797)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rowobj.RowCellCount", the listing name "Row" is dropped:
"rowobj.CellCount".
RowCellCount (Page 540)

RowCellText (Page 540)

RowCount (Page 540)

RowNumber (Page 541)

See also
GetRow method (Page 716)
GetRowCollection method (Page 717)

240

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
GetSelectedRow method (Page 723)
GetSelectedRows method (Page 724)

RulerBlock object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Block" listing object to configure the blocks of WinCC RulerControl.

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rulerblockobj.BlockName", the listing name "Block" is
dropped: "rulerblockobj.Name".
BlockAlign (Page 336)

BlockHideText (Page 338)

BlockPrecisions (Page 340)

BlockAutoPrecisions (Page 337)

BlockHideTitleText (Page 338)

BlockShowDate (Page 340)

BlockCaption (Page 337)

BlockID

BlockShowIcon (Page 340)

BlockCount (Page 337)

BlockIndex (Page 339)

BlockShowTitleIcon (Page 341)

BlockDateFormat (Page 337)

BlockLength (Page 340)

BlockTimeFormat (Page 341)

BlockExponentialFormat (Page 338)

BlockName (Page 340)

BlockUseSourceFormat (Page 341)

See also
GetRulerBlock method (Page 718)
GetRulerBlockCollection method (Page 719)

RulerColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the columns of the ruler window in WinCC
RulerControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

241

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rulercolobj.ColumnName", the listing name "Column" is
dropped: "rulercolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ColumnAdd (Page 368)

ColumnName (Page 372)

ColumnSort (Page 375)

ColumnCount (Page 369)

ColumnRemove (Page 373)

ColumnSortIndex (Page 375)

ColumnIndex (Page 371)

ColumnRepos (Page 373)

ColumnVisible (Page 377)

See also
GetRulerColumn method (Page 720)
GetRulerColumnCollection method (Page 721)

StatisticAreaColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the columns of the statistic area window in WinCC
RulerControl.

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "statareacolobj.ColumnName", the listing name "Column" is
dropped: "statareacolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".

242

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ColumnAdd (Page 368)

ColumnName (Page 372)

ColumnSort (Page 375)

ColumnCount (Page 369)

ColumnRemove (Page 373)

ColumnSortIndex (Page 375)

ColumnIndex (Page 371)

ColumnRepos (Page 373)

ColumnVisible (Page 377)

See also
GetStatisticAreaColumn method (Page 726)
GetStatisticAreaColumnCollection method (Page 727)

StatisticResultColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the columns of the statistic window in WinCC
RulerControl.

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "statrescolobj.ColumnName", the listing name "Column" is
dropped: "statrescolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ColumnAdd (Page 368)

ColumnName (Page 372)

ColumnSort (Page 375)

ColumnCount (Page 369)

ColumnRemove (Page 373)

ColumnSortIndex (Page 375)

ColumnIndex (Page 371)

ColumnRepos (Page 373)

ColumnVisible (Page 377)

See also
GetStatisticResultColumn method (Page 728)
GetStatisticResultColumnCollection method (Page 729)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

243

VBS for Creating Procedures and Actions


1.14 VBS Reference

StatusbarElement object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "StatusbarElement" listing object to configure the properties of the statusbar of the
controls.

Use in the controls


WinCC AlarmControl (Page 255)

WinCC FunctionTrendControl
(Page 260)

WinCC OnlineTableControl (Page 267)

WinCC OnlineTrendControl (Page 271)

WinCC RulerControl (Page 278)

WinCC UserArchiveControl (Page 285)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "statusbarobj.StatusbarElementName", the listing name
"StatusbarElement" is dropped: "statusbarobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
StatusbarElementAdd (Page 575)

StatusbarElementIndex (Page 576)

StatusbarElementText (Page 578)

StatusbarElementAutoSize (Page 576)

StatusbarElementName (Page 577)

StatusbarElementTooltipText
(Page 578)

StatusbarElementCount (Page 576)

StatusbarElementRemove
(Page 577)

StatusbarElementUserDefined
(Page 578)

StatusbarElementIconId (Page 576)

StatusbarElementRename
(Page 577)

StatusbarElementVisible (Page 578)

StatusbarElementId (Page 576)

StatusbarElementRepos (Page 577)

StatusbarElementWidth (Page 579)

See also
GetStatusbarElement method (Page 730)
GetStatusbarElementCollection method (Page 731)

TimeAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).

244

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Use the "TimeAxis" listing object to configure the properties of the time axis in columns in the
WinCC OnlineTrendControl.

Use in the controls


WinCC OnlineTrendControl (Page 271)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "timeaxisobj.TimeAxisName", the listing name "TimeAxis" is
dropped: "timeaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
TimeAxisActualize

TimeAxisIndex (Page 592)

TimeAxisRepos (Page 594)

TimeAxisAdd (Page 589)

TimeAxisInTrendColor

TimeAxisShowDate (Page 594)

TimeAxisAlign (Page 590)

TimeAxisLabel (Page 592)

TimeAxisTimeFormat (Page 594)

TimeAxisBeginTime (Page 590)

TimeAxisMeasurePoints (Page 592)

TimeAxisTimeRangeBase (Page 595)

TimeAxisColor (Page 590)

TimeAxisName (Page 593)

TimeAxisTimeRangeFactor (Page 595)

TimeAxisCount (Page 590)

TimeAxisRangeType (Page 593)

TimeAxisTrendWindow (Page 595)

TimeAxisDateFormat (Page 591)

TimeAxisRemove (Page 593)

TimeAxisVisible (Page 595)

TimeAxisEndTime (Page 591)

TimeAxisRename (Page 593)

See also
GetTimeAxis method (Page 732)
GetTimeAxisCollection method (Page 733)

TimeColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "TimeColumn" listing object to configure the properties of the time column in WinCC
OnlineTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

245

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC OnlineTableControl (Page 267)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "timecolobj.TimeColumnName", the listing name
"TimeColumn" is dropped: "timecolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
TimeColumnActualize (Page 596)

TimeColumnHideText (Page 600)

TimeColumnShowDate (Page 602)

TimeColumnAdd (Page 597)

TimeColumnHideTitleText (Page 600)

TimeColumnShowIcon (Page 602)

TimeColumnAlign (Page 597)

TimeColumnIndex (Page 600)

TimeColumnShowTitleIcon (Page 603)

TimeColumnBackColor (Page 598)

TimeColumnLength (Page 600)

TimeColumnSort (Page 603)

TimeColumnBeginTime (Page 598)

TimeColumnMeasurePoints (Page 601) TimeColumnSortIndex (Page 603)

TimeColumnCaption (Page 598)

TimeColumnName (Page 601)

TimeColumnTimeFormat (Page 603)

TimeColumnCount (Page 598)

TimeColumnRangeType (Page 601)

TimeColumnTimeRangeBase
(Page 604)

TimeColumnDateFormat (Page 599)

TimeColumnRemove (Page 601)

TimeColumnTimeRangeFactor
(Page 604)

TimeColumnEndTime (Page 599)

TimeColumnRename (Page 602)

TimeColumnUseValueColumnColors
(Page 605)

TimeColumnForeColor (Page 599)

TimeColumnRepos (Page 602)

TimeColumnVisible (Page 605)

See also
GetTimeColumn method (Page 735)
GetTimeColumnCollection method (Page 736)

ToolbarButton object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "ToolbarButton" listing object to configure the properties of the toolbar of the controls.

Use in the controls


WinCC AlarmControl (Page 255)

WinCC FunctionTrendControl
(Page 260)

WinCC OnlineTableControl (Page 267)

WinCC OnlineTrendControl (Page 271)

WinCC RulerControl (Page 278)

WinCC UserArchiveControl (Page 285)

246

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "toolbarobj.ToolbarButtonName", the listing name
"ToolbarButton" is dropped: "toolbarobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ToolbarButtonActive (Page 616)

ToolbarButtonId (Page 621)

ToolbarButtonRename (Page 623)

ToolbarButtonAdd (Page 617)

ToolbarButtonIndex (Page 621)

ToolbarButtonRepos (Page 623)

ToolbarButtonBeginGroup (Page 617)

ToolbarButtonLocked (Page 622)

ToolbarButtonTooltipText (Page 623)

ToolbarButtonCount (Page 621)

ToolbarButtonName (Page 622)

ToolbarButtonUserDefined (Page 623)

ToolbarButtonEnabled (Page 621)

ToolbarButtonPasswordLevel
(Page 622)

ToolbarButtonVisible (Page 624)

ToolbarButtonHotKey (Page 621)

ToolbarButtonRemove (Page 622)

See also
GetToolbarButton method (Page 737)
GetToolbarButtonCollection method (Page 738)

Trend object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Trend" listing object to configure the properties of the trends. The "InsertData" and
"RemoveData" methods are used to fill the trend with data or to delete the trend. The
"GetRulerData" method is used to access the data at a particular point of the trend.

Use in the controls


WinCC FunctionTrendControl (Page 260)

WinCC OnlineTrendControl (Page 271)

Available methods of the object


GetRulerData (Page 722)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

InsertData (Page 754)

RemoveData (Page 778)

247

VBS for Creating Procedures and Actions


1.14 VBS Reference

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "trendobj.Trendname", the listing name "Trend" is dropped:
"trendobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
Properties in WinCC FunctionTrendControl and WinCC OnlineTrendControl
TrendAdd (Page 630)

TrendLineWidth (Page 636)

TrendRemove (Page 640)

TrendColor (Page 632)

TrendLowerLimit (Page 636)

TrendRename (Page 640)

TrendCount (Page 633)

TrendLowerLimitColor (Page 636)

TrendRepos (Page 640)

TrendExtendedColorSet

TrendLowerLimitColoring (Page 636)

TrendTrendWindow (Page 643)

TrendFill (Page 634)

TrendName (Page 637)

TrendUncertainColor (Page 643)

TrendFillColor (Page 634)

TrendPointColor (Page 637)

TrendUncertainColoring (Page 643)

TrendIndex (Page 634)

TrendPointStyle

TrendUpperLimit (Page 643)

TrendLabel (Page 635)

TrendPointWidth (Page 638)

TrendUpperLimitColor (Page 644)

TrendLineStyle (Page 635)

TrendProvider (Page 638)

TrendUpperLimitColoring (Page 644)

TrendLineType (Page 635)

TrendProviderCLSID (Page 639)

TrendVisible (Page 645)

Properties in WinCC OnlineTrendControl


TrendAutoRangeBeginTagName
(Page 631)

TrendAutoRangeSource (Page 632)

TrendValueAlignment

TrendAutoRangeBeginValue
(Page 631)

TrendSelectTagName (Page 640)

TrendValueAxis (Page 645)

TrendAutoRangeEndTagName
(Page 631)

TrendTagName (Page 641)

TrendValueUnit

TrendAutoRangeEndValue (Page 631)

TrendTimeAxis (Page 642)

Properties in the WinCC FunctionTrendControl


TrendActualize (Page 630)

TrendSelectTagNameX (Page 640)

TrendTimeRangeBase (Page 642)

TrendBeginTime (Page 632)

TrendSelectTagNameY (Page 641)

TrendTimeRangeFactor (Page 642)

TrendEndTime (Page 633)

TrendTagNameX (Page 641)

TrendXAxis (Page 652)

TrendMeasurePoints (Page 637)

TrendTagNameY (Page 642)

TrendYAxis (Page 652)

TrendRangeType

See also
GetTrend method (Page 739)
GetTrendCollection method (Page 740)

248

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendWindow object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "TrendWindow" listing object to configure the properties of the trend window.

Use in the controls


WinCC FunctionTrendControl (Page 260)

WinCC OnlineTrendControl (Page 271)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "trendwndobj.TrendWindowName", the listing name
"TrendWindow" is dropped: "trendwndobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
Properties in WinCC FunctionTrendControl and WinCC OnlineTrendControl
TrendWindowAdd (Page 645)

TrendWindowGridInTrendColor
(Page 647)

TrendWindowRulerColor (Page 649)

TrendWindowCoarseGrid (Page 646)

TrendWindowHorizontalGrid
(Page 647)

TrendWindowRulerLayer

TrendWindowCoarseGridColor
(Page 646)

TrendWindowIndex (Page 648)

TrendWindowRulerStyle (Page 649)

TrendWindowCount (Page 646)

TrendWindowName (Page 648)

TrendWindowRulerWidth (Page 650)

TrendWindowFineGrid (Page 646)

TrendWindowRemove (Page 648)

TrendWindowSpacePortion (Page 650)

TrendWindowFineGridColor
(Page 647)

TrendWindowRename (Page 648)

TrendWindowVerticalGrid (Page 651)

TrendWindowForegroundTrendGrid
(Page 647)

TrendWindowRepos (Page 649)

TrendWindowVisible (Page 651)

Properties in WinCC OnlineTrendControl


TrendWindowStatisticRulerColor
(Page 650)

TrendWindowStatisticRulerStyle
(Page 650)

TrendWindowStatisticRulerWidth
(Page 651)

See also
GetTrendWindow method (Page 742)
GetTrendWindowCollection method (Page 743)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

249

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "ValueAxis" listing object to configure the properties of the value axis in WinCC
OnlineTrendControl.

Use in the controls


WinCC OnlineTrendControl (Page 271)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "valueaxisobj.ValueAxisName", the listing name "ValueAxis"
is dropped: "valueaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ValueAxisAdd (Page 667)

ValueAxisEndValue (Page 669)

ValueAxisRemove (Page 671)

ValueAxisAlign (Page 667)

ValueAxisExponentialFormat
(Page 669)

ValueAxisRename (Page 671)

ValueAxisAutoPrecisions (Page 668)

ValueAxisIndex (Page 669)

ValueAxisRepos (Page 671)

ValueAxisAutoRange (Page 668)

ValueAxisInTrendColor

ValueAxisScalingType (Page 672)

ValueAxisBeginValue (Page 668)

ValueAxisLabel (Page 670)

ValueAxisTrendWindow (Page 672)

ValueAxisColor (Page 668)

ValueAxisName (Page 670)

ValueAxisVisible (Page 672)

ValueAxisCount (Page 669)

ValueAxisPrecisions (Page 671)

See also
GetValueAxis method (Page 744)
GetValueAxisCollection method (Page 745)

ValueColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "ValueColumn" listing object to configure the properties of the value column in WinCC
OnlineTrendControl.

250

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC OnlineTableControl (Page 267)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "valcolobj.ValueColumnName", the listing name
"ValueColumn" is dropped: "valcolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ValueColumnAdd (Page 672)

ValueColumnHideTitleText (Page 675)

ValueColumnRepos (Page 677)

ValueColumnAlign (Page 673)

ValueColumnIndex (Page 675)

ValueColumnSelectTagName
(Page 678)

ValueColumnAutoPrecisions
(Page 673)

ValueColumnLength (Page 676)

ValueColumnShowIcon (Page 678)

ValueColumnBackColor (Page 674)

ValueColumnName (Page 676)

ValueColumnShowTitleIcon (Page 678)

ValueColumnCaption (Page 674)

ValueColumnPrecisions (Page 676)

ValueColumnSort (Page 679)

ValueColumnCount (Page 674)

ValueColumnProvider (Page 676)

ValueColumnSortIndex (Page 679)

ValueColumnExponentialFormat
(Page 674)

ValueColumnProviderCLSID
(Page 677)

ValueColumnTagName (Page 679)

ValueColumnForeColor (Page 675)

ValueColumnRemove (Page 677)

ValueColumnTimeColumn (Page 680)

ValueColumnHideText (Page 675)

ValueColumnRename (Page 677)

ValueColumnVisible (Page 680)

See also
GetValueColumn method (Page 746)
GetValueColumnCollection method (Page 747)

XAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Xaxis" listing object to configure the properties of the X axis in WinCC
FunctionTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

251

VBS for Creating Procedures and Actions


1.14 VBS Reference

Use in the controls


WinCC FunctionTrendControl (Page 260)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "xaxisobj.XAxisName", the listing name "XAxis" is dropped:
"xaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
XAxisAdd (Page 687)

XAxisEndValue (Page 689)

XAxisRemove (Page 691)

XAxisAlign

XAxisExponentialFormat (Page 689)

XAxisRename (Page 693)

XAxisAutoPrecisions (Page 688)

XAxisIndex (Page 693)

XAxisRepos (Page 691)

XAxisAutoRange (Page 688)

XAxisInTrendColor

XAxisScalingType (Page 691)

XAxisBeginValue (Page 688)

XAxisLabel (Page 690)

XAxisTrendWindow (Page 692)

XAxisColor (Page 689)

XAxisName (Page 690)

XAxisVisible (Page 692)

XAxisCount (Page 693)

XAxisPrecisions (Page 691)

See also
GetXAxis method (Page 748)
GetXAxisCollection method (Page 750)

YAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Yaxis" listing object to configure the properties of the Y axis in WinCC
FunctionTrendControl.

Use in the controls


WinCC FunctionTrendControl (Page 260)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "yaxisobj.YAxisName", the listing name "YAxis" is dropped:
"yaxisobj.Name".

252

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
YAxisAdd (Page 687)

YAxisEndValue (Page 689)

YAxisRemove (Page 691)

YAxisAlign (Page 687)

YAxisExponentialFormat (Page 689)

YAxisRename (Page 694)

YAxisAutoPrecisions (Page 688)

YAxisIndex (Page 693)

YAxisRepos (Page 691)

YAxisAutoRange (Page 688)

YAxisInTrendColor (Page 690)

YAxisScalingType (Page 691)

YAxisBeginValue (Page 688)

YAxisLabel (Page 690)

YAxisTrendWindow (Page 692)

YAxisColor (Page 689)

YAxisName (Page 690)

YAxisVisible (Page 692)

YAxisCount (Page 693)

YAxisPrecisions (Page 691)

See also
GetYAxis method (Page 751)
GetYAxisCollection method (Page 752)

HMI Symbol Library


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "HMI Symbol Library"

Type Identifier in VBS


HMISymbolLibrary

Usage
In the following example, the object with the name "Control1" is moved 20 pixels to the right:

'VBS64
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +20

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

253

VBS for Creating Procedures and Actions


1.14 VBS Reference

Properties
This object type has the following properties:

See also
Left Property (Page 464)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
Stretch Property (Page 581)
Picture Property (Page 523)
Parent Property (Page 515)
ObjectName Property (Page 499)
Object Property (Page 498)
Layer Object (Page 136)
Height Property (Page 431)
ForeColor Property (Page 423)
Flip Property (Page 417)
Enabled Property (Page 395)
Cursor Property (Page 382)
BlinkColor Property (Page 335)
BackStyle Property (Page 327)
BackColor Property (Page 323)

254

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

WinCC AlarmControl
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC AlarmControl" as
of WinCC V7.0.

Type Identifier in VBS


HMIAlarmControl

Available list objects


HitlistColumn (Page 236)

Row (Page 240)

MessageBlock (Page 237)

StatusbarElement (Page 244)

MessageColumn (Page 238)

ToolbarButton (Page 246)

OperatorColumn (Page 239)

Available Methods in VBS


Activate

GetOperatorMessageCollecti MoveToLastLine
on

ShowHideList

ActivateDynamic

GetRow (Page 716)

MoveToLastPage

ShowHitList

AttachDB

GetRowCollection
(Page 717)

MoveToNextLine

ShowInfoText

CopyRows

GetSelectedRow (Page 723)

MoveToNextPage

ShowLockDialog

DeactivateDynamic

GetSelectedRows
(Page 724)

MoveToPreviousLine

ShowLockList

DetachDB

GetStatusbarElement

MoveToPreviousPage

ShowLongTermArchiveList

Export

GetStatusbarElementCollecti Print
on

ShowMessageList

GetHitlistColumn

GetToolbarButton

QuitHorn

ShowPropertyDialog

GetHitlistColumnCollection

GetToolbarButtonCollection

QuitSelected

ShowSelectionDialog

GetMessageBlock

HideAlarm

QuitVisible

ShowShortTermArchiveList

GetMessageBlockCollection

LockAlarm

ShowComment

ShowSortDialog

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

255

VBS for Creating Procedures and Actions


1.14 VBS Reference
GetMessageColumn

ShowDisplayOptionsDialog

ShowTimebaseDialog

GetMessageColumnCollectio MoveToFirstLine
n

LoopInAlarm

ShowEmergencyQuitDialog

UnhideAlarm

GetOperatorMessage

ShowHelp

UnlockAlarm

MoveToFirstPage

Available Properties in VBS


If you access the properties with a listing object, you do not have to enter the name of the
listing. For example, when using "messagecol.MessageColumnName", the listing name
"MessageColumn" is dropped: "messagecol.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
Activate

HitListRelTime

OperatorMessageSource10

AllServer

HitListRelTimeFactor

OperatorMessageSourceTyp StatusbarElementText
e1

ApplyProjectSettings

HitListRelTimeFactorType

OperatorMessageSourceTyp StatusbarElementTooltipText
e2

AutoCompleteColumns

HorizontalGridLines

OperatorMessageSourceTyp StatusbarElementUserDefin
e3
ed

AutoCompleteRows

IconSpace

OperatorMessageSourceTyp StatusbarElementVisible
e4

AutoScroll

LineColor (Page 467)

OperatorMessageSourceTyp StatusbarElementWidth
e5

AutoSelectionColors

LineWidth (Page 468)

OperatorMessageSourceTyp StatusbarFontColor
e6

AutoSelectionRectColor

LongTermArchiveConsistenc OperatorMessageSourceTyp StatusbarShowTooltips


y
e7

BackColor

MessageBlockAlign

OperatorMessageSourceTyp StatusbarText
e8

BorderColor

MessageBlockAutoPrecision
s

OperatorMessageSourceTyp StatusbarUseBackColor
e9

BorderWidth

MessageBlockCaption

OperatorMessageSourceTyp StatusbarVisible
e10

Caption

MessageBlockCount

PageMode

TableColor

CellCut

MessageBlockDateFormat

PageModeMessageNumber

TableColor2

CellSpaceBottom

MessageBlockExponentialFo PrintJobName
rmat

TableForeColor

CellSpaceLeft

MessageBlockFlashOn

RowCellCount (Page 540)

TableForeColor2

CellSpaceRight

MessageBlockHideText

RowCellText (Page 540)

TimeBase

CellSpaceTop

MessageBlockHideTitleText

RowCount (Page 540)

TitleColor

Closeable

MessageBlockIndex

RowNumber (Page 541)

TitleCut

ColumnResize

MessageBlockLeadingZeros

RowScrollbar

TitleDarkShadowColor

ColumnTitleAlign

MessageBlockLength

RowTitleAlign

TitleForeColor

ColumnTitles

MessageBlockPrecisions

RowTitles

TitleGridLineColor

DefaultMsgFilterSQL

MessageBlockSelected

RTPersistence

TitleLightShadowColor

256

StatusbarElementRepos

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
DefaultSort

MessageBlockShowDate

RTPersistencePasswordLev
el

TitleSort

DefaultSort2

MessageBlockShowIcon

RTPersistenceType

TitleStyle

DefaultSort2Column

MessageBlockShowTitleIcon SelectedCellColor

ToolbarAlignment

DisplayOptions

MessageBlockTextId

SelectedCellForeColor

ToolbarBackColor

DoubleClickAction

MessageBlockType

SelectedRowColor

ToolbarButtonActive

ExportDirectoryChangeable

MessageColumnAdd

SelectedRowForeColor

ToolbarButtonAdd

ExportDirectoryname

MessageColumnCount

SelectedTitleColor

ToolbarButtonBeginGroup

ExportFileExtension

MessageColumnIndex

SelectedTitleForeColor

ToolbarButtonClick

ExportFilename

MessageColumnName

SelectionColoring

ToolbarButtonCount

ExportFilenameChangeable

MessageColumnRemove

SelectionRect

ToolbarButtonEnabled

ExportFormatGuid

MessageColumnRepos

SelectionRectColor

ToolbarButtonHotKey

ExportFormatName

MessageColumnSort

SelectionRectWidth

ToolbarButtonId

ExportParameters

MessageColumnSortIndex

SelectionType

ToolbarButtonIndex

ExportSelection

MessageColumnVisible

ServerNames

ToolbarButtonLocked

ExportShowDialog

MessageListType

ShowSortButton

ToolbarButtonName

ExportXML

Moveable

ShowSortIcon

ToolbarButtonPasswordLeve
l

Font

MsgFilterSQL

ShowSortIndex

ToolbarButtonRemove

GridLineColor

OperatorMessageID

ShowTitle

ToolbarButtonRename

GridLineWidth

OperatorMessageIndex

Sizeable

ToolbarButtonRepos

HitlistColumnAdd

OperatorMessageName

SkinName

ToolbarButtonTooltipText

HitlistColumnCount

OperatorMessageNumber

SortSequence

ToolbarButtonUserDefined

HitlistColumnIndex

OperatorMessageSelected

StatusbarBackColor

ToolbarButtonVisible

HitlistColumnName

OperatorMessageSource1

StatusbarElementAdd

ToolbarShowTooltips

HitlistColumnRemove

OperatorMessageSource2

StatusbarElementAutoSize

ToolbarUseBackColor

HitlistColumnRepos

OperatorMessageSource3

StatusbarElementCount

ToolbarUseHotKeys

HitlistColumnSort

OperatorMessageSource4

StatusbarElementIconId

ToolbarVisible

HitlistColumnSortIndex

OperatorMessageSource5

StatusbarElementId

UseMessageColor

HitlistColumnVisible

OperatorMessageSource6

StatusbarElementIndex

UseSelectedTitleColor

HitListDefaultSort

OperatorMessageSource7

StatusbarElementName

UseTableColor2

HitListMaxSourceItems

OperatorMessageSource8

StatusbarElementRemove

VerticalGridLines

HitListMaxSourceItemsWarn

OperatorMessageSource9

StatusbarElementRename

Example
A selection of messages is defined in an existing WinCC AlarmControl. The column properties
are configured in the script.
Requirements
A "WinCC AlarmControl" with the name "Control1" has already been inserted in a process
picture in Graphics Designer. The picture "C_015_Native_Alarms_Sel.pdl" from the demo
project was used for this example.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

257

VBS for Creating Procedures and Actions


1.14 VBS Reference
You have already configured messages in your project. Or you are using the demo project
from which we have taken the messages used for the example.
Messages have already been triggered in Runtime. The buttons "incoming" and "outgoing"
were clicked in the demo project.

'VBS366
Sub OnClick(ByVal Item)
Dim objControl
Dim objMessColumn
Dim objMessBlock
Set objControl = ScreenItems("Control1")
objControl.ApplyProjectSettings = False
Set objMessBlock = objControl.GetMessageBlock("Date")
objMessBlock.DateFormat = "dd.MM.yy"
Set objMessColumn = objControl.GetMessageColumn("Time")
objMessColumn.Visible = False
objControl.MsgFilterSQL = "MSGNR >= 5 AND Priority = 0"
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)

WinCC Digital/Analog Clock


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Digital/Analog
Clock"

258

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Type Identifier in VBS


HMIClock

Usage
In the following example, the object with the name "Control1" is moved 11 pixels to the right:

'VBS55
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +11

See also
Parent Property (Page 515)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
Ticks Property (Page 588)
TicksColor Property (Page 588)
SquareExtent Property (Page 573)
SecondNeedleWidth Property (Page 550)
SecondNeedleHeight Property (Page 550)
Picture Property (Page 523)
ObjectName Property (Page 499)
Object Property (Page 498)
MinuteNeedleWidth Property (Page 494)
MinuteNeedleHeight Property (Page 493)
LocaleID Property (Page 470)
Left Property (Page 464)
Layer Object (Page 136)
HourNeedleWidth Property (Page 438)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

259

VBS for Creating Procedures and Actions


1.14 VBS Reference
HourNeedleHeight Property (Page 437)
Height Property (Page 431)
Handtype Property (Page 431)
HandFillColor Property (Page 430)
ForeColor Property (Page 423)
Font property (before WinCC V7) (Page 419)
FocusRect Property (Page 418)
Enabled Property (Page 395)
BackStyle Property (Page 327)
BackColor Property (Page 323)
Analog Property (Page 313)

WinCC FunctionTrendControl
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC
FunctionTrendControl" as of WinCC V7.0.

Type Identifier in VBS


HMIFunctionTrendControl

Available list objects


StatusbarElement (Page 244)

Trend (Page 247)

XAxis (Page 251)

ToolbarButton (Page 246)

TrendWindow (Page 249)

YAxis (Page 252)

260

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Methods available in VBS


Activate

GetToolbarButtonCollectio
n

MoveAxis

ShowTrendSelection

ActivateDynamic GetTrend

NextTrend

StartStopUpdate

AttachDB

GetTrendCollection

OneToOneView

ZoomArea

DeactivateDyna
mic

GetTrendWindow

PreviousTrend

ZoomInOut

DetachDB

GetTrendWindowCollection Print

ZoomInOutX

Export

GetXAxis

ShowHelp

ZoomInOutY

GetStatusbarEle
ment

GetXAxisCollection

ShowPropertyDialog

ZoomMove

GetStatusbarEle
mentCollection

GetYAxis

ShowTagSelection

GetToolbarButto
n

GetYAxisCollection

ShowTimeSelection

Properties available in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "xaxisobj.XAxisName", the listing name "XAxis" is dropped:
"xaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
BackColor

StatusbarElementTooltipText TrendLineWidth

TrendWindowVerticalGrid

BorderColor

StatusbarElementUserDefin
ed

TrendLowerLimit

TrendWindowVisible

BorderWidth

StatusbarElementVisible

TrendLowerLimitColor

TrendXAxis

Caption

StatusbarElementWidth

TrendLowerLimitColoring

TrendYAxis

Closeable

StatusbarFontColor

TrendMeasurePoints

UseTrendNameAsLabel

ConnectTrendWindows

StatusbarShowTooltips

TrendName

XAxisAdd

ExportDirectoryChangeable

StatusbarText

TrendPointColor

XAxisAlign

ExportDirectoryname

StatusbarUseBackColor

TrendPointStyle

XAxisAutoPrecisions

ExportFileExtension

StatusbarVisible

TrendPointWidth

XAxisAutoRange

ExportFilename

TimeBase

TrendProvider

XAxisBeginValue

ExportFilenameChangeable

ToolbarAlignment

TrendProviderCLSID

XAxisColor

ExportFormatGuid

ToolbarBackColor

TrendRangeType

XAxisCount

ExportFormatName

ToolbarButtonActive

TrendRemove

XAxisEndValue

ExportSelection

ToolbarButtonAdd

TrendRename

XAxisExponentialFormat

ExportShowDialog

ToolbarButtonBeginGroup

TrendRepos

XAxisIndex

ExportParameters

ToolbarButtonClick

TrendSelectTagNameX

XAxisInTrendColor

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

261

VBS for Creating Procedures and Actions


1.14 VBS Reference
ExportXML

ToolbarButtonCount

TrendSelectTagNameY

XAxisLabel

Font

ToolbarButtonEnabled

TrendTagNameX

XAxisName

GraphDirection

ToolbarButtonHotKey

TrendTagNameY

XAxisPrecisions

LineColor

ToolbarButtonId

TrendTimeRangeBase

XAxisRemove

LineWidth

ToolbarButtonIndex

TrendTimeRangeFactor

XAxisRename

LoadDataImmediately

ToolbarButtonLocked

TrendTrendWindow

XAxisRepos

Moveable

ToolbarButtonName

TrendUncertainColor

XAxisScalingType

Online

ToolbarButtonPasswordLeve TrendUncertainColoring
l

XAxisTrendWindow

PrintJobName

ToolbarButtonRemove

TrendUpperLimit

XAxisVisible

RTPersistence

ToolbarButtonRename

TrendUpperLimitColor

XAxisAdd

RTPersistencePasswordLev
el

ToolbarButtonRepos

TrendUpperLimitColoring

XAxisAlign

RTPersistenceType

ToolbarButtonTooltipText

TrendVisible

XAxisAutoPrecisions

ShowRuler

ToolbarButtonUserDefined

TrendWindowAdd

XAxisAutoRange

ShowRulerInAxis

ToolbarButtonVisible

TrendWindowCoarseGrid

XAxisBeginValue

ShowScrollbars

ToolbarShowTooltips

TrendWindowCount

XAxisColor

ShowTitle

ToolbarUseBackColor

TrendWindowCoarseGridCol YAxisCount
or

Sizeable

ToolbarUseHotKeys

TrendWindowFineGrid

XAxisEndValue

ShowTrendIcon

ToolbarVisible

TrendWindowFineGridColor

XAxisExponentialFormat

SkinName

TrendActualize

TrendWindowForegroundTre YAxisIndex
ndGrid

StatusbarBackColor

TrendAdd

TrendWindowGridInTrendCo XAxisInTrendColor
lor

StatusbarElementAdd

TrendBeginTime

TrendWindowHorizontalGrid

XAxisLabel

StatusbarElementAutoSize

TrendColor

TrendWindowIndex

XAxisName

StatusbarElementCount

TrendCount

TrendWindowName

XAxisPrecisions

StatusbarElementIconId

TrendEndTime

TrendWindowRemove

XAxisRemove

StatusbarElementId

TrendExtendedColorSet

TrendWindowRename

YAxisRename

StatusbarElementIndex

TrendFill

TrendWindowRepos

XAxisRepos

StatusbarElementName

TrendFillColor

TrendWindowRulerColor

XAxisScalingType

StatusbarElementRemove

TrendIndex

TrendWindowRulerLayer

XAxisTrendWindow

StatusbarElementRename

TrendLabel

TrendWindowRulerStyle

XAxisVisible

StatusbarElementRepos

TrendLineStyle

TrendWindowRulerWidth

StatusbarElementText

TrendLineType

TrendWindowSpacePortion

Examples
A trend is displayed in a WinCC FunctionTrendControl that is linked with a user archive.
Different properties are configured for the trend in the script. The "StartID" of the user archive
and the number of measurement points is changed regarding data connection.

262

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Requirements
A "WinCC FunctionTrendControl" with the name "Control1" is inserted in a process picture
in Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured a user archive in your project. Or you are using the demo
project from which we have taken the user archive for the example.

'VBS363
Sub OnClick(ByVal Item)
Dim objFXControl
Dim objTrendWindow
Dim objTrend
Dim objXAxis
Dim objYAxis
Dim startID
Dim FXServerDataX(3)
Dim FXServerDataY(3)
' create reference to FXControl
Set objFXControl = ScreenItems("Control1")
' create reference to new window, x and y axis
Set objTrendWindow = objFXControl.GetTrendWindowCollection.AddItem("myWindow")
Set objXAxis = objFXControl.GetXAxisCollection.AddItem("myXAxis")
Set objYAxis = objFXControl.GetYAxisCollection.AddItem("myYAxis")
' assign x and y axis to the window
objXAxis.TrendWindow = objTrendWindow.Name
objYAxis.TrendWindow = objTrendWindow.Name
' add new trend
Set objTrend = objFXControl.GetTrendCollection.AddItem("myTrend1")
' configure trend data connection (UserArchive)
objTrend.Provider = 3
startID = CLng(4)
FXServerDataX(0) = "Setpoint"
FXServerDataX(1) = "ParabelX"
FXServerDataX(3) = startID
FXServerDataY(0) = "Setpoint"
FXServerDataY(1) = "ParabelY"
FXServerDataY(3) = startID
objTrend.MeasurePoints = 50
objTrend.SetTagName "Setpoint\ParabelX", "Setpoint\ParabelY", FXServerDataX, FXServerDataY
' assign trend properties
objTrend.Color = RGB(255,0,0)
objTrend.PointStyle = 1
objTrend.TrendWindow = objTrendWindow.Name
objTrend.XAxis = objXAxis.Name
objTrend.YAxis = objYAxis.Name
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

263

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)
ServerDataX (Page 557)
ServerDataY (Page 557)

WinCC Gauge Control


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Gauge Control"

Type Identifier in VBS


HMIGauge

Usage
In the following example, the object with the name "Control1" is moved 14 pixels to the right:

'VBS58
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +14

264

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WarningColor Property (Page 682)
Object Property (Page 498)
BackColor Property (Page 323)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)
Width Property (Page 683)
Warning Property (Page 682)
Visible Property (Page 681)
ValueMin Property (Page 680)
ValueMax Property (Page 680)
ValueColumnAlignment Property (Page 673)
UnitText Property (Page 658)
UnitOffset Property (Page 658)
UnitFont Property (Page 657)
UnitColor Property (Page 657)
Type Property (Page 652)
Top Property (Page 628)
TicWidth Property (Page 587)
TicTextOffset Property (Page 587)
TicTextColor Property (Page 587)
TicOffset Property (Page 586)
TicFont Property (Page 586)
TicColor Property (Page 586)
ShowWarning Property (Page 566)
ShowPeak Property (Page 561)
ShowNormal Property (Page 560)
ShowDecimalPoint Property (Page 560)
ShowDanger Property (Page 560)
Rectangular Property (Page 536)
Parent Property (Page 515)
ObjectName Property (Page 499)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

265

VBS for Creating Procedures and Actions


1.14 VBS Reference
NormalColor Property (Page 497)
NeedleColor Property (Page 497)
LocaleID Property (Page 470)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FrameScale Property (Page 425)
FramePicture Property (Page 425)
FrameColor Property (Page 424)
Enabled Property (Page 395)
Delta Property (Page 390)
DangerColor Property (Page 384)
CenterScale Property (Page 355)
CenterColor Property (Page 355)
CaptionOffset Property (Page 353)
CaptionFont Property (Page 352)
Caption Property (Page 351)
CaptionColor Property (Page 352)
BorderWidth Property (Page 344)
BevelWidth Property (Page 335)
BevelOuter Property (Page 334)
BevelInner Property (Page 334)
BackStyle Property (Page 327)
BackgroundPicture Property (Page 326)
AngleMin Property (Page 314)
AngleMax Property (Page 314)

266

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

WinCC Media Control


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "WinCC Media Control" graphic object as
of WinCC V7.0.
Object Type of ScreenItem Object. Represents the "WinCC Media Control" graphic object as
of WinCC V7.0.

Type Identifier in VBS


HMIMediaControl

Usage
In the following example, the object with the name "Control1" is moved 16 pixels to the right:

'VBS60
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left 16

WinCC OnlineTableControl
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

267

VBS for Creating Procedures and Actions


1.14 VBS Reference
Object Type of ScreenItem Object. Represents the graphic object "WinCC
OnlineTableControl" as of WinCC V7.0.

Type Identifier in VBS


HMIOnlineTableControl

Available list objects


Row (Page 240)

ToolbarButton (Page 246)

StatusbarElement (Page 244)

ValueColumn (Page 250)

TimeColumn (Page 245)

Available Methods in VBS


Activate

GetRow (Page 716)

GetToolbarButtonCollection

Print

ActivateDynamic

GetRowCollection
(Page 717)

GetValueColumn

SelectedStatisticArea

AttachDB

GetSelectedRow (Page 723)

GetValueColumnCollection

ShowColumnSelection

CalculateStatistic

GetSelectedRows
(Page 724)

MoveToFirst

ShowHelp

CopyRows

GetStatusbarElement

MoveToLast

ShowPropertyDialog

DeactivateDynamic

GetStatusbarElementCollecti MoveToNext
on

ShowTagSelection

DetachDB

GetTimeColumn

MoveToPrevious

ShowTimeSelection

Edit

GetTimeColumnCollection

NextColumn

StartStopUpdate

Export

GetToolbarButton

PreviousColumn

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "timecolobj.TimeColumnName", the listing name
"TimeColumn" is dropped: "timecolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
AutoCompleteColumns

RTPersistence

TimeColumnAdd

ToolbarButtonId

AutoCompleteRows

RTPersistencePasswordLev
el

TimeColumnAlign

ToolbarButtonIndex

AutoSelectionColors

RTPersistenceType

TimeColumnBackColor

ToolbarButtonLocked

AutoSelectionRectColor

SelectedCellColor

TimeColumnBeginTime

ToolbarButtonName

BackColor

SelectedCellForeColor

TimeColumnCaption

ToolbarButtonPasswordLeve
l

268

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
BorderColor

SelectedRowColor

TimeColumnCount

ToolbarButtonRemove

BorderWidth

SelectedRowForeColor

TimeColumnDateFormat

ToolbarButtonRename

Caption

SelectedTitleColor

TimeColumnEndTime

ToolbarButtonRepos

CellCut

SelectedTitleForeColor

TimeColumnForeColor

ToolbarButtonTooltipText

CellSpaceBottom

SelectionColoring

TimeColumnHideText

ToolbarButtonUserDefined

CellSpaceLeft

SelectionRect

TimeColumnHideTitleText

ToolbarButtonVisible

CellSpaceRight

SelectionRectColor

TimeColumnIndex

ToolbarShowTooltips

CellSpaceTop

SelectionRectWidth

TimeColumnLength

ToolbarUseBackColor

Closeable

SelectionType

TimeColumnMeasurePoints

ToolbarUseHotKeys

ColumnResize

ShowSortButton

TimeColumnName

ToolbarVisible

ColumnScrollbar

ShowSortIcon

TimeColumnRangeType

UseColumnBackColor

ColumnTitleAlign

ShowSortIndex

TimeColumnRemove

UseColumnForeColor

ColumnTitles

ShowTitle

TimeColumnRename

UseSelectedTitleColor

EnableEdit

Sizeable

TimeColumnRepos

UseTableColor2

ExportDirectoryChangeable

SkinName

TimeColumnShowDate

ValueColumnAdd

ExportDirectoryname

SortSequence

TimeColumnShowIcon

ValueColumnAlign

ExportFileExtension

StatusbarBackColor

TimeColumnShowTitleIcon

ValueColumnAutoPrecisions

ExportFilename

StatusbarElementAdd

TimeColumnSort

ValueColumnBackColor

ExportFilenameChangeable

StatusbarElementAutoSize

TimeColumnSortIndex

ValueColumnCaption

ExportFormatGuid

StatusbarElementCount

TimeColumnTimeFormat

ValueColumnCount

ExportFormatName

StatusbarElementIconId

TimeColumnTimeRangeBas
e

ValueColumnExponentialFor
mat

ExportParameters

StatusbarElementId

TimeColumnTimeRangeFact ValueColumnForeColor
or

ExportSelection

StatusbarElementIndex

TimeColumnUseValueColum ValueColumnHideText
nColors

ExportShowDialog

StatusbarElementName

TimeColumnVisible

ValueColumnHideTitleText

ExportXML

StatusbarElementRemove

TimeStepBase

ValueColumnIndex

Font

StatusbarElementRename

TimeStepFactor

ValueColumnLength

GridLineColor

StatusbarElementRepos

TitleColor

ValueColumnName

GridLineWidth

StatusbarElementText

TitleCut

HorizontalGridLines

StatusbarElementTooltipText TitleDarkShadowColor

ValueColumnProvider

IconSpace

StatusbarElementUserDefin
ed

TitleForeColor

ValueColumnProviderCLSID

LineColor

StatusbarElementVisible

TitleGridLineColor

ValueColumnRemove

LineWidth

StatusbarElementWidth

TitleLightShadowColor

ValueColumnRename

LoadDataImmediately

StatusbarFontColor

TitleSort

ValueColumnRepos

Moveable

StatusbarShowTooltips

TitleStyle

ValueColumnSelectTagNam
e

Online

StatusbarText

ToolbarAlignment

ValueColumnShowIcon

PrintJobName

StatusbarUseBackColor

ToolbarBackColor

ValueColumnShowTitleIcon

RowCellCount (Page 540)

StatusbarVisible

ToolbarButtonActive

ValueColumnSort

RowCellText (Page 540)

TableColor

ToolbarButtonAdd

ValueColumnSortIndex

RowCount (Page 540)

TableColor2

ToolbarButtonBeginGroup

ValueColumnState

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ValueColumnPrecisions

269

VBS for Creating Procedures and Actions


1.14 VBS Reference
RowNumber (Page 541)

TableForeColor

ToolbarButtonClick

ValueColumnTagName

RowScrollbar

TableForeColor2

ToolbarButtonCount

ValueColumnTimeColumn

RowTitleAlign

TimeBase

ToolbarButtonEnabled

ValueColumnVisible

RowTitles

TimeColumnActualize

ToolbarButtonHotKey

VerticalGridLines

Example
An additional column is added in an existing WinCC OnlineTableControl that is linked with an
archive tag. Different properties are configured for the control and the column in the script.
Requirement
A "WinCC OnlineTableControl" with the name "Control1" has already been inserted in a
process picture in Graphics Designer. The control consists of a time column and three value
columns. The picture "B_025_V7_Arch_TableControl.PDL" from the demo project was used
for this example.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured archives and archive tags in your project. Or you are using
the demo project from which we have taken the archive for the example.

VBS362
Sub OnClick(ByVal Item)
Dim objControl
Dim objTimeColumn
Dim objValueColumn
Set objControl = ScreenItems("Control1")
' Control wide specification
objControl.ColumnResize = False
objControl.TimeBase = 1
objControl.TimeColumnTimeFormat = "HH:mm:ss tt"
objControl.TimeColumnLength = 20
' properties for Time column
Set objTimeColumn = objControl.GetTimeColumn("Time column 1")
objTimeColumn.DateFormat = "dd/MM/yy"
' properties for a new 4th value column with connection to archive tag "Trend_4"
Set objValueColumn = objControl.GetValueColumnCollection.AddItem("Trend 4")
objValueColumn.Caption = "Trend 4"
objValueColumn.Length = 10
objValueColumn.Align = 1
objValueColumn.Provider = 1
objValueColumn.TagName = "G_Archive\Trend_4"
objValueColumn.TimeColumn = "Time column 1"
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

270

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Controls (Page 232)

WinCC OnlineTrendControl
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC
OnlineTrendControl" as of WinCC V7.0.

Type Identifier in VBS


HMIOnlineTrendControl

Available list objects


StatusbarElement (Page 244)

ToolbarButton (Page 246)

TrendWindow (Page 249)

TimeAxis (Page 244)

Trend (Page 247)

ValueAxis (Page 250)

Available Methods in VBS


Activate

GetTimeAxisCollection

MoveToFirst

ShowPropertyDialog

ActivateDynamic GetToolbarButton
method
(Page 737)

MoveToLast

ShowTagSelection

AttachDB
method

GetToolbarButtonCollectio
n (Page 738)

MoveToNext

ShowTimeSelection

CalculateStatisti
c

GetTrend

MoveToPrevious

ShowTrendSelection

DeactivateDyna
mic

GetTrendCollection

NextTrend

StartStopUpdate

DetachDB

GetTrendWindow

OneToOneView

ZoomArea

Export

GetTrendWindowCollection PreviousTrend

ZoomInOut

GetStatusbarEle
ment

GetValueAxis

ZoomInOutTime

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Print

271

VBS for Creating Procedures and Actions


1.14 VBS Reference
GetStatusbarEle
mentCollection

GetValueAxisCollection

ShowHelp

ZoomInOutValues

GetTimeAxis

MoveAxis

ShowPercentageAxis

ZoomMove

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "trendobj.Trendname", the listing name "Trend" is dropped:
"trendobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
BackColor

StatusbarElementRepos

ToolbarButtonRemove

TrendValueUnit

BorderColor

StatusbarElementText

ToolbarButtonRename

TrendVisible

BorderWidth

StatusbarElementTooltipText ToolbarButtonRepos

TrendWindowAdd

Caption

StatusbarElementUserDefin
ed

ToolbarButtonTooltipText

TrendWindowCoarseGrid

Closeable

StatusbarElementVisible

ToolbarButtonUserDefined

TrendWindowCoarseGridCol
or

ConnectTrendWindows

StatusbarElementWidth

ToolbarButtonVisible

TrendWindowCount

ExportDirectoryChangeable

StatusbarFontColor

ToolbarShowTooltips

TrendWindowFineGrid

ExportDirectoryname

StatusbarShowTooltips

ToolbarUseBackColor

TrendWindowFineGridColor

ExportFileExtension

StatusbarText

ToolbarUseHotKeys

TrendWindowForegroundTre
ndGrid

ExportFilename

StatusbarUseBackColor

ToolbarVisible

TrendWindowGridInTrendCo
lor

ExportFilenameChangeable

StatusbarVisible

TrendAdd

TrendWindowHorizontalGrid

ExportFormatGuid

TimeAxisActualize

TrendAutoRangeBeginTagN
ame

TrendWindowIndex

ExportFormatName

TimeAxisAdd

TrendAutoRangeBeginValue TrendWindowName

ExportParameters

TimeAxisAlign

TrendAutoRangeEndTagNa
me

TrendWindowRemove

ExportSelection

TimeAxisBeginTime

TrendAutoRangeEndValue

TrendWindowRename

ExportShowDialog

TimeAxisColor

TrendAutoRangeSource

TrendWindowRepos

ExportXML

TimeAxisCount

TrendColor

TrendWindowRulerColor

Font

TimeAxisDateFormat

TrendCount

TrendWindowRulerLayer

GraphDirection

TimeAxisEndTime

TrendExtendedColorSet

TrendWindowRulerStyle

LineColor

TimeAxisIndex

TrendFill

TrendWindowRulerWidth

LineWidth

TimeAxisInTrendColor

TrendFillColor

TrendWindowSpacePortion

LoadDataImmediately

TimeAxisLabel

TrendIndex

TrendWindowStatisticRulerC
olor

Moveable

TimeAxisMeasurePoints

TrendLabel

TrendWindowStatisticRulerS
tyle

Online

TimeAxisName

TrendLineStyle

TrendWindowStatisticRuler
Width

272

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
PercentageAxis

TimeAxisRangeType

TrendLineType

TrendWindowVerticalGrid

PercentageAxisAlign

TimeAxisRemove

TrendLineWidth

TrendWindowVisible

PercentageAxisColor

TimeAxisRename

TrendLowerLimit

UseTrendNameAsLabel

PrintJobName

TimeAxisRepos

TrendLowerLimitColor

ValueAxisAdd

RTPersistence

TimeAxisShowDate

TrendLowerLimitColoring

ValueAxisAlign

RTPersistencePasswordLev
el

TimeAxisTimeFormat

TrendName

ValueAxisAutoPrecisions

RTPersistenceType

TimeAxisTimeRangeBase

TrendPointColor

ValueAxisAutoRange

ShowRuler

TimeAxisTimeRangeFactor

TrendPointStyle

ValueAxisBeginValue

ShowRulerInAxis

TimeAxisTrendWindow

TrendPointWidth

ValueAxisColor

ShowScrollbars

TimeAxisVisible

TrendProvider

ValueAxisCount

ShowStatisticRuler

TimeBase

TrendProviderCLSID

ValueAxisEndValue

ShowTitle

ToolbarAlignment

TrendRemove

ValueAxisExponentialFormat

ShowTrendIcon

ToolbarBackColor

TrendRename

ValueAxisIndex

Sizeable

ToolbarButtonActive

TrendRepos

ValueAxisInTrendColor

SkinName

ToolbarButtonAdd

TrendSelectTagName

ValueAxisLabel

StatusbarBackColor

ToolbarButtonBeginGroup

TrendTagName

ValueAxisName

StatusbarElementAdd

ToolbarButtonClick

TrendTimeAxis

ValueAxisPrecisions

StatusbarElementAutoSize

ToolbarButtonCount

TrendTrendWindow

ValueAxisRemove

StatusbarElementCount

ToolbarButtonEnabled

TrendUncertainColor

ValueAxisRename

StatusbarElementIconId

ToolbarButtonHotKey

TrendUncertainColoring

ValueAxisRepos

StatusbarElementId

ToolbarButtonId

TrendUpperLimit

ValueAxisScalingType

StatusbarElementIndex

ToolbarButtonIndex

TrendUpperLimitColor

ValueAxisTrendWindow

StatusbarElementName

ToolbarButtonLocked

TrendUpperLimitColoring

ValueAxisVisible

StatusbarElementRemove

ToolbarButtonName

TrendValueAlignment

StatusbarElementRename

ToolbarButtonPasswordLeve TrendValueAxis
l

Example
Three trends are displayed in a WinCC OnlineTrendControl that are linked with archive tags.
Different properties are configured for the trends in the script.
Requirements
A "WinCC OnlineTrendControl" with the name "Control1" is inserted in a process picture
in Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured archives and archive tags in your project. Or you are using
the demo project from which we have taken the archives for the example.

'VBS361
Sub OnClick(ByVal Item)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

273

VBS for Creating Procedures and Actions


1.14 VBS Reference

Dim objTrendControl
Dim objTrendWindow
Dim objTimeAxis
Dim objValueAxis
Dim objTrend
'create reference to TrendControl
Set objTrendControl = ScreenItems("Control1")
'create reference to new window, time and value axis
Set objTrendWindow = objTrendControl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = objTrendControl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValueAxis = objTrendControl.GetValueAxisCollection.AddItem("myValueAxis")
'assign time and value axis to the window
objTimeAxis.TrendWindow = objTrendWindow.Name
objValueAxis.TrendWindow = objTrendWindow.Name
' assign properties to trendwindow
objTrendWindow.HorizontalGrid = False
' add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend1")
objTrend.Provider = 1
objTrend.TagName = "G_Archive\Trend_1"
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
objTrend.Color = RGB(255,0,0)
objTrend.PointStyle = 0
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend2")
objTrend.Provider = 1
objTrend.TagName = "G_Archive\Trend_2"
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
objTrend.Color = RGB(0,255,0)
objTrend.LineWidth = 3
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend3")
objTrend.Provider = 1
objTrend.TagName = "G_Archive\Trend_3"
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
objTrend.Color = RGB(0,0,255)
objTrend.LineType = 2
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

274

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Controls (Page 232)

WinCC Push Button Control


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Push Button Control"

Type Identifier in VBS


HMIButton

Usage
In the following example, the object with the name "Control1" is moved 17 pixels to the right:

'VBS61
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +17

Note
The events KeyDown, KeyUp and KeyPress cannot be addressed by VBS. If it is required to
make controls dynamic with the help of VBS, no parameter must be declared with ByRef.

Notes on Error Handling


Buttons and pushbuttons are mapped in the object model to an "HMIButton" type. Since the
objects have different properties, the availability of the property (dynamic type compilation in

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

275

VBS for Creating Procedures and Actions


1.14 VBS Reference
Runtime) should be queried via an exception measure. The exception measure is activated
for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

'VBS62
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = "HMIButton" Then
'
'=== Property "Text" available only for Standard-Button
objScreenItem.Text = "Windows"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Windows-Button" & vbCrLf
Err.Clear
'Delete error message
End If
'
'=== Property "Caption" available only for PushButton
objScreenItem.Caption = "Push"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Control" & vbCrLf

276

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Err.Clear
End If
End If
Next
On Error Goto 0

'Deactivation of errorhandling

See also
Properties (Page 303)
FontName Property (Page 421)
Activate Method (Page 697)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Transparent Property (Page 630)
Top Property (Page 628)
PictureUnselected Property (Page 526)
PictureSelected Property (Page 525)
Parent Property (Page 515)
Outline Property (Page 514)
ObjectName Property (Page 499)
Object Property (Page 498)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
FrameWidth Property (Page 426)
FrameColorUp Property (Page 425)
FrameColorDown Property (Page 424)
ForeColor Property (Page 423)
FontUnderline Property (Page 422)
FontStrikeThru Property (Page 422)
FontSize Property (Page 421)
FontItalic Property (Page 420)
Font property (before WinCC V7) (Page 419)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

277

VBS for Creating Procedures and Actions


1.14 VBS Reference
FontBold Property (Page 420)
FocusRect Property (Page 418)
Enabled Property (Page 395)
Caption Property (Page 351)
BackColor Property (Page 323)
AutoSize Property (Page 321)

WinCC RulerControl
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC RulerControl" as
of WinCC V7.0.

Type Identifier in VBS


HMIRulerControl

Available list objects


Row (Page 240)

StatisticResultColumn (Page 243)

RulerBlock (Page 241)

StatusbarElement (Page 244)

RulerColumn (Page 241)

ToolbarButton (Page 246)

StatisticAreaColumn (Page 242)

Available Methods in VBS


Activate

GetRulerBlock

GetStatisticAreaColumn

GetToolbarButton

ActivateDynamic

GetRulerBlockCollection

GetStatisticAreaColumnColl
ection

GetToolbarButtonCollection

DeactivateDynamic

GetRulerColumn

GetStatisticResultColumn

ShowHelp

Export

GetRulerColumnCollection

GetStatisticResultColumnCol ShowPropertyDialog
lection

278

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
GetRow (Page 716)

GetSelectedRow (Page 723)

GetStatusbarElement

GetRowCollection
(Page 717)

GetSelectedRows
(Page 724)

GetStatusbarElementCollecti
on

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rulercolobj.ColumnName", the listing name "Column" is
dropped: "rulercolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
AutoCompleteColumns

ColumnScrollbar

SelectedRowForeColor

TableColor2

AutoCompleteRows

ColumnSort

SelectedTitleColor

TableForeColor

AutoPositon

ColumnSortIndex

SelectedTitleForeColor

TableForeColor2

AutoSelectionColors

ColumnTitleAlign

SelectionColoring

TitleColor

AutoSelectionRectColor

ColumnTitles

SelectionRect

TitleCut

AutoShow

ColumnVisible

SelectionRectColor

TitleDarkShadowColor

BackColor

ExportDirectoryChangeable

SelectionRectWidth

TitleForeColor

BlockAlign

ExportDirectoryname

SelectionType

TitleGridLineColor

BlockAutoPrecisions

ExportFileExtension

ShareSpaceWithSourceCont TitleLightShadowColor
rol

BlockCaption

ExportFilename

ShowSortButton

TitleSort

BlockCount

ExportFilenameChangeable

ShowSortIcon

TitleStyle

BlockDateFormat

ExportFormatGuid

ShowSortIndex

ToolbarAlignment

BlockExponentialFormat

ExportFormatName

ShowTitle

ToolbarBackColor

BlockHideText

ExportParameters

Sizeable

ToolbarButtonActive

BlockHideTitleText

ExportSelection

SkinName

ToolbarButtonAdd

BlockID

ExportShowDialog

SortSequence

ToolbarButtonBeginGroup

BlockIndex

ExportXML

SourceControl

ToolbarButtonClick

BlockLength

Font

SourceControlType

ToolbarButtonCount

BlockName

GridLineColor

StatusbarBackColor

ToolbarButtonEnabled

BlockPrecisions

GridLineWidth

StatusbarElementAdd

ToolbarButtonHotKey

BlockShowDate

HorizontalGridLines

StatusbarElementAutoSize

ToolbarButtonId

BlockShowIcon

IconSpace

StatusbarElementCount

ToolbarButtonIndex

BlockShowTitleIcon

LineColor

StatusbarElementIconId

ToolbarButtonLocked

BlockTimeFormat

LineWidth

StatusbarElementId

ToolbarButtonName

BlockUseSourceFormat

Moveable

StatusbarElementIndex

ToolbarButtonPasswordLeve
l

BorderColor

PrintJobName

StatusbarElementName

ToolbarButtonRemove

BorderWidth

RowCellCount (Page 540)

StatusbarElementRemove

ToolbarButtonRename

Caption

RowCellText (Page 540)

StatusbarElementRename

ToolbarButtonRepos

CellCut

RowCount (Page 540)

StatusbarElementRepos

ToolbarButtonTooltipText

CellSpaceBottom

RowNumber (Page 541)

StatusbarElementText

ToolbarButtonUserDefined

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

279

VBS for Creating Procedures and Actions


1.14 VBS Reference
CellSpaceLeft

RowScrollbar

StatusbarElementTooltipText ToolbarButtonVisible

CellSpaceRight

RowTitleAlign

StatusbarElementUserDefin
ed

ToolbarShowTooltips

CellSpaceTop

RowTitles

StatusbarElementVisible

ToolbarUseBackColor

Closeable

RTPersistence

StatusbarElementWidth

ToolbarUseHotKeys

ColumnAdd

RTPersistencePasswordLev
el

StatusbarFontColor

ToolbarVisible

ColumnCount

RTPersistenceType

StatusbarShowTooltips

UseSelectedTitleColor

ColumnIndex

RulerType

StatusbarText

UseSourceBackColors

ColumnName

SelectedCellColor

StatusbarUseBackColor

UseSourceForeColors

ColumnRemove

SelectedCellForeColor

StatusbarVisible

UseTableColor2

ColumnRepos

SelectedRowColor

TableColor

VerticalGridLines

ColumnResize

Example
A WinCC Ruler Control is inserted in a picture with an existing WinCC OnlineTableControl.
The RulerControl contains a statistics window that displays the "Minimum", "Maximum" and
"Average" columns. The static values are then displayed for the selected rows of the
OnlineTableControl.
Requirements
A "WinCC OnlineTableControl" with the name "Control1" has already been inserted in a
process picture in Graphics Designer. The control is linked with archive tags or process
tags. The picture "B_025_V7_Arch_TableControl.PDL" from the demo project was used for
this example.
You have added an additional "WinCC RulerControl" with the name "Control2" in the picture.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have selected some rows in OnlineTableControl.

'VBS364
Sub OnClick(ByVal Item)
Dim objRulerControl
Dim objTableControl
Dim objstatColumn
Dim rows
Set objRulerControl = ScreenItems("Control2")
' Use Statistic-window
objRulerControl.RulerType = 2
objRulerControl.SourceControl = "Control1"
' In Statistic-window only columns "Name", "MinValue", MaxValue" and "Average" are shown
Set objstatColumn = objRulerControl.GetStatisticResultColumnCollection
objstatColumn.RemoveItem(4)
objstatColumn.RemoveItem(5)
objstatColumn.RemoveItem(6)

280

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

' Get the selected rows of tablecontrol and calculate statistic


Set objTrendControl = ScreenItems("Control1")
Set rows = objTableControl.SelectAll
objTableControl.CalculateStatistic
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)

WinCC Slider Control


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Slider Control"

Type Identifier in VBS


HMISlider

Usage
In the following example, the object with the name "Control1" is moved 19 pixels to the right:

'VBS63
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +19

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

281

VBS for Creating Procedures and Actions


1.14 VBS Reference

Notes on Error Handling


Sliders and WinCC slider controls are mapped in the object model to an "HMISlider" type.
Since the objects have different properties, the availability of the property (dynamic type
compilation in Runtime) should be queried via an exception measure. The exception measure
is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(Byval Item)


'VBS193
Dim ScreenItem
' activating error handling:
On Error Resume Next
For Each ScreenItem In ScreenItems
If ScreenItem.Type = "HMISlider" Then
'=== Property "BevelColorUp" only exists for a WinCC Slider Control
ScreenItem.BevelColorUp = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no Windows-Slider" + vbCrlf)
' delete error message
Err.Clear

282

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

End If
'=== Property "BorderStyle" only exists for a Windows-Slider
ScreenItem.BorderStyle = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no WinCC Slider Control" + vbCrlf)
Err.Clear
End If
End If
Next
On Error GoTo 0 ' deactivating error handling
End Sub

See also
PictureThumb Property (Page 525)
BarFillColor Property (Page 328)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
WithLabels Property (Page 686)
WithAxes Property (Page 686)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
TickStyle Property (Page 588)
ThumbBackColor Property (Page 585)
ShowThumb Property (Page 564)
ShowPosition Property (Page 561)
ShowBar Property (Page 559)
RangeMin Property (Page 535)
RangeMax Property (Page 535)
Position Property (Page 528)
PictureBack Property (Page 523)
Parent Property (Page 515)
OuterBevelWidth Property (Page 514)
OuterBevelStyle Property (Page 513)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

283

VBS for Creating Procedures and Actions


1.14 VBS Reference
ObjectName Property (Page 499)
Object Property (Page 498)
LocaleID Property (Page 470)
Left Property (Page 464)
Layer Object (Page 136)
LabelColor Property (Page 444)
InnerBevelWidth Property (Page 441)
InnerBevelStyle Property (Page 440)
InnerBevelOffset Property (Page 440)
Height Property (Page 431)
ForeColor Property (Page 423)
FontPosition Property (Page 421)
Font property (before WinCC V7) (Page 419)
FocusWidth Property (Page 418)
FocusColor Property (Page 418)
Enabled Property (Page 395)
ContinousChange Property (Page 381)
Caption Property (Page 351)
BevelColorUp Property (Page 333)
BevelColorDown Property (Page 333)
BarBackColor Property (Page 328)
BackStyle Property (Page 327)
BackColor Property (Page 323)

WinCC UserArchiveControl
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC
UserArchiveControl" as of WinCC V7.0.

284

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Type Identifier in VBS


HMIUserArchiveControl

Available list objects


Column (Page 235)

StatusbarElement (Page 244)

Row (Page 240)

ToolbarButton (Page 246)

Available Methods in VBS


Activate

GetRow (Page 716)

MoveToFirst

ServerImport

ActivateDynamic

GetRowCollection
(Page 717)

MoveToLast

ShowHelp

CopyRows

GetSelectedRow (Page 723)

MoveToNext

ShowPropertyDialog

CutRows

GetSelectedRows
(Page 724)

MoveToPrevious

ShowSelectArchive

DeactivateDynamic

GetStatusbarElement

PasteRows

ShowSelection

CutRows

GetStatusbarElementCollecti Print
on

ShowSelectTimeBase

Export

GetToolbarButton

ReadTags

ShowSort

GetColumn

GetToolbarButtonCollection

ServerExport

WriteTags

GetColumnCollection

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "colobj.ColumnName", the listing name "Column" is dropped:
"colobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ArchiveName

ColumnShowIcon

RowTitles

StatusbarUseBackColor

ArchiveType
AutoCompleteColumns

ColumnShowTitleIcon

RTPersistence

StatusbarVisible

ColumnSort

RTPersistencePasswordLev
el

TableColor

AutoCompleteRows

ColumnSortIndex

RTPersistenceType

TableColor2

AutoSelectionColors

ColumnStartValue

SelectArchiveName

TableForeColor

AutoSelectionRectColor

ColumnStringLength

SelectedCellColor

TableForeColor2

BackColor

ColumnTimeFormat

SelectedCellForeColor

TimeBase

BorderColor

ColumnTitleAlign

SelectedRowColor

TitleColor

BorderWidth

ColumnTitles

SelectedRowForeColor

TitleCut

Caption

ColumnType

SelectedTitleColor

TitleDarkShadowColor

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

285

VBS for Creating Procedures and Actions


1.14 VBS Reference
CellCut

ColumnVisible

SelectedTitleForeColor

TitleForeColor

CellSpaceBottom

ColumnWriteAccess

SelectionColoring

TitleGridLineColor

CellSpaceLeft

EnableDelete

SelectionRect

TitleLightShadowColor

CellSpaceRight

EnableEdit

SelectionRectColor

TitleSort

CellSpaceTop

EnableInsert

SelectionRectWidth

TitleStyle

Closeable

ExportDirectoryChangeable

SelectionType

ToolbarAlignment

ColumnAlias

ExportDirectoryname

ShowSortButton

ToolbarBackColor

ColumnAlign

ExportFileExtension

ShowSortIcon

ToolbarButtonActive

ColumnAutoPrecisions

ExportFilename

ShowSortIndex

ToolbarButtonAdd

ColumnCaption

ExportFilenameChangeable

ShowTitle

ToolbarButtonBeginGroup

ColumnCount

ExportFormatGuid

Sizeable

ToolbarButtonClick

ColumnDateFormat

ExportFormatName

SkinName

ToolbarButtonCount

ColumnDMVarName

ExportParameters

SortSequence

ToolbarButtonEnabled

ColumnExponentialFormat

ExportSelection

StatusbarBackColor

ToolbarButtonHotKey

ColumnFlagNotNull

ExportShowDialog

StatusbarElementAdd

ToolbarButtonId

ColumnFlagUnique

ExportXML

StatusbarElementAutoSize

ToolbarButtonIndex

ColumnHideText

FilterSQL

StatusbarElementCount

ToolbarButtonLocked

ColumnHideTitleText

Font

StatusbarElementIconId

ToolbarButtonName

ColumnIndex

GridLineColor

StatusbarElementId

ToolbarButtonPasswordLeve
l

ColumnLeadingZeros

GridLineWidth

StatusbarElementIndex

ToolbarButtonRemove

ColumnLength

HorizontalGridLines

StatusbarElementName

ToolbarButtonRename

ColumnMaxValue

IconSpace

StatusbarElementRemove

ToolbarButtonRepos

ColumnMinValue

LineColor

StatusbarElementRename

ToolbarButtonTooltipText

ColumnName

LineWidth

StatusbarElementRepos

ToolbarButtonUserDefined

ColumnPosition (Page 372)

Moveable

StatusbarElementText

ToolbarButtonVisible

ColumnPrecisions

PrintJobName

StatusbarElementTooltipText ToolbarShowTooltips

ColumnReadAccess

RowCellCount (Page 540)

StatusbarElementUserDefin
ed

ToolbarUseBackColor

ColumnReadonly

RowCellText (Page 540)

StatusbarElementVisible

ToolbarUseHotKeys

ColumnRepos

RowCount (Page 540)

StatusbarElementWidth

ToolbarVisible

ColumnResize

RowNumber (Page 541)

StatusbarFontColor

UseSelectedTitleColor

ColumnScrollbar

RowScrollbar

StatusbarShowTooltips

UseTableColor2

ColumnShowDate

RowTitleAlign

StatusbarText

VerticalGridLines

Example
A user archive is displayed in a WinCC UserArchiveControl.
The following actions are initiated via script:
Selecting data
Exporting data
Printing a table

286

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Requirements
A "WinCC UserArchiveControl" with the name "Control1" is inserted in a process picture in
Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured a user archive in your project. Or you are using the demo
project from which you can use a user archive.

VBS365
Sub OnClick(ByVal Item)
Dim objUAControl
Dim objColumn
Dim coll
Dim field
' create reference to UserArchivControl
Set objUAControl = ScreenItems("Control1")
' Select user archive and general column properties
objUAControl.SelectArchiveName = True
objUAControl.ColumnResize = False
objUAControl.ColumnTitleAlign = 1
' properties for ID column
Set objColumn = objUAControl.GetColumn("ID")
objColumn.Length = 2
objColumn.Align = 0
' Select data
objUAControl.FilterSQL = "ID >=3"
'export the content as a CSV-file in the "ua" directory of the project folder
objUAControl.ServerExport
' print the control
objUAControl.PrintJobName = "UserArchiveControl - Table"
objUAControl.Print
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

287

VBS for Creating Procedures and Actions


1.14 VBS Reference

Controls before WinCC V7


WinCC Alarm Control (before WinCC V7)
Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Alarm Control"

Type Identifier in VBS


HMIMessageView

Usage
In the following example, the object with the name "Control1" is moved 10 pixels to the right:

'VBS54
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left + 10

See also
ProjectPath Property (Page 532)
BackColor Property (Page 323)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
WindowType Property (Page 686)
Width Property (Page 683)
Visible Property (Page 681)

288

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Type Property (Page 652)
Top Property (Page 628)
ToolbarButtons Property (Page 624)
Titleline Property (Page 613)
TitleCut property (before WinCC V7) (Page 612)
StatusbarPanes Property (Page 579)
ServerNames property (before WinCC V7) (Page 558)
SelectionType property (before WinCC V7) (Page 555)
SelectionRectWidth property (before WinCC V7) (Page 554)
SelectionRectColor property (before WinCC V7) (Page 554)
SelectionMode Property (Page 553)
PersistentRTPermission Property (Page 520)
PersistentRTCSPermission Property (Page 520)
Parent Property (Page 515)
ObjectName Property (Page 499)
Object Property (Page 498)
MsgFilterSQL property (before WinCC V7) (Page 495)
MsgCtrlFlags Property (Page 495)
LineTitle Property (Page 468)
LineHeight Property (Page 467)
LineFont Property (Page 467)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
HeaderSort Property (Page 431)
GridLineVert Property (Page 430)
GridLineHorz Property (Page 428)
Font property (before WinCC V7) (Page 419)
Enabled Property (Page 395)
ColWidth Property (Page 378)
ColTitle Property (Page 367)
ColMove Property (Page 363)
CellCut property (before WinCC V7) (Page 353)
Caption Property (Page 351)
ButtonCommand Property (Page 347)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

289

VBS for Creating Procedures and Actions


1.14 VBS Reference
AutoScroll property (before WinCC V7) (Page 319)
AllServer property (before WinCC V7) (Page 312)
Activate property (before WinCC V7) (Page 304)
LocaleSpecificSettings Property (Page 470)
SortOrder Property (Page 568)
TableFocusOnButtonCommand Property (Page 582)
CursorMode Property (Page 384)
CursorModePrefetch Property (Page 384)
LongTimeArchiveConsistency property (before WinCC V7) (Page 473)

WinCC Function Trend Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Function Trend
Control"

Type Identifier in VBS


HMIFunctionTrendView

Usage
In the following example, the object with the name "Control1" is moved 13 pixels to the right:

'VBS57
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +13

290

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Top Property (Page 628)
ScalingTypeY Property (Page 547)
Layer Object (Page 136)
DesiredCurveSourceUAArchive Property (Page 391)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 683)
Visible Property (Page 681)
UpperLimitValue Property (Page 660)
UpperLimit Property (Page 659)
UpperLimitColor Property (Page 660)
Type Property (Page 652)
ToolbarHotKeys Property (Page 625)
ToolbarButtons Property (Page 624)
ToolbarAlignment property (before WinCC V7) (Page 615)
Titleline Property (Page 613)
TimeZone Property (Page 611)
TimeAxisX Property (Page 596)
TagProviderClsid Property (Page 584)
SourceUAColumnY Property (Page 573)
SourceUAColumnX Property (Page 573)
SourceUAArchiveStartID Property (Page 572)
SourceUAArchive Property (Page 572)
SourceTimeRange Property (Page 572)
SourceTagProviderDataY Property (Page 571)
SourceTagProviderDataX Property (Page 571)
SourceTagNameY Property (Page 571)
SourceTagNameX Property (Page 570)
SourceNumberOfValues Property (Page 570)
SourceNumberOfUAValues Property (Page 570)
SourceEndTime Property (Page 569)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

291

VBS for Creating Procedures and Actions


1.14 VBS Reference
SourceBeginTime Property (Page 568)
ShowValuesExponentialY Property (Page 566)
ShowValuesExponentialX Property (Page 565)
ShowRulerImmediately Property (Page 562)
ScalingTypeX Property (Page 546)
RulerPrecisionY Property (Page 544)
RulerPrecisionX Property (Page 543)
Replacement Property (Page 537)
ReplacementColor Property (Page 538)
RelayCurves Property (Page 537)
ProviderType Property (Page 533)
PrecisionY Property (Page 529)
PrecisionX Property (Page 529)
PersistentRTPermission Property (Page 520)
PersistentRT Property (Page 519)
PersistentRTCSPermission Property (Page 520)
PersistentRTCS Property (Page 519)
Parent Property (Page 515)
Online property (before WinCC V7) (Page 503)
ObjectName Property (Page 499)
Object Property (Page 498)
NumItems Property (Page 498)
Name Property (Page 496)
LowerLimitValue Property (Page 475)
LowerLimit Property (Page 473)
LowerLimitColor Property (Page 474)
LoadDataImmediately property (before WinCC V7) (Page 469)
Left Property (Page 464)
LabelY Property (Page 445)
LabelX Property (Page 445)
ItemVisible Property (Page 444)
InsertData Property (Page 441)
Index Property (Page 439)
Height Property (Page 431)
GridlinesY Property (Page 429)

292

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
GridlinesX Property (Page 429)
GridlinesValueY Property (Page 429)
GridlinesValueX Property (Page 428)
GraphDirection property (before WinCC V7) (Page 427)
FreezeProviderConnections Property (Page 426)
Font property (before WinCC V7) (Page 419)
FineGridY Property (Page 411)
FineGridX Property (Page 411)
FineGridValueY Property (Page 411)
FineGridValueX Property (Page 410)
EndY Property (Page 399)
EndX Property (Page 398)
Enabled Property (Page 395)
DesiredCurveVisible Property (Page 392)
DesiredCurveSourceUAColumnY Property (Page 392)
DesiredCurveSourceUAColumnX Property (Page 392)
DesiredCurveSourceUAArchiveStartID Property (Page 391)
DesiredCurveSourceNumberOfUAValues Property (Page 391)
DesiredCurveCurveForm Property (Page 390)
DesiredCurveColor Property (Page 390)
DeleteData Property (Page 389)
DataY Property (Page 387)
DataXY Property (Page 387)
DataX Property (Page 386)
DataIndex Property (Page 385)
CurveForm Property (Page 383)
CommonY Property (Page 379)
CommonX Property (Page 379)
Color Property (Page 363)
CoarseGridY Property (Page 361)
CoarseGridX Property (Page 361)
CoarseGridValueY Property (Page 362)
CoarseGridValueX Property (Page 362)
Closeable property (before WinCC V7) (Page 359)
Caption Property (Page 351)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

293

VBS for Creating Procedures and Actions


1.14 VBS Reference
BeginY Property (Page 333)
BeginX Property (Page 332)
BackColor Property (Page 323)
AutorangeY Property (Page 319)
AutorangeX Property (Page 319)
AllowPersistence Property (Page 312)
LocaleSpecificSettings Property (Page 470)
PrintBackgroundColor Property (Page 531)
PrintJob Property (Page 531)
RulerFont Property (Page 543)

WinCC Online Table Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Online Table
Control"

Type Identifier in VBS


HMITableView

Usage
In the following example, the object with the name "Control1" is moved 15 pixels to the right:

'VBS59
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +15

294

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
TimeOverlap Property (Page 607)
ItemVisible Property (Page 444)
PrintBackgroundColor Property (Page 531)
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 683)
Visible Property (Page 681)
Variable Property (Page 681)
ValueColumnAlignment Property (Page 673)
UpperLimitValue Property (Page 660)
UpperLimit Property (Page 659)
UpperLimitColor Property (Page 660)
Type Property (Page 652)
Top Property (Page 628)
ToolbarHotKeys Property (Page 625)
Toolbar Property (Page 615)
ToolbarButtons Property (Page 624)
ToolbarAlignment property (before WinCC V7) (Page 615)
Titleline Property (Page 613)
TimeZone Property (Page 611)
TimeRangeFactor Property (Page 608)
TimeRange Property (Page 608)
TimeRangeBase Property (Page 608)
TimeOverlapColor Property (Page 607)
TimeJump Property (Page 606)
TimeJumpColor Property (Page 606)
TimeFormat Property (Page 605)
TimeColumnAlignment Property (Page 597)
Statusbar Property (Page 575)
PrintJob Property (Page 531)
Precisions Property (Page 529)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

295

VBS for Creating Procedures and Actions


1.14 VBS Reference
PersistentRTPermission Property (Page 520)
PersistentRT Property (Page 519)
PersistentRTCSPermission Property (Page 520)
PersistentRTCS Property (Page 519)
Parent Property (Page 515)
Online property (before WinCC V7) (Page 503)
ObjectName Property (Page 499)
Object Property (Page 498)
NumItems Property (Page 498)
LowerLimitValue Property (Page 475)
LowerLimit Property (Page 473)
LowerLimitColor Property (Page 474)
LoadDataImmediately property (before WinCC V7) (Page 469)
Left Property (Page 464)
Layer Object (Page 136)
Index Property (Page 439)
Height Property (Page 431)
Font property (before WinCC V7) (Page 419)
EndTime Property (Page 398)
Enabled Property (Page 395)
Edit Property (Page 394)
Editable Property (Page 395)
CommonTime Property (Page 379)
Command Property (Page 378)
Color Property (Page 363)
Closeable property (before WinCC V7) (Page 359)
Caption Property (Page 351)
BeginTime Property (Page 332)
BackColor Property (Page 323)
Archive Property (Page 315)
AllowPersistence Property (Page 312)
Actualize Property (Page 307)
Activate property (before WinCC V7) (Page 304)
LocaleSpecificSettings Property (Page 470)

296

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

WinCC Online Trend Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Online Trend
Control"

Type Identifier in VBS


HMITrendView

Usage
In the following example, the object with the name "Control1" is moved 16 pixels to the right:

'VBS60
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +16

See also
Properties (Page 303)
TimeAxis Property (Page 589)
LowerLimitColor Property (Page 474)
Caption Property (Page 351)
Activate Method (Page 697)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 683)
Visible Property (Page 681)
UpperLimitValue Property (Page 660)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

297

VBS for Creating Procedures and Actions


1.14 VBS Reference
UpperLimit Property (Page 659)
UpperLimitColor Property (Page 660)
Type Property (Page 652)
Top Property (Page 628)
ToolbarHotKeys Property (Page 625)
Toolbar Property (Page 615)
ToolbarButtons Property (Page 624)
ToolbarAlignment property (before WinCC V7) (Page 615)
Titleline Property (Page 613)
TimeZone Property (Page 611)
TimeRangeFactor Property (Page 608)
TimeRange Property (Page 608)
TimeRangeBase Property (Page 608)
TimeOverlap Property (Page 607)
TimeOverlapColor Property (Page 607)
TimeJump Property (Page 606)
TimeJumpColor Property (Page 606)
TimeAxisFormat Property (Page 591)
TagName Property (Page 583)
Statusbar Property (Page 575)
ShowRulerImmediately Property (Page 562)
ServerData Property (Page 556)
RulerPrecisions Property (Page 543)
Replacement Property (Page 537)
ReplacementColor Property (Page 538)
RelayCurves Property (Page 537)
ProviderClsid Property (Page 532)
PrintJob Property (Page 531)
Precisions Property (Page 529)
PersistentRTPermission Property (Page 520)
PersistentRT Property (Page 519)
PersistentRTCSPermission Property (Page 520)
PersistentRTCS Property (Page 519)
Parent Property (Page 515)
Online property (before WinCC V7) (Page 503)

298

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ObjectName Property (Page 499)
Object Property (Page 498)
NumItems Property (Page 498)
MeasurePoints Property (Page 482)
LowerLimitValue Property (Page 475)
LowerLimit Property (Page 473)
LoadDataImmediately property (before WinCC V7) (Page 469)
Left Property (Page 464)
Layer Object (Page 136)
Label Property (Page 444)
ItemVisible Property (Page 444)
Index Property (Page 439)
Height Property (Page 431)
GridLineValue Property (Page 430)
GridLines Property (Page 428)
GraphDirection property (before WinCC V7) (Page 427)
Font property (before WinCC V7) (Page 419)
FineGridValue Property (Page 410)
FineGrid Property (Page 410)
EndValue Property (Page 398)
EndTime Property (Page 398)
Enabled Property (Page 395)
CurveForm Property (Page 383)
CommonY Property (Page 379)
CommonX Property (Page 379)
Command Property (Page 378)
Color Property (Page 363)
CoarseGridValue Property (Page 361)
CoarseGrid Property (Page 360)
Closeable property (before WinCC V7) (Page 359)
BeginValue Property (Page 332)
BeginTime Property (Page 332)
BackColor Property (Page 323)
Autorange Property (Page 318)
AllowPersistence Property (Page 312)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

299

VBS for Creating Procedures and Actions


1.14 VBS Reference
Actualize Property (Page 307)
Activate property (before WinCC V7) (Page 304)
AdjustRuler Property (Page 309)
LineWidth property (before WinCC V7) (Page 468)
ScalingType Property (Page 546)
UseRangeSubstitutes Property (Page 662)
XAxisColor property (before WinCC V7) (Page 687)
HideTagNames Property (Page 432)
LocaleSpecificSettings Property (Page 470)
PrintBackgroundColor Property (Page 531)
ItemProviderClsid Property (Page 443)
OneY Property (Page 502)
AllowXAxisColor - Property (Page 312)
AnchorRuler Property (Page 313)
SavedTrend Property (Page 545)
SelectedTrend Property (Page 553)
ShowSpanNames Property (Page 564)
DefaultPrecision Property (Page 388)
DefaultRulerPrecision Property (Page 388)
LowerLimitTagName Property (Page 474)
UpperLimitTagName Property (Page 660)
UseOnlineTags Property (Page 662)

1.14.3.7

Customized Object

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Customized Object".

300

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Type Identifier in VBS


HMIScreenModule

Usage
You access customized properties in a customized object via the attribute name in VBS.
Intellisense is only applicable to the customized object as a whole.
You will locate the attribute name under Properties of the properties placed outside (right-click
Property) and can be modified there.
In the following example, the object with the name "CustomizedObject1" is moved 10 pixels
to the right:

'VBS65
Dim objCustomObject
Set objCustomObject = ScreenItems("CustomizedObject1")
objCustomObject.Left = objCustomObject.Left + 10

See also
Activate Method (Page 697)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Parent Property (Page 515)
ObjectName Property (Page 499)
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
Enabled Property (Page 395)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

301

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.3.8

Group

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Group"

Type Identifier in VBS


HMIGroup

Usage
In the following example, the object with the name "Group1" is moved 10 pixels to the right:

'VBS66
Dim objGroup
Set objGroup = ScreenItems("Group1")
objGroup.Left = objGroup.Left + 10

See also
Properties (Page 303)
Activate Method (Page 697)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)
Width Property (Page 683)
Visible Property (Page 681)
Type Property (Page 652)
Top Property (Page 628)
ToolTipText Property (Page 627)
Parent Property (Page 515)
ObjectName Property (Page 499)

302

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Left Property (Page 464)
Layer Object (Page 136)
Height Property (Page 431)
Enabled Property (Page 395)

1.14.4

Properties

1.14.4.1

Properties

Overview
The properties of the individual objects can be used to modify specific graphic objects and
tags in Runtime , e.g. activating an operating element per mouse click or triggering a color
change by modifying a tag value.
Properties on graphic objects can be addressed via the following syntax:

'VBS191
Dim obj
Set obj = ScreenItems("object1")
obj.property = Value

In the following example, the object with the name "Control1" is moved 10 pixels to the right:

'VBS192
Dim obj
Set obj = ScreenItems("control1")
obj.Left = obj.Left + 10

1.14.4.2

Aa - Ad
AccessPath Property
Description
Displays the storage path (with hierarchy information) of a screen object (picture). The property
corresponds to the full access code on the Screens Collections.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

303

VBS for Creating Procedures and Actions


1.14 VBS Reference
STRING (read only)

Example:
In the following example, the path of the picture "ScreenWindow1" is issued:

'VBS67
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
MsgBox objScreen.AccessPath

See also
ScreenItem Object (Page 141)
Screens Object (List) (Page 149)

Activate property (before WinCC V7)


Description
The data to be displayed is only requested from the archive server when this attribute is set.
In order to reduce the picture opening times, this attribute should not be set and the value only
dynamically changed when necessary.
Write/Read access
To differentiate between the "Activate" property form the "Activate" method, the property is
accessed via "Object".

Example:

Dim ctrl
Set ctrl = ScreenItems("Control")
ctrl.Object.activate = true

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

304

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Activate property
Activate
The data to be displayed in the message window are only requested from the message server
if you set this attribute. Instead of setting this attribute, it is advisable to change the value
dynamically in order to reduce picture activation times.
The attribute can be assigned dynamic properties by means of the name Activate . The data
type is BOOLEAN.

ActiveProject Property
Description
Returns an object of type "Project".

See also
Path Property (Page 517)
Name Property (Page 496)
Ellipse segment (Page 162)
HMIRuntime Object (Page 134)

ActiveScreen Property
Description
Supplies a reference to the picture which contains the object with the current focus.

Usage
"ActiveScreen" is used in Runtime to address the properties of the picture which contains the
currently focussed object.

Example:
The following example assigns the name of the current picture to the tag "strScrName" and
outputs it in a message:

'VBS68
Dim strScrName
strScrName = HMIRuntime.ActiveScreen.Objectname
MsgBox strScrName

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

305

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Screen Object (Page 146)
HMIRuntime Object (Page 134)

ActiveScreenItem Property
Description
Supplies a reference to the object currently in focus.

Usage
"ActiveScreenItem" is used in Runtime in order to address the properties of the object currently
in focus.

Example:
The following example displays the name of the object in the "ScreenWindow1" picture which
has the focus:

'VBS69
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
MsgBox objScreen.ActiveScreenItem.ObjectName

See also
ScreenItem Object (Page 141)
HMIRuntime Object (Page 134)

Actualize Property
Description
The "Index" property references a column pair or a trend. "Actualize" defines whether a static
or dynamic representation should be used for this column pair/trend.
0: Static display
-1: Dynamic display

306

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

ActualPointLeft Property
Description
Defines or returns the x-coordinate of the current corner point in relation to the original picture
(top left). Each corner point is identified by an index which is derived from the number
("PointCount") of corner point available.
A change of the value can affect the properties "Width" (object width) and "Left" (x-coordinate
of the object position).

See also
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

ActualPointTop Property
Description
Defines or returns the y-coordinate of the current corner point in relation to the original picture
(top left). Each corner point is identified by an index which is derived from the number
("PointCount") of corner point available.
A change of the value can affect the properties "Height" (object height) and "Top" (y-coordinate
of the position).

See also
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

307

VBS for Creating Procedures and Actions


1.14 VBS Reference

AdaptBorder Property
Description
TRUE, when the border should be dynamically adjusted to the size of the text. BOOLEAN writeread access.
For text list and I/O field: Read only access.

See also
Button (Page 215)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
I/O Field (Page 199)
ScreenItem Object (Page 141)

AdaptPicture Property
Description
Defines whether the picture displayed in a picture window should be adapted to the size of the
picture window in Runtime or not. Read only access.
TRUE, when the picture adapts to the picture window size.
FALSE, when the picture does not adapt to the picture window size.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

AdaptSize Property
Description
Defines whether the picture window should adapt to the size of the picture displayed in it during
Runtime or not. Read only access.
TRUE, when the picture window adapts to the picture size.
FALSE, when the picture window does not adapt to the picture size.

308

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

AdjustRuler Property
Description
Specifies if the ruler window should be adjusted to the trend window upon each appearance.
TRUE, if you move the ruler window and make it appear and disappear again, it will be
displayed in its original position and its original size.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

Al - Ap
AlarmID property
Description
Returns the AlarmID of the Alarm object. The AlarmID is unique, and is assigned by the system.
AlarmID (readonly)

See also
Alarms object (list) (Page 126)

AlarmHigh Property
Description
Defines the top limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmHigh" property.
The "CheckAlarmHigh" property determines whether the monitoring for this limit value is
activated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

309

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

AlarmLogs Property
Description
Returns an object of type "AlarmLogs".
AlarmLogs (read-only)

See also
HMIRuntime Object (Page 134)

AlarmLow Property
Description
Defines the bottom limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmLow" property.
The "CheckAlarmLow" property determines whether the monitoring for this limit value is
activated.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Alignment Property
Description
Defines or returns the representation of the scale (left/right or top/bottom) according to the
position of the bar graph object. The "Scaling" property must be set to TRUE for the scale to
be displayed.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

310

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

AlignmentLeft Property
Description
Defines or returns the horizontal alignment of the text. Value range from 0 to 2.
0 = left
1 = centered
2 = right

See also
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

AlignmentTop Property
Description
Defines or returns the vertical alignment of the text. Value range from 0 to 2.
0 = top
1 = centered
2 = bottom

See also
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

311

VBS for Creating Procedures and Actions


1.14 VBS Reference

AllowPersistence Property
Description
TRUE, when settings regarding persistence are possible. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

AllowXAxisColor - Property
Description
TRUE if the defined color of the common X-axis is displayed in runtime. BOOLEAN write-read
access.

AllServer property (before WinCC V7)


Description
Defines that the data to be displayed in the message window is required by all servers
participating in a distributed system on which Alarm Logging is activated. Write/Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

AllServer property
All servers - AllServer
Selects all servers whose packages were loaded and on which "Alarm Logging Runtime" is
activated in the startup list.
Value

Explanation

TRUE

All servers are activated.

FALSE

Activates only the servers entered in "Server selection".

312

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name AllServer. The data
type is BOOLEAN.

Analog Property
Description
TRUE, when the clock is to be displayed as an analog clock. BOOLEAN write-read access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

AnchorRuler Property
Description
TRUE if the ruler window is firmly linked to the curve window. BOOLEAN write-read access.

AngleAlpha Property
Description
Defines or returns depth angle a for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

AngleBeta Property
Description
Defines or returns depth angle b for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

313

VBS for Creating Procedures and Actions


1.14 VBS Reference

AngleMax Property
Description
Defines or returns the angle on the scale at which the scale graduation ends. LONG write-read
access.
The start and end of the scale graduation are described by the attributes "AngleMin" and
"AngleMax" in angular degrees. AngleMin < AngleMax applies.
Angle 0 degrees is at the right side of the horizontal diameter of the graduated scale disk.
Positive angle values are counted in a counterclockwise direction.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

AngleMin Property
Description
Defines or returns the angle on the scale at which the scale graduation begins. LONG writeread access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

Application Property
Description
Returns the Graphics Designer application when the application property is used without an
object identifier. If the application property is used with object identifier, it returns an application
object which displays the application with which the defined object was created. Read only
access.

See also
Application Window (Page 188)
ScreenItem Object (Page 141)

314

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ApplyProjectSettings property
Apply project settings - ApplyProjectSettings
Activates the project settings derived from "Alarm Logging".
Value

Explanation

TRUE

The "Apply project settings" check box is selected. The message blocks configured in "Alarm Logging"
and their properties are activated in AlarmControl. The message blocks are displayed with these
properties in the message window.

FALSE

The "Apply project settings" check box is deactivated. You can add or remove message blocks, or edit
their properties.

The attribute can be assigned dynamic properties by means of the name


ApplyProjectSettings. The data type is BOOLEAN.

Ar - Ax
Archive Property
Description
The "Index" property references a pair of columns. "Archive" defines process archive values
linked to the column pair. The name of the process value archive is specified in the following
form: Server name::Archive name

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

ArchiveName property
Name - ArchiveName
Specifies the user archive or view to be displayed. Open the "Package Browser" dialog for
configuring an archive or a view by clicking the button.
The attribute can be assigned dynamic properties by means of the name ArchiveName. The
data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

315

VBS for Creating Procedures and Actions


1.14 VBS Reference

ArchiveType property
Type - ArchiveType
Specifies whether the selected user archive is an archive or a view. The field cannot be edited.
The attribute can be assigned dynamic properties by means of the name ArchiveType. The
data type is LONG.

AspectRatio property
AspectRatio
Specifies if the aspect ratio is kept in movies.
The attribute can be assigned dynamic properties by means of the name AspectRatio. The
data type is BOOLEAN.

Assignments Property
Description
A list which contains the assignments between the output values and the actual output texts
to be output.
The assignments depend on the set list type. The list type is defined with the ListType property.
Read only access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

AssumeOnExit Property
Description
TRUE, if the entered text is assumed upon exiting the entry field (e.g., with the key or mouse
click). BOOLEAN write-read access.

See also
I/O Field (Page 199)
Text list (Page 211)
ScreenItem Object (Page 141)

316

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

AssumeOnFull Property
Description
TRUE, when the content of the input field is full (specified number of characters have been
entered) and should be exited automatically and the input accepted. BOOLEAN write-read
access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

AutoCompleteColumns property
Show empty columns - AutoCompleteColumns
Adds empty columns if the Control width is greater than the width of columns configured.
Value

Explanation

TRUE

Enables the display of empty columns.

FALSE

Disables the display of empty columns.

The attribute can be assigned dynamic properties by means of the name


AutoCompleteColumns. The data type is BOOLEAN.

AutoCompleteRows property
Show empty rows - AutoCompleteRows
Enables the insertion of empty rows if the Control length is greater than the number of rows
configured.
Value

Explanation

TRUE

Enables the display of empty rows.

FALSE

Disables the display of empty rows.

The attribute can be assigned dynamic properties by means of the name


AutoCompleteRows. The data type is BOOLEAN.

AutoPosition property
Automatic positioning - AutoPosition
Defines whether to position the RulerControl exactly below the source control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

317

VBS for Creating Procedures and Actions


1.14 VBS Reference
The following settings are available:
Value

Explanation

TRUE

The RulerControl is positioned exactly below the source control.

FALSE

The RulerControl is displayed in accordance with your configuration of the control position.

The attribute can be assigned dynamic properties by means of the name AutoPosition. The
data type is BOOLEAN.

Autorange Property
Description
TRUE, when the value range of the Y-axis is determined automatically or defined by using the
"BeginValue" and "EndValue"attributes. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

AutorangeX Property
Description
TRUE, when the value range of the X-axis is determined automatically. FALSE, when it is
determined by means of the "BeginX" and "EndX" attributes. BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

AutorangeY Property
Description
TRUE, when the value range of the Y-axis is determined automatically. FALSE, when it is
determined by means of the "BeginY" and "EndY" attributes. BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

318

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

AutoScroll property (before WinCC V7)


Description
Defines the behavior of the message window when a new message is received. BOOLEAN
write-read access.
TRUE : A newly received message is appended to the list displayed in the message window
and is automatically selected. The visible range of the message window is moved, if necessary.
FALSE : A newly received message is not selected. The visible range of the message window
is not changed.
The targeted selection of messages is only possible when "AutoScroll" is not active.
The "AutoScroll" property is deactivated when the attribute "MsgCtrlFlag" = "-1" is set. This
means that the most recent message is displayed at the top of the list in the message window.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

AutoScroll Property
Auto scrolling - AutoScroll
Defines the behavior of the message window after a new message events.
You can only select message lines if "Auto scrolling" is disabled.
Value

Explanation

TRUE

If "AutoScroll" is activated, a new activated message is appended to the list displayed in the
message window and selected automatically. The visible area of the message window is
shifted as required.

FALSE

New message events are not selected if "Autoscroll" is disabled. The visible area of the
message window is not changed.

The attribute can be assigned dynamic properties by means of the name AutoScroll. The data
type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

319

VBS for Creating Procedures and Actions


1.14 VBS Reference

AutoSelectionColors property
Automatic selection coloring - AutoSelectionColor
Enables the display of default system colors as selection color for cells and rows.
Value

Explanation

TRUE

The system colors are in use.

FALSE

The custom colors are used.

The attribute can be assigned dynamic properties by means of the name


AutoSelectionColors. The data type is BOOLEAN.

AutoSelectionRectColor property
Automatic color assignment - AutoSelectionRectColor
Defines a system color for the selection border.
Value

Explanation

TRUE

The system color is in use.

FALSE

The custom color is used.

The attribute can be assigned dynamic properties by means of the name


AutoSelectionRectColors. The data type is BOOLEAN.

AutoShow property
Show/hide automatically - AutoShow
Enables/disables automatic activation of the RulerControl on the display if you selected the
button functions for the ruler, statistics range and for statistics in the source control.
The RulerControl is hidden again if you are no longer using the ruler, statistics range and
statistics functions.
Value

Explanation

TRUE

The RulerControl is displayed automatically.

FALSE

The RulerControl is not displayed automatically.

The attribute can be assigned dynamic properties by means of the name AutoShow. The data
type is BOOLEAN.

320

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

AutoSize Property
Description
Defines or returns the size adaptation of the object. The following values can be set:
0: No size adaptation.
1: The picture ("PictureSelected", "PictureUnselected" properties) is adapted to the button.
2: The button is adapted to the picture ("PictureSelected", "PictureUnselected" properties).

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

Autostart property
Autostart
Specifies if movies are started automatically.
The attribute can be assigned dynamic properties by means of the name Autostart. The data
type is BOOLEAN.

Average Property
Average
TRUE, if the mean value is calculated based on the last 10 values. A value change is
conditional for calculation of a new mean value. The mean value is reset when you change a
picture. If only one value is available when you change the picture, the following mean value
is calculated: (5+0+0+0+0+0+0+0+0+0)/10=0,5.
BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Axe Property
Description
Defines or returns the position of the 3D bar in the coordinate system. Value range from 0 to
2.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

321

VBS for Creating Procedures and Actions


1.14 VBS Reference
0: The 3D-bar is displayed on the X-axis.
1: The 3D-bar is displayed on the Y-axis.
2: The 3D-bar is displayed on the Z-axis.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

AxisSection Property
Description
Defines or returns the distance between two long axis sections. The information on the distance
is given in scale units and is dependent on the minimum and maximum values configured.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1.14.4.3

Ba
BackBorderWidth Property
Description
Defines or returns the width of the 3D border in pixels. The value for the width is dependent
on the size of the object.

See also
ScreenItem Object (Page 141)
Button (Page 215)
Round Button (Page 223)
Slider (Page 226)
Group Display (Page 208)

322

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

BackColor property
Background - BackColor
Specifies the background color of the control. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name BackColor. The data
type is LONG.

BackColor property
Background Color (BackColor)
Specifies the icon background color in the "Color selection" dialog. The background color is
displayed in "opaque" style.
The attribute can be assigned dynamic properties by means of the name BackColor. The data
type is LONG.

BackColor Property
Function
Defines or returns the background color for the object.
For objects with a fill pattern, the background color is not displayed if "transparent" is defined
as the fill style.
Special features of the WinCC slider control
The background color only takes effect when the object is at least partially filled.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Enter the appropriate decimal value
for each of the three RGB values.
Example:
RGB(200, 150, 100)

Example:
The following example defines the background of the "ScreenWindow1" picture to red:

'VBS70
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.BackColor = RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

323

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
FillStyle Property (Page 408)
FillColor Property (Page 406)
ScreenItem Object (Page 141)

BackColor2 Property
Description
Defines or returns the bar color for the display of the current value. LONG write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

BackColor3 Property
Description
Defines or returns the color of the bar background. LONG write-read access.

See also
ScreenItem Object (Page 141)
Bar (Page 189)

BackColorBottom Property
Description
Defines or returns the color for the bottom/right part of the slider. LONG write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

324

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

BackColorTop Property
Description
Defines or returns the color for the top/left part of the slider. LONG write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

BackFlashColorOff Property
Description
Defines or returns the color of the object background for the flash status "Off". LONG writeread access.

See also
ScreenItem Object (Page 141)

BackFlashColorOn Property
Description
Defines or returns the color of the object background for the flash status "On". LONG writeread access.

See also
ScreenItem Object (Page 141)

Background Property
Description
TRUE, when the background of the 3D-bar graph object should be visible. BOOLEAN writeread access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

325

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BackgroundPicture Property
Description
Returns the picture name of the background picture for the graduated scale disk. Read only
access

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BackPictureAlignment property
Description
Defines or returns the mode of representation of the background image in the process picture.
LONG write-read access.

BackPictureName property
Description
Defines the path and file name of the background image in the process picture or returns it.
LONG write-read access.

BackStyle Property
Description
WinCC Digital/Analog Clock
Defines the type of background of the analog clock:
0: The rectangular background of the clock is filled by the specified background color.
1: The round numbered face of the clock is filled by the specified background color. This
enables a round analog clock to be displayed.

326

2: Numbered face and rectangular background are transparent.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
WinCC Gauge Control
Defines the type of background of the gauge:
0: The rectangular or square background of the gauge has a border color is filled with the
specified color. The circular graduated scale disk is filled by the specified background color.
1: The rectangular or square background of the gauge is transparent. The circular
graduated scale disk is filled by the specified background color. This enables a circular
gauge to be displayed.
2: The rectangular or square background and graduated scale disk are transparent.
WinCC Slider Control
Defines whether the object background should be transparent.
0: The object background is not transparent
1: The object background is transparent
HMI Symbol Library
Defines the icon background transparency. Write/Read access.
0: The background is transparent and, thus, invisible.
1: The background is visible, the color of the background is defined by the "Background
Color" attribute.

See also
HMI Symbol Library (Page 253)
WinCC Slider Control (Page 281)
WinCC Gauge Control (Page 264)
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

BarBackColor Property
Description
Defines the background color in the area of the slider. The area stretches form "RangeMin" to
"RangeMax".

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

327

VBS for Creating Procedures and Actions


1.14 VBS Reference

BarDepth Property
Description
Defines or returns the depth of the bar in pixels.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BarFillColor Property
Description
Defines the fill color in the area of the slider. The area stretches from "RangeMin" to the position
of the slider.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

BarHeight Property
Description
Defines or returns the height of the bar in pixels.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BarWidth Property
Description
Defines or returns the width of the bar in pixels.

328

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BasePicReferenced Property
Description
TRUE, when the picture assigned in the object status display should be saved. Otherwise,
only the associated object reference is saved. Read only access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

BasePicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "BasePicUseTransColor" property is
"True".

See also
Status display (Page 213)
ScreenItem Object (Page 141)

BasePicture Property
Description
Returns the basic picture for the object status display. Read-only access.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.
In this context, the "BasePicReferenced" property defines whether the basic picture should be
saved together with the object status display or referenced.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

329

VBS for Creating Procedures and Actions


1.14 VBS Reference

BasePicUseTransColor Property
Description
TRUE, when the configured color ("BasePicTransColor" property) of the bitmap objects should
be set to "transparent". BOOLEAN write-read access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

BaseScreenName Property
Function
Defines or returns the current basic picture.
STRING (write-read access)
A picture change is executed using the

HMIRuntime.BaseScreenName = (<Serverprfix>::)<Neues Grundbild>

command.
When reading out the "BaseScreenName" property, only the picture name without server prefix
is returned.
Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

Example:
The following example executes a picture change to "bild1.pdl":

HMIRuntime.BaseScreenName = "bild1"

See also
ScreenItem Object (Page 141)
HMIRuntime Object (Page 134)

330

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

BaseY Property
Description
Defines or returns the vertical distance of the bottom bar edge to the top edge of the objet field.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BaseX Property
Description
Defines or returns the horizontal distance of the right bar edge to the left edge of the object
field in pixels.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Be - Bl
BeginTime Property
Description
WinCC Online Trend Control
The "Index" property references a pair of columns. "BeginTime" defines the start time for
displaying this column pair. Write/Read access.
WinCC Online Trend Control
The "Index" property references a trend. "BeginTime" defines the start time for displaying this
trend. Whether the information is evaluated is dependent on the TimeRange" and "CommonX"
properties.
Use the "yyyy-mm-dd hh:mm:ss" format when creating a dynamic time range.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

331

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

BeginValue Property
Description
The "Index" property references a trend. "BeginValue" defines the lower limit of the value range
to be displayed for the trend. Whether the information is evaluated is dependent on the
"Autorange" and "CommonY" properties.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

BeginX Property
Description
Defines or returns the lower limit of the X-axis of a trend referenced with the "Index" property.
Whether the information is evaluated is dependent on the "AutorangeX" and "CommonX"
properties.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

BeginY Property
Description
Defines or returns the lower limit of the Y-axis of a trend referenced with the "Index" property.
Whether the information is evaluated is dependent on the "AutorangeY" and "CommonY"
properties.

See also
ScreenItem Object (Page 141)
WinCC Function Trend Control (before WinCC V7) (Page 290)

332

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

BevelColorDown Property
Description
Defines the color of the following border sections in the case of 3D representation of the
borders:
with depressed bevel ("BevelStyle" = 1): top and left bevel section
with raised bevel ("BevelStyle" = 2): bottom and right bevel section

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

BevelColorUp Property
Description
Defines the color of the following border sections in the case of 3D representation of the
borders:
with depressed bevel ("BevelStyle" = 1): bottom and right bevel section
with raised bevel ("BevelStyle" = 2): top and left bevel section

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

BevelInner Property
Description
Defines or returns the appearance of the inner part of the object bevel. Write/Read access.
0: inner part not available
1: "depressed" appearance
2: "raised" appearance
3: uniform gray border
4 or higher: uniformly colored order, border color = background color

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

333

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BevelOuter Property
Description
Defines or returns the appearance of the outer part of the object bevel. Write/Read access.
0: inner part not available
1: "depressed" appearance
2: "raised" appearance
3: uniform gray border
4 or higher: uniformly colored order, border color = background color

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BevelWidth Property
Description
Defines or returns the border width for the inner part of the border (inner bevel) and for the
outer border part (outer bevel) in pixels. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BitNumber Property
Description
Defines or returns the bit whose status must change in order to trigger a change of value. The
tag used must be of the type BYTE, WORD or DWORD.

334

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Text list (Page 211)
ScreenItem Object (Page 141)

BlinkColor Property
Description
Defines the color of the icon in the flash picture. LONG write-read access.

See also
HMI Symbol Library (Page 253)
ScreenItem Object (Page 141)

BlinkMode property
Flash mode (BlinkMode)
Specifies the flash mode of the icon in runtime.
The following settings are available:
Value

Description

Comments

No flashing

The icon does not flash.

Hidden

The icon flashes in the background color.

Shadow

The icon flashes with shading in the foreground color.

Solid

The icon flashes in the foreground color.

The attribute can be assigned dynamic properties by means of the name BlinkMode. The data
type is LONG.

BlinkSpeed property
Flash rate (BlinkSpeed)
Specifies the length of the icon flash interval in Runtime.
The following settings are available:
Value

Description

Comments

250

Fast

Flash interval of 250 ms.

500

Medium

Flash interval of 500 ms.

1000

Slow

Flash interval of 1000 ms.

The attribute can be assigned dynamic properties by means of the name BlinkSpeed. You can
also use other values. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

335

VBS for Creating Procedures and Actions


1.14 VBS Reference

BlockAlign property
Block alignment - BlockAlign
Defines the mode of aligning the caption of blocks in column headers.
The following settings are available:
Value

Description

Explanation

left

The block caption is left justified.

centered

The block caption is aligned to center.

right

The block caption is right justified.

The attribute can be assigned dynamic properties by means of the name BlockAlign. The data
type is LONG.

BlockAutoPrecisions property
Decimal places automatic - BlockAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" field is disabled.

FALSE

The value in the "Decimal places" field is enabled.

The attribute can be assigned dynamic properties by means of the name


BlockAutoPrecisions. The data type is BOOLEAN.

BlockCaption property
Caption - BlockCaption
Defines the caption of the column header in the control for the selected message block.
The caption is active in all Runtime languages.
The attribute can be assigned dynamic properties by means of the name BlockCaption. The
data type is STRING.

BlockCount property
BlockCount
Specifies the number of blocks to be made available as columns for the control.
The attribute can be assigned dynamic properties by means of the name BlockCount. The
data type is LONG.

336

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

BlockDateFormat property
Date format - BlockDateFormat
Defines the date format for visualization.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name BlockDateFormat.
The data type is STRING.

BlockExponentialFormat property
Exponential notation - BlockExponentialFormat
Specifies exponential notation for the display of values of a selected block.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


BlockExponentialFormat. The data type is BOOLEAN.

BlockHideText property
Content as text - BlockHideText
Enables the textual display of the content of a selected block.
Value

Explanation

TRUE

The content is not displayed in text format. The option is disabled.

FALSE

The content is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name BlockHideText. The
data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

337

VBS for Creating Procedures and Actions


1.14 VBS Reference

BlockHideTitleText property
Title as text - BlockHideTitleText
Enables the display of the header of a selected block in text format.
Value

Explanation

TRUE

The header is not displayed in text format. The option is disabled.

FALSE

The header is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name BlockHideTitleText.
The data type is BOOLEAN.

BlockId property
BlockId
Default assignment of the ID number and of the block in WinCC RulerControl:

338

Value

Description

No block

Name

Index

Designation

Display

Tag name Y

Tag name X

Y value

X value/time stamp

Y value (LL)

10

Time stamp (LL)

11

Y value (UL)

12

Time stamp (UL)

13

Minimum

14

Minimum - Time stamp

15

Maximum

16

Maximum - Time stamp

17

Average

18

Standard deviation

19

Integral

20

Weighted mean value

21

Duration

22

Number of values

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name BlockID. The data
type is LONG.

BlockIndex property
BlockIndex
References a block. Using this attribute you can assign the values of other attributes to a
specific block.
Values between 0 and "BlockCount" minus 1 are valid for "BlockIndex". Attribute "BlockCount"
defines the number of available blocks.
The attribute can be assigned dynamic properties by means of the name BlockIndex. The data
type is LONG.

BlockLength property
Length in characters - BlockLength
Specifies the column width for a selected block.
The attribute can be assigned dynamic properties by means of the name BlockLength. The
data type is LONG.

BlockName property
Object name - BlockName
Displays the name of the block selected. You cannot edit this name.
The attribute can be assigned dynamic properties by means of the name BlockName. The
data type is STRING.

BlockPrecisions property
Decimal places - BlockPrecisions
Specifies the number of decimal places of the values in the selected column. You can only
enter the value if the "Automatic" option is disabled.
The attribute can be assigned dynamic properties by means of the name BlockPrecisions. The
data type is SHORT.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

339

VBS for Creating Procedures and Actions


1.14 VBS Reference

BlockShowDate property
Display date - BlockShowDate
Specifies if the "Time" block is displayed with time and date in a field.
Value

Explanation

TRUE

The date and time are displayed. The date format is defined in the "Date format" field.

FALSE

The time is displayed.

The attribute can be assigned dynamic properties by means of the name BlockShowDate. The
data type is BOOLEAN.

BlockShowIcon property
Content as icon - BlockShowIcon
Enables the display of the content of a selected block as icon. This function is only available
in WinCC Alarm Control.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name BlockShowIcon. The
data type is BOOLEAN.

BlockShowTitleIcon property
Title as icon - BlockShowTitleIcon
Enables the display of the header of a selected block as icon. This function is only available
in WinCC Alarm Control.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name BlockShowTitleIcon.
The data type is BOOLEAN.

BlockTimeFormat property
Time format - BlockTimeFormat
Defines the time format to be used for visualization.
The following time formats are available:

340

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name BlockTimeFormat.
The data type is STRING.

BlockUseSourceFormat property
Use source format - BlockUseSourceFormat
Specifies that the format is inherited from the interconnected control. Here the size of the
control, the zoom factor and the value range are taken into consideration to display the optimal
number of decimal places.
Value

Explanation

TRUE

The formats are derived from the interconnected control.

FALSE

The formats configured in Ruler Control are used, for example, the display of a precisely specified number of
decimal places.

The attribute can be assigned dynamic properties by means of the name


BlockUseSouceFormat. The data type is BOOLEAN.

Bo - Bu
BorderBackColor Property
Description
Defines or returns the background color of the line for the object. LONG write-read access.
The background color is only visible with the property setting "BorderWidth" > 0.

See also
ScreenItem Object (Page 141)

BorderColor Property
Description
Defines or returns the line color for the object. LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

341

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ScreenItem Object (Page 141)

BorderColor property
Border color - BorderColor
Specifies the border color. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name BorderColor. The
data type is LONG.

BorderColorBottom Property
Description
Defines or returns the border color for the bottom/right part of the object. LONG write-read
access.

See also
ScreenItem Object (Page 141)
Button (Page 215)
Round Button (Page 223)

BorderColorTop Property
Description
Defines or returns the border color for the top/left part of the object. LONG write-read access.

See also
Button (Page 215)
Round Button (Page 223)
ScreenItem Object (Page 141)

BorderEndStyle Property
Description
Defines or returns the line end style of the object. LONG write-read access.

342

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Polyline (Page 173)
Line (Page 169)
ScreenItem Object (Page 141)

BorderFlashColorOff Property
Description
Defines or returns the color of the object lines for the flashing status "Off". LONG write-read
access.

See also
ScreenItem Object (Page 141)

BorderFlashColorOn Property
Description
Defines or returns the color of the object lines for the flashing status "On". LONG write-read
access.

See also
ScreenItem Object (Page 141)

BorderStyle Property
Description
Defines or returns the line style for the object. Value range from 0 to 4.
0 = solid line
1 = dashed line
2 = dotted line
3 = dash-dotted line
4 = dash-dot-dot line

See also
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

343

VBS for Creating Procedures and Actions


1.14 VBS Reference

BorderWidth Property
Description
Defines or returns the line weight (in pixels) for the object.
WinCC Gauge Control:
Defines or returns the width of the middle border part in pixels.
The object border is composed of three parts. The middle part of the object border is described
by the "BorderWidth" property.
The color of the middle border part is in the background color.

See also
ScreenItem Object (Page 141)

BorderWidth property
Border width - BorderWidth
Specifies the line weight of the border in pixels.
The attribute can be assigned dynamic properties by means of the name BorderWidth. The
data type is LONG.

BottomConnectedConnectionPointIndex Property
Description
Specifies or sets the index number of the bottom connecting point.
LONG write-read access.

See also
Connector (Page 182)
ScreenItem Object (Page 141)

BottomConnectedObjectName Property
Description
Specifies or sets the object name of the object which is docked on at the bottom connecting
point.
LONG write-read access.

344

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Connector (Page 182)
ScreenItem Object (Page 141)

BoxAlignment Property
Description
TRUE, when the fields are arranged aligned to the right. BOOLEAN write-read access.

See also
Radio box (Page 221)
Check box (Page 219)
ScreenItem Object (Page 141)

BoxCount Property
Description
Defines or returns the number of fields. Value range from 0 to 31.

See also
Radio box (Page 221)
Check box (Page 219)
ScreenItem Object (Page 141)

BoxType Property
Description
Defines or returns the field type. Value range from 0 to 2:
0: Edition
1: Input
2: I/O field

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

345

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

ButtonColor Property
Description
Defines or returns the color of the slider. LONG write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ButtonCommand Property
Description
Upon changing a value of "ButtonCommand", a message is issued to the WinCC Alarm Control
in order to adapt the display in the message window.
Value (hex); value (dec); Retrieved Function:
0x00000001; 1; Message list
0x00000002; 2; Short-term archive list
0x00000004; 4; Long-term archive list
0x00200000; 2097152; Lock list
0x00000008; 8; Acknowledge central signaling device
0x00000010; 16; Single Acknowledgment
0x00000020; 32; Group Acknowledge
0x00000040; 64; Autoscroll
0x00000080; 128; Selection Dialog
0x00000100; 256; Lock Dialog
0x00000200; 512; Print Message Log
0x00000800; 2048; Emergency Acknowledgment
0x00001000; 4096; First Message
0x00002000; 8192; Last Message
0x00004000; 16384; Next Message

346

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
0x00008000; 32768; Previous Message
0x00010000; 65536; Infotext Dialog
0x00020000; 131072; Comments Dialog
0x00040000; 262144; Loop in Alarm
0x00100000; 1048576; Print current view
0x00400000; 4194304; Lock/unlock message
0x00800000; 8388608; Sorting Dialog
0x01000000; 16777216; Time base dialog
0x02000000; 33554432; Hit list
0x04000000; 67108864; List of messages to be hidden
0x08000000; 134217728; Show/hide message
0x10000000; 268435456; Display option dialog

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Button1MessageClasses property
Message Types for Button 1 (Button1MessageClasses)
Define one or more message events for displaying the first button in the group display. This is
done by entering the numbers of the bits in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
One event can be displayed simultaneously in more than one button.
The "Message Types for Button 1" attribute can be assigned dynamic properties with the name
"Button1MessageClasses".

Button2MessageClasses property
Message Types for Button 2 (Button2MessageClasses)
For displaying both buttons, define one or more message events in the group display. This is
done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

347

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "Message Types for Button 2" attribute can be assigned dynamic properties with the name
"Button2MessageClasses".

Button3MessageClasses property
Message Types for Button 3 (Button3MessageClasses)
For displaying the third button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 3" attribute can be assigned dynamic properties with the name
"Button3MessageClasses".

Button4MessageClasses property
Message Types for Button 4 (Button4MessageClasses)
For displaying the fourth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 4" attribute can be assigned dynamic properties with the name
"Button4MessageClasses".

Button5MessageClasses property
Message Types for Button 5 (Button5MessageClasses)
For displaying the fifth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 5" attribute can be assigned dynamic properties with the name
"Button5MessageClasses".

348

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Button6MessageClasses property
Message Types for Button 6 (Button6MessageClasses)
For displaying the sixth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there are more than one selected event for one button,
the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 6" attribute can be assigned dynamic properties with the name
"Button6MessageClasses".

Button7MessageClasses property
Message Types for Button 7 (Button7MessageClasses)
For displaying the seventh button, define one or more message events in the group display.
This is done by entering the number of the bit in the collect value. The display of the message
events is configured in the "Message Types" property group.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there are more than one selected event for one button,
the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 7" attribute can be assigned dynamic properties with the name
"Button7MessageClasses".

Button8MessageClasses property
Message Types for Button 8 (Button8MessageClasses)
For displaying the eighth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there are more than one selected event for one button,
the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 8" attribute can be assigned dynamic properties with the name
"Button8MessageClasses".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

349

VBS for Creating Procedures and Actions


1.14 VBS Reference

Button1Width Property
Description
Defines or returns the width of the Button 1 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Button2Width Property
Description
Defines or returns the width of the Button 2 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Button3Width Property
Description
Defines or returns the width of the Button 3 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

See also
ScreenItem Object (Page 141)
Group Display (Page 208)

Button4Width Property
Description
Defines or returns the width of the Button 4 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

350

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

1.14.4.4

Ca - Cl
Caption Property
Description
Application and picture windows
TRUE, when the application or picture window has a title bar in Runtime. Read only access.
The Caption property must be set to TRUE when the application or picture window should
have Maximize and Close buttons.
Controls before WinCC V7
Defines or returns the text to be displayed on the label on the button or in the title bar (Online
Trend Control and Online Table Control). Write/Read access.

See also
Controls (Page 232)
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

Caption property
Text - Caption
Defines the text of the window caption.
The attribute can be assigned dynamic properties by means of the name Caption. The data
type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

351

VBS for Creating Procedures and Actions


1.14 VBS Reference

CaptionColor Property
Description
Defines or returns the color of the element labeling. LONG write-read access.

See also
ScreenItem Object (Page 141)
WinCC Gauge Control (Page 264)

CaptionFont Property
Description
Returns the values for font, font style and font size as well as the "Underline" and
"Strikethrough" effects for the element labeling. Read only access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

CaptionOffset Property
Description
Defines or returns the distance of the element labeling in relation to the top edge of the object.
The element labeling can only be positioned along the vertical diameter of the graduated scale
disk. The value of the attribute is related to the height of the object and is measured from the
top edge of the object to the base of the text. Write/Read access.
The value range is 0 to 1:
0: The base of the text is at the top limit of the object. The text is no longer visible because it
is outside the object.
1: The base of the text is at the bottom limit of the object.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

352

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

CaptionText Property
Description
Defines or returns the window title which is displayed in Runtime.
The Caption property must be set to TRUE.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

CellCut property (before WinCC V7)


Description
TRUE, when the content of the cells in a message line should be cut if the column width is too
small. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

CellCut property
Shorten contents - CellCut
Shortens cell contents if the cell width is insufficient.
Value

Explanation

TRUE

Enables shortening of cell contents.

FALSE

Disables shortening of cell contents.

The attribute can be assigned dynamic properties by means of the name CellCut. The data
type is BOOLEAN.

CellSpaceBottom property
CellSpaceBottom
Defines the bottom margin of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceBottom.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

353

VBS for Creating Procedures and Actions


1.14 VBS Reference

CellSpaceLeft property
CellSpaceLeft
Defines the left indent of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceLeft . The
data type is LONG.

CellSpaceRight property
CellSpaceRight
Defines the right indent of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceRight . The
data type is LONG.

CellSpaceTop property
CellSpaceTop
Defines the top margin of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceTop . The
data type is LONG.

CenterColor Property
Description
Defines or returns the color of the circular center of the scale (cover of the pointer axis). LONG
write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

CenterScale Property
Description
Defines or returns the diameter of the circular center of the scale (cover of the pointer axis) in
relation to the smaller value of the geometric width and height attributes. Write/Read access.
The value range is 0.03 to 1:

354

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
1: The diameter corresponds to the smaller value of the "Width" or "Height" geometric values.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

CheckAlarmHigh Property
Description
TRUE, when the "AlarmHigh" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "AlarmHigh", "ColorAlarmHigh" and "TypeAlarmHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckAlarmLow Property
Description
TRUE, when the "AlarmLow" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "AlarmLow", "ColorAlarmLow" and "TypeAlarmLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitHigh4 Property
Description
TRUE, when the "Reserve 4" upper limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitHigh4", "ColorLimitHigh4" and "TypeLimitHigh4" properties.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

355

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitHigh5 Property
Description
TRUE, when the "Reserve 5" upper limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitHigh5", "ColorLimitHigh5" and "TypeLimitHigh5" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitLow4 Property
Description
TRUE, when the "Reserve 4" lower limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitLow4", "ColorLimitLow4" and "TypeLimitLow4" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitLow5 Property
Description
TRUE, when the "Reserve 5" lower limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitLow5", "ColorLimitLow5" and "TypeLimitLow5" properties.

356

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckToleranceHigh Property
Description
TRUE, when the "ToleranceHigh" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "ToleranceHigh", "ColorToleranceHigh" and "TypeToleranceHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckToleranceLow Property
Description
TRUE, when the "ToleranceLow" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "ToleranceLow", "ColorToleranceLow" and "TypeToleranceLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckWarningHigh Property
Description
TRUE, when the "WarningHigh" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "WarningHigh", "ColorWarningHigh" and "TypeWarningHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

357

VBS for Creating Procedures and Actions


1.14 VBS Reference

CheckWarningLow Property
Description
TRUE, when the "WarningLow" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "WarningLow", "ColorWarningLow" and "TypeWarningLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ClearOnError Property
Description
TRUE, when the field entry is automatically deleted in the case of invalid input. BOOLEAN
write-read access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

ClearOnNew Property
Description
TRUE, when the field entry is deleted as soon as the I/O field has the focus. BOOLEAN writeread access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

Closeable property (before WinCC V7)


Description
TRUE, when the window can be closed in Runtime. BOOLEAN write-read access.

358

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

Closeable property
Closeable
Defines whether the control can be closed in Runtime.
Value

Explanation

TRUE

The control can be closed in Runtime.

FALSE

The control cannot be closed in Runtime.

The attribute can be assigned dynamic properties by means of the name Closeable. The data
type is BOOLEAN.

CloseButton Property
Description
TRUE, when the window is provided with a "Close" button. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

Co
CoarseGrid Property
Description
TRUE when the value axis is scaled by long tick marks. The distance between two long tick
marks can be changed using the "CoarseGridValue" property. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

359

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

CoarseGridX Property
Description
TRUE, when the X-axis graduation is scaled by long tick marks. The distance between two
long tick marks can be changed using the "CoarseGridValueX" property. BOOLEAN write-read
access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CoarseGridY Property
Description
TRUE, when the Y-axis graduation is scaled by long tick marks. The distance between two
long tick marks can be changed using the "CoarseGridValueY" property. BOOLEAN write-read
access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CoarseGridValue Property
Description
Defines the distance between two long tick marks in the scale. Whether the information is
evaluated is dependent on the value of the "CoarseGrid" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

360

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

CoarseGridValueX Property
Description
Defines or returns the distance between two long tick marks on the graduation scale of the Xaxis. Whether the information is evaluated is dependent on the value of the "CoarseGridX"
property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CoarseGridValueY Property
Description
Defines or returns the distance between two long tick marks on the graduation scale of the Yaxis. Whether the information is evaluated is dependent on the value of the "CoarseGridY"
property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CollectValue Property
Description
Contains the respective status of the active message class in Runtime as the start value. LONG
write/read access.
The value can be determined from the group display of hierarchically subordinate pictures by
making it dynamic using a tag.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

361

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColMove Property
Description
TRUE, when the arrangement of columns can be changed. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Color Property
Description
The "Index" property references a column pair or a trend. "Color" defines the color of the font
in the column or the trend. LONG write-read access. The color is defined as an RGB value.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ColorAlarmHigh Property
Description
Defines or returns the bar color for the "AlarmHigh" limit value. LONG write/read access.
The "CheckAlarmHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

362

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColorAlarmLow Property
Description
Defines or returns the bar color for the "AlarmLow" limit value. LONG write/read access.
The "CheckAlarmLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorBottom Property
Description
Defines or returns the color for the bottom/right stop of the slider object. LONG write-read
access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ColorChangeType Property
Description
TRUE, if the change of color should occur segment by segment in the case of a color change
(e.g. on reaching a limit value). If set to FALSE, it defines the change of color for the entire
bar. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

363

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColorLimitHigh4 Property
Description
Defines or returns the color for the "Reserve 4" upper limit value. LONG write/read access.
The "CheckLimitHigh4" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorLimitHigh5 Property
Description
Defines or returns the color for the "Reserve 5" upper limit value. LONG write/read access.
The "CheckLimitHigh5" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorLimitLow4 Property
Description
Defines or returns the color for the "Reserve 4" lower limit value. LONG write/read access.
The "CheckLimitLow4" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

364

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColorLimitLow5 Property
Description
Defines or returns the color for the "Reserve 5" lower limit value. LONG write/read access.
The "CheckLimitLow5" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorToleranceHigh Property
Description
Defines or returns the color for the "ToleranceHigh" upper limit value. LONG write/read access.
The "CheckToleranceHigh" property must have been set to TRUE if the bar color should
change on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorToleranceLow Property
Description
Defines or returns the color for the "ToleranceLow" lower limit value. LONG write/read access.
The "CheckToleranceLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorTop Property
Description
Defines or returns the color for the top/left stop of the slider object. LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

365

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ColorWarningHigh Property
Description
Defines or returns the color for the "WarningHigh" upper limit value. LONG write/read access.
The "CheckWarningHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorWarningLow Property
Description
Defines or returns the color for the "WarningLow" lower limit value. LONG write/read access.
The "CheckWarningLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColTitle Property
Description
TRUE, when the columns in the message window should have a title bar. BOOLEAN writeread access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

366

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColumnAdd property
Apply - ColumnAdd
Copies the selected column from the list of existing columns to the list of selected columns.
The attribute can be assigned dynamic properties by means of the name ColumnAdd. The
data type is STRING.

ColumnAlias property
ColumnAlias
Defines the alias specified in the user archive for the column name.
The attribute can be assigned dynamic properties by means of the name ColumnAlias. The
data type is STRING.

ColumnAlign property
Alignment - ColumnAlign
Specifies the mode of alignment of a selected column.
The following settings are available:
Value

Description

Explanation

left

The selected column is aligned left.

centered

The selected column is aligned to center.

right

The selected column is aligned right.

The attribute can be assigned dynamic properties by means of the name ColumnAlign. The
data type is LONG.

ColumnAutoPrecisions property
Decimal places automatic - ColumnAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" field is disabled.

FALSE

The value in the "Decimal places" field is enabled.

The attribute can be assigned dynamic properties by means of the name


ColumnAutoPrecisions. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

367

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColumnCaption property
Caption - ColumnCaption
Sets the caption for a selected column.
The attribute can be assigned dynamic properties by means of the name ColumnCaption. The
data type is STRING.

ColumnCount property
ColumnCount
Defines the number of columns configured.
The attribute can be assigned dynamic properties by means of the name ColumnCount. The
data type is LONG.

ColumnDateFormat property
Date format - ColumnDateFormat
Defines the date format for visualization.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name ColumnDateFormat.
The data type is STRING.

ColumnDMVarName property
ColumnDMVarName
Defines the name of the tag you assigned to the column in the user archive.
The attribute can be assigned dynamic properties by means of the name
ColumnDMVarName. The data type is STRING.

368

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColumnExponentialFormat property
Exponential notation - ColumnExponentialFormat
Sets exponential notation for the display of values of a selected column.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


ColumnExponentialFormat. The data type is BOOLEAN.

ColumnFlagNotNull property
ColumnFlagNotNull
Specifies whether the user archive field assigned to the column must have a value.
Value

Explanation

Yes

The column must have a value.

No

The column can have a value.

The attribute cannot be dynamized.

ColumnFlagUnique property
ColumnFlagUnique
Specifies whether the user archive field assigned to the column must have a unique value.
Values in this column must not be redundant.
Value

Explanation

TRUE

The column must have a unique value.

FALSE

The column must not have a unique value.

The attribute cannot be dynamized.

ColumnHideText property
Content as text - ColumnHideText
Defines textual display of the contents of a selected column.
Value

Explanation

TRUE

The content is not displayed in text format. The option is disabled.

FALSE

The content is displayed in text format. The option is enabled.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

369

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name ColumnHideText.
The data type is BOOLEAN.

ColumnHideTitleText property
Text header - ColumnHideTitleText
Sets textual display of the header of a selected column.
Value

Explanation

TRUE

The header is not displayed in text format. The option is disabled.

FALSE

The header is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name


ColumnHideTitleText. The data type is BOOLEAN.

ColumnIndex property
ColumnIndex
References a control column. Using this attribute you can assign the values of other properties
to a specific column.
Values between 0 and "ColumnCount" minus 1 are valid for "ColumnIndex"; the attribute
"ColumnCount" defines the number of available columns.
The "ColumnIndex" attribute can be assigned dynamic properties by means of attribute
ColumnIndex. The data type is LONG.

ColumnLeadingZeros property
With leading zeros - ColumnLeadingZeros
Enables the display of values with leading zeros for the column selected. Use "Number of
digits" or "ColumnLeadingZeros" to specify the number of leading zeros. The maximum
number is "11". No leading zeros are displayed with the value "0". The "With leading zeros"
option is deactivated.
The attribute can be assigned dynamic properties by means of the name
ColumnLeadingZeros. The data type is LONG.

ColumnLength property
Length in Characters - ColumnLength
Specifies the width of a selected column.

370

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name ColumnLength. The
data type is LONG.

ColumnMaxValue property
ColumnMaxValue
Defines the maximum column value specified in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnMaxValue.
The data type is STRING.

ColumnMinValue property
ColumnMinValue
Defines the minimum column value specified in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnMinValue.
The data type is STRING.

ColumnName property
ColumnName
Defines the name of the column which is referenced by means of "ColumnIndex" attribute.
The attribute can be assigned dynamic properties by means of the name ColumnName. The
data type is STRING.

ColumnPosition property
ColumnPosition
Displays the field position defined in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnPosition. The
data type is LONG.

ColumnPrecisions property
Decimal places - ColumnPrecisions
Specifies the number of decimal places of the values in the selected column. You can only
enter the value if the "Automatic" option is disabled.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

371

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name ColumnPrecisions.
The data type is SHORT.

ColumnReadAccess property
ColumnReadAccess
Defines authorizations for read access to the column as specified in the user archive. The
number corresponds with the number assigned to the authorization in the "User Administrator"
editor.
The attribute cannot be dynamized.

ColumnReadonly property
Write protected - ColumnReadonly
Sets the write protection of a selected column.
Value

Explanation

TRUE

This column is write protected.

FALSE

This column is not write protected. You can edit the column values in Runtime by activating the "Change"
option in the General" tab.

The attribute can be assigned dynamic properties by means of the name ColumnReadonly.
The data type is BOOLEAN.

ColumnRemove property
Remove - ColumnRemove
Cuts selected columns from the list of selected columns and pastes these to the list of available
columns.
The attribute can be assigned dynamic properties by means of the name ColumnRemove. The
data type is STRING.

ColumnRepos property
Up/Down - ColumnRepos
Changes the order of columns. "Up" and "Down" move the column selected up or down in the
list. This moves the column towards the front or towards the back.
The attribute can be assigned dynamic properties by means of the name ColumnRepos. The
data type is LONG.

372

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColumnResize property
Width can be resized - ColumnResize
Enables changes to the width of columns.
Value

Explanation

TRUE

You can change the width of the columns.

FALSE

You cannot change the width of the columns.

The attribute can be assigned dynamic properties by means of the name ColumnResize. The
data type is BOOLEAN.

ColumnSrollbar properties
Column scroll bars - ColumnScrollbar
Enables the display of column scroll bars.
The following settings are available:
Value

Description

Explanation

no

Column scroll bars are not displayed.

as required

Column scroll bars are displayed if vertical space requirements of the


control are greater than the actually available display area.

always

Column scroll bars are always displayed.

The attribute can be assigned dynamic properties by means of the name ColumnScrollbar.
The data type is LONG.

ColumnShowDate property
Display date - ColumnShowDate
Specifies if the "Time" block is displayed with time and date in a field.
Value

Explanation

TRUE

The date and time are displayed. The date format is defined in the "Date format" field.

FALSE

The time is displayed.

The attribute can be assigned dynamic properties by means of the name ColumnShowDate.
The data type is BOOLEAN.

ColumnShowIcon property
Content as icon - ColumnShowIcon

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

373

VBS for Creating Procedures and Actions


1.14 VBS Reference
Enables the display the contents of a selected column by means of icon. This function is only
available in WinCC Alarm Control.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name ColumnShowIcon.
The data type is BOOLEAN.

ColumnShowTitleIcon property
Header as icon - ColumnShowTitleIcon
Specifies the display of the header of a selected column by means of icon. This function is
only available in WinCC Alarm Control.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


ColumnShowTitleIcon. The data type is BOOLEAN.

ColumnSort property
ColumnSort
Defines the sorting order of the user archive column referenced in the "ColumnIndex" attribute.
The following settings are available:
Value

Description

Explanation

No

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name ColumnSort . The
data type is LONG.

ColumnSortIndex property
ColumnSortIndex
Defines the sorting order of the column referenced in "ColumnIndex". The sorting criterion is
removed from "ColumnSort" if you set a "0" value..

374

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name ColumnSortIndex.
The data type is LONG.

ColumnStartValue property
ColumnStartValue
Defines the column start value specified in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnStartValue.
The data type is STRING.

ColumnStringLength property
ColumnStringLength
Displays the string length of the column as defined in the user archive.
The attribute can be assigned dynamic properties by means of the name
ColumnStringLength. The data type is LONG.

ColumnTimeFormat property
Time format - ColumnTimeFormat
Defines the time format to be used for visualization.
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name


ColumnTimeFormat. The data type is STRING.

ColumnTitleAlign property
Column title alignment - ColumnTitleAlign
Specifies the type of column title alignment.
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

375

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Explanation

left

The column titles are left justified.

centered

The column titles are centered.

right

The column titles are right justified.

Same as table
content

The column titles are justified to fit the corresponding column content.

The attribute can be assigned dynamic properties by means of the name ColumnTitleAlign.
The data type is LONG.

ColumnTitles property
Show column title - ColumnTitles
Enables the display of the column header.
Value

Explanation

TRUE

The column header is displayed.

FALSE

The column header is not displayed.

The attribute can be assigned dynamic properties by means of the name ColumnTitles. The
data type is BOOLEAN.

ColumnType property
Type - ColumnType
Displays the data type set in the user archive for a selected column.
The attribute can be assigned dynamic properties by means of the name ColumnType. The
data type is LONG.

ColumnVisible property
ColumnVisible
Enables the display of a column referenced by means of "ColumnIndex" attribute.
Value

Explanation

TRUE

The column is displayed.

FALSE

The column is not displayed.

The attribute can be assigned dynamic properties by means of the name ColumnVisible . The
data type is BOOLEAN.

376

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ColumnWriteAccess property
ColumnWriteAccess
Defines authorizations for write access to the column as specified in the user archive. The
number corresponds with the number assigned to the authorization in the "User Administrator"
editor.
The attribute cannot be dynamized.

ColWidth Property
Description
TRUE, when it should be possible to change the widths of the columns in the message window.
The width of the columns can only be changed, however, when the "AutoScroll" property is
not active. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Command Property
Description
TRUE, when updating of the values displayed in the control should be forced.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

Comment property
Description
Reads or sets the Alarm object comment.

See also
Alarms object (list) (Page 126)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

377

VBS for Creating Procedures and Actions


1.14 VBS Reference

CommonTime Property
Description
TRUE, when a common time column is to be used in the table window. BOOLEAN write-read
access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

CommonX Property
Description
TRUE, when the trends in the trend window should be displayed with a common X-axis.
BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CommonY Property
Description
TRUE, when the trends in the trend window should be displayed with a common Y-axis.
BOOLEAN write-read access.

See also
ScreenItem Object (Page 141)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

ComputerName property
Description
Returns the name of the computer on which the alarm object was triggered.

378

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
ComputerName (readonly)

See also
Alarms object (list) (Page 126)

Context property
Description
Reads or sets the alarm object server prefix.

See also
Alarms object (list) (Page 126)

ConnectTrendWindows property
Connect trend windows - ConnectTrendWindows
Enables the connection of trend windows configured. You must have configured several trend
windows.
The connected trend windows have the following properties:
They can have a common X axis.
They have a scroll bar.
They have a ruler.
The zoom functions for a trend window affect the connected trend windows.
Value

Description

TRUE

All trend windows configured are connected.

FALSE

The trend windows are displayed separately.

The attribute can be assigned dynamic properties by means of the name


ConnectTrendWindows. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

379

VBS for Creating Procedures and Actions


1.14 VBS Reference

ContinousChange Property
Description
Defines the type of transfer of the value defined by the slider ("Position" property) in Runtime:
FALSE : The value of the "Position" property is transferred when the mouse button is
released.
TRUE : The value of the "Position" property is transferred immediately following a change
of the slider position.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

Count Property
Description
Supplies the number of elements in a list.
INTEGER (read-only access).

Example:
The example shows how the number of objects in a DataSet list is output.

'VBS165
HMIRuntime.Trace "Count: " & HMIRuntime.DataSet.Count & vbNewLine

The following example adds two tags to the TagSet list and outputs the count properties as
Trace.

'VBS177
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "Count: " & group.Count & vbNewLine

380

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
CreateTagSet Method (Page 702)
TagSet Object (List) (Page 156)
ScreenItems Object (List) (Page 144)
Screens Object (List) (Page 149)
Layers Object (Listing) (Page 137)
DataSet Object (List) (Page 132)
ProcessValues Object (List) (Page 140)

Cu
CurrentContext Property
Description
In the case of a picture window, the server from which the picture comes and contains the
script is read out.
The "CurrentContext" property can return different results: If, for example, a picture window
displaying a server picture is set in a local basic picture, distinction is made between two cases:
The "CurrentContext" property is used in an action of the picture window picture: The result
is the return of the symbolic computer name of the server (Package property) extended by
two colons, e.g."WinCCProject_MyComputer:: .
The "CurrentContext" property is used in an action of the basic picture: The result is returned
in the form of an empty character string.

See also
HMIRuntime Object (Page 134)

Cursor Property
Description
Controls the appearance of the cursor in Runtime when positioned over an icon.
0: The cursor appears as an arrow and does not change when positioned over the icon.
1: The cursor appears as a 3D arrow accompanied by a green lightening symbol. In
Runtime, this indicates that the object concerned can be operated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

381

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ScreenItem Object (Page 141)
HMI Symbol Library (Page 253)

Cursor property
Mouse pointer (Cursor)
Specifies whether or not to display the mouse pointer on the icon at runtime.
Value

Explanation

TRUE

The mouse pointer is shown at runtime if positioned on the icon.

FALSE

The mouse pointer is hidden at runtime if positioned on the icon.

The attribute can be assigned dynamic properties by means of the name Cursor. The data
type is BOOLEAN.

CursorControl Property
Description
TRUE, when Alpha Cursor mode is activated, the cursor skips to the next field in the TAB
sequence after exiting the field. BOOLEAN write-read access.
To do this, the "CursorMode" property must be set to TRUE.

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

CurveForm Property
Description
WinCC Function Trend Control
Defines how the measuring points of a trend referenced by the "Index" property should be
connected. Write/Read access.
WinCC Online Trend Control
The "Index" property references a trend. "CurveForm" defines how the measuring points
should be connected.

382

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
0x00000012 Representation of the measuring points.
0x00000014 Measuring points are connected linearly.
0x00000011 Measuring points are connected via a step curve.
0x00000021 The area under the linearly connected trend is filled.
0x00000022: The area under the step curve is filled.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CursorMode Property
Description
When the "CursorMode" is set to "yes", you can show all messages from the short-term archive
page by page in the long-term archive list. Use the "CursorModePrefetch" property to
determine the number of messages shown per page.
The "Autoscroll" option must be unchecked in order to be able to switch between pages. Write/
Read access.

CursorModePrefetch Property
Description
Sets the number of message that you want to display page by page in the long-term archive
list out of all messages in the short-term archive.
The "CursorMode" object property must be set to "yes".
Write/Read access.

1.14.4.5

Da
DangerColor Property
Description
Defines or returns the color of the danger zone on the scale. LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

383

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

Danger Property
Description
Defines or returns the beginning of the "danger zone". The zone stretches from the "danger"
value to the end of the scale. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

DataFormat Property
Description
Returns the data type of the I/O field object. Read only access.
Value range from 0 to 3.
0: Binary
1: Decimal
2: String
3: Hexadecimal

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

DataIndex Property
Description
Returns the current index of the data of the current trend.
Note
The property is only supported for the controls prior to WinCC V7.

384

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DataLogs Property
Description
Returns an object of type "DataLogs".
DataLogs (read-only)

See also
DataLogs Object (Page 130)
HMIRuntime Object (Page 134)

DataSet Property
Description
Returns an object of type "DataSet".
DataSet (read-only)

See also
DataSet Object (List) (Page 132)
HMIRuntime Object (Page 134)

DataX Property
Description
Inserts a single data record and must be set before calling "InsertData".
Note
The property is only supported for the controls prior to WinCC V7.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

385

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DataXY Property
Description
Inserts several data records as an array with pairs of values and must be set before calling
"InsertData".
The data in the array is assumed when "DataX" is of the VT_EMPTY type. Otherwise, the
"InsertData" attribute used the single value pair resulting from DataX and DataY.
Note
The property is only supported for the controls prior to WinCC V7.

See also
Example: Calling Methods of an ActiveX Control (Page 820)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DataY Property
Description
Inserts a single data record and must be set before calling "InsertData".
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

386

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

De - Do
DefaultMsgFilterSQL property
DefaultMsgFilterSQL
Defines an SQL statement for a fixed selection of messages.
The SQL statements of "DefaultMsgFilterSQL" and "MsgFilterSQL" are linked logically by
"AND" operation if you define additional custom selections by means of "MsgFilterSQL"
attribute.
The attribute can be assigned dynamic properties by means of the name
DefaultMsgFilterSQL. The data type is STRING.

DefaultPrecision Property
Description
This attribute defines the number of default decimal places, with which the scale value is
specified. Write/Read access.

DefaultRulerPrecision Property
Description
This attribute defines the number of decimal places as standard value with which a measured
value should be displayed when it is determined using the "Display value at this position"
function. Write/Read access.

DefaultSort property
Default sorting order - DefaultSort
Defines the default sorting order in table columns.
The following settings are available:
Value

Description

Explanation

Ascending

The list is updated starting with the bottom line.

Descending

The list is updated starting with the top line.

The attribute can be assigned dynamic properties by means of the name DefaultSort. The data
type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

387

VBS for Creating Procedures and Actions


1.14 VBS Reference

DefaultSort2 property
DefaultSort2
Use this function to define the sorting method in table columns if not using the default "Date/
time/number" sorting order. Instead, you defined a message block in the "DefaultSort2Column"
object property to sort the columns based on the "message block/date/time/number" order.
The following settings are available:
Value

Description

Explanation

Ascending

The list is updated starting with the bottom line.

Descending

The list is updated starting with the top line.

The attribute can be assigned dynamic properties by means of the name DefaultSort2. The
data type is LONG.

DefaultSort2Column property
DefaultSort2Column
Use this function to define the sorting method in table columns if not using the default "Date/
time/number" sorting order.
Define a message block by its object name.
The table columns are now sorted based on the "message block/date/time/number" order.
The attribute can be assigned dynamic properties by means of the name
DefaultSort2Column. The data type is STRING.

DeleteData Property
Description
Deletes data in the data buffer of the current trend.
TRUE : All trend data is deleted.
FALSE : The value pair at the "DataIndex" position are deleted.
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

388

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Delta Property
Description
Defines or returns the value difference between two main scale graduation marks. Write/Read
access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

DesiredCurveColor Property
Description
Defines the color of a setpoint trend which belongs to a trend referenced by the "Index"
property. The color is defined as an RGB value. Whether the information is evaluated is
dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveCurveForm Property
Description
Defines the form of representation of a setpoint trend which belongs to a trend referenced by
the "Index" property. Whether the information is evaluated is dependent on the value of the
"DesiredCurveVisible" property.
0x00000011 Measuring points are connected by a solid line via a step curve
0x00000012 Representation of the measuring points
0x00000014 Measuring points are connected linearly with a solid line
0x00000021 The area under the linearly connected trend is filled.
0x00000022: The area under the stepped curve is filled.
0x00000031: Measuring points are connected by a dashed line via a step curve
0x00000032: Measuring points are connected linearly with a dashed line

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

389

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceNumberOfUAValues Property
Description
Defines the number of value pairs of a setpoint trend which belongs to a trend referenced by
the "Index" property. Whether the information is evaluated is dependent on the value of the
"DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAArchive Property
Description
Defines the name of the user archive from which the value of a setpoint trend, which belongs
to a trend referenced by "Index", is read. Whether the information is evaluated is dependent
on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAArchiveStartID Property
Description
Defines the starting point for the value of a setpoint trend, which belongs to a trend referenced
by "Index", from which the values should be read from the archive. Whether the information is
evaluated is dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

390

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

DesiredCurveSourceUAColumnX Property
Description
Defines the column in the user archive from which the X-values of a setpoint trend, which
belongs to a trend referenced by "Index", should be read. Whether the information is evaluated
is dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAColumnY Property
Description
Defines the column in the user archive from which the Y-values of a setpoint trend, which
belongs to a trend referenced by "Index", should be read. Whether the information is evaluated
is dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveVisible Property
Description
TRUE, a setpoint trend which belongs to a trend referenced by "Index" should be displayed.
BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Direction Property
Description
Defines or returns the bar direction or the position of the slider object. BOOLEAN write-read
access. Value range from 0 to 3.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

391

VBS for Creating Procedures and Actions


1.14 VBS Reference
0 = top
1 = bottom
2 = left
3 = right

See also
Slider (Page 226)
Bar (Page 189)
3D Bar (Page 184)
ScreenItem Object (Page 141)

DisplayName property
Display name (DisplayName)
Specifies the user-defined name of the process picture. The attribute is of type "Multilingual
String". You can specify names for all languages installed in WinCC.
The "Display name" attribute can be dynamized with the "DisplayName" name.

DisplayOptions property
Show messages - DisplayOptions
Select the messages to be displayed.
The following selection options are available:
Value

Designation

All messages

Only displayed messages

Only hidden messages

The attribute can be assigned dynamic properties by means of the name DisplayOptions. The
data type is LONG.

392

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

DisplayOptions property (before WinCC V7)


Description
Specifies if a button is assigned to a graphic, text, or both.
0
1
2
3

Picture or text: If a picture exists, the button is assigned with the picture, otherwise it is
assigned with text.
Graphic and text
Text only
Graphic only

DoubleClickAction property
Action on double-click - DoubleClickAction
Sepcifies the action to be executed in Runtime by double-clicking on a message line.
The following settings are available:
Value

Description

Explanation

none

No action.

Loop-in-alarm

Calls the "Loop-in-alarm" function.

Open comments dialog

Calls the "Comments dialog" button function.

Open Infotext dialog

Calls the "Infotext dialog" button function.

Column-dependent

The action is determined by the column in which you


double-clicked.

The attribute can be assigned dynamic properties by means of the name DoubleClickAction.
The data type is LONG.

1.14.4.6

Edit Property
Description
Activates Editing mode for a cell as long as the "Editable" property has been set to TRUE for
the corresponding column.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

393

VBS for Creating Procedures and Actions


1.14 VBS Reference

Editable Property
Description
The "Index" property references a pair of columns. "Editable" defines whether the column pair
should be editable. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

EditAtOnce Property
Description
TRUE, if accessing the field with the <TAB> key permits input immediately and without further
action. BOOLEAN write-read access.

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

Enabled Property
Function
Enables or disables possible operation of an object or issues the corresponding value. TRUE :
Enable operation, FALSE: Operation is disabled.
BOOLEAN write-read access.

Example:
The following example disables all objects in the picture "NewPDL1":

'VBS71
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")

394

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

For lngIndex = 1 To objScreen.ScreenItems.Count


strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Enabled=False
'Lock object
Next

'Read names of objects

See also
Screen Object (Page 146)
ScreenItem Object (Page 141)

EnableDelete property
Delete - EnableDelete
Enables deletion of data from the user archive in Runtime.
Value

Explanation

TRUE

You can delete data from the user archive in Runtime.

FALSE

You cannot delete data from the user archive in Runtime.

The attribute can be assigned dynamic properties by means of the name EnableDelete. The
data type is BOOLEAN.

EnableEdit property
Modify - EnableEdit
Enables editing of the data displayed during runtime.
Value

Explanation

TRUE

Enables editing of data during runtime.

FALSE

Disables editing of data during runtime.

The attribute can be assigned dynamic properties by means of the name EnableEdit. The data
type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

395

VBS for Creating Procedures and Actions


1.14 VBS Reference

EnableInsert property
Add - EnableInsert
Enables insertion of data in the user archive in Runtime.
Value

Explanation

TRUE

You can add data to the user archive in Runtime.

FALSE

You cannot add data to the user archive in Runtime.

The attribute can be assigned dynamic properties by means of the name EnableInsert. The
data type is BOOLEAN.

EnablePopupMenu property
EnablePopupMenu
Specifies if the pop-up menu is enabled in the control.
The attribute can be assigned dynamic properties by means of the name EnablePopupMenu.
The data type is BOOLEAN.

EndAngle Property
Description
Defines or returns the end of the object. The information is in counterclockwise direction in
degrees, beginning at the 12:00 clock position.

See also
Pie segment (Page 167)
Circular arc (Page 166)
Ellipse segment (Page 162)
Ellipse arc (Page 161)
ScreenItem Object (Page 141)

396

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

EndTime Property
Description
Online Table Control
The "Index" attribute references a pair of columns. "EndTime" defines the end time for
displaying this column pair. Whether the information is evaluated is dependent on the
TimeRange" and "CommonTime" properties. Write/Read access.
Online Trend Control
The "Index" attribute references a trend. "EndTime" defines the end time for displaying this
trend. Whether the information is evaluated is dependent on the "Autorange", "TimeRange"
and "CommonX" properties.
Use the "yyyy-mm-dd hh:mm:ss" format when creating a dynamic time range.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

EndValue Property
Description
The "Index" property references a trend. "EndValue" defines the upper limit of the value range
to be displayed for the trend. Whether the information is evaluated is dependent on the
"Autorange" and "CommonY" properties.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

EndX Property
Description
Defines the upper limit of the X-axis of a trend referenced with "Index". Whether the information
is evaluated is dependent on the "AutorangeX" and "CommonX" properties.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

397

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

EndY Property
Description
Defines the upper limit of the Y-axis of a trend referenced with "Index". Whether the information
is evaluated is dependent on the "AutorangeY" and "CommonY" properties.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ErrorDescription Property
Function
Error description of the "LastError" property. The error description is provided in English only.
STRING (read only)
The following error messages are defined:
Output

Description

""

OK

"Operation Failed"

Execution error

"Variable not found"

Tag error

"Server down"

Server not available.

"An error occured for one or several tags"

Multi Tag Error (Error in one or several tags)

In order that ErrorDescription returns a value, a read process must be executed beforehand.
If an error occurs during read or write of several tags using the TagSet object, the error is set
to "Multi Tag Error". In order to determine at which tag the error occurred and what type of
error it was, the ErrorDescription property of each tag must be analyzed.

Example:
The following example displays the error description for "Tag1":

'VBS72
Dim objTag

398

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Set objTag = HMIRuntime.Tags("Tag1")


objtag.Read
MsgBox objTag.ErrorDescription

The following example adds two tags to the TagSet list and outputs the ErrorDescription
property as Trace.

'VBS179
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "ErrorDescription: " & group.ErrorDescription & vbNewLine

The ErrorDescription property of a tag contained in the list may be accessed as follows:

HMIRuntime.Trace "ErrorDescription: " & group("Motor1").ErrorDescription & vbNewLine

See also
LastError Property (Page 446)
QualityCode Property (Page 533)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

Exponent Property
Description
TRUE, when the display of numbers should be with exponents (e.g."1.00e+000"). BOOLEAN
write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

399

VBS for Creating Procedures and Actions


1.14 VBS Reference

ExportDirectoryChangeable property
Directory can be changed - ExportDirectoryChangeable
Enables changing of the directory for data export in Runtime.
Value

Explanation

TRUE

The data export directory can be changed in Runtime.

FALSE

The data export directory cannot be changed in Runtime.

The attribute can be assigned dynamic properties by means of the name


ExportDirectoryChangeable. The data type is BOOLEAN.

ExportDirectoryname property
Directory - ExportDirectoryname
Defines the directory to which the exported Runtime data is written.
You can select or create the directory using the selection button.
The attribute can be assigned dynamic properties by means of the name
ExportDirectoryname. The data type is STRING.

ExportFileExtension property
ExportFileExtension
Defines the extension of the export file.
Only the file name extension "csv" is currently supported.
The attribute can be assigned dynamic properties by means of the name
ExportFileExtension. The data type is STRING.

ExportFilename property
File name - ExportFilename
Defines the name of the file which is to receive the exported Runtime data.
The attribute can be assigned dynamic properties by means of the name ExportFilename. The
data type is STRING.

400

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ExportFilenameChangeable property
File can be renamed - ExportFilenameChangeable
Enables renaming of the export file in Runtime.
Value

Explanation

TRUE

The export file can be renamed in Runtime.

FALSE

The export file cannot be renamed in Runtime.

The attribute can be assigned dynamic properties by means of the name


ExportFilenameChangeable. The data type is BOOLEAN.

ExportFormatGuid property
ExportFormatGuid
Default assignment of the ID number and export provider.
The attribute can be assigned dynamic properties by means of the name ExportFormatGuid.
The data type is STRING.

ExportFormatName property
Format - ExportFormatName
Defines the export file format.
Only the "csv" file format is currently available for the export.
The attribute can be assigned dynamic properties by means of the name ExportFormatName.
The data type is STRING.

See also
How to export Runtime data

ExportParameters property
ExportParameters
Specifies the parameters of the selected format by means of the properties dialog.
The attribute can be assigned dynamic properties by means of the name ExportParameters.
The data type is VARIANT.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

401

VBS for Creating Procedures and Actions


1.14 VBS Reference

ExportSelection property
Scope of data export - ExportSelection
Specifies the control's Runtime data to be exported.
The following settings are available:
Value

Description

Explanation

all

All Runtime data of the control is exported.

Selection

Selected Runtime data of the control is exported.

The attribute can be assigned dynamic properties by means of the name ExportSelection. The
data type is LONG.

ExportShowDialog property
Show dialog - ExportShowDialog
Enables the display of the export dialog during runtime.
Value

Explanation

TRUE

The dialog is displayed during runtime.

FALSE

The dialog is not displayed during runtime.

The attribute can be assigned dynamic properties by means of the name ExportShowDialog.
The data type is BOOLEAN.

ExportXML property
ExportXML
Only used internally.
The attribute can be assigned dynamic properties by means of the name ExportXML.

ExtendedOperation Property
Description
TRUE, when the slider regulator is set at the respective end value (minimum/maximum value).
This is done by clicking the mouse in an area outside the current regulator setting. BOOLEAN
write-read access.

402

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ExtendedZoomingEnable Property
Description
Activates/deactivates the ExtendedZooming properties of a picture.
Using ExtendedZooming, the view of a process picture in Runtime may be enlarged or reduced
by using the mouse wheel.
BOOLEAN write-read access.

Example:
Activates ExtendedZooming for picture NewPDL1.

'VBS155
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
objScreen.ExtendedZoomingEnable = 1

See also
Screen Object (Page 146)

1.14.4.7

Fe - Fl
FeatureFullscreen property
FeatureFullscreen
Specifies if the "Full screen" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeatureFullscreen.
The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

403

VBS for Creating Procedures and Actions


1.14 VBS Reference

FeaturePause property
FeaturePause
Specifies if the "Pause" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeaturePause. The
data type is BOOLEAN.

FeaturePlay property
FeaturePlay
Specifies if the "Play" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeaturePlay. The
data type is BOOLEAN.

FeatureStepBackward property
FeatureStepBackward
Specifies if the "Step backward" function is available in the control.
The attribute can be assigned dynamic properties by means of the name
FeatureStepBackward. The data type is BOOLEAN.

FeatureStepForward property
FeatureStepForward
Specifies if the "Step forward" function is available in the control.
The attribute can be assigned dynamic properties by means of the name
FeatureStepForward. The data type is BOOLEAN.

FeatureStop property
FeatureStop
Specifies if the "Stop" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeatureStop. The
data type is BOOLEAN.

404

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

FeatureVolume property
FeatureVolume
Specifies if the "Volume" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeatureVolume. The
data type is BOOLEAN.

FileName property
FileName
Specifies the file whose content you want to display or play.
The attribute can be assigned dynamic properties by means of the name FileName. The data
type is STRING.

FillColor Property
Description
Defines or returns the fill pattern color for the object.
LONG (write-read access)
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Enter the appropriate decimal value
for each of the three RGB values.
Example:
RGB(200, 150, 100)

Example:
The following example defines the fill color for "ScreenWindow1" to blue:

'VBS73
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.FillStyle = 131075
objScreen.FillColor = RGB(0, 0, 255)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

405

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
FillStyle Property (Page 408)
BackColor Property (Page 323)
ScreenItem Object (Page 141)

Filling Property
Description
TRUE, when the object can be filled by closed border lines (e.g. representing the fill level of a
tank). BOOLEAN write-read access.
The fill level of the object is set by means of the "FillingIndex" property.

See also
ScreenItem Object (Page 141)

FillingDirection properties
Filling direction (FillingDirection)
The "Filling direction" attribute specifies the filling direction for an object enclosed in a frame
line.
Bottom to top

The object is filled from bottom to top.

Top to bottom

The object is filled from top to bottom.

Left to right

The object is filled from left to right.

Right to left

The object is filled from right to left.

The attribute can be assigned dynamic properties by means of the name FillingDirection. The
data type is LONG.

FillingIndex Property
Description
Defines the %age value (related to the height of the object) to which the object with closed
border line is to be filled.
The fill level is represented by the current background color. The unfilled background is
transparent.

See also
ScreenItem Object (Page 141)

406

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

FillStyle Property
Description
Defines or returns the fill pattern for the object.
LONG (write-read access)
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

65536
0

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1048576

196611

196627

1048577

196612

196628

1048578

196613

196629

1048579

196614

196630

1048832

196615

196631

1048833

196616

196632

1048834

196617

196633

1048835

196618

196634

131072

196619

196635

131073

196620

196636

131074

196621

196637

131075

196622

196638

131076

196623

196639

196608

196624

196640

407

VBS for Creating Procedures and Actions


1.14 VBS Reference
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

196609

196625

196641

196610

196626

196642

Example
The following example sets the fill pattern for "ScreenWindow1" to transparent:

'VBS190
Dim obj
Set obj = ScreenItems("Rectangle1")
obj.FillStyle = 65536

See also
FillColor Property (Page 405)
BackColor Property (Page 323)
Screen Object (Page 146)

FillStyle2 Property
Description
Defines or returns the fill style of the bar.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

FillStyleAlignment property
Description
Defines the alignment of the fill pattern for the process picture.
Normal

The fill pattern refers to the process picture. In runtime, no scaling is


performed when opening the picture.
Stretched (window) The fill pattern refers to the window in the Graphics Designer. In runtime,
scaling is performed when opening the picture.

408

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

FilterSQL property
FilterSQL
Defines an SQL statement for a selection of data in the user archive.
The attribute can be assigned dynamic properties by means of the name FilterSQL. The data
type is STRING.

FineGrid Property
Description
TRUE, when the value axis is scaled by short tick marks. The distance between two short tick
marks can be changed using the "FineGridValue" property. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

FineGridValue Property
Description
Defines the distance between two short tick marks in the scale. Whether the information is
evaluated is dependent on the value of the "FineGrid" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

FineGridValueX Property
Description
Defines the distance between two short tick marks on the X-axes scaling. Whether the
information is evaluated is dependent on the value of the "FineGridX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

409

VBS for Creating Procedures and Actions


1.14 VBS Reference

FineGridValueY Property
Description
Defines the distance between two short tick marks on the Y-axes scaling. Whether the
information is evaluated is dependent on the value of the "FineGridX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FineGridX Property
Description
TRUE, when the X-axis graduation is scaled by short tick marks. The distance between two
short tick marks can be changed using the "FineGridValueX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FineGridY Property
Description
TRUE, when the Y-axis graduation is scaled by short tick marks. The distance between two
short tick marks can be changed using the "FineGridValueY" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FlashBackColor Property
Description
TRUE, when flashing of the background is activated. BOOLEAN write-read access

410

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ScreenItem Object (Page 141)

FlashBorderColor Property
Description
TRUE, when flashing of the object lines is activated. BOOLEAN write-read access.

See also
ScreenItem Object (Page 141)

FlashFlashPicture Property
Description
TRUE, when flashing of the flash picture is activated. BOOLEAN write-read access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashForeColor Property
Description
TRUE, when flashing of the text is activated. BOOLEAN write-read access.

See also
I/O Field (Page 199)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

411

VBS for Creating Procedures and Actions


1.14 VBS Reference

FlashPicReferenced Property
Description
TRUE, when the assigned flash picture should be saved. Otherwise, only the associated object
reference is saved. Read only access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashPicTransColor Property
Description
Defines which color of the bitmap object (.bmp, .dib) assigned to the flash picture should be
set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "FlashPicUseTransColor" property is
"True".

See also
ScreenItem Object (Page 141)
Status display (Page 213)

FlashPicture Property
Description
Returns the flash picture. Read-only access.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.
In this context, the "FlashPicReferenced" property defines whether the flash picture should be
saved together with the object status display or referenced.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

412

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

FlashPicUseTransColor Property
Description
TRUE, when the configured color ("FlashPicTransColor" property) of the bitmap objects
assigned to the flash picture should be set to "transparent". BOOLEAN write-read access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashRate Property
Description
Defines or returns the flashing frequency for the object. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

413

VBS for Creating Procedures and Actions


1.14 VBS Reference

FlashRateBackColor Property
Description
Defines or returns the flash frequency for the object background. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
ScreenItem Object (Page 141)

FlashRateBorderColor Property
Description
Defines or returns the flash frequency for the lines of the object. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
ScreenItem Object (Page 141)

414

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

FlashRateFlashPic Property
Description
Defines or returns the flash frequency for the status display. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashRateForeColor Property
Description
Defines or returns the flash frequency for the object label. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.5 Hz)

Medium (approx. 2 Hz)

Fast (approx. 8 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

415

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

Flip property
Flip (Flip)
Specifies flipping of the icon at runtime.
The following settings are available:
Value

Description

Comments

None

The icon is not flipped.

Horizontal

The object is flipped along the horizontal center axis.

Vertical

The object is flipped along the vertical center axis.

Both

The object is flipped along the horizontal and vertical center axes.

The attribute can be assigned dynamic properties by means of the name Flip. The data type
is LONG.

Flip Property
Description
Mirrors the icon on the vertical and/or horizontal middle axis of the icon.
Zero - 0: The icon is mot mirrored.
Horizontal - 1: The icon is mirrored on the vertical center axis.
Vertical - 2: The icon is mirrored on the horizontal, center axis.
Both - 3: The icon is mirrored both on the horizontal and vertical center axes.

See also
HMI Symbol Library (Page 253)
ScreenItem Object (Page 141)

416

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Fo - Fr
FocusColor Property
Description
If the focus is positioned on the control in Runtime, the labeling and position text are identified
by a border. FocusColor defines the color of the border.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

FocusRect Property
Description
TRUE, when the button should be provided with a selection border, in Runtime, as soon as it
receives the focus. BOOLEAN write-read access.

See also
WinCC Push Button Control (Page 275)
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

FocusWidth Property
Description
If the focus is positioned on the control in Runtime, the labeling and position text are identified
by a border. FocusWidth defines the width of the border, value range of 1-10 pixels. LONG
write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

417

VBS for Creating Procedures and Actions


1.14 VBS Reference

Font Property
Name - Font
Sets the font.
The attribute cannot be dynamized.

Font property (before WinCC V7)


Description
Defines or returns the font. Write/Read access.
The font object has the following sub-properties
Size (Font Size)
Bold (yes/no)
Name (font name)
Italic (yes/no)
Underline (underline yes/no)
StrikeThrough (yes/no)
If two font properties are directly assigned, only the default property "Name" is assumed.

Example:

'VBS74
Dim objControl1
Dim objControl2
Set objControl1 = ScreenItems("Control1")
Set objControl2 = ScreenItems("Control2")
objControl2.Font = objControl1.Font ' take over only the type of font

See also
WinCC Slider Control (Page 281)
WinCC Push Button Control (Page 275)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Digital/Analog Clock (Page 258)

418

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

FontBold Property
Description
TRUE, when the text in the object should be assigned the "bold" attribute. BOOLEAN writeread access.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
Bar (Page 189)
ScreenItem Object (Page 141)

FontItalic Property
Description
TRUE, when the text in the object should be assigned the "italic" attribute. BOOLEAN writeread access.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

419

VBS for Creating Procedures and Actions


1.14 VBS Reference

FontName Property
Description
Defines or returns the font name of the text in the object.
All the fonts installed in Windows are available for selection.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
Bar (Page 189)
ScreenItem Object (Page 141)

FontPosition Property
Description
Returns the font name for the display of the slider position in the bottom part of the object. All
the fonts installed in Windows are available for selection. Read only access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

FontSize Property
Description
Defines or returns the font size of the text in the object in points.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)

420

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
Bar (Page 189)
ScreenItem Object (Page 141)

FontStrikeThru Property
Description
TRUE, when the text in the object should be assigned the "strikethrough" attribute. BOOLEAN
write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FontUnderline Property
Description
TRUE, when the text in the object should be assigned the "underline" attribute. BOOLEAN
write-read access.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

421

VBS for Creating Procedures and Actions


1.14 VBS Reference

ForeColor Property
Description
Defines or returns the color of the font for the text in the object. LONG write-read access.

See also
WinCC Slider Control (Page 281)
WinCC Push Button Control (Page 275)
WinCC Digital/Analog Clock (Page 258)
HMI Symbol Library (Page 253)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

ForeColor property
Foreground color (ForeColor)
Specifies the foreground color of the icon in the "Color selection" dialog. The icon is displayed
in the foreground color if the "Shadow" and "Solid" foreground mode is set.
The attribute can be assigned dynamic properties by means of the name ForeColor. The data
type is LONG.

ForeFlashColorOff Property
Description
Defines or returns the color of the text for flash status "Off". LONG write-read access.

See also
Text list (Page 211)
Static text (Page 180)
Radio box (Page 221)
Check box (Page 219)

422

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

ForeFlashColorOn Property
Description
Defines or returns the color of the text for flash status "On". LONG write-read access.

See also
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

FrameColor Property
Description
Defines or returns the color of the rectangular or square area located on the graduated scale
disk. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

FrameColorDown Property
Description
Defines or returns the color for the right, bottom part of the 3D frame of the button (button
pressed). LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

423

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FrameColorUp Property
Description
Defines or returns the color for the left, top part of the 3D frame of the button (button not
pressed). LONG write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FramePicture Property
Description
Returns the picture name of the background picture for the graduated scale disk. Read only
access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

FrameScale Property
Description
Defines or returns the diameter of the graduated scale disk in relation to smallest value of the
width and height geometric attributes. Write/Read access.
The value range is (scale distance - scale width) to 1.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

424

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

FrameWidth Property
Description
Defines or returns the border width of the button in pixels. Write/Read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FreezeProviderConnections Property
Description
Enables modification of the data connection properties ("ProviderType", "Source"...), without
the change being effective immediately. On changing "SourceTagNameX", for example,
impermissible combinations can created with "SourceTagNameY".
Therefore, FreezeProviderConnections" must be set to TRUE before modifying a data
connection attribute. After modifying all the data connection, "FreezeProviderConnection" is
set to FALSE and the changes take effect.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1.14.4.8

GlobalColorScheme property
Description
Defines whether the colors defined for the current design in the global color scheme will be
used for this object.
TRUE if the object is displayed with the colors from the global color scheme defined for this
object type.
FALSE if the object is displayed with the colors as per the settings in the object.
BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

425

VBS for Creating Procedures and Actions


1.14 VBS Reference

GlobalShadow property
Description
Defines whether the object will be displayed with the shadowing defined in the active design.
TRUE if the object is displayed with the global shadow defined for this object type.
FALSE if no shadow is displayed.
BOOLEAN write-read access.

GraphDirection property (before WinCC V7)


Description
Defines which edge of the trend window should display the current values. Write/Read access.
0: Positive values run to the right and upwards.
-1: Positive values run to the left and upwards.
-2: Positive values run to the right and upwards.
-3: Positive values run to the right and downwards.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

GraphDirection Property
Write direction - GraphDirection
Defines the direction of the update of axis values.
Value

Description

Explanation

From the right

The updated values are displayed starting at the right side of the trend.

From the left

The updated values are displayed starting at the left side of the trend.

From the top

The updated values are displayed starting at the top of the trend.

From the bottom

The updated values are displayed starting at the bottom of the trend.

True type fonts must be used within the trend window if "From the top" or "From the bottom"
is selected for write direction. Only this setting ensures legibility of the labeling of the vertical
axis.
The attribute can be assigned dynamic properties by means of the name GraphDirection. The
data type is LONG.

426

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GridLineColor property
Color of the row divider / content - GridLineColor
Defines the color of row/column dividers in table contents. The button opens the "Color
selection" dialog.
The attribute can be assigned dynamic properties by means of the name GridLineColor. The
data type is LONG.

GridLineHorz Property
Description
TRUE, when the message window columns are separated by horizontal dividing lines.
BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

GridLines Property
Description
TRUE, when the trend window is displayed with grid lines parallel to the X-axis. The distance
between two grid lines can be changed using the "GridLineValue" property. BOOLEAN writeread access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

GridlinesValueX Property
Description
Defines or returns the distance between two grid lines on the X-axis. Whether the information
is evaluated is dependent on the value of the "GridLinesX" property.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

427

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

GridlinesValueY Property
Description
Defines or returns the distance between two grid lines on the Y-axis. Whether the information
is evaluated is dependent on the value of the "GridLinesY" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

GridlinesX Property
Description
TRUE, when the trend window is displayed with grid lines parallel to the X-axis. The distance
between two grid lines can be changed using the "GridLineValueX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

GridlinesY Property
Description
TRUE, when the trend window is displayed with grid lines parallel to the Y-axis. The distance
between two grid lines can be changed using the "GridLineValueX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

428

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GridLineValue Property
Description
Defines the distance between two grid lines. Whether the information is evaluated is
dependent on the value of the "GridLines" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

GridLineVert Property
Description
TRUE, when the message window columns are separated by vertical dividing lines. BOOLEAN
write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

GridLineWidth property
Width of dividers - GridLineWidth
Defines the line weight of the row/column dividers in pixels.
The attribute can be assigned dynamic properties by means of the name GridLineWidth. The
data type is LONG.

1.14.4.9

Ha - Hi
HandFillColor Property
Description
Defines or returns the fill color of all the hands in the analog clock. In order that the hands are
displayed with the fill color defined, the "Handtype" property must be set to "0" (covering).
LONG write-read access.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

429

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

Handtype Property
Description
Defines the representation of the hands:
0: The hands are filled in the hand color defined and the edges in the foreground color.
1: The hands fill color is transparent and the edges displayed in the foreground color.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

HeaderSort Property
Description
Specifies if sorting of messages by message block column header is possible.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Height Property
Description
Defines or returns the height of the object in pixels.
LONG (write-read access)

Example:
The following example halves the height of all objects in the "NewPDL1" picture whose names
begin with "Circle":

'VBS75

430

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Dim objScreen
Dim objCircle
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'Searching all circles
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
If "Circle" = Left(strName, 6) Then
'
'to halve the height of the circles
Set objCircle = objScreen.ScreenItems(strName)
objCircle.Height = objCircle.Height / 2
End If
Next

See also
Width Property (Page 683)
Object types of the ScreenItem object (Page 158)
ScreenItem Object (Page 141)

HiddenInput Property
Description
TRUE, when the input value should not be displayed when being entered. Each character
entered is substituted by a *. BOOLEAN write-read access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

HideTagNames Property
Description
TRUE if the archive and tag name in the trend should be hidden via the right mouse button,
in the status line and in the table to display the coordinates. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

431

VBS for Creating Procedures and Actions


1.14 VBS Reference

HitlistColumnAdd property
HitlistColumnAdd
Transfers the selected message block from the list of available message blocks to the list of
selected message blocks.
The attribute can be assigned dynamic properties by means of the name HitlistColumnAdd .
The data type is STRING.

HitlistColumnCount property
HitlistColumnCount
Specifies the number of message blocks displayed in the hitlist in Runtime.
The attribute can be assigned dynamic properties by means of the name
HitlistColumnCount . The data type is LONG.

HitlistColumnIndex property
HitlistColumnIndex
References a message block selected for the hitlist. Using this attribute you can assign the
values of other attributes to a specific message block of the hitlist.
Values between 0 and "HitlistColumnCount" minus 1 are valid for "HitlistColumnIndex".
Attribute "HitlistColumnCount" defines the number of message blocks selected for the hitlist.
The "HitlistColumnIndex" attribute can be assigned dynamic properties by means of attribute
HitlistColumnRepos. The data type is LONG.

HitlistColumnName property
HitlistColumnName
Displays the name of the message block of the hitlist which is referenced with attribute
"HitlistColumnIndex". You cannot edit this name.
The attribute can be assigned dynamic properties by means of the name
HitlistColumnName . The data type is STRING.

HitlistColumnRemove property
HitlistColumnRemove
Cuts the marked message block from the list of selected message blocks and pastes it to the
list of available message blocks.

432

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
HitlistColumnRemove. The data type is STRING.

HitlistColumnRepos
Up/Down - MessageColumnRepos/HitlistColumnRepos
Resorts the message blocks. The "Up" and "Down" commands move the selected message
block accordingly in the list. This moves the message block in Runtime Control towards the
front or towards the back.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnRepos .
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnRepos.
The data type is LONG.

HitlistColumnSort property
HitlistColumnSort
Defines the sorting order of the message block referenced in "HitlistColumnIndex" for the hitlist.
The following settings are available:
Value

Description

Explanation

none

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name HitlistColumnSort .
The data type is LONG.

HitlistColumnSortIndex property
HitlistColumnSortIndex
Defines the sorting order of the message block referenced in "HitlistColumnIndex" in the hitlist.
The sorting criterion is removed from "HitlistColumnSort" if you set a "0" value..
The attribute can be assigned dynamic properties by means of the name
HitlistColumnSortIndex. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

433

VBS for Creating Procedures and Actions


1.14 VBS Reference

HitlistColumnVisible
Selected message blocks - MessageColumnVisible/HitlistColumnVisible
Selected message blocks of message list or hitlist that are displayed in Runtime. Defines
whether the message block referenced in "MessageColumnIndex" or "HitlistColumnIndex" is
displayed.
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnVisible.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnVisible.
The data type is BOOLEAN.

HitlistDefaultSort property
HitlistDefaultSort
Defines the default sorting order in the table columns of the hitlist.
The following settings are available:
Value

Description

Explanation

Ascending

The list is sorted in ascending order based on frequency.

Descending

The list is sorted in descending order based on frequency.

The attribute can be assigned dynamic properties by means of the name HitlistDefaultSort.
The data type is LONG.

HitListMaxSourceItems property
Maximum number of data records - HitListMaxSourceItems
Defines the maximum number of data records for statistics.
The attribute can be assigned dynamic properties by means of the name
HitListMaxSourceItems . The data type is LONG.

434

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

HitListMaxSourceItemsWarn property
Warning when maximum is reached - HitListMaxSourceItemsWarn
Enables the output of a warning notice after the valid number of data records was reached.
Value

Explanation

TRUE

A warning is output after the valid maximum number of data records was reached.

FALSE

A warning is not output after the valid maximum number of data records was reached.

The attribute can be assigned dynamic properties by means of the name


HitListMaxSourceItemsWarn. The data type is BOOLEAN.

HitListRelTime property
Time range for statistics - HitListRelTime
Sets a time range for the statistics.
Value

Explanation

TRUE

The time range set for statistics is used if this range was not defined in the selection.

FALSE

The time range is not used.

The attribute can be assigned dynamic properties by means of the name HitListRelTime. The
data type is BOOLEAN.

HitListRelTimeFactor property
Time range - HitListRelTimeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
HitListRelTimeFactor. The data type is LONG.

HitListRelTimeFactorType property
Time range - HitListRelTimeFactorType
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

Minute

Hour

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

435

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Day

Week

Month

The attribute can be assigned dynamic properties by means of the name


HitListMaxRelTimeFactorType. The data type is LONG.

Ho - Hy
HorizontalGridLines property
Horizontal - HorizontalGridLines
Defines whether horizontal separating lines will be displayed.
Value

Explanation

TRUE

Enables the display of horizontal dividers.

FALSE

Disables the display of horizontal dividers.

The attribute can be assigned dynamic properties by means of the name


HorizontalGridLines. The data type is BOOLEAN.

Hotkey Property
Description
Returns the function key related to the mouse operation in respect of a button object.
Read only access.

See also
Button (Page 215)
ScreenItem Object (Page 141)

HourNeedleHeight Property
Description
Defines or returns the length of the hour hand for the analog clock. The specification of the
length is entered as a percentage value in relation to half the length of the short side of the
rectangular background. Write/Read access.
Example:
The shorter side of the rectangular background is 100 pixels long.

436

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The hour hand length is 50.
This results in a length of the hour hand of (100 pixels / 2) * 0.5 = 25 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

HourNeedleWidth Property
Description
Defines or returns the width of the hour hand for the analog clock. The width is specified as a
percentage value related to double the length of the hour hand. Write/Read access.
Example:
The length of the hour hand is 25 pixels.
The hour hand width is 10.
This results in a width of the hour hand of 25 pixels * 2 * 0.1 = 5 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

Hysteresis Property
Description
TRUE, when the display should appear with hysteresis. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

HysteresisRange Property
Description
Defines the hysteresis in % of the displayed value or returns it.
The Hysteresis property must be set to TRUE for the hysteresis to be calculated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

437

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1.14.4.10 I
IconSpace property
IconSpace
Defines the spacing between the icons and text in the table cells. The value is active if and
icon and text are displayed.
The attribute can be assigned dynamic properties by means of the name IconSpace. The data
type is LONG.

IndependentWindow property
Description
Defines whether the display of the picture window in Runtime depends on the process picture
in which the picture window was configured.
TRUE if the size and position of the picture window are independent of the process picture
and only defined by the "Window mode" attribute.
FALSE if the size and position of the picture window change with the shift or scaling of the
process picture.

Index Property
Description
Check box, radio box
Defines or returns the number (0 to 31) of the field whose text is to be defined.
Combo box, list box
Defines or returns the number (0 to 31) of the line whose text is to be defined.
Polygon, polyline, tube polygon
Defines or returns the number of the corner point whose position coordinates are to be modified
or displayed.

438

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
WinCC online trend control, WinCC online table control, WinCC function trend control
The "Index" property is evaluated by other properties in order to be able to assign the settings
to a specific trend or column pair. The valid values for the index move within the range from 0
to (NumItems - 1). The "NumItems" properties contains the number of the trends/column pairs
to be displayed. The index must always be set before you change the properties of a trend /
column in runtime.
Status display
Defines the status (0 to 255) or returns it. A basic picture and flash picture can be defined for
each status value.

See also
Status display (Page 213)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
Polyline (Page 173)
Polygon (Page 171)
Radio box (Page 221)
Check box (Page 219)
ScreenItem Object (Page 141)

InnerBevelOffset Property
Description
Defines the distance between the inner and outer bevels.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

InnerBevelStyle Property
Description
Defines the 3D effect for the inner bevel of the object.
0: No border.
1: The border is displayed depressed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

439

VBS for Creating Procedures and Actions


1.14 VBS Reference
2: The border is displayed raised.
3: The border is displayed in one color without a 3D effect. The border color is defined by
the "BevelColorDown" property.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

InnerBevelWidth Property
Description
Defines the width of the inner bevel in pixels.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

InputValue property
Description
Defines the value to be entered by the user in the I/O field. The value is not displayed in the I/
O field when the property is set.
If you want the value to be displayed in the I/O field after confirmation with the <Return> key,
configure a direct connection between the properties "input value" and "output value". The
direct connection is only practical when no tag is connected to the output value, but the user
can nevertheless query the specified value, for example, through a script.
LONG write-read access.

See also
Example: Calling Methods of an ActiveX Control (Page 820)

InsertData Property
Description
Inserts data for the current trend.
TRUE : "DataIndex" is ignored and the data is appended to that in the data buffer.
FALSE : The data is inserted at the "DataIndex" position in the data buffer.

440

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The trend window is redrawn following each operation involving "Insert Data".
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Instance property
Description
Returns an instance of the alarm object.

See also
Alarms object (list) (Page 126)

ItemBorderBackColor Property
Description
Defines or returns the background color for dividing lines in the selection list of the text list
object. LONG write-read access. The background color is only visible with the property setting
ItemBorderStyle > 0.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

ItemBorderColor Property
Description
Defines or returns the color for deviding lines in the selection list of the text list object. LONG
write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

441

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Text list (Page 211)
ScreenItem Object (Page 141)

ItemBorderStyle Property
Description
Defines or returns the color for the dividing line style in the selection list of the text list object.
Value range from 0 to 4.
0 = solid line
1 = dashed line
2 = dotted line
3 = dash-dotted line
4 = dash-dot-dot line

See also
Text list (Page 211)
ScreenItem Object (Page 141)

ItemBorderWidth Property
Description
Defines or returns the dividing line weight in pixels in the selection list of the text list object.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

ItemProviderClsid Property
Description
"ItemProviderCIsid" shows, if the trend referenced using Index in Trend Control is connected
with an archive tag or an online tag.
Notice: If you assign a value to the "ProviderCIsid" property , you will overwrite the trendspecific property "ItemProviderCIsid".

442

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
{416A09D2-8B5A-11D2-8B81-006097A45D48}: The trend is connected to an archive tag.
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: The trend is connected to an online tag.
If the trends are being supplied with archive and online tags, the property "ProviderCIsid"
returns the value "{00000000-0000-0000-0000-000000000000}".

ItemVisible Property
Description
TRUE, when a trend or a column pair reference by the "Index" property is visible. BOOLEAN
write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1.14.4.11 L
Lab - Las
Label Property
Description
The "Index" property references a trend. Label is used to define the name of the time axis or
value axis in accordance with the value of the "TimeAxis" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

LabelColor Property
Description
Defines the color of the scale label.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

443

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

LabelX Property
Description
Defines or returns the label on the X-axis for a trend referenced by "Index" according to the
value of "TimeAxisX". Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LabelY Property
Description
Defines or returns the label on the Y-axis for a trend referenced by "Index" according to the
value of "TimeAxisY". Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LanguageSwitch Property
Description
Returns the value which defines where the language dependent assigned texts are stored.
Read only access.
TRUE, when the texts in the Text Library are managed. Translation to other language occurs
in the Text Library.
FALSE, when the texts are managed directly in the object. Translation to other language can
be carried out using Text Distributor.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

444

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Language Property
Description
Defines the current Runtime language or reads it.
You specify the Runtime language in VBS by using a country code, e.g., 1031 for German Default, 1033 for English - USA etc. A summary of all country codes may be found in the Basics
of VBScript under the subject header "Regional Scheme ID (LCID) Diagram".
INTEGER (write-read access)

Example:
The following example sets the data language to German:

'VBS76
HMIRuntime.Language = 1031

See also
HMIRuntime Object (Page 134)

LastError Property
Description
Returns an error code regarding the success of the last operation, e.g. information on a tag
write or read process. The "QualityCode" property can provide information on the quality of
the returned value. A description of the error can be called in using the "ErrorDescription"
property.
LONG (read only)
The following error codes are defined:
Code in hexadecimal notation

Description

0x00000000

OK

0x80040001

Execution error

0x80040002

Tag error

0x80040003

Server not available.

0x80040004

Multi Tag Error (Error in one or several tags)

In order that LastError returns a value, a read must be executed beforehand.


If an error occurs during read or write of several tags using the TagSet object, the error is set
to "Multi Tag Error". In order to determine at which tag the error occurred and what type of
error it was, the LastError property of each tag must be analyzed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

445

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
The following example displays the error code for "Tag1":

'VBS77
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
MsgBox objTag.LastError

The following example adds two tags to the TagSet list and outputs the LastError property as
Trace.

'VBS178
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "LastError: " & group.LastError & vbNewLine

The LastError property of a tag contained in the list may be accessed as follows:

HMIRuntime.Trace "LastError: " & group("Motor1").LastError & vbNewLine

See also
TagSet Object (List) (Page 156)
QualityCode Property (Page 533)
ErrorDescription Property (Page 398)
Tag Object (Page 152)

Layer
Layer Property
Description
Returns the layer of the picture in which the object is located. There is a total of 32 layers
available, whereby Layer "0" is the bottom layer and Layer "31" the top layer.
The configured objects are initially in the background of a layer.

446

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
LONG (read only)
Note
The layer property specifies the layer in which the object is located. The layer "0" is output
as "Layer0".
When accessed, the layers are counted up from 1 in VBS. Therefore, the layer "1" must be
addressed with "layers(2)".

Example:
The following example displays the name and layer of all the objects in the picture "NewPDL1":

'VBS78
Dim objScreen
Dim objScrItem
Dim lngAnswer
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(strName & " is in layer " & objScrItem.Layer,vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

See also
ScreenItem Object (Page 141)

Layer00Checked Property
Description
TRUE, when limit 0 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer00Value and Layer00Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

447

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer01Checked Property
Description
TRUE, when limit 1 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer01Value and Layer01Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer02Checked Property
Description
TRUE, when limit 2 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer02Value and Layer02Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer03Checked Property
Description
TRUE, when limit 3 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer03Value and Layer03Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

448

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer04Checked Property
Description
TRUE, when limit 4 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer04Value and Layer04Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer05Checked Property
Description
TRUE, when limit 5 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer05Value and Layer05Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer06Checked Property
Description
TRUE, when limit 6 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer06Value and Layer06Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

449

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer07Checked Property
Description
TRUE, when limit 7 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer07Value and Layer07Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer08Checked Property
Description
TRUE, when limit 8 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer08Value and Layer08Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer09Checked Property
Description
TRUE, when limit 9 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer09Value and Layer09Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

450

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer10Checked Property
Description
TRUE, when limit 10 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer10Value and Layer10Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer00Color Property
Description
Defines or returns the color for limit 0. LONG write/read access.
When monitoring of the limit value is activated (Layer00Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer01Color Property
Description
Defines or returns the color for limit 1. LONG write/read access.
When monitoring of the limit value is activated (Layer01Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

451

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer02Color Property
Description
Defines or returns the color for limit 2. LONG write/read access.
When monitoring of the limit value is activated (Layer02Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer03Color Property
Description
Defines or returns the color for limit 3. LONG write/read access.
When monitoring of the limit value is activated (Layer03Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer04Color Property
Description
Defines or returns the color for limit 4. LONG write/read access.
When monitoring of the limit value is activated (Layer04Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

452

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer05Color Property
Description
Defines or returns the color for limit 5. LONG write/read access.
When monitoring of the limit value is activated (Layer05Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer06Color Property
Description
Defines or returns the color for limit 6. LONG write/read access.
When monitoring of the limit value is activated (Layer06Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer07Color Property
Description
Defines or returns the color for limit 7. LONG write/read access.
When monitoring of the limit value is activated (Layer07Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

453

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer08Color Property
Description
Defines or returns the color for limit 8. LONG write/read access.
When monitoring of the limit value is activated (Layer08Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer09Color Property
Description
Defines or returns the color for limit 9. LONG write/read access.
When monitoring of the limit value is activated (Layer09Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer10Color Property
Description
Defines or returns the color for limit 10. LONG write/read access.
When monitoring of the limit value is activated (Layer10Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer00FillColor property
Bar fill color 0 (Layer00FillColor)
The "Layer00FillColor" attribute defines the color with which the bar is filled in relation to "Limit
0".

454

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "Layer00FillColor" attribute can be made dynamic with the name "Layer00FillColor".

Layer01FillColor property
Layer01FillColor
The "Layer01FillColor" attribute defines the color with which the bar is filled in relation to "Limit
1".
The "Layer01FillColor" attribute can be made dynamic with the name "Layer01FillColor".

Layer02FillColor property
Layer02FillColor
The "Layer02FillColor" attribute defines the color with which the bar is filled in relation to "Limit
2".
The "Layer02FillColor" attribute can be made dynamic with the name "Layer02FillColor".

Layer03FillColor property
Layer03FillColor
The "Layer03FillColor" attribute defines the color with which the bar is filled in relation to "Limit
3".
The "Layer03FillColor" attribute can be made dynamic with the name "Layer03FillColor".

Layer04FillColor property
Layer04FillColor
The "Layer04FillColor" attribute defines the color with which the bar is filled in relation to "Limit
4".
The "Layer04FillColor" attribute can be made dynamic with the name "Layer04FillColor".

Layer05FillColor property
Layer05FillColor
The "Layer05FillColor" attribute defines the color with which the bar is filled in relation to "Limit
5".
The "Layer05FillColor" attribute can be made dynamic with the name "Layer05FillColor".

Layer06FillColor property
Layer06FillColor
The "Layer06FillColor" attribute defines the color with which the bar is filled in relation to "Limit
6".
The "Layer06FillColor" attribute can be made dynamic with the name "Layer06FillColor".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

455

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer07FillColor property
Layer07FillColor
The "Layer07FillColor" attribute defines the color with which the bar is filled in relation to "Limit
7".
The "Layer07FillColor" attribute can be made dynamic with the name "Layer07FillColor".

Layer08FillColor property
Layer08FillColor
The "Layer08FillColor" attribute defines the color with which the bar is filled in relation to "Limit
8".
The "Layer08FillColor" attribute can be made dynamic with the name "Layer08FillColor".

Layer09FillColor property
Layer09FillColor
The "Layer09FillColor" attribute defines the color with which the bar is filled in relation to "Limit
9".
The "Layer09FillColor" attribute can be made dynamic with the name "Layer09FillColor".

Layer10FillColor property
Layer10FillColor
The "Layer10FillColor" attribute defines the color with which the bar is filled in relation to "Limit
10".
The "Layer10FillColor" attribute can be made dynamic with the name "Layer10FillColor".

Layer00FillStyle property
Layer00FillStyle
The "Layer00FillStyle" attribute defines the style of the bar in relation to "Limit 0". For the fill
pattern to become visible, "bar fill color 0" must differ from "bar color 0".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer00FillStyle" attribute can be made dynamic with the name "Layer00FillStyle".

Layer01FillStyle property
Layer01FillStyle
The "Layer01FillStyle" attribute defines the style of the bar in relation to "Limit 1". For the fill
pattern to become visible, "bar fill color 1" must differ from "bar color 1".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.

456

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "Layer01FillStyle" attribute can be made dynamic with the name "Layer01FillStyle".

Layer02FillStyle property
Layer02FillStyle
The "Layer02FillStyle" attribute defines the style of the bar in relation to "Limit 2". For the fill
pattern to become visible, "bar fill color 2" must differ from "bar color 2".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer02FillStyle" attribute can be made dynamic with the name "Layer02FillStyle".

Layer03FillStyle property
Layer03FillStyle
The "Layer03FillStyle" attribute defines the style of the bar in relation to "Limit 3". For the fill
pattern to become visible, "bar fill color 3" must differ from "bar color 3".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer03FillStyle" attribute can be made dynamic with the name "Layer03FillStyle".

Layer04FillStyle property
Layer04FillStyle
The "Layer04FillStyle" attribute defines the style of the bar in relation to "Limit 4". For the fill
pattern to become visible, "bar fill color 4" must differ from "bar color 4".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer04FillStyle" attribute can be made dynamic with the name "Layer04FillStyle".

Layer05FillStyle property
Layer05FillStyle
The "Layer05FillStyle" attribute defines the style of the bar in relation to "Limit 5". For the fill
pattern to become visible, "bar fill color 5" must differ from "bar color 5".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer05FillStyle" attribute can be made dynamic with the name "Layer05FillStyle".

Layer06FillStyle property
Layer06FillStyle
The "Layer06FillStyle" attribute defines the style of the bar in relation to "Limit 6". For the fill
pattern to become visible, "bar fill color 6" must differ from "bar color 6".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

457

VBS for Creating Procedures and Actions


1.14 VBS Reference
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer06FillStyle" attribute can be made dynamic with the name "Layer06FillStyle".

Layer07FillStyle property
Layer07FillStyle
The "Layer07FillStyle" attribute defines the style of the bar in relation to "Limit 7". For the fill
pattern to become visible, "bar fill color 7" must differ from "bar color 7".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer07FillStyle" attribute can be made dynamic with the name "Layer07FillStyle".

Layer08FillStyle property
Layer08FillStyle
The "Layer08FillStyle" attribute defines the style of the bar in relation to "Limit 8". For the fill
pattern to become visible, "bar fill color 8" must differ from "bar color 8".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer08FillStyle" attribute can be made dynamic with the name "Layer08FillStyle".

Layer09FillStyle property
Layer09FillStyle
The "Layer09FillStyle" attribute defines the style of the bar in relation to "Limit 9". For the fill
pattern to become visible, "bar fill color 9" must differ from "bar color 9".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer09FillStyle" attribute can be made dynamic with the name "Layer09FillStyle".

Layer10FillStyle property
Layer10FillStyle
The "Layer10FillStyle" attribute defines the style of the bar in relation to "Limit 10". For the fill
pattern to become visible, "bar fill color 10" must differ from "bar color 10".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer10FillStyle" attribute can be made dynamic with the name "Layer10FillStyle".

458

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer00Value Property
Description
Determines the value for "Limit 0" or returns it.
Monitoring only takes effect when the Layer00Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer01Value Property
Description
Determines the value for "Limit 1" or returns it.
Monitoring only takes effect when the Layer01Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer02Value Property
Description
Determines the value for "Limit 2" or returns it.
Monitoring only takes effect when the Layer02Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer03Value Property
Description
Determines the value for "Limit 3" or returns it.
Monitoring only takes effect when the Layer03Checked property value is set to TRUE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

459

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer04Value Property
Description
Determines the value for "Limit 4" or returns it.
Monitoring only takes effect when the Layer04Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer05Value Property
Description
Determines the value for "Limit 5" or returns it.
Monitoring only takes effect when the Layer05Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer06Value Property
Description
Determines the value for "Limit 6" or returns it.
Monitoring only takes effect when the Layer06Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

460

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Layer07Value Property
Description
Determines the value for "Limit 7" or returns it.
Monitoring only takes effect when the Layer07Checked property value is set to TRUE.

See also
ScreenItem Object (Page 141)
3D Bar (Page 184)

Layer08Value Property
Description
Determines the value for "Limit 8" or returns it.
Monitoring only takes effect when the Layer08Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer09Value Property
Description
Determines the value for "Limit 9" or returns it.
Monitoring only takes effect when the Layer09Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer10Value Property
Description
Determines the value for "Limit 10" or returns it.
Monitoring only takes effect when the Layer10Checked property value is set to TRUE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

461

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

LayerDeclutteringEnable Property
Description
Returns the LayerDecluttering properties of a picture.
LayerDecluttering enables fading in and out of layers depending on the set minimum and
maximum zoom.
BOOLEAN Read-only access.

Example:
The example outputs the LayerDecluttering Property NewPDL1 as a trace.

'VBS156
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

Layers Property
Description
Returns an object of type "Layers".
Layers (read-only)

See also
Layers Object (Listing) (Page 137)
HMIRuntime Object (Page 134)

462

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Le - Li
Left Property
Description
Defines or returns the X-coordinate of an object (measured from the top left edge of the picture)
in pixels. The X-coordinate relates to the top left corner of the rectangle enclosing the object.
LONG (write-read access)

Example:
The following example shifts all objects in the picture "NewPDL1" 5 pixels to the left:

'VBS79
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Left = objScrItem.Left - 5
Next

See also
Top Property (Page 628)
ScreenItem Object (Page 141)

LeftComma Property
Description
Defines or returns the number of digits to the left of the decimal point (0 to 20).

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

463

VBS for Creating Procedures and Actions


1.14 VBS Reference

LightEffect Property
Description
TRUE, when the light effect should be activated. BOOLEAN write-read access.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

LimitHigh4 Property
Description
Determines the upper limit value for "Reserve 4" or returns it.
The CheckLimitHigh4 property must be set to TRUE in order that the "Reserve 4" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitHigh4 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LimitHigh5 Property
Description
Determines the upper limit value for "Reserve 5" or returns it.
The CheckLimitHigh5 property must be set to TRUE in order that the "Reserve 5" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitHigh5 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

464

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

LimitLow4 Property
Description
Determines the lower limit value for "Reserve 4" or returns it.
The CheckLimitLow4 property must be set to TRUE in order that the "Reserve 4" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow4 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LimitLow5 Property
Description
Determines the lower limit value for "Reserve 5" or returns it.
The CheckLimitLow5 property must be set to TRUE in order that the "Reserve 5" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow5 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LimitMax Property
Description
Determines the upper limit value as an absolute value depending on the data format or returns
it.
If the displayed value exceeds the upper limit value, it is displayed by a sequence of *** (not
displayable).

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

465

VBS for Creating Procedures and Actions


1.14 VBS Reference

LimitMin Property
Description
Determines the lower limit value as an absolute value depending on the data format or returns it.
If the displayed value exceeds the upper limit value, it is displayed by a sequence of *** (not
displayable).

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

LineColor property
Color of window dividers - LineColor
Specifies the color of the window dividers. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name LineColor. The data
type is LONG.

LineFont Property
Description
TRUE, when the font size should be automatically adapted to the line height. BOOLEAN writeread access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

LineHeight Property
Description
TRUE, when the line height can be modified. BOOLEAN write-read access.
The "LineHeight" property is only deactivated if both properties "LineHeight" and "LineFont"
are set to "FALSE".

466

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

LineJoinStyle property
Description
Defines the way that corners are displayed in a tube polygon.
Angle
Round

The tubes are joined at corner points without rounding


The tubes are rounded at the outside corner points.

LineTitle Property
Description
TRUE, when the message window a column with consecutive number contains queued
messages. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

LineWidth property (before WinCC V7)


Description
Specifies the line width of the trend referenced by "Index". Value range from 0 to 10.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

LineWidth property
Line weight of window dividers - LineWidth
Defines the line weight of the window dividers in pixels.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

467

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name LineWidth. The data
type is LONG.

ListType Property
Description
Returns the data type displayed in the case of a text list object. Read only access.
Value range from 0 to 2.
0 = decimal
1 = binary
2 = bit

See also
Text list (Page 211)
ScreenItem Object (Page 141)

Lo
LoadDataImmediately property
Load archive data - LoadDataImmediately
Defines whether the tag values for the time range to be displayed are loaded from the archives
when the picture is called.
Value

Explanation

TRUE

Loads archived values on picture calls.

FALSE

Loads only current values on picture calls.

The attribute can be assigned dynamic properties by means of the name


LoadDataImmediately. The data type is BOOLEAN.

LoadDataImmediately property (before WinCC V7)


Description
TRUE, when the tag values for the time range to be displayed are loaded from the archives
on opening a picture. BOOLEAN write-read access.

468

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LocaleID Property
Description
Defines the language to be displayed in the control, e.g. 1031 for German. Write/Read access.
The list of language codes is available in the WinCC documentation (Index > Language Code).

See also
WinCC Slider Control (Page 281)
WinCC Gauge Control (Page 264)
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

LocaleSpecificSettings Property
Description
TRUE if a font can be assigned and formatted for each Runtime language. BOOLEAN writeread access.

LockBackColor Property
Description
Defines or returns the background color of the button for a locked measuring point. LONG
write/read access.
The LockStatus property must be set to TRUE for the background color to be displayed.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

469

VBS for Creating Procedures and Actions


1.14 VBS Reference

LockStatus Property
Description
TRUE, when a locked measuring point should be displayed. BOOLEAN write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

LockText Property
Description
Defines the label of a button for a locked measuring point.
The LockStatus property must be set to TRUE for the label to be displayed.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

LockTextColor Property
Description
Defines or returns the color of the button label for a locked measuring point. LONG write/read
access.
The LockStatus property must be set to TRUE for the background color to be displayed.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Logging Property
Description
Returns an object of type "Logging".
Logging (read-only)

470

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
HMIRuntime Object (Page 134)
Logging Object (Page 138)

LongStrokesBold Property
Description
TRUE, when the long sections of a scale should be displayed in bold face. BOOLEAN writeread access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LongStrokesOnly Property
Description
TRUE, when only the long sections of a scale should be displayed . BOOLEAN write-read
access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LongStrokesSize Property
Description
Defines or returns the length of the axis section in pixels.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

471

VBS for Creating Procedures and Actions


1.14 VBS Reference

LongStrokesTextEach Property
Description
Returns the value which defines which sections of the scale displayed should be labeled (1 =
every section, 2 = every second section, etc.). Read only access

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LongTimeArchiveConsistency Property
LongTimeArchiveConsistency
If "LongTimeArchiveConsistency" is set to "No", 1000 messages are displayed in the long-term
archive list on the single-user system, server or client for each server, or for each redundant
server pair.
If the "LongTimeArchiveConsistency" is set to "yes", the most recent 1000 messages are
displayed on the client of all servers or redundant server pair in the long-term archive list.
The attribute can be assigned dynamic properties by means of the name
LongTimeArchiveConsistency . The data type is BOOLEAN.

LongTimeArchiveConsistency property (before WinCC V7)


Description
If "LongTimeArchiveConsistency" is set to "No", 1000 messages are displayed in the long-term
archive list in the single-user system, server or client for each server or for each redundant
server pair.
If the "LongTimeArchiveConsistency" is set to "yes", the most recent 1000 messages are
displayed on the client of all servers or redundant server pair in the long-term archive list.
Write/Read access.

LowerLimit Property
Description
WinCC Online Trend Control/WinCC Function Trend Control
TRUE, when the "LowerLimitColor" specification is to be used in order to identify the tag values
(from a trend referenced via "Index") which lie below the value defined in "LowerLimitValue".
BOOLEAN write-read access.

472

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
WinCC Online Trend Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LowerLimitColor Property
Description
WinCC Online Trend Control/WinCC Function Trend Control
Defines the color to be used in order to identify the tag values (from trend referenced via
"Index") which lie below the value defined in "LowerLimitValue". Whether the information is
evaluated is dependent on the value of the "LowerLimit" property. The color is defined as an
RGB value. LONG write-read access.
Online Table Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LowerLimitTagName Property
Description
This defines the lower limit of the trend range, which is automatically taken from the variable
properties configured in PCS 7. Write/Read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

473

VBS for Creating Procedures and Actions


1.14 VBS Reference

LowerLimitValue Property
Description
WinCC Online Trend Control/WinCC Function Trend Control
Tag values (from a trend referenced via "Index") which lie below the value defined by
"LowerLimitValue" are identified by the color specified in "LowerLimitColor". Whether the
information is evaluated is dependent on the value of the "LowerLimit" attribute.
Online Table Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

1.14.4.12 M
Ma - Mc
Marker Property
Description
TRUE, when the limit values should be displayed as scale values. BOOLEAN write-read
access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Max Property
Description
Defines or returns the absolute value in the case of a full value display. This value is displayed
if the scale display is active.

474

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
Slider (Page 226)
3D Bar (Page 184)
ScreenItem Object (Page 141)

MaximizeButton Property
Description
TRUE, when the object can be maximized in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

MCGUBackColorOff-Eigenschaft
Description
Defines or returns the background color for flash status "Off" in the case of the "Departed
Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUBackColorOn Property
Description
Defines or returns the background color for flash status "On" in the case of the "Departed
Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

475

VBS for Creating Procedures and Actions


1.14 VBS Reference

MCGUBackFlash Property
Description
TRUE, when the background should flash when a message departs unacknowledged.
BOOLEAN write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUTextColorOff Property
Description
Defines or returns the color of the text for flash status "Off" in the case of the "Departed
Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUTextColorOn Property
Description
Defines or returns the background color of the text for flash status "Off" in the case of the
"Departed Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUTextFlash Property
Description
TRUE, when the font should flash when a message departs unacknowledged. BOOLEAN writeread access.

476

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOBackColorOff Property
Description
Defines or returns the background color for flash status "Off" in the case of the "Arrived" status.
LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOBackColorOn Property
Description
Defines or returns the background color for flash status "On" in the case of the "Arrived" status.
LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOBackFlash Property
Description
TRUE, when the background should flash when a message arrives. BOOLEAN write-read
access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

477

VBS for Creating Procedures and Actions


1.14 VBS Reference

MCKOTextColorOff Property
Description
Defines or returns the color of the text for flash status "Off" in the case of the "Arrived" status.
LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOTextColorOn Property
Description
Defines or returns the background color of the text for flash status "On" in the case of the
"Arrived" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOTextFlash Property
Description
TRUE, when the font should flash when a message arrives. BOOLEAN write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQBackColorOff Property
Description
Defines or returns the background color for flash status "Off" in the case of the "Departed
Acknowledged" status. LONG write-read access.

478

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQBackColorOn Property
Description
Defines or returns the background color for flash status "On" in the case of the "Departed
Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQBackFlash Property
Description
TRUE, when the background should flash when a message departs acknowledged. BOOLEAN
write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQTextColorOff Property
Description
Defines or returns the color of the text for flash status "Off" in the case of the "Departed
Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

479

VBS for Creating Procedures and Actions


1.14 VBS Reference

MCKQTextColorOn Property
Description
Defines or returns the background color of the text for flash status "On" in the case of the
"Departed Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQTextFlash Property
Description
TRUE, when the font should flash when a message departs acknowledged. BOOLEAN writeread access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCText Property
Description
Defines or returns the label for the respective message class.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

480

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Me
MeasurePoints Property
Description
The "Index" property references a trend. "MeasurePoints" defines the number of measuring
points to be displayed. The information is only evaluated when the "TimeAxis" property is set
to the value "-1".

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

MenuToolBarConfig Property
Description
Loads the given configuration file with configured menu and toolbars or returns the name of
the configuration file. STRING (write-read access)

See also
Picture Window (Page 194)
HMIRuntime Object (Page 134)

MessageBlockAlign property
Alignment - MessageBlockAlign
Aligns the contents of a selected message block in the table.
To change the alignment, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The following settings are available:
Value

Description

Explanation

Left

Aligns the contents of a selected message block to the left.

Centered

Aligns the contents of a selected message block to the center.

Right

Aligns the contents of a selected message block to the right.

The attribute can be assigned dynamic properties by means of the name MessageBlockAlign.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

481

VBS for Creating Procedures and Actions


1.14 VBS Reference

MessageBlockAutoPrecisions property
Automatic decimal places - MessageBlockAutoPrecisions
Enables automatic setting of the number of decimal places.
Value

Explanation

TRUE

The number of decimal places is set automatically. The value in the "Decimal places" field is disabled.

FALSE

The value in the "Decimal places" field is enabled.

The attribute can be assigned dynamic properties by means of the name


MessageBlockAutoPrecisions. The data type is BOOLEAN.

MessageBlockCaption property
Label - MessageBlockCaption
Defines the label of the column title in the message window for the selected message block.
The label specified is active in all Runtime languages.
To change the label, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockCaption. The data type is STRING.

MessageBlockCount property
MessageBlockCount
Defines the number of message blocks which are available for the message list and the hitlist.
The attribute can be assigned dynamic properties by means of the name
MessageBlockCount . The data type is LONG.

MessageBlockDateFormat property
Date format - MessageBlockDateFormat
Defines the date format for displaying messages.
To change the date format, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The following date formats are available:

482

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name


MessageBlockDateFormat. The data type is STRING.

MessageBlockExponentialFormat property
Exponential notation - MessageBlockExponentialFormat
Specifies the exponential notation for visualization of the values of a selected message block.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


MessageBlockExponentialFormat. The data type is BOOLEAN.

MessageBlockFlashMode property
Flash mode - MessageBlockFlashMode
Specifies how the content of the selected message block flashes in Runtime when a message
appears. The "Flashing on" option must be selected.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
Valu
e

Description

Explanation

Standard

The text color switches between the standard color and the flash color when flashing

Switch
background
color/text color

The color of the background and the text color switch during flashing. You configure the message
colors for the type of message in the alarm logging editor.

Switch message
color/table color

The message colors and the configured table colors switch during flashing. You configure the
message colors for the type of message in the alarm logging editor. Set the table colors in the
"Layout" tab in the AlarmControl.

The attribute can be assigned dynamic properties by means of the name


MessageBlockFlashMode. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

483

VBS for Creating Procedures and Actions


1.14 VBS Reference

MessageBlockFlashOn property
Flashing on - MessageBlockFlashOn
Enables flashing of the selected message block in Runtime after a message was activated.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
Value

Explanation

TRUE

Flashing message block content.

FALSE

No flashing message block content.

The attribute can be assigned dynamic properties by means of the name


MessageBlockFlashOn. The data type is BOOLEAN.

MessageBlockHideText property
Content as text - MessageBlockHideText
Enables the textual display of the content of a selected message block.
Value

Explanation

TRUE

The content is not displayed in text format. The option is disabled.

FALSE

The content is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name


MessageBlockHideText. The data type is BOOLEAN.

MessageBlockHideTitleText property
Title as text - MessageBlockHideTitleText
Enables the display of the header of a selected message block in text format.
Value

Explanation

TRUE

The header is not displayed in text format. The option is disabled.

FALSE

The header is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name


MessageBlockHideTitleText. The data type is BOOLEAN.

484

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

MessageBlockId property
MessageBlockId
Default assignment of the ID number and message block in WinCC AlarmControl.
The attribute can be assigned dynamic properties by means of the name MessageBlockID.
The data type is LONG.

MessageBlockInvertUseMessageColor property
MessageBlockInvertUseMessageColor
Specifies for the message block whether or not the message colors are displayed, contrary to
the central setting for the AlarmControl . For example, the "UseMessageColor" property is set
to "FALSE" for the AlarmControl. You have set the "MessageBlockInvertUseMessageColor"
property to "TRUE" for a message block. This causes the message colors to be displayed for
this message block in Runtime.
Value

Explanation

TRUE

Contrary to the central setting in "UseMessageColor", the message colors are displayed or not displayed
for the message block.

FALSE

Just like the central setting in "UseMessageColor", the message colors are displayed or not displayed
for the message block.

The attribute can be assigned dynamic properties by means of the name


MessageBlockInvertUseMessageColor. The data type is BOOLEAN.

MessageBlockIndex property
MessageBlockIndex
References an existing message block. Using this attribute, you can assign a specific message
block values for other attributes.
Values between 0 and "MessageBlockCount" minus 1 are valid for "MessageBlockIndex".
Attribute "MessageBlockCount" defines the number of available message blocks.
The attribute can be assigned dynamic properties by means of the name
MessageBlockIndex. The data type is LONG.

MessageBlockLeadingZeros property
Number of digits - MessageBlockLeadingZeros
Defines the number of leading zeros for the message block content. The maximum number is
"11". A "0" value deactivates the "With leading zeros" option.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

485

VBS for Creating Procedures and Actions


1.14 VBS Reference
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockLeadingZeros. The data type is LONG.

MessageBlockLength property
Length in characters - MessageBlockLength
Defines the length of the message block selected based on the number of characters.
To change the length, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockLength. The data type is LONG.

MessageBlockName property
Object name - MessageBlockName
Displays the object name of the message block selected. You cannot edit this name.
The data type is STRING.

MessageBlockPrecisions property
Decimal places - MessageBlockPrecisions
Specifies the decimal precision of the values of a selected message block. You can only enter
the value if the "Automatic" option is disabled.
The attribute can be assigned dynamic properties by means of the name
MessageBlockPrecisions. The data type is SHORT.

MessageBlockSelected property
Available message blocks - MessageBlockSelected
The available message blocks are blocks that can be used in Runtime for the message list or
hitlist.
Select the "Message blocks" tab to activate existing message blocks as required in the Control.
Select the "Hitlist" and "Message list" tabs to configure the hitlist and message list based on
the available blocks.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".

486

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
MessageBlockSelected. The data type is BOOLEAN.

MessageBlockShowDate property
Show date - MessageBlockShowDate
Enables the display of a date in the "Time" message block in addition to the time.
Value

Explanation

TRUE

Date and time are displayed.

FALSE

The time is displayed.

The attribute can be assigned dynamic properties by means of the name


MessageBlockShowDate. The data type is BOOLEAN.

MessageBlockShowIcon property
Content as icon - MessageBlockShowIcon
Enables the display of the content of a selected message block as icon.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name


MessageBlockShowIcon. The data type is BOOLEAN.

MessageBlockShowTitleIcon property
Title as icon - MessageBlockShowTitleIcon
Enables the display of the title of a selected message block as icon.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


MessageBlockShowTitleIcon. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

487

VBS for Creating Procedures and Actions


1.14 VBS Reference

MessageBlockTextId property
Text ID - MessageBlockTextId
Specifies the caption of the selected message block using a Text ID which was derived from
the text library. The caption is adapted automatically if a user changes the Runtime language.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockTextId. The data type is LONG.

MessageBlockTimeFormat property
MessageBlockTimeFormat
Defines which time format or duration format is used for displaying the messages.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss

Hours:Minutes:Seconds, e.g. 15:35:44

HH:mm:ss.ms

Hours:Minutes:Seconds.Milliseconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The following time duration formats are available:


Value

Explanation

Automatic

The time duration format is determined automatically.

d H:mm:ss

Day Hours:Minutes:Seconds, e.g. 1 2:03:55.

H:mm:ss.

Hours:Minutes:Seconds, e.g. 26:03:55.

m:ss

Minutes:Seconds, Example: 1563:55.

Seconds, e.g. 93835.

The attribute can be made dynamic by means of the name MessageBlockTimeFormat. The
data type is STRING.

MessageBlockType property
MessageBlockType
Displays the association of the message block.

488

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The following settings are available:
Value

Description

Explanation

System block

The message block belongs to the system block category.

Text block

The message block belongs to the user text block category.

Process value block

The message block belongs to the process value block category.

Hitlist block

The message block belongs to the message blocks of the hitlist.

The attribute can be assigned dynamic properties by means of the name


MessageBlockType . The data type is LONG.

MessageClass Property
Description
Defines the respective message type (Alarm High, Alarm Low, Warning High, Warning Low, ...)
for which the "Display Text", "Arrived-", "Arrived Acknowledged -" and "Departed
Unacknowledged -" settings have been configured.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MessageColumnAdd property
MessageColumnAdd
Adds the selected message block from the list of existing message blocks to the list of selected
message blocks.
The attribute can be assigned dynamic properties by means of the name
MessageColumnAdd . The data type is STRING.

MessageColumnCount property
MessageColumnCount
Specifies the number of message blocks to be displayed in the message list in Runtime.
The attribute can be assigned dynamic properties by means of the name
MessageColumnCount . The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

489

VBS for Creating Procedures and Actions


1.14 VBS Reference

MessageColumnIndex property
MessageColumnIndex
References a message block selected for the message list. Using this attribute you can assign
the values of other attributes to a specific message block of the message list.
Values between 0 and "MessageColumnCount" minus 1 are valid for "MessageColumnIndex".
Attribute "MessageColumnCount" defines the number of message blocks selected for the
message list.
The "MessageColumnIndex" attribute can be assigned dynamic properties by means of
attribute MessageColumnRepos. The data type is LONG.

MessageColumnName property
MessageColumnName
Displays the name of the message block of the message list which is referenced with attribute
"MessageColumnIndex". You cannot edit this name.
The attribute can be assigned dynamic properties with the name MessageColumnName. The
data type is STRING.

MessageColumnRemove property
MessageColumnRemove
Cuts the marked message block from the list of selected message blocks and pastes it to the
list of available message blocks.
The attribute can be assigned dynamic properties by means of the name
MessageColumnRemove . The data type is STRING.

MessageColumnRepos property
Up/Down - MessageColumnRepos/HitlistColumnRepos
Resorts the message blocks. The "Up" and "Down" commands move the selected message
block accordingly in the list. This moves the message block in Runtime Control towards the
front or towards the back.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnRepos .
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnRepos.
The data type is LONG.

490

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

MessageColumnSort property
MessageColumnSort
Defines the sorting order of the message block referenced in "MessageColumnIndex" .
The following settings are available:
Value

Description

Explanation

no

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name


MessageColumnSort . The data type is LONG.

MessageColumnSortIndex property
MessageColumnSortIndex
Defines the sorting order of the message block referenced in "MessageColumnIndex". The
sorting criterion is removed from "MessageColumnSort" if you set a "0" value.
The attribute can be assigned dynamic properties by means of the name
MessageColumnSortIndex. The data type is LONG.

MessageColumnVisible property
Selected message blocks - MessageColumnVisible/HitlistColumnVisible
Selected message blocks of message list or hitlist that are displayed in Runtime. Defines
whether the message block referenced in "MessageColumnIndex" or "HitlistColumnIndex" is
displayed.
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnVisible.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnVisible.
The data type is BOOLEAN.

MessageListType property
Active list on picture call - MessageListType
Selection field for defining the active list for picture calls.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

491

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Explanation

Message list

The currently active messages are displayed after a picture was


called.

Short-term archive list

A short-term archive list displays the logged messages after the


picture was called. The display is updated immediately on activation
of new messages.

Long-term archive list

A long-term archive list displays the logged messages after a picture


was called.

Lock list

Only the currently locked messages are displayed after a picture


was called.

Hitlist

The configured statistics data is displayed after a picture was called.

List of messages to be
hidden

The messages to be hidden are displayed at the call of a picture.

The attribute can be assigned dynamic properties by means of the name MessageListType.
The data type is LONG.

Mi - Ms
Min Property
Description
Defines or returns the absolute value in the case of the smallest value display. This value is
displayed if the scale display is active.

See also
Slider (Page 226)
Bar (Page 189)
3D Bar (Page 184)
ScreenItem Object (Page 141)

MinuteNeedleHeight Property
Description
Defines or returns the length of the minute hand for the analog clock. The specification of the
length is entered as a percentage value in relation to half the length of the short side of the
rectangular background. Write/Read access.
Example:
The shorter side of the rectangular background is 100 pixels long.
The minute hand length is 80.
This results in a length of the minute hand of (100 pixels / 2) * 0.8 = 40 pixels.

492

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

MinuteNeedleWidth Property
Description
Defines or returns the width of the minute hand for the analog clock. The width is specified as
a percentage value related to double the length of the minute hand.
Example:
The length of the minute hand is 40 pixels.
The minute hand width is 8.
This results in a width of the minute hand of 40 pixels * 2 * 0.08 = 6 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

Moveable Property
Description
TRUE, when the object can be moved in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

Moveable Property
Movable
Defines whether the control can be moved in Runtime.
Value

Explanation

TRUE

The control can be moved in Runtime.

FALSE

The control cannot be moved in Runtime.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

493

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name Moveable. The data
type is BOOLEAN.

MsgCtrlFlags Property
Description
Defines the sorting sequence in Alarm Control. Write/Read access.
0: The entries are sorted by the value in the time column and in ascending order, i.e. the
oldest messages are displayed at the top of the message window.
1: The entries are sorted by the value in the time column in descending order, i.e. the oldest
messages are displayed at the bottom of the message window. In the case of this value,
the "AutoScroll" property is automatically deactivated, otherwise the current message could
be moved out of the display area of the message window.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

MsgFilterSQL property (before WinCC V7)


Description
Defines an SQL Statement to the selected messages displayed in the message window. Write/
Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

MsgFilterSQL property
MsgFilterSQL
Defines one or several SQL statements for the custom selection of messages. Multiple userdefined selections are logically linked by "OR" operation. The SQL statements of
"DefaultMsgFilterSQL" and "MsgFilterSQL" are linked logically by "AND" operation if you
define a default selection by means of "DefaultMsgFilterSQL".
The attribute can be assigned dynamic properties by means of the name MsgFilterSQL. The
data type is STRING.

494

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.4.13 N
Name Property
Description of layer and tag object
Returns the object name. STRING (read only)
In the case of tags, the name of the tag without server and tag prefix
In the case of layers, the layer name
Tags
The tag "Name" property is used to address the tag via the tag list. The name of a tag can
contain a server prefix. In WinCC, tag names are structured according to the following scheme:
<Serverprefix>::<Variablenprefix><Name der Variable>
If the tag name alone is specified, the server prefix and tag prefix are removed from the context
of the picture.
If the tag is specified with a server prefix in the tag name, the tags and server prefix of the
context are ignored and the server prefix included is used.

WinCC Function Trend Control Description


The "Index" property references a trend. "Name" defines the name of the trend.

Description Project Object


Returns the name of the current Runtime project. STRING (read only)
Example:
The following example returns the name of the current Runtime project as Trace:

'VBS160
HMIRuntime.Trace "Name: " & HMIRuntime.ActiveProject.Name & vbNewLine

Description of DataItem Object


Returns the name of the DataItem object.

See also
ActiveProject Property (Page 305)
WinCC Function Trend Control (before WinCC V7) (Page 290)
Tag Object (Page 152)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

495

VBS for Creating Procedures and Actions


1.14 VBS Reference
Ellipse segment (Page 162)
Layer Object (Page 136)
DataItem Object (Page 129)

NeedleColor Property
Description
Defines or returns the color of the pointer. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

NormalColor Property
Description
Defines the color of the normal area of the scale. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

NumberLines Property
Description
Text list
Defines or return the number of lines the text list object should contain. If the amount of
configured text is larger than this value, the selection list receives a vertical scroll bar.
Combobox and list box
Defines or returns for the Combobox and List Box objects the number of entries the object
should contain. You can define a maximum of 100,000 lines.
At the same time, the value of the "Number of rows" attribute specifies the upper limit value
for the "Index" attribute in the "Font" property group. Changing the value can have the following
effects:

496

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Increasing the number: New lines are added at the bottom. The standard labeling of the
new filed can be changed using the "Text" attribute in the "Font" property group.
Reducing the number: All lines are removed for which the value of the "Index" attribute is
higher than the new number.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

NumItems Property
Description
Returns the number of trends or column pairs (visible and invisible) in the window which have
been configured. Write/Read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1.14.4.14 O
Ob - On
Object Property
Description
If a non-WinCC control is used, it is possible that the properties provided by the control have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an external control supplier can be
accessed using the additional "object" property.

Example:
Address the properties of an external control supplier as follows:
Control.object.type
If the following form alone is used

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

497

VBS for Creating Procedures and Actions


1.14 VBS Reference
Control.type
the properties of the ScreenItem object are used in the case of identical names.

See also
Controls (Page 232)
ScreenItem Object (Page 141)

ObjectName Property
Description
Returns the object name.
In the case of graphic objects, the object name
In the case of pictures, the picture name
STRING (read only)

Example:
The following example issues the names of all the objects contained in the picture "NewPDL1":

'VBS80
Dim objScreen
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
lngAnswer = MsgBox("Name of object " & lngIndex & ": " & strName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

Pictures
Establish the picture name directly from the "ObjectName" property:

'VBS81
MsgBox "Screenname: " & HMIRuntime.ActiveScreen.ObjectName

498

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Screen Object (Page 146)
ScreenItem Object (Page 141)

ObjectSizeDeclutteringEnable Property
Description
Returns the ObjectSizeDecluttering properties of a picture.
Upon activated ObjectSizeDecluttering, only objects within a set size range are displayed.
You specify the upper and lower limits for the display range in Graphics Designer under "Tools>
Settings > Show/Hide".
BOOLEAN Read-only access.

Example:
The example outputs the Decluttering Properties of the picture NewPDL1 as a trace.

'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Min: " & objScreen.ObjectSizeDeclutteringMin & vbNewLine
HMIRuntime.Trace "Max: " & objScreen.ObjectSizeDeclutteringMax & vbNewLine
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

ObjectSizeDeclutteringMax Property
Description
Using the ObjectSizeDeclutteringMax property, the upper size range of a picture may be read.
Objects which are larger than the stated pixel size are no longer displayed when
ObjectSizeDecluttering is activated.
LONG read-only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

499

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
The example outputs the Decluttering Properties of the picture NewPDL1 as a trace.

'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Min: " & objScreen.ObjectSizeDeclutteringMin & vbNewLine
HMIRuntime.Trace "Max: " & objScreen.ObjectSizeDeclutteringMax & vbNewLine
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

ObjectSizeDeclutteringMin Property
Description
Using the ObjectSizeDeclutteringMin property, the lower size range of a picture may be read.
Objects which are smaller than the stated pixel size are no longer displayed when
ObjectSizeDecluttering is activated.
LONG read-only access.

Example:
The example outputs the Decluttering Properties of the picture NewPDL1 as a trace.

'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Min: " & objScreen.ObjectSizeDeclutteringMin & vbNewLine
HMIRuntime.Trace "Max: " & objScreen.ObjectSizeDeclutteringMax & vbNewLine
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

OffsetLeft Property
Description
Defines or returns the distance of the picture from the left edge of the picture window.

500

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The picture is displayed as a cutout of the picture window. The picture scroll bars are located
at the left and upper edge of the picture. If you wish to display the picture in the picture window
by using the horizontal and vertical positioning of the picture scroll bars, use the properties
"ScrollPositionX" and "ScrollPositionY" for such positioning.

See also
ScrollPositionY Property (Page 549)
ScrollPositionX Property (Page 549)
Picture Window (Page 194)
ScreenItem Object (Page 141)

OffsetTop Property
Description
Defines or returns the distance of the picture from the top edge of the picture window.
The picture is displayed as a cutout of the picture window. The picture scroll bars are located
at the left and upper edge of the picture. If you wish to display the picture in the picture window
by using the horizontal and vertical positioning of the picture scroll bars, use the properties
"ScrollPositionX" and "ScrollPositionY" for such positioning.

See also
ScrollPositionY Property (Page 549)
ScrollPositionX Property (Page 549)
Picture Window (Page 194)
ScreenItem Object (Page 141)

OneY Property
Description
TRUE if only the Y-axis of the trend is displayed in the foreground instead of all Y-axes of the
displayed trends. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

501

VBS for Creating Procedures and Actions


1.14 VBS Reference

Online property (before WinCC V7)


Description
Serves to start or stop updating.
0: The updated display is stopped. The values are buffered and updated when the button
is clicked again.
-1: The updated display is resumed.

See also
ScreenItem Object (Page 141)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

Online property
Starting refresh - Online
Enables a refresh of displayed values when calling a picture in Runtime.
Value

Description

TRUE

Enables the refresh of values on picture calls.

FALSE

Disables the refresh of values on picture calls.

The attribute can be assigned dynamic properties by means of the name Online. The data
type is BOOLEAN.

OnTop Property
Description
TRUE, when the object should remain in the foreground in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

502

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Op
OperationMessage Property
Description
TRUE, if a message should be output upon successful operation. BOOLEAN Schreib-LeseZugriff.
The operation is sent to the message system, and is archived. Using the message system, a
message may be output in a message line, for example.
Special features of I/O field, text list and slider
The reason for the operation may only be entered if the "OperationReport" property has been
set to TRUE.

See also
Slider (Page 226)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
I/O Field (Page 199)
ScreenItem Object (Page 141)

OperatorMessageID property
OperatorMessageID
Default assignment of the ID number and trigger event in WinCC OnlineTableControl:
Value

Description

Explanation

EditValue

Trigger event "Change archive value"

InsertValue

Trigger event "Generate archive value"

The attribute can be assigned dynamic properties by means of the name


OperatorMessageID. The data type is LONG.

OperatorMessageIndex property
OperatorMessageIndex
References the event of an archive value change for an operator message. Using this attribute
you can assign the values of other attributes to a specific operator message.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

503

VBS for Creating Procedures and Actions


1.14 VBS Reference
The following values are available:
Value

Explanation

Trigger event "Change archive value"

Trigger event "Generate archive value"

The attribute can be assigned dynamic properties by means of the name


OperatorMessageIndex. The data type is LONG.

OperatorMessageName property
Object name - OperatorMessageName
Displays the name that is referenced with the attribute "OperatorMessageIndex" for message
events for operator messages. You cannot edit this name.
The following names are available for message events:
Value

Explanation

Lock

Message event "Lock"

Unlock

Message event "Enable"

Hide

Message event "Hide"

Unhide

Message event "Unhide"

Quit

Message event "Ackn."

The attribute can be assigned dynamic properties by means of the name


OperatorMessageName . The data type is STRING.

See also
How to configure operator messages

OperatorMessageNumber property
Message number - OperatorMessageNumber
Define a message number for the selected operator message event if you do not want to use
the operator message of WinCC.
The attribute can be assigned dynamic properties by means of the name
OperatorMessageNumber. The data type is LONG.

504

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

OperatorMessageSelected property
Operator messages for - OperatorMessageSelected
Activate the message events which trigger operator messages in the list.
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSelected. The data type is BOOLEAN.

OperatorMessageSource1 property
Source - OperatorMessageSource1
Define the message block of an operated message to be added to "Process value block 1" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 1" of the operator message. Select "1" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource1. The data type is STRING.

OperatorMessageSource2 property
Source - OperatorMessageSource2
Define the message block of an operated message to be added to "Process value block 2" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 2" of the operator message. Select "2" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource2. The data type is STRING.

OperatorMessageSource3 property
Source - OperatorMessageSource3
Define the message block of an operated message to be added to "Process value block 3" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 3" of the operator message. Select "3" at process value as the message lock of
the operated message "User text block 1".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

505

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource3. The data type is STRING.

OperatorMessageSource4 property
Source - OperatorMessageSource4
Define the message block of an operated message to be added to "Process value block 4" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 4" of the operator message. Select "4" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource4. The data type is STRING.

OperatorMessageSource5 property
Source - OperatorMessageSource5
Define the message block of an operated message to be added to "Process value block 5" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 5" of the operator message. Select "5" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource5. The data type is STRING.

OperatorMessageSource6 property
Source - OperatorMessageSource6
Define the message block of an operated message to be added to "Process value block 6" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 6" of the operator message. Select "6" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource6. The data type is STRING.

506

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

OperatorMessageSource7 property
Source - OperatorMessageSource7
Define the message block of an operated message to be added to "Process value block 7" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 7" of the operator message. Select "7" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource7. The data type is STRING.

OperatorMessageSource8 property
Source - OperatorMessageSource8
Define the message block of an operated message to be added to "Process value block 8" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 8" of the operator message. Select "8" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource8. The data type is STRING.

OperatorMessageSource9 property
Source - OperatorMessageSource9
Define the message block of an operated message to be added to "Process value block 9" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 9" of the operator message. Select "9" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource9. The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

507

VBS for Creating Procedures and Actions


1.14 VBS Reference

OperatorMessageSource10 property
Source - OperatorMessageSource10
Define the message block of an operated message to be added to "Process value block 10"
of the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 10" of the operator message. Select "10" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource10. The data type is STRING.

OperatorMessageSourceType1 property
Transfer as - OperatorMessageSourceType1
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType1. The data type is LONG.

OperatorMessageSourceType2 property
Transfer as - OperatorMessageSourceType2
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType2. The data type is LONG.

508

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

OperatorMessageSourceType3 property
Transfer as - OperatorMessageSourceType3
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType3. The data type is LONG.

OperatorMessageSourceType4 property
Transfer as - OperatorMessageSourceType4
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType4. The data type is LONG.

OperatorMessageSourceType5 property
Transfer as - OperatorMessageSourceType5
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType5. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

509

VBS for Creating Procedures and Actions


1.14 VBS Reference

OperatorMessageSourceType6 property
Transfer as - OperatorMessageSourceType6
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType6. The data type is LONG.

OperatorMessageSourceType7 property
Transfer as - OperatorMessageSourceType7
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType7. The data type is LONG.

OperatorMessageSourceType8 property
Transfer as - OperatorMessageSourceType8
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType8. The data type is LONG.

510

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

OperatorMessageSourceType9 property
Transfer as - OperatorMessageSourceType9
Defines the format for transferring the source.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source as text.

Value

Transfer the source as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType9. The data type is LONG.

OperatorMessageSourceType10 property
Transfer as - OperatorMessageSourceType10
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType10. The data type is LONG.

OperationReport Property
Description
TRUE, if the reason for an operation should be recorded. BOOLEAN write/read access.
When the object is used or operated in Runtime, a dialog opens in which the operator can
input the reason for the operation in the form of text. The operation is sent to the message
system, and is archived.

See also
Slider (Page 226)
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

511

VBS for Creating Procedures and Actions


1.14 VBS Reference

Or - Ou
Orientation Property
Description
TRUE, when the text in the object should be displayed horizontally. BOOLEAN write-read
access.

Description of the "Connector" object type


Modifies the orientation of the connector. BOOLEAN write-read access.

See also
Connector (Page 182)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

OuterBevelStyle Property
Description
Defines the 3D effect for the outer bevel of the object.
0: No border.
1: The border is displayed depressed.
2: The border is displayed raised.
3: The border is displayed in one color without a 3D effect. The border color is defined by
the "BevelColorUp" property.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

512

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

OuterBevelWidth Property
Description
Defines the width of the outer bevel in pixels.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

Outline Property
Description
TRUE, when the button should be given a black border in addition to the 3D border. BOOLEAN
write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

OutputFormat Property
Description
Returns the value for the representation of the output value and sets it. The representation
depends on the data format.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

OutputValue Property
Description
Determines the default setting for the value to be displayed or returns it.
This value is used in Runtime when the associated tag cannot be connected or updated when
a picture is started.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

513

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

1.14.4.15 P
Pa - Pe
PageMode property
Enable paging - PageMode
Enables paging is in the long-term archive list. Allows you to display all messages of the shortterm archive in the long-term archive list. Use the "Messages per page" or
"PageModeMessageNumber" property to determine the number of messages displayed per
page.
The page up/down buttons of the toolbar can be used if paging is enabled.
Value

Explanation

TRUE

Paging is enabled for the long-term archive list.

FALSE

Paging is disabled for the long-term archive list.

The attribute can be assigned dynamic properties by means of the name PageMode. The data
type is BOOLEAN.

PageModeMessageNumber property
Messages per page - PageModeMessageNumber
Defines the number of messages shown per page when paging the long-term archive list.
The attribute can be assigned dynamic properties by means of the name
PageModeMessageNumber. The data type is LONG.

Parent Property
Description
Returns a reference to the superordinate object.

514

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Objects within the VBS object model are accessed by hierarchy. You may descend in the
picture hierarchy using Screen and Screenitems. You may ascend in the picture hierarchy by
using the Parent property.

Usage
The Parent property can be used as often as required within an object hierarchy. The following
section provides a systematic description of how to access all the elements in a hierarchy:

The Command
MsgBox MyCircle.Parent.Objectname
returns the name of "Picture2" located one layer higher in the object hierarchy than the original
ScreenItem object "Circle1".
For example, if you wish to use "Parent" three times, ascend in the object hierarchy by three
layers:
MsgBox MyCircle.Parent.Parent.Parent.Objectname
returns the name of Picture1.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

515

VBS for Creating Procedures and Actions


1.14 VBS Reference
Reasoning:
Original reference is to ScreenItem "Circle1"
"Circle1" is within "Picture2" (Layer 1)
"Picture2" is within Picture Window2 "BF2" (Layer 2)
"BF2" is within "Picture 1"(Layer 3)

Example
In the following examples, the object name of the parent object is displayed:

'VBS120
Dim objCircle
Set objCircle = HMIRuntime.Screens("ScreenWindow1").ScreenItems("Circle1")
MsgBox objCircle.Parent.ObjectName

'VBS82
Dim objScrItem
Set objScrItem = HMIRuntime.Screens(1).ScreenItems(1)
MsgBox "Name of BaseScreen: " & objScrItem.Parent.ObjectName

See also
Picture Window (Page 194)
Screen Object (Page 146)
Objects and Lists (Page 123)

PasswordLevel Property
Description
Defines the authorization for operation (e.g. no input or no triggering actions) of the object.

See also
ScreenItem Object (Page 141)

Path Property
Description
Returns the path of the current project (without file name). For a WinCC client without its own
path, the path is returned in UNC format, otherwise the local path is returned.

516

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
STRING (read access only)

Example:
The following example returns the project path as Trace:

'VBS161
HMIRuntime.Trace "Path: " & HMIRuntime.ActiveProject.Path & vbNewLine

See also
Project Object (Page 140)

PercentageAxis property
PercentageAxis
Enables the additional display of an axis with percentage scaling in a trend window for value
axes.
Value

Explanation

TRUE

The display of an axis with percentage scaling is enabled.

FALSE

The display of an axis with percentage scaling is disabled.

The attribute can be assigned dynamic properties by means of the name PercentageAxis. The
data type is BOOLEAN.

PercentageAxisAlign property
PercentageAxisAlign
Enables axis alignment with percentage scaling in the trend window.
The following settings are available:
Value

Description

Explanation

left

The axis with percentage scaling is aligned left.

right

The axis with percentage scaling is aligned right.

The attribute can be assigned dynamic properties by means of the name


PercentageAxisAlign. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

517

VBS for Creating Procedures and Actions


1.14 VBS Reference

PercentageAxisColor property
PercentageAxisColor
Specifies the color of an axis with percentage scaling. The button opens the "Color selection"
dialog to select the color.
The attribute can be assigned dynamic properties by means of the name
PercentageAxisColor. The data type is LONG.

PersistentRT Property
Description
TRUE, when modified window settings should be retained following a change of picture.
Whether the information is evaluated is dependent on the value of the "AllowPersistance"
property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

PersistentRTCS Property
Description
TRUE, when modified settings should be retained following a change of picture and applied
in the configuration system. Whether the information is evaluated is dependent on the value
of the "AllowPersistance" property. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

518

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

PersistentRTCSPermission Property
Description
Defines the operator permission which is necessary in order to modify settings related to
persistence. The value to be entered must correspond to the number of the requested
authorization level in the user administrator. Whether or not the information is to be analyzed
depends on the value of the "AllowPersistence" property (does not apply to WinCC Alarm
Control).

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

PersistentRTPermission Property
Description
Defines the operator permission which is necessary in order to modify settings related to the
persistency in Runtime. The value to be entered must correspond to the number of the
requested authorization level in the user administrator. Whether or not the information is to be
analyzed depends on the value of the "AllowPersistence" property (does not apply to WinCC
Alarm Control).

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

519

VBS for Creating Procedures and Actions


1.14 VBS Reference

Pi
PicDeactReferenced-Eigenschaft
Description
TRUE, when the picture assigned for the "Disable" status should be saved in the RoundButton
object. Otherwise, only the associated object reference is saved. Read only access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDeactTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "Disabled"
status should be set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicDeactUseTransColor" property is
"True".

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDeactUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDeactTransparent" property for the
"Disable" status should be used. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

520

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

PicDownReferenced Property
Description
TRUE, when the picture assigned for the "On" status is to be saved. Otherwise, only the
associated object reference is saved. Read only access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDownTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "On" status
should be set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicDownUseTransColor" property is
"True".

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDownUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDownTransparent" property for the "On"
status should be used. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicReferenced Property
Description
TRUE, when the assigned picture is references the object and is not saved in it. Read only
access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

521

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

PictAlignment property
Description
Defines or returns the picture alignment of the picture on the button or round button.
LONG write-read access.

PicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicUseTransColor" property is "True".

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

Picture Property
Description
Returns the picture name of the background picture for the rectangular background for both
the analog and digital clocks. Read only access

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

PictureBack Property
Description
Returns the picture name of the picture for the object background. Read only access.

522

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

PictureDeactivated Property
Description
Defines the picture to be displayed in the "Disable" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PictureDirectory property
Directory for pictures (PictureDirectory)
Specifies the name of the subdirectory that is created in the "GraCS" directory of the WinCC
project. If pictures are stored in the subdirectory, they are available for the extended status
display. If no subdirectory is specified or the subdirectory does not contain any pictures, the
pictures in the "GraCS" directory are taken into consideration.
The "Directory for pictures" attribute can be dynamized with the name "PictureDirectory".

PictureDown Property
Description
Defines the picture to be displayed in the "On" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Button (Page 215)
Round Button (Page 223)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

523

VBS for Creating Procedures and Actions


1.14 VBS Reference

PictureName Property
Description
Defines the picture to be displayed in the graphic object in Runtime or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

PictureSelected Property
Description
Returns the picture name of the picture displayed in the "On" status. "AutoSize" controls the
adaptation of the size of picture and buttons. Read only access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

PictureSizeMode property
PictureSizeMode
Specifies the size adjustment between picture and control.
Value

Designation

Explanation

Fit size to content

The control is adapted to the picture size.

Fit content to size

The picture is adapted or scaled to the control.

The attribute can be assigned dynamic properties by means of the name PictureSizeMode.
The data type is LONG.

PictureThumb Property
Description
Returns the picture name of the background picture for the slider. Read only access.

524

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

PictureUnselected Property
Description
Returns the picture name of the picture displayed in the "Off" status. "AutoSize" controls the
adaptation of the size of picture and buttons. Read only access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

PictureUp Property
Description
Defines the picture to be displayed in the "Off" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Round Button (Page 223)
Button (Page 215)
ScreenItem Object (Page 141)

PicUpReferenced Property
Description
TRUE, when the picture assigned for the "Off" status should be saved in the object. Otherwise,
only the associated object reference is saved. Read only access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

525

VBS for Creating Procedures and Actions


1.14 VBS Reference

PicUpTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "Off" status
should be set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicUpUseTransColor" property is
"True".

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicUpUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicUpTransparent" property for "Off" status
should be used. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDeactTransparent" property for the
"Disable" status should be used. BOOLEAN write-read access.

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

526

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Pl - Pr
PlayEndless property
PlayEndless
Specifies if movies are played endlessly in the control.
The attribute can be assigned dynamic properties by means of the name PlayEndless. The
data type is BOOLEAN.

PointCount Property
Description
Defines or returns the number of corner points. Each corner point has position coordinates
and is identified via an index.

See also
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

Position Property
Description
Defines the presetting for the position of the slider.
This value is used as the start value in Runtime.
To operate the process value linked to this attribute, it is necessary that the process value is
also linked to the "Position" event. You will find the event "Position" in the "Event" tab, in the
topic tree under SliderCtrl\Property Topics\Control Properties\Value.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

527

VBS for Creating Procedures and Actions


1.14 VBS Reference

Precisions Property
Description
WinCC Online Trend Control
The "Index" property references a pair of columns. "Precision" defines the number of decimal
places which should be shown in this value column. A maximum of 16 decimal places can be
displayed.
WinCC Online Trend Control
Defines the number of decimal places with which the scale value is specified.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

PrecisionX Property
Description
Defines or returns the number of decimal places with which the scale value for the X-axis
should be specified. Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

PrecisionY Property
Description
Defines or returns the number of decimal places with which the scale value for the Y-axis
should be specified. Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

528

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

PredefinedAngles Property
Description
Defines or returns the depth of the display of the 3DBarGraph object. Value range from 0 to 3.
0 = cavalier
1 = isometric
2 = axionometric
3 = freely defined

See also
ScreenItem Object (Page 141)
3D Bar (Page 184)

PreferredTarget property
Preferred picture target (PreferredTarget)
The "Preferred picture target" attribute specifies where the picture change is carried out by the
Favorites browser.
Yes

The picture change is carried out in this picture screen. In the case of nested picture screens the picture change
is carried out at the innermost picture screen with the "Yes" setting.

No

The picture change is carried out in the main screen.

The "Preferred picture target" attribute can be made dynamic with the name "PreferredTarget".

Pressed Property
Description
TRUE, when the Button or RoundButton object is pressed. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

529

VBS for Creating Procedures and Actions


1.14 VBS Reference

PrintBackgroundColor Property
Description
TRUE, if the defined background color is also printed while printing the controls. BOOLEAN
write-read access.

PrintJob Property
Description
Defines or reads out which print layout should be used for the printed output.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

PrintJobName property
Current print job view - PrintJobName
Defines the print job triggered by the print function of the "Print" toolbar button. The
recommended print job is set for the control by default.
Open the "Select Print Job" dialog using the selection button.
The attribute can be assigned dynamic properties by means of the name PrintJobName. The
data type is STRING.

Process Property
Description
Defines or returns presetting for the value to be displayed.
This value is used in Runtime when the associated tag cannot be connected or updated when
a picture is started.

See also
Slider (Page 226)
Radio box (Page 221)
Check box (Page 219)
Bar (Page 189)

530

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
3D Bar (Page 184)
ScreenItem Object (Page 141)

ProcessValue property
Description
Returns an object of type "ProcessValue".

See also
Alarms object (list) (Page 126)

ProjectPath Property
Description
Contains the path and name of the associated project.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ProviderClsid Property
Description
The "Index" property references a trend. "ProviderClsid" defines whether an archive tag or an
internal or external tag should be displayed in this trend.
{416A09D2-8B5A-11D2-8B81-006097A45D48}: The trend is connected to an archive tag.
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: The trend is connected to an internal or
external tag.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

531

VBS for Creating Procedures and Actions


1.14 VBS Reference

ProviderType Property
Description
Defines the type of values to be displayed in a trend referenced by "Index". In the case of
modification of "ProviderType", impermissible combinations with other attributes for data
connection could be created. Therefore, before modifying "ProviderType", the immediate
acceptance of the changes must be prevented using "FreezeProviderConnections".
0: Values are supplied via the API interface.
-1: Display of online or archive tags
-2: Displaying values from a user archive

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1.14.4.16 Q
QualityCode Property
Description
Defines a standard for the quality of a tag value after being read. The quality code is provided
as a 16-bit value for automatic evaluation. After a tag has been written, the value is invalid.
SHORT (read only)
Note
A summary of possible Quality Codes is provided in the WinCC Information System under
the heading "Communication" > "Diagnostics" or "Communication" > "Quality Codes".

Example:
The following example indicates the quality of the read value when no errors have occurred
during the reading process:

'VBS83
Dim objTag
Dim lngLastErr
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
lngLastErr = objTag.LastError

532

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

If 0 = lngLastErr Then
MsgBox objTag.QualityCode
End If

See also
LastError Property (Page 445)
ErrorDescription Property (Page 398)
Tag Object (Page 152)

1.14.4.17 R
Ra - Ri
Radius Property
Description
Defines or returns the radius in pixels.

See also
Pie segment (Page 167)
Circular arc (Page 166)
Circle (Page 164)
Round Button (Page 223)
ScreenItem Object (Page 141)

RadiusHeight Property
Description
Defines or returns the vertical radius in pixels (0 to 5000).

See also
Ellipse segment (Page 162)
Ellipse arc (Page 161)
Ellipse (Page 159)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

533

VBS for Creating Procedures and Actions


1.14 VBS Reference

RadiusWidth Property
Description
Defines or returns the horizontal radius in pixels (0 to 5000).

See also
Ellipse segment (Page 162)
Ellipse arc (Page 161)
Ellipse (Page 159)
ScreenItem Object (Page 141)

RangeMax Property
Description
Defines the maximum absolute value for the value display.
If the "WithLabels" property has the value -1 (yes), this value is displayed on the scale.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

RangeMin Property
Description
Defines the minimum absolute value for the value display.
If the "WithLabels" property has the value -1 (yes), this value is displayed on the scale.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

534

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Rectangular Property
Description
Defines or returns the side ratio of the rectangular background of the gauge. BOOLEAN writeread access.
FALSE : The size of the gauge can be adjusted to any side ratio by dragging the marking points
with the mouse.
TRUE : The size of the gauge can only be adjusted by dragging the marking points with the
mouse. The side ratio of the background always remains 1:1.

See also
ScreenItem Object (Page 141)
WinCC Gauge Control (Page 264)

ReferenceRotationLeft Property
Description
Defines or returns the X-coordinate of the reference point about which the object should be
rotated in Runtime.
The value of the x coordinate is relative to the object width. Enter the value in percent starting
from the left edge of the rectangle enclosing the object.

See also
Line (Page 169)
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

ReferenceRotationTop Property
Description
Defines or returns the Y-coordinate of the reference point about which the object should be
rotated in Runtime.
The value of the Y-coordinate is relative to the object height. Enter the value in percent starting
from the top edge of the rectangle enclosing the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

535

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ScreenItem Object (Page 141)
Line (Page 169)
Polyline (Page 173)
Polygon (Page 171)

RelayCurves Property
Description
TRUE, when the trends should be displayed staggered. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Relevant Property
Description
TRUE, when the object will be taken into account when forming the group display. BOOLEAN
write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Replacement Property
Description
The "Index" property references a trend. Values, whose start value is unknown on activating
Runtime or for which a substitute value is used, have an unstable status. "Replacement"
defines whether such values should be identified by the color defined in "ReplacementColor".
BOOLEAN write-read access.

536

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ReplacementColor Property
Description
The "Index" property references a trend. Values, whose start value is unknown on activating
Runtime or for which a substitute value is used, have an unstable status. "ReplacementColor"
defines the color used to identify this value. The color is defined as an RGB value. Whether
the information is evaluated is dependent on the value of the "Replacement" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

RightComma Property
Description
Defines or returns the number of decimal places (0 to 20).

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Ro - Ru
Rotation property
Rotation (Rotation)
Specifies anticlockwise rotation around the icon center.
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

537

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Comments

The icon is not rotated.

90

The icon is rotated by 90 degrees.

180

The icon is rotated by 180 degrees.

270

The icon is rotated by 270 degrees.

The attribute can be assigned dynamic properties by means of the name Rotation. The data
type is LONG.

RotationAngle Property
Description
Standard objects
Defines or returns the rotation angle in degrees.
In Runtime, the object (starting from the configured starting position) is displayed rotated
clockwise around the reference point by the specified value. The changed orientation of the
object is only visible in Runtime.
The coordinates of the reference point are defined with the "Rotation Reference X" and
"Rotation Reference Y" attributes.
T-piece
Defines or returns the orientation of a T-piece in degrees.
The attribute can assume one of four values. If you enter another value, it is automatically
converted to modulus 360 and rounded up or down to the closest permissible value.
The orientation is produced by rotating the T-piece clockwise around the center point by the
specified number of degrees.
0
90
180
270

The standard position of the T-piece is the shape of the letter "T"
The "leg" of the "T" points towards the left
The "leg" of the "T" points upwards
The "leg" of the "T" points to the right

See also
Line (Page 169)
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

538

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

RoundCornerHeight Property
Description
Defines or returns the corner radius.
Enter the value as a percentage of half the height of the object.

See also
Rounded rectangle (Page 177)
ScreenItem Object (Page 141)

RoundCornerWidth Property
Description
Defines or returns the corner radius.
Enter the value as a percentage of half the width of the object.

See also
ScreenItem Object (Page 141)

RowCellCount property
RowCellCount
Specifies the number of cells of the Row object of a Table Control. The number of cells
corresponds to the number of columns.

RowCellText property
RowCellText
Returns the contents of a cell as a string. The cell is determined from the column number of
the Row object. Numbering runs from "1" to "CellCount".

RowCount property
RowCount
Specifies the number of rows of the Row object of a Table Control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

539

VBS for Creating Procedures and Actions


1.14 VBS Reference

RowNumber property
RowNumber
Specifies the row number of the Row object of a Table Control.

RowScrollbar property
Row scroll bars - RowScrollbar
Enables the display of row scroll bars.
The following settings are available:
Value

Description

Explanation

No

No row scroll bars.

as required

Row scroll bars are displayed if horizontal space requirements of the control are greater
than the actually available display area.

always

Row scroll bars are always displayed.

The attribute can be assigned dynamic properties by means of the name RowScrollbar. The
data type is LONG.

RowTitleAlign property
Row label alignment - RowTitleAlign
Specifies the type of row label alignment.
The following settings are available:
Value

Description

Explanation

left

The row headers are aligned left.

centered

The row headers are aligned to center.

right

The row headers are aligned right.

The attribute can be assigned dynamic properties by means of the name RowTitleAlign. The
data type is LONG.

540

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

RowTitles property
Show row labels - RowTitles
Enables the display of row labels.
Value

Explanation

TRUE

The row labels are displayed.

FALSE

The row labels are not displayed.

The attribute can be assigned dynamic properties by means of the name RowTitles. The data
type is BOOLEAN.

RTPersistence property
Online configuration at the next picture change - RTPersistence
Enables retention of the online configurations of the control after a picture change.
The following settings are available:
Value

Description

Explanation

Discard

The current online configurations are discarded at the next picture change.

Retain

The current online configurations are retained at the next picture change.

Reset

All online configurations made are lost. The picture is set to the contents
found in the configuration system.

The attribute can be assigned dynamic properties by means of the name RTPersistence. The
data type is LONG.

RTPersistencePasswordLevel property
Operator authorization for online configuration - RTPersistencePasswordLevel
Displays the authorization for online configuration. You can edit the authorization using the
selection button. Authorizations are configured in the "User Administrator" editor.
The attribute can be assigned dynamic properties by means of the name
RTPersistencePasswordLevel . The data type is LONG.

RTPersistenceType property
Online configuration - RTPersistenceType
Defines how to retain online configurations of WinCC.
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

541

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Explanation

Do not retain

Online configurations are not retained. These are lost at


the next picture change.

Retain during runtime

Online configurations are retained during runtime. These


are lost on exiting.

Retain permanently

Online configurations are retained permanently. These


are also available after restart.

The attribute cannot be dynamized.

RulerFont Property
Description
This attribute defines the font of the table of the tag values, which is displayed by the key
function "Display value at this position" / "Ruler". Write/Read access.

RulerPrecisions Property
Description
Defines the number of decimal places to which a measured value should be displayed when
it is determined using the "Display value at this position" function.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

RulerPrecisionX Property
Description
Defines the number of decimal places used by the "Display value at this position" to display
the X-coordinate of a measured value. Whether the information is evaluated is dependent on
the value of the "TimeAxisX" attribute.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

542

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

RulerPrecisionY Property
Description
Defines the number of decimal places used by the "Display value at this position" to display
the Y-coordinate of a measured value.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

RulerType property
Window - RulerType
Specifies window to be displayed during runtime. Depending on the window type, only certain
blocks can be used as columns of the WinCC RulerControl.
The following window types can be selected:
Value

Description

Explanation

"Ruler" window

The ruler window shows the coordinate values of the trends on a


ruler or values of a selected row in the table.

"Statistics area" window

The statistics area window shows the values of the low and high
limit of trends between two rulers, or displays the selected range
in the table.

"Statistics" window

The statistics window shows the statistic evaluation of trends


between two rulers, or it displays the selected values in the table.

The attribute can be assigned dynamic properties by means of the name RulerType. The data
type is LONG.

1.14.4.18 S
Sa - Sc
SameSize Property
Description
TRUE, when all four buttons of a Group Display object have the same size. BOOLEAN writeread access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

543

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

SavedTrend Property
Description
Displays the name of the last saved trend that was exported in WinCC Online Trend Control
using the Save Report button. Read only access.

ScaleColor Property
Description
Defines or returns the color of the scale. LONG write-read access.
The "Scaling" property must be set to TRUE for the color to be displayed.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ScaleTicks Property
Description
Defines the number of segments into which the bar will be subdivided by large tick marks of
the scale:
0-100: Object can be divided into a maximum of 100 segments
= 0: The optimum number of segments is set automatically.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Scaling Property
Description
TRUE, when a scale should also be used to represent a value. BOOLEAN write-read access.

544

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ScalingType Property
Description of Bar Scaling
Defines or returns the type of bar scaling. Value range from 0 to 6.
0 = linear
1 = logarithmic
2 = negative logarithmic
3 = automatic (linear)
4 = tangent
5 = square
6 = cubic
The "Scaling" property must be set to TRUE for the color to be displayed.

Description of Online Trend Control


Specifies or returns the type of scaling for a trend referenced by "Index". Value range from 0
to 2.
0 = linear
1 = logarithmic
2 = negative logarithmic

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
Bar (Page 189)
ScreenItem Object (Page 141)

ScalingTypeX Property
Description
Defines the type of scaling of the X-axis of a trend referenced with "Index". Whether the
information is evaluated is dependent on the value of the "TimeAxisX" attribute.
0: Linear
-1: Logarithmically. This setting prevents the display of negative values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

545

VBS for Creating Procedures and Actions


1.14 VBS Reference
-2: Logarithmically negated. This setting prevents the display of positive values.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ScalingTypeY Property
Description
Defines the type of scaling of the Y-axis of a trend referenced with "Index".
0: Linear
-1: Logarithmically. This setting prevents the display of negative values.
-2: Logarithmically negated. This setting prevents the display of positive values.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ScreenName Property
Description
Defines the picture to be displayed in the picture window in Runtime or returns the picture
name.
Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

546

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Screens Property
Description
Returns an object of type "Screens".
Screens (read only)

Example:
The following example accesses the picture "NewPDL1":

'VBS84
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")

See also
Screens Object (List) (Page 149)
Screen Object (Page 146)
HMIRuntime Object (Page 134)

ScreenItems Property
Description
Returns an object of type "ScreenItems".
ScreenItems (read only)

Example:
The following example issues the number of all the objects contained in the picture "NewPDL1":

'VBS85
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
Msgbox objScreen.ScreenItems.Count

See also
ScreenItems Object (List) (Page 144)
HMIRuntime Object (Page 134)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

547

VBS for Creating Procedures and Actions


1.14 VBS Reference

ScrollBars Property
Description
TRUE, when the object is equipped with a scroll bar in Runtime. Read only access.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

ScrollPositionX Property
Description
Specifies the horizontal positioning of the scroll bar in a picture window with slider, or returns
its value.
The picture is displayed in the picture window by positioning the horizontal and vertical scroll
bars. If you wish to display the picture as a cutout where the scroll bars are located at the left
and upper edge of the picture, use the properties "OffsetLeft" and "OffsetTop" as the origin of
this cutout.

See also
ScreenItem Object (Page 141)
OffsetTop Property (Page 501)
OffsetLeft Property (Page 500)
Picture Window (Page 194)

ScrollPositionY Property
Description
Specifies the vertical positioning of the scroll bar in a picture window with slider, or returns its
value.
The picture is displayed in the picture window by positioning the horizontal and vertical scroll
bars. If you wish to display the picture as a cutout where the scroll bars are located at the left
and upper edge of the picture, use the properties "OffsetLeft" and "OffsetTop" as the origin of
this cutout.

See also
OffsetTop Property (Page 501)
OffsetLeft Property (Page 500)

548

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Picture Window (Page 194)
ScreenItem Object (Page 141)

Se
SecondNeedleHeight Property
Description
Defines or returns the length of the second hand for the analog clock. The specification of the
length is entered as a percentage value in relation to half the length of the short side of the
rectangular background. Write/Read access.
Example:
The shorter side of the rectangular background is 100 pixels long.
The second hand length is 80.
This results in a length of the second hand of (100 pixels / 2) * 0.8 = 40 pixels.

See also
ScreenItem Object (Page 141)
WinCC Digital/Analog Clock (Page 258)

SecondNeedleWidth Property
Description
Defines or returns the width of the second hand for the analog clock. The width is specified as
a percentage value related to double the length of the second hand. Write/Read access.
Example:
The length of the second hand is 40 pixels.
The second hand width is 2.
This results in a width of the second hand of 40 pixels * 2 * 0.02 = 2 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

549

VBS for Creating Procedures and Actions


1.14 VBS Reference

SelBGColor Property
Description
Defines or returns the background color of the selected entry in a text list object. LONG writeread access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

SelectArchiveName property
SelectArchiveName
Opens the dialog for selecting the user archive.
Programmers can set this attribute to allow users to select a user archive by means of a button,
for example.
The attribute can be assigned dynamic properties by means of the name
SelectArchiveName. The data type is BOOLEAN.

SelectedCellColor property
Background color of selected cell - SelectedCellColor
Specifies the background color of a selected cell. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name SelectedCellColor.
The data type is LONG.

SelectedCellForeColor property
Font color of the selected cell - SelectedCellForeColor
Specifies the font color of the selected cell. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name
SelectedCellForeColor. The data type is LONG.

550

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

SelectedRowColor property
Background color of the selected row - SelectedRowColor
Specifies the background color of the selected line. The button opens the "Color selection"
dialog.
The attribute can be assigned dynamic properties by means of the name SelectedRowColor.
The data type is LONG.

SelectedRowForeColor property
Font color of the selected row - SelectedRowForeColor
Specifies the font color of the selected row. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name
SelectedRowForeColor. The data type is LONG.

SelectedTitleColor property
Background selection color - SelectedTitleColor
Specifies the background color of a selected table header. The button opens the "Color
selection" dialog.
The setting is only active in Runtime if the "Selection color" or "UseSelectedTitleColor" option
is activated.
The attribute can be assigned dynamic properties by means of the name SelectedTitleColor.
The data type is LONG.

SelectedTitleForeColor property
Font selection color - SelectedTitleForeColor
Specifies the font color of the table header selected. The button opens the "Color selection"
dialog.
The setting is only active in Runtime if the "Selection color" or "UseSelectedTitleColor" option
is activated.
The attribute can be assigned dynamic properties by means of the name
SelectedTitleForeColor. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

551

VBS for Creating Procedures and Actions


1.14 VBS Reference

SelectedTrend Property
Description
This property brings a trend to the foreground via its name. Write/Read access.

SelectionColoring property
Selection colors for - SelectionColoring
Enables the use of selection colors for cells or rows.
The following settings are available:
Value

Description

Explanation

None

No selection colors for cells and rows.

Cell

Selection color for cell.

Row

Selection color for row.

Cell and row

Selection colors for cell and row.

The attribute can be assigned dynamic properties by means of the name SelectionColoring.
The data type is LONG.

SelectionMode Property
Description
Defines whether and how a message line can be selected.
0 - NoSelection: Prevents the selection of a message. Acknowledgement affects the oldest
pending message.
1 - Cell: Enables the selection of fields in the message line. Acknowledgement affects the
selected message.
2 - Line: Enables the selection of a message line. Acknowledgement affects the selected
message.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

552

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

SelectionRect property
Selection border- SelectionRect
Enables the use of a selection border for selected cells or rows.
The following settings are available:
Value

Description

Explanation

None

No selection border is drawn for selected cells or rows.

Cell

A selection border is drawn for the selected cell.

Row

A selection border is drawn for the selected row.

The attribute can be assigned dynamic properties by means of the name SelectionRect. The
data type is LONG.

SelectionRectColor property (before WinCC V7)


Description
Specifies the color of the rectangle in the message window if SelectionType equals "1".

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

SelectionRectColor property
Color of the selection border - SelectionRectColor
Specifies the color of the selection border. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name SelectionRectColor.
The data type is LONG.

SelectionRectWidth property (before WinCC V7)


Description
Specifies the line weight of the rectangle in the message window if SelectionType equals "1".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

553

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

SelectionRectWidth property
Line weight of the selection border - SelectionRectWidth
Defines the line weight of the selection border in pixels.
The attribute can be assigned dynamic properties by means of the name SelectionRectWidth.
The data type is LONG.

SelectionType property (before WinCC V7)


Description
Specifies if the selected message in the message window should be optically emphasized by
color change or rectangle.
0 - Color Change: selected message is optically emphasized by color change
1 - Rectangle: selected message is optically emphasized by a rectangle

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

SelectionType property
Selectable rows - SelectionType
Defines the number of lines you can select. The following settings are available:
Value

Description

Explanation

None

No row selection.

Single selection

One row can be selected.

Multiple selection

Multiple rows can be selected.

The attribute can be assigned dynamic properties by means of the name SelectionType. The
data type is LONG.

554

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

SelIndex property
Description
Defines and returns the index of which the associated text is highlighted in the combobox or
list box.
The maximum value is the number of lines (NumberLines) of the object.

SelText property
Description
Shows the text defined with the "Selected field" (SelIndex) attribute which is highlighted in the
combobox or list box.

SelTextColor Property
Description
Defines or returns the color of the text of the selected entry in the text list object. LONG writeread access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

ServerData Property
Description
The attribute can only be modified using the "Properties of WinCC Online Trend Control" dialog.
Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

555

VBS for Creating Procedures and Actions


1.14 VBS Reference

ServerDataX
ServerDataX
Accesses the configured data connection for the X axis with WinCC FunctionTrendControl.
The attribute can be assigned dynamic properties by means of the name ServerDataX. The
data type is LONG.

Example: Editing the start ID


You may use the ServerDataX attribute to edit the start ID of the X axis.
Prerequisite is that you have an existing trend and trend view, configured X and Y axes, as
well as a data connection to the user archive.
In the following example you employ the GetTrend method to set a reference to the object in
step one, and then to the trend used in step two. Determine the data connection settings in
the third step. Set the start ID to 4 in step 4. The number (3) represents the listing type "user
archive" for data transfer. Change the modified data connection settings in step five:
Sub OnCklick(ByVal Item)
1. Step:
Dim fx_ctrl
Set fx_ctrl

ScreenItems.Item("Control1")

2. Step:
Dim fx_trend
Set fx_trend = fx_ctrl.Getrend("myTrend1")
3. Step:
Dim vServerDataX, vServerDataY
vServerDataX = fx_trend.ServerDataX
vServerDataY = fx_trend.ServerDataY
4. Step:
Dim startId
startId = CLng(4)
vServerDataX(3) = startId
vServerDataY(3) = startId
5. Step:
fx_trend.ServerDataX = ServerDataX
fx_trend.ServerDataY = ServerDataY
End Sub

ServerDataY
ServerDataY
Accesses the configured data connection for the Y axis with WinCC FunctionTrendControl.

556

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name ServerDataY. The
data type is LONG.

Example: Editing the start ID


You may use the ServerDataY attribute to edit the start ID of the Y axis.
Prerequisite is that you have an existing trend and trend view, configured X and Y axes, as
well as a data connection to the user archive.
In the following example you employ the GetTrend method to set a reference to the object and
then to the trend used. Determine the data connection settings in the third step. Set the start
ID to 4 in step 4. The number (3) represents the listing type "user archive" for data transfer.
Change the modified data connection settings in step five:
Sub OnCklick(ByVal Item)
1. Step:
Dim fx_ctrlSet fx_ctrl

ScreenItems.Item("Control1")

2. Step:
Dim fx_trendSet fx_trend = fx_ctrl.Getrend("myTrend1")
3. Step:
Dim vServerDataX, vServerDataYvServerDataX =
fx_trend.ServerDataXvServerDataY = fx_trend.ServerDataY
4. Step:
Dim startIdstartId = CLng(4)vServerDataX(3) =
startIdvServerDataY(3) = startId
5. Step:
fx_trend.ServerDataX = ServerDataXfx_trend.ServerDataY =
ServerDataY
End Sub

ServerNames property
Server selection - ServerNames
Defines from which servers within a distributed system the message window obtains the
display data.
The attribute can be assigned dynamic properties by means of the name ServerNames. The
data type is STRING.

ServerNames property (before WinCC V7)


Description
Defines the server in a distributed system to which the data in the message window should
relate. Servers are specified as follows: NameServer1;NameServer2;NameServer3. Write/
Read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

557

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ServerPrefix Property
Description
Defines the server containing the picture to be displayed in the picture window in Runtime or
returns the server name.
Enter the server name followed by two colons: "<Servername>::". No check is made as to
whether the server actually exists.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

Sh - Sk
ShareSpaceWithSourceControl property
ShareSpaceWithSourceControl
Defines whether the size of the source control in the picture window is adapted so that the
WinCC RulerControl is also displayed in a small picture window.
Value

Explanation

TRUE

The source control in the picture window is adapted.

FALSE

The source control in the picture window is not adapted.

The attribute can be assigned dynamic properties by means of the name


ShareSpaceWithSourceControl. The data type is BOOLEAN.

ShowBar Property
Description
TRUE, when the bar should be displayed. BOOLEAN write-read access.

558

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

ShowDanger Property
Description
Controls the display of the "danger zone" on the instrument scale. BOOLEAN write-read
access.
TRUE : The area is identified by the color defined in "DangerColor".
FALSE : The color identification of the area is switched off.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowDecimalPoint Property
Description
TRUE, when the labeling of the scale section should be with decimal numbers (decimal point
and one decimal place).
FALSE, when the labeling of the scale section should be with whole numbers.
BOOLEAN write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowNormal Property
Description
Controls the display of the "normal zone" on the instrument scale. BOOLEAN write-read
access.
TRUE : The area is identified by the color defined for normal color.
FALSE : The color identification of the area is switched off.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

559

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowPeak Property
Description
Defines the display of a slave pointer to display the maximum value. BOOLEAN write-read
access.
TRUE : The slave pointer is displayed.
FALSE : The slave pointer is hidden.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowPosition Property
Description
TRUE, when the slider position is to be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

ShowRuler property
Show ruler - ShowRuler
Enables the display of a ruler for scanning the coordinate points on picture calls.
Value

Explanation

TRUE

Enables the display of a ruler for scanning the coordinate points.

FALSE

Disables the display of a ruler for scanning the coordinate points.

The attribute can be assigned dynamic properties by means of the name ShowRuler. The data
type is BOOLEAN.

560

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowRulerImmediately Property
Description
TRUE, when the ruler for determining the coordinate values should be displayed when opening
a picture. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ShowRulerInAxis property
ShowRulerInAxis
Enables the display of rulers in the time axis.
Value

Explanation

TRUE

Enables the display of rulers in the time axes.

FALSE

Disables the display of rulers in the time axes.

The attribute can be assigned dynamic properties by means of the name ShowRulerInAxis.
The data type is BOOLEAN.

ShowScrollbars property
Scroll bars - ShowScrollbars
Enables the display of scroll bars.
The following settings are available:
Value

Description

Explanation

No

The display of scroll bars is disabled.

as required

Scroll bars are displayed if space requirements of the control are greater than the actual
display area.

always

The scroll bars are always displayed.

The attribute can be assigned dynamic properties by means of the name ShowScrollbars. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

561

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowSlider property
ShowSlider
Specifies if a time slider is displayed in the control.
The attribute can be assigned dynamic properties by means of the name ShowSlider. The data
type is BOOLEAN.

ShowSortButton property
Use sorting button - ShowSortButton
Enables the display of a sorting button above the vertical scroll bar. Click this sorting button
to sort the selected column based on the configured sorting criteria. The sorting button is not
displayed if the table does not contain a vertical scroll bar.
Value

Explanation

TRUE

Enables sorting of a selected column by means of sorting button.

FALSE

The sorting button is not displayed.

The attribute can be assigned dynamic properties by means of the name ShowSortButton .
The data type is BOOLEAN.

ShowSortIcon property
Show sorting icon - ShowSortIcon
Enables the display of the sorting icon.
Value

Explanation

TRUE

Enables the display of the sorting icon.

FALSE

Disables the display of the sorting icon.

The attribute can be assigned dynamic properties by means of the name ShowSortIcon. The
data type is BOOLEAN.

562

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowSortIndex property
Show sorting index - ShowSortIndex
Enables the display of a sorting icon.
Value

Explanation

TRUE

Enables the display of a sorting index.

FALSE

Disables the display of a sorting index.

The attribute can be assigned dynamic properties by means of the name ShowSortIndex. The
data type is BOOLEAN.

ShowSpanNames Property
Description
TRUE, if a section name is also to be displayed in the Value column of Trend Control apart
from the measured value and the status display "i" and "u". BOOLEAN write-read access.

ShowStatisticRuler property
ShowStatisticRuler
Enables the display of rulers in the statistics field on picture calls.
Value

Explanation

TRUE

Enables the display of rulers in the statistics field.

FALSE

Disables the display of rulers in the statistics field.

The attribute can be assigned dynamic properties by means of the name ShowStatisticRuler.
The data type is BOOLEAN.

ShowThumb Property
Description
TRUE, when the slider is to be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

563

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowTitle property
Window title - ShowTitle
Defines representation the Control window header.
Value

Designation

Explanation

No

No window title.

Normal

The window title consists of a WinCC icon and text. The text is entered in the "Text" field.

Narrow

The window title consists only of text. The text is entered in the "Text" field.

The attribute can be assigned dynamic properties by means of the name ShowTitle. The data
type is LONG.

ShowToolbar property
ShowToolbar
Specifies if a toolbar is displayed in the control.
The attribute can be assigned dynamic properties by means of the name ShowToolbar. The
data type is BOOLEAN.

ShowTrendIcon property
ShowTrendIcon
Enables the display of an icon below the value axes. The icon indicates the trend currently
displayed in the foreground.
The attribute can be assigned dynamic properties by means of the name ShowTrendIcon. The
data type is BOOLEAN.

ShowValuesExponentialX Property
Description
TRUE, when the X-coordinate of a measured value determined via the "Display value at this
position" function is displayed in exponential notation by a trend referenced via "Index".
Whether the information is evaluated is dependent on the value of the "TimeAxisX" property.
BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

564

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowValuesExponentialY Property
Description
TRUE, when the Y-coordinate of a measured value determined via the "Display value at this
position" function is displayed in exponential notation by a trend referenced via "Index".
BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ShowWarning Property
Description
Controls the display of the "warning zone" on the instrument scale. BOOLEAN write-read
access.
TRUE : The area is identified by the color defined by the warning color attribute.
FALSE : The color identification of the area is switched off.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

SignificantMask Property
Description
Is required in Runtime to display the active message class with the highest priority.
The value of the SignificantMask property represents an internal system output value does not
require any specific configuration by the user. Updating is initiated in Runtime by clicking on
the object.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

565

VBS for Creating Procedures and Actions


1.14 VBS Reference

Sizeable property
Sizeable
Enables resizing of the control during runtime.
Value

Explanation

TRUE

The control can be resized during runtime.

FALSE

The control cannot be resized during runtime.

The attribute can be assigned dynamic properties by means of the name Sizeable. The data
type is BOOLEAN.

SkinName property
Style - SkinName
The control style can be defined in this selection field.
The following settings are available:
Value

Designation

Explanation

Project setting

The style corresponds to the project settings in WinCC Explorer.

Simple

"Classic" WinCC style

Standard

New WinCC V7 style

Basic Process Control

The style is reserved for internal use with Basic Process Control.

The attribute can be assigned dynamic properties by means of the name SkinName. The data
type is STRING.

Sm - Sq
SmallChange Property
Description
Defines how many steps the controller can be moved with one mouse click or returns the value.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

566

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

SmartTag property
Description
Returns an object of type "SmartTag".

See also
SmartTags Object (Page 151)

SortOrder Property
Description
Defines the sort sequence of the message blocks in the message window.

SortSequence property
Sorting order by mouse click - SortSequence
Specifies how to change the sorting order by mouse click.
The following sorting orders are available:
Value

Description

Explanation

Up/down/none

You can toggle between ascending, descending and no sorting by means of mouse click.

Up/down

You can toggle between ascending and descending sorting order by means of mouse click.

The attribute can be assigned dynamic properties by means of the name SortSequence. The
data type is LONG.

SourceBeginTime Property
Description
In the case of online tags and archive tags ("ProviderType" = -1), it defines the starting time
of the time range of a trend referenced via "Index" and to be displayed in the trend window. In
the case of modification of "SourceBeginTime", impermissible combinations with other
attributes for data connection could be created. Therefore, before modifying
"SourceBeginTime", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

567

VBS for Creating Procedures and Actions


1.14 VBS Reference

SourceControl property
Source - SourceControl
Defines the control to be interconnected with WinCC RulerControl.
The attribute can be assigned dynamic properties by means of the name SourceControl. The
data type is STRING.

SouceControlType property
Type - SourceControlType
Defines the type of control that is interconnected with the WinCC RulerControl in the "Source"
field.
Value

Designation

Explanation

None

The RulerControl is not connected to any source.

OnlineTrend
Control

The RulerControl is connected with an OnlineTrendControl.

OnlineTable
Control

The RulerControl is connected with an OnlineTableControl.

FunctionTrend
Control

The RulerControl is connected with a FunctionTrendControl.

The attribute can be assigned dynamic properties by means of the name SourceControlType.
The data type is LONG.

SourceEndTime Property
Description
In the case of online tags and archive tags ("ProviderType" = -1), it defines the stopping time
of the time range of a trend referenced via "Index" and to be displayed in the trend window. In
the case of modification of "SourceEndTime", impermissible combinations with other attributes
for data connection could be created. Therefore, before modifying "SourceEndTime", the
immediate acceptance of the changes must be prevented using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

568

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

SourceNumberOfUAValues Property
Description
For values from the user archives ("ProviderType" = -2) it defines the number of values which
should be loaded from the user archive for a trend referenced via "Index". In the case of
modification of "SourceNumberOfUAValues", impermissible combinations with other attributes
for data connection could be created. Therefore, before modifying
"SourceNumberOfUAValues", the immediate acceptance of the changes must be prevented
using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceNumberOfValues Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1), "SourceNumberOfValues" defines the number of values which should
be displayed in the trend window. Whether the information is evaluated is dependent on the
value of the "SourceTimeRange" property.
In the case of modification of "SourceNumberOfValues", impermissible combinations with
other attributes for data connection could be created. Therefore, before modifying
"SourceNumberOfValues", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagNameX Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1) "SourceTagNameX" defines the tag which should be displayed along
the X-axis. In the case of modification of "SourceTagNameX", impermissible combinations with
other attributes for data connection could be created. Therefore, before modifying
"SourceTagNameX", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

569

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagNameY Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1) "SourceTagNameY" defines the tag which should be displayed along
the X-axis. In the case of modification of "SourceTagNameY", impermissible combinations with
other attributes for data connection could be created. Therefore, before modifying
"SourceTagNameY", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagProviderDataX Property
Description
The attribute can only be modified using the "Properties of WinCC Function Trend Control"
dialog.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagProviderDataY Property
Description
The attribute can only be modified using the "Properties of WinCC Function Trend Control"
dialog.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

570

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

SourceTimeRange Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1) "SourceTimeRange" defines how the time range to be displayed in the
trend window is defined. In the case of modification of "SourceTimeRange", impermissible
combinations with other attributes for data connection could be created. Therefore, before
modifying "SourceTimeRange", the immediate acceptance of the changes must be prevented
using "FreezeProviderConnections".
0: The time range to be displayed is defined by the starting time (SourceBeginTime) and the
number of value pairs (SourceNumberOfValues).
-1: The time range to be displayed is defined by the starting time (SourceBeginTime) and
stopping time (SourceEndTime).

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAArchive Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAArchive" defines the user archive from which the values
should be loaded. In the case of modification of "SourceUAArchive", impermissible
combinations with other attributes for data connection could be created. Therefore, before
modifying "SourceUAArchive" the immediate acceptance of the changes must be prevented
using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAArchiveStartID Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAArchiveStartID" defines the data record from which the
values should be loaded from the user archive. In the case of modification of
"SourceUAArchiveStartID", impermissible combinations with other attributes for data
connection could be created. Therefore, before modifying "SourceUAArchiveStartID", the
immediate acceptance of the changes must be prevented using "FreezeProviderConnections".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

571

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAColumnX Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAColumnX" defines the column in the user archive from which
the values for the X-axis should be loaded. In the case of modification of "SourceUAColumnX",
impermissible combinations with other attributes for data connection could be created.
Therefore, before modifying "SourceUAColumnX", the immediate acceptance of the changes
must be prevented using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAColumnY Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAColumnY" defines the column in the user archive from which
the values for the Y-axis should be loaded. In the case of modification of "SourceUAColumnY",
impermissible combinations with other attributes for data connection could be created.
Therefore, before modifying "SourceUAColumnY", the immediate acceptance of the changes
must be prevented using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SquareExtent Property
Description
TRUE, when the size of the clock should be adjustable to any side ratio by dragging the marking
points with the mouse. BOOLEAN write-read access.

572

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

St - Sy
StartAngle Property
Description
Defines or returns the start of the object. The information is in counterclockwise direction in
degrees, beginning at the 12:00 clock position.

See also
Pie segment (Page 167)
Circular arc (Page 166)
Ellipse segment (Page 162)
Ellipse arc (Page 161)
ScreenItem Object (Page 141)

State property
Description
Returns the status of a message.
The following table shows the possible states of a message:
State

Alarm Log Status

Came In

Went Out

Came in and comment

Gone and comment

See also
Alarms object (list) (Page 126)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

573

VBS for Creating Procedures and Actions


1.14 VBS Reference

Statusbar Property
Description
TRUE, when the status line is to be displayed. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

StatusbarBackColor property
Background color - StatusbarBackColor
Defines the background color of the status bar. The button opens the "Color selection" dialog
to select the color.
For the setting to become active, the "Display" or "StatusbarUseBackColor" option must be
activated.
The attribute can be assigned dynamic properties by means of the name
StatusbarBackColor. The data type is LONG.

StatusbarElementAdd property
New - StatusbarElementAdd
Defines a new, user-defined status bar element. The name set by WinCC can be edited in the
"Object name" field.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementAdd . The data type is STRING.

574

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

StatusbarElementAutoSize property
Automatic - StatusbarElementAutoSize
Enables autosizing of the width of a status bar element selected.
Value

Explanation

TRUE

The width of the selected element is set automatically.

FALSE

The width of the selected element is not set automatically.

The attribute can be assigned dynamic properties by means of the name


StatusbarElementAutoSize. The data type is BOOLEAN.

StatusbarElementCount property
StatusbarElementCount
Defines the number of configurable status bar elements.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementCount. The data type is LONG.

StatusbarElementIconId property
StatusbarElementIconId
Default assignment of the ID number and icon of a status bar element.
The attribute for custom status bar elements can be made assigned dynamic properties by
measn of the name StatusbarElementIconId. The data type is LONG.

StatusbarElementID property
Object ID - StatusbarElementID
Unique ID of the status bar element selected. WinCC assigns this read only ID number.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementID. The data type is LONG.

StatusbarElementIndex property
StatusbarElementIndex
References a status bar element. Using this attribute you can assign the values of other
attributes to a specific status bar element.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

575

VBS for Creating Procedures and Actions


1.14 VBS Reference
Values between 0 and "StatusbarElementCount" minus 1 are valid for
"StatusbarElementIndex". Attribute "StatusbarElementCount" defines the number of
configurable status bar elements.
The "StatusbarElementIndex" attribute can be assigned dynamic properties by means of
attribute StatusbarElementIndex. The data type is LONG.

StatusbarElementName property
Object name - StatusbarElementName
Displays the object name of the status bar element selected. You can rename the objects of
custom status bar elements.
The "StatusbarElementName" attribute can be assigned dynamic properties by means of
attribute StatusbarElementRename. The data type is STRING.

StatusbarElementRemove property
Remove - StatusbarElementRemove
Removes the selected status bar element. You can only remove user-defined status bar
element from the list.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementRemove. The data type is STRING.

StatusbarElementRename property
StatusbarElementRename
Renames a custom status bar element which is referenced by means of
"StatusbarElementIndex" attribute.
The attribute for custom elements can be assigned dynamic properties by means of the name
StatusbarElementRename. "StatusbarElementRename" also sets a dynamic attribute
"StatusbarElementName". The data type is STRING.

StatusbarElementRepos property
Up/Down - StatusbarElementRepos
Changes the sorting order of button functions. "Up" and "Down" moves the selected status bar
element up or down in the list. This moves the status bar element of the Control towards the
front or towards the back in Runtime.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementRepos . The data type is LONG.

576

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

StatusbarElementText property
StatusbarElementText
Defines the text to be displayed for the status bar element. You can edit the
"StatusbarElementText" attribute for custom elements.
The attribute for custom elements can be assigned dynamic properties by means of the name
StatusbarElementText. The data type is STRING.

StatusbarElementTooltipText property
StatusbarElementTooltipText
Defines the tooltip text for the custom status bar element.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementTooltipText. The data type is STRING.

StatusbarElementVisible property
Status bar elements - StatusbarElementVisible
Activate the elements in the list of status bar elements for their display in Runtime.
Click a list entry to adapt the properties, or to change its position in the status bar of the Control
by means of the "Up" and "Down" buttons.
Value

Explanation

TRUE

The status bar element is displayed.

FALSE

The status bar element is not displayed.

The attribute can be assigned dynamic properties by means of the name


StatusbarElementVisible. The data type is BOOLEAN.

StatusbarElementUserDefined property
StatusbarElementUserDefined
Indicates whether the project engineer has added the status bar element as a new custom
element.
Value

Explanation

TRUE

The status bar element is user-defined.

FALSE

The status bar element is defined by the system.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

577

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
StatusbarElementUserDefined. The data type is BOOLEAN.

StatusbarElementWidth property
Width in pixels - StatusbarElementWidth
Shows the width of the status bar element selected in pixels. You can define the width if the
"Automatic" option is not activated.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementWidth. The data type is LONG.

StatusbarFontColor property
Font color - StatusbarFontColor
Defines the color of the text in the status bar.
The attribute can be assigned dynamic properties by means of the name StatusbarFontColor.
The data type is LONG.

StatusbarPanes Property
Description
Defines the elements to be displayed in the status bar. Write/Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

StatusbarShowTooltips property
Tooltips - StatusbarShowTooltips
Enables the display of tooltips for the status bar elements in Runtime.
Value

Explanation

TRUE

Enables the display of tooltips.

FALSE

Disables the display of tooltips.

The attribute can be assigned dynamic properties by means of the name


StatusbarShowTooltips. The data type is BOOLEAN.
Attribute "StatusbarElementTooltipText" defines the tooltip text.

578

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

StatusbarText property
StatusbarText
Default text in the status bar.
The attribute can be assigned dynamic properties by means of the name StatusbarText. The
data type is STRING.

StatusbarUseBackColor property
Display background color - StatusbarUseBackColor
Sets a background color for the status bar.
Value

Explanation

TRUE

Enables the display of the background color of the status bar.

FALSE

Disables the display of a background color for the status bar.

The attribute can be assigned dynamic properties by means of the name


StatusbarUseBackColor. The data type is BOOLEAN.

StatusbarVisible property
Show status bar - StatusbarVisible
Enables the display of the status bar of a control.
Value

Explanation

TRUE

Enables the display of a status bar.

FALSE

Disables the display of a status bar.

The attribute can be assigned dynamic properties by means of the name StatusbarVisible .
The data type is BOOLEAN.

StepSeconds property
StepSeconds
Specifies the interval for step forward or step backward in movies.
The attribute can be assigned dynamic properties by means of the name StepSeconds. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

579

VBS for Creating Procedures and Actions


1.14 VBS Reference

Stretch Property
Description
Defines whether the side ratio is retained or adjustable on changing the icon size. BOOLEAN
write-read access.
FALSE : The side ratio is retained on changing the icon size.
TRUE : The side ratio of the icon can be adjusted parallel to changing the icon size.

See also
HMI Symbol Library (Page 253)
ScreenItem Object (Page 141)

SymbolAppearance property
Foreground mode (SymbolAppearance)
Specifies the appearance of the icon.
The following settings are available:
Value

Description

Comments

Original

The appearance of the icon corresponds to the multi-color representation in the


selection of the "Icons" tab.

Shadow

"Black" lines are maintained as contour lines. Elements of the symbols in other
colors are displayed as brightness grades of the current foreground color.

Solid

"Black" lines are maintained as contour lines. All icon elements of other colors are
assigned the color value of the current foreground color.

Outline

Lines of the color "Black" are maintained as contour lines. All the elements of the
symbol in other colors are assigned the color value of the current background color.

The attribute can be assigned dynamic properties by means of the name SymbolAppearance.
The data type is LONG.

1.14.4.19 T
Ta -Tic
TableColor property
Row background color 1 - TableColor
Defines the background color of the rows. The button opens the "Color selection" dialog.

580

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name TableColor. The data
type is LONG.

TableColor2 property
Row background color 2 - TableColor2
Specifies the background color of "Row color 2". The button opens the "Color selection" dialog.
The setting is only active in Runtime if the "Row color 2" or "UseTableColor2" option is
activated. The background colors of "Row color 2" and "Row color 1" are used alternately in
this case.
The attribute can be assigned dynamic properties by means of the name TableColor2. The
data type is LONG.

TableFocusOnButtonCommand Property
Description
Defines whether the focus is set to the table of the control when a button in a script is clicked.

TableForeColor property
Row font color 1 - TableForeColor
Specifies the font color of the rows. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name TableForeColor. The
data type is LONG.

TableForeColor2 property
Row font color 2 - TableForeColor2
Specifies the font color of "Row color 2". The button opens the "Color selection" dialog.
The setting is only active in Runtime if the "Row color 2" or "UseTableColor2" option is
activated. The font colors of "Row color 2" and "Row color 1" are used alternately in this case.
The attribute can be assigned dynamic properties by means of the name TableForeColor2.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

581

VBS for Creating Procedures and Actions


1.14 VBS Reference

TagName Property
Description
The "Index" property references a trend. "TagName" defines the tag linked to this trend. It is
specified in the form "Archivname\Variablenname" to display tags in a process value archive
or "TasgName" to display an internal or external tag which is not stored in an archive.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

TagPrefix Property
Description
Defines or returns the tag prefix which is prefixed to all tags contained in the picture window
object. In this way, a picture that is embedded in a picture window retains access to its own
tags while another accesses other tags.
Modification of the TagPrefix takes effect when a picture is reloaded. When a picture is
changed, this occurs automatically, otherwise the picture name must be reassigned.
The tag prefix can be freely defined, but must match the name of the structure tags.
Note
The TagPrefix property is not available for the controls.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

Tags Property
Description
Returns an object of type "Tags".
Tags (read only)

582

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
The following example accesses the tag "Tag1":

'VBS86
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")

See also
Tags Object (List) (Page 155)
HMIRuntime Object (Page 134)

TagProviderClsid Property
Description
The "Index" property references a trend. "TagProviderClsid" defines whether this trend should
display an online tag or archived value. The data is only evaluated for online tags and archive
tags ("ProviderType" = -1).
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: Online tag.
{416A09D2-8B5A-11D2-8B81-006097A45D48}: Values are read from a process value archive
or a user archive.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Template Property
Description
Returns the template for displaying the window content of the "Application Window" object.
Read only access.
The following templates are possible depending on the property value:
Window Contents = Global Script
"GSC diagnostics"
The application window is supplied by applications of the Global Script. The results of the
diagnosis system are displayed.
"GSC Runtime"
The application window is supplied by applications of the Global Script. The analysis results
regarding characteristics in Runtime are displayed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

583

VBS for Creating Procedures and Actions


1.14 VBS Reference
Window Contents = Print Jobs
"All Jobs":
The application window is supplied by the logging system. The available reports are displayed
as a list.
"All Jobs - Context Menu":
The application window is supplied by the logging system. The available reports are displayed
as a list. The shortcut menu enables the selection of print options, display of a print preview
as well as a printout of the log.
"Job Detail View":
The application window is supplied by the logging system. The available reports are displayed
in a selection menu. Detailed information is displayed for the selected report.
"Selected Jobs - Context Menu":
The application window is supplied by the logging system. The available reports are displayed
as a list. This list only contains reports which you have activated the option "Mark for print job
list" in the "Print Job Properties" dialog. The shortcut menu enables the selection of print
options, display of a print preview as well as a printout of the log.

See also
ScreenItem Object (Page 141)
Application Window (Page 188)

Text Property
Description
Defines or returns the labeling for an object.

See also
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
Static text (Page 180)
ScreenItem Object (Page 141)

ThumbBackColor Property
Description
Defines the color of the slider.

584

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

TicColor Property
Description
Defines the color of the scale tick marks. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicFont Property
Description
Controls the display of the scale division labeling. Read only access.
The following properties can be set:
- Font
- Font Style
- Font Size
- "Strikethrough" effect
- "Underline" effect

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicOffset Property
Description
Defines the diameter of the imaginary circle on which the scale graduation is set. The value is
related to the smaller value of the geometric properties Width and Height.
The ends of the main tick marks of the scale graduation point outwards onto this circle.
Value range from 0 to 1.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

585

VBS for Creating Procedures and Actions


1.14 VBS Reference
0: The scale division is in the middle of the graduated scale disk.
1: The diameter of the imaginary circle for the scale tick marks is the smaller value of the
geometric properties Width and Height.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicTextColor Property
Description
Defines the color of the labeling of the scale tick marks.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicTextOffset Property
Description
Defines the diameter of the imaginary circle on which the labeling of the scale tick marks is
set. The value is related to the smaller value of the geometric properties Width and Height.
Value range from 0 to 1.
0: The label is in the middle of the graduated scale disk.
1: The diameter of the imaginary circle for the label is the smaller value of the geometric
properties Width and Height. As a result, part of the label can lie outside the object limits and
is, thus, invisible.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicWidth Property
Description
Defines the length of the long tick marks for the scaling. The value is related to the half the
smaller value of the geometric properties Width and Height.

586

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The length of the tick marks for fine scaling is 0.5*scale width.
Value range from 0 to end of scale.
0: No scale graduation is available. The division of the scale into ranges is not visible.
Scaling distance: The scaling division ranges from the middle point of the graduated scale disk
to the value defined by the scaling distance.

See also
ScreenItem Object (Page 141)
WinCC Gauge Control (Page 264)

Ticks Property
Description
TRUE, when the numbered face is displayed. BOOLEAN write-read access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

TicksColor Property
Description
Defines or returns the color of the hour markings on the face of the analog clock. LONG writeread access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

TickStyle Property
Description
This attribute defines the appearance of the scale. Value Range: 0 to 3.
As a result of the automatic scaling, it is possible that, occasionally, two scale tick marks lie
directly beside each other (apparently wide tick mark). This effect can be corrected by minimally
lengthening or shortening the slider object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

587

VBS for Creating Procedures and Actions


1.14 VBS Reference
It is also possible to completely suppress display of the scaling ("WithAxes").

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

TimeAxis - TimeBase
TimeAxis Property
Description
Defines whether a common time axis should be used for all trends in the trend window.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

TimeAxisActualize property
Refresh - TimeAxisActualize
Enables refreshing of the time axis selected.
Value

Explanation

TRUE

Enables updates of the trend window which is assigned to the time axis.

FALSE

Disables updates of the trend window which is assigned to the time axis. This setting can
be useful when comparing a logged trend with a current trend.

The attribute can be assigned dynamic properties by means of the name TimeAxisActualize.
The data type is BOOLEAN.

TimeAxisAdd property
New - TimeAxisAdd
Creates a new time axis.
The attribute can be assigned dynamic properties by means of the name TimeAxisAdd. The
data type is STRING.

588

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeAxisAlign property
Alignment - TimeAxisAlign
Specifies the mode of alignment of a selected time axis.
The following settings are available:
Value

Description

Explanation

Bottom

The time axis selected is displayed below the trend.

Top

The time axis selected is displayed above the trend.

The attribute can be assigned dynamic properties by means of the name TimeAxisAlign. The
data type is LONG.

TimeAxisBeginTime property
Start time - TimeAxisBeginTime
Defines the start of the time range for a selected time axis.
The attribute can be assigned dynamic properties by means of the name
TimeAxisBeginTime. The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

TimeAxisColor property
Time axis color - TimeAxisColor
Specifies the color of the time axis. The button opens the "Color selection" dialog to select the
color.
The setting is only active if the "Use trend color" option is not activated or if
"TimeAxisInTrendColor" is "FALSE".
The attribute can be assigned dynamic properties by means of the name TimeAxisColor. The
data type is LONG.

TimeAxisCount property
TimeAxisCount
Defines the number of time axes configured.
The attribute can be assigned dynamic properties by means of the name TimeAxisCount. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

589

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeAxisDateFormat property
Date format - TimeAxisDateFormat
Defines the date format for visualizing a selected time axis.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name


TimeAxisDateFormat. The data type is STRING.

TimeAxisEndTime property
End time - TimeAxisEndTime
Defines the end of the time range of a selected time axis.
The attribute can be assigned dynamic properties by means of the name TimeAxisEndTime.
The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

TimeAxisFormat Property
Description
Defines the format of the information along the time axis.
0: The information is provided in hh:mm
-1: The information is provided in hh:mm:ss
-2: The information is provided in hh:mm:ss.ms
-3: The information is provided in hh:mm (full hours)
-4: The information is provided in hh:mm:ss (full minutes)
-5: The information is provided in hh:mm:ss.ms (full seconds)

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

590

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeAxisIndex property
TimeAxisIndex
References a configured time axis. Using this attribute you can assign the values of other
attributes to a specific time axis.
Values between 0 and "TimeAxisCount" minus 1 are valid for "TimeAxisIndex". Attribute
"TimeAxisCount" defines the number of trends configured.
The "TimeAxisIndex" attribute can be assigned dynamic properties by means of attribute
TimeAxisRepos. The data type is LONG.

TimeAxisInTrendColor property
Use trend color - TrendAxisInTrendColor
Sets a trend color for displaying the time axis selected. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The trend color is used to display the time axis selected. The setting in the "Color" or
"TimeAxisColor" field is disabled.

FALSE

The time axis selected is displayed in the color set in the "Color" or "TimeAxisColor" field.

The attribute can be assigned dynamic properties by means of the name


TimeAxisInTrendColor. The data type is BOOLEAN.

TimeAxisLabel property
Label - TimeAxisLabel
Defines the label text for a time axis.
The attribute can be assigned dynamic properties by means of the name TimeAxisLabel. The
data type is STRING.

TimeAxisMeasurePoints property
Number of measurement points - TimeAxisMeasurePoints
Defines the number of measurement points to be displayed at the time axis selected.
The attribute can be assigned dynamic properties by means of the name
TimeAxisMeasurePoints. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

591

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeAxisName property
Object name - TimeAxisName
Specifies the name of a selected time axis.
The "TimeAxisName" attribute can be assigned dynamic properties by means of attribute
TimeAxisRename. The data type is STRING.

TimeAxisRangeType property
Time range setting - TimeAxisRangeType
Specifies the time range for the time axis selected.
Value

Description

Explanation

Time range

Defines the start time and the time range for the time axis.

Start to end time

Defines the start and end time for the time axis.

Number of measurement
points

Defines the start time and the number of measurement points


for the time axis.

The attribute can be assigned dynamic properties by means of the name


TimeAxisRangeType. The data type is LONG.

TimeAxisRemove property
Remove - TimeAxisRemove
Removes the selected time axis from the list.
The attribute can be assigned dynamic properties by means of the name TimeAxisRemove.
The data type is STRING.

TimeAxisRename property
TimeAxisRename
Renames a time axis which is referenced by means of "TimeAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name TimeAxisRename.
"TimeAxisRename" also sets a dynamic attribute "TimeAxisName". The data type is STRING.

592

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeAxisRepos property
Up/Down - TimeAxisRepos
Changes the order of the time axes. "Up" and "Down" move the selected time axis up or down
in the list.
The list order determines the time axis position in the trend window. The time axis is moved
away from the trend if the listing is the same and the time axis is further up in the list.
The attribute can be assigned dynamic properties by means of the name TimeAxisRepos. The
data type is LONG.

TimeAxisShowDate property
Show date - TimeAxisShowDate
Enables the display of the date and time at the time axis selected.
Value

Explanation

TRUE

Date and time are displayed. The date format is defined in the "Date format" field.

FALSE

The date is not displayed. Only the time is displayed.

The attribute can be assigned dynamic properties by means of the name TimeAxisShowDate.
The data type is BOOLEAN.

TimeAxisTimeFormat property
Time format - TimeAxisTimeFormat
Defines the time format for visualizing a selected time axis.
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

hh:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name


TimeAxisTimeFormat. The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

593

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeAxisTimeRangeBase property
Time range - TimeAxisTimeRangeBase
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

500

500 ms

1000

1 second

60000

1 minute

3600000

1 hour

86400000

1 day

The attribute can be assigned dynamic properties by means of the name


TimeAxisTimeRangeBase. The data type is LONG.

TimeAxisTimeRangeFactor property
Time range - TimeAxisTimeRangeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
TimeAxisTimeRangeFactor. The data type is SHORT.

TimeAxisTrendWindow property
Trend window - TimeAxisTrendWindow
Specifies the trend window for displaying the time axis selected. Define the available trend
windows in the "Trend window" or "TrendWindowAdd" tab.
The attribute can be assigned dynamic properties by means of the name
TimeAxisTrendWindow. The data type is STRING.

TImeAxisVisible property
Time axis - TimeAxisVisible
The list shows all time axes you created. Click a time axis entry in the list to adapt the properties
and to assign the time axis to a trend window.
Activate the time axes to be displayed in the trend window in the list.
Defines whether the selected time axis is displayed.

594

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Explanation

TRUE

The time axis is displayed.

FALSE

The time axis is not displayed.

The attribute can be assigned dynamic properties by means of the name TimeAxisVisible. The
data type is BOOLEAN.

TimeAxisX Property
Description
TRUE, when a common axis should be used for all trends in the trend window. BOOLEAN
write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

TimeBase property
Time base - TimeBase
This selection field is used to define the time base for the time stamp in the control.
Value

Designation

Local time zone

Coordinated Universal Time (UTC)

Project setting

The attribute can be assigned dynamic properties by means of the name TimeBase. The data
type is LONG.

TimeColumn
TimeColumnActualize property
TimeColumnActualize
Enables the update of values in the selected column.
Value

Explanation

TRUE

The time column is updated.

FALSE

The time column is not updated. This setting can be useful when comparing tables.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

595

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
TimeColumnActualize. The data type is BOOLEAN.

TimeColumnAdd property
New - TimeColumnAdd
Creates a new time column.
The attribute can be assigned dynamic properties by means of the name TimeColumnAdd.
The data type is STRING.

TimeColumnAlign property
Alignment - TimeColumnAlign
Defines the mode of alignment of the time column selected.
The following settings are available:
Value

Description

Explanation

left

The time column selected is displayed on the left.

Centered

The time column selected is aligned to center.

right

The time column selected is displayed on the right.

The attribute can be assigned dynamic properties by means of the name TimeColumnAlign.
The data type is LONG.

TimeColumnAlignment Property
Description
The "Index" property references a pair of columns. "TimeColumnAlignment" defines the
alignment of the time column for this column pair.
0: Time values are entered aligned left.
1: Time values are entered centered.
2: Time values are entered aligned right.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

596

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnBackColor property
Background color - TimeColumnBackColor
Specifies the background color of the time column selected. Use the button to open the "Color
selection" dialog.
The setting is useful if:
The "Use value column colors" option is not activated or
"TimeColumnUseValueColumnColors" is "FALSE".
The "Background color" option is activated or "UseColumnBackColor" is "TRUE in the "Use
column color" field of the "General" tab".
The attribute can be assigned dynamic properties by means of the name
TimeColumnBackColor. The data type is LONG.

TimeColumnBeginTime property
Start time - TimeColumnBeginTime
Defines the start of the time range for a selected time column.
The attribute can be assigned dynamic properties by means of the name
TimeColumnBeginTime. The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

TimeColumnCaption property
Caption - TimeColumnCaption
Defines the caption of the time column.
The attribute can be assigned dynamic properties by means of the name
TimeColumnCaption. The data type is STRING.

TimeColumnCount property
TimeColumnCount
Defines the number of time columns configured.
The attribute can be assigned dynamic properties by means of the name TimeColumnCount.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

597

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnDateFormat property
Date format - TimeColumnDateFormat
Defines the date format for visualizing a selected time column.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name


TimeColumnDateFormat. The data type is STRING.

TimeColumnEndTime property
End time - TimeColumnEndTime
Defines the end of the time range of a selected time column.
The attribute can be assigned dynamic properties by means of the name
TimeColumnEndTime. The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

TimeColumnForeColor property
Font color - TimeColumnForeColor
Specifies the font color of the time column selected. Use the button to open the "Color selection"
dialog.
The setting is useful if:
The "Use value column colors" option is not activated or
"TimeColumnUseValueColumnColors" is "FALSE".
The "Font color" option is activated or "UseColumnForeColor" is "TRUE" in the "Use column
color" field of the "General" tab.
The attribute can be assigned dynamic properties by means of the name
TimeColumnForeColor. The data type is LONG.

598

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnHideText property
TimeColumnHideText
Sets text format for displaying the content of a time column.
Value

Explanation

TRUE

The content is not displayed in text format.

FALSE

The content is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


TimeColumnHideText. The data type is BOOLEAN.

TimeColumnHideTitleText property
TimeColumnHideTitleText
Sets text format for displaying the time column header.
Value

Explanation

TRUE

The header is not displayed in text format.

FALSE

The header is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


TimeColumnHideTitleText. The data type is BOOLEAN.

TimeColumnIndex property
TimeColumnIndex
References a configured time column. Using this attribute you can assign the values of other
attributes to a specific time column.
Values between 0 and "TimeColumnCount" minus 1 are valid for "TimeColumnIndex". Attribute
"TimeColumnCount" defines the number of time columns configured.
The "TimeColumnIndex" attribute can be assigned dynamic properties by means of attribute
TimeColumnRepos. The data type is LONG.

TimeColumnLength property
Length in characters - TimeColumnLength
Specifies the width of a selected time column.
The attribute can be assigned dynamic properties by means of the name TimeColumnLength.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

599

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnMeasurePoints property
Number of measurement points - TimeColumnMeasurePoints
Defines the number of measurement points to be displayed in the time column selected.
The attribute can be assigned dynamic properties by means of the name
TimeColumnMeasurePoints. The data type is LONG.

TimeColumnName property
Object name - TimeColumnName
Specifies the name of a selected time column.
The "TimeColumnName" attribute can be assigned dynamic properties by means of attribute
TimeColumnRename. The data type is STRING.

TimeColumnRangeType property
Time range setting - TimeColumnRangeType
Defines the time range setting for the time column selected.
Value

Description

Explanation

Time range

Defines the start time and time range of the time column.

Start to end time

Defines the start and end time for the time column.

Number of measurement points

Defines the start time and the number of measurement points for the time
column.

The attribute can be assigned dynamic properties by means of the name


TimeColumnRangeType. The data type is LONG.

TimeColumnRemove property
Remove - TimeColumnRemove
Removes the selected time column from the list.
The attribute can be assigned dynamic properties by means of the name
TimeColumnRemove. The data type is STRING.

600

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnRename property
TimeColumnRename
Renames a time column which is referenced by means of "TimeColumnIndex" attribute.
The attribute can be assigned dynamic properties by means of the name
TimeColumnRename. "TimeColumnRename" also sets a dynamic attribute
"TimeColumnName". The data type is STRING.

TimeColumnRepos property
Up/Down - TimeColumnRepos
Repositions the order of time columns and of corresponding value columns. "Up" and "Down"
move the time column selected up or down in the list. This moves the time column and
corresponding value columns in the table towards the front or towards the back.
The attribute can be assigned dynamic properties by means of the name TimeColumnRepos.
The data type is LONG.

TimeColumnShowDate property
Show date - TimeColumnShowDate
Enables the display of the date and time in the time column selected.
Value

Explanation

TRUE

Date and time are displayed. The date format is defined in the "Date format" field or by using
"TimeColumnDateFormat".

FALSE

The date is not displayed. Only the time is displayed.

The attribute can be assigned dynamic properties by means of the name


TimeColumnShowDate. The data type is BOOLEAN.

TimeColumnShowIcon property
TimeColumnShowIcon
Enables the display of time column contents as icon. This function is only available in WinCC
Alarm Control.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name


TimeColumnShowIcon. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

601

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnShowTitleIcon property
TimeColumnShowTitleIcon
Enables display of the time column header as icon. This function is only available in WinCC
Alarm Control.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


TimeColumnShowTitleIcon. The data type is BOOLEAN.

TimeColumnSort property
TimeColumnSort
Defines the sorting order of the time column referenced in "TimeColumnIndex" .
The following settings are available:
Value

Description

Explanation

No

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name TimeColumnSort .
The data type is LONG.

TimeColumnSortIndex property
TimeColumnSortIndex
Defines the sorting order of the time column referenced in "TimeColumnIndex". The sorting
criterion is removed from "TimeColumnSort" if you set a "0" value..
The attribute can be assigned dynamic properties by means of the name
TimeColumnSortIndex. The data type is LONG.

TimeColumnTimeFormat property
Time format - TimeColumnTimeFormat
Defines the time format for visualizing a selected time column.
The following time formats are available:

602

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name


TimeColumnTimeFormat. The data type is STRING.

TimeColumnTimeRangeBase property
Time range - TimeColumnTimeRangeBase
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

500

500 ms

1000

1 second

60000

1 minute

3600000

1 hour

86400000

1 day

The attribute can be assigned dynamic properties by means of the name


TimeColumnTimeRangeBase. The data type is LONG.

TimeColumnTimeRangeFactor property
Time range - TimeColumnTimeRangeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
TimeColumnTimeRangeFactor. The data type is SHORT.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

603

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeColumnUseValueColumnColors property
Use value column colors - TimeColumnUseValueColumnColors
Defines whether the selected time column will be displayed in the value column colors.
Value

Explanation

TRUE

The colors of the value column are used to display a selected time column. The settings in the "Font color"
and "Background color" fields are disabled.

FALSE

The colors defined in the "Font color" and "Background color" fields are used to display the selected time
column.

The attribute can be assigned dynamic properties by means of the name


TimeColumnUseValueColumnColors. The data type is BOOLEAN.

TimeColumnVisible property
Time columns - TimeColumnVisible
The list shows the time columns you created. Click a time column entry in the list to adapt the
properties and to define the time range of the time column.
Select the time columns to be displayed in the table from the list.
Defines whether the selected time column is displayed.
The attribute can be assigned dynamic properties by means of the name TimeColumnVisible.
The data type is BOOLEAN.

TimeFormat - Tolerance
TimeFormat Property
Description
Defines the format of the time specification.
0: The information is provided in hh:mm
-1: The information is provided in hh:mm:ss
-2: The information is provided in hh:mm:ss.ms
-3: The information is provided in hh:mm (full hours)
-4: The information is provided in hh:mm:ss (full minutes)
-5: The information is provided in hh:mm:ss.ms (full seconds)

604

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeJump Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeJump" defines whether the time jumps in the
archive should be identified by the color defined in "TimeJumpColor".
WinCC Online Trend Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeJumpColor Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeJumpColor" defines the color identifying the
time jumps in the archive. Whether the information is evaluated is dependent on the value of
the "TimeJump" property. The color is defined as an RGB value. LONG write-read access.
WinCC Online Trend Control
The value of this property cannot be changed. Read only access.

See also
ScreenItem Object (Page 141)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

605

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeOverlap Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeOverlap" defines whether the time overlaps in
the archive should be identified by the color defined in "TimeOverlapColor".
WinCC Online Trend Control
The value of this property cannot be changed. Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeOverlapColor Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeOverlapColor" defines the color identifying the
time overlaps in the archive. Whether the information is evaluated depends on the value of the
"TimeOverlap" attribute. The color is defined as an RGB value.
WinCC Online Trend Control
The value of this property cannot be changed. Read only access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

606

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TimeRange Property
Description
The "Index" property references a column pair or a trend. "TimeRange" defines how the time
range to be displayed should be defined.
0: The time range to be displayed is defined by a start time ("BeginTime") and end time
("EndTime").
-1: The time range to be displayed is defined by a start time ("BeginTime") and a time range
("TimeRangeBase" and "TimeRangeFactor").

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeRangeBase Property
Description
The "Index" property references a column pair or a trend. The time range to be displayed for
this column pair/trend results from multiplying the values "TimeRangeBase" and
"TimeRangeFactor", whereby the value "TimeRangeBase" is interpreted in milliseconds.
The "TimeRangeBase" and "TimeRangeFactor" properties are only evaluated when the
"TimeRange" property is set, i.e. has the value "-1".

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeRangeFactor Property
Description
The "Index" property references a column pair or a trend. The time range to be displayed for
this column pair/trend results from multiplying the values "TimeRangeBase" and
"TimeRangeFactor", whereby the value "TimeRangeBase" is interpreted in milliseconds.
The "TimeRangeBase" and "TimeRangeFactor" properties are only evaluated when the
"TimeRange" property is set, i.e. has the value "-1".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

607

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeStamp Property
Description
Reads the time stamp of the last read access of a tag. The time stamp is returned in local time.
DATE (read only)
The VBS standard function "FormatDateTime(Date[, NamedFormat])" enables the time stamp
property to be output in plain text. The output is dependent on the current language setting.
The language setting can be set using the VBS standard function SetLocale().
By implementing the second parameter of the FormatDate() function and further VBS standard
functions such as Year, WeekDay, Day, Hour, Minute, Second enable the information, required
by the user, to be split. Use the WeekdayName function to receive the name of the weekday
for WeekDay.
Example:

'VBS87
Dim objTag
Dim lngCount
lngCount = 0
Set objTag = HMIRuntime.Tags("Tag11")
objTag.Read
SetLocale("en-gb")
MsgBox FormatDateTime(objTag.TimeStamp)
'Output: e.g. 06/08/2002 9:07:50
MsgBox Year(objTag.TimeStamp)
'Output: e.g. 2002
MsgBox Month(objTag.TimeStamp)
'Output: e.g. 8
MsgBox Weekday(objTag.TimeStamp)
'Output: e.g. 3
MsgBox WeekdayName(Weekday(objTag.TimeStamp))
'Output: e.g. Tuesday
MsgBox Day(objTag.TimeStamp)
'Output: e.g. 6
MsgBox Hour(objTag.TimeStamp)
'Output: e.g. 9
MsgBox Minute(objTag.TimeStamp)
'Output: e.g. 7
MsgBox Second(objTag.TimeStamp)
'Output: e.g. 50
For lngCount = 0 To 4
MsgBox FormatDateTime(objTag.TimeStamp, lngCount)
Next
'lngCount = 0: Output: e.g. 06/08/2002 9:07:50
'lngCount = 1: Output: e.g. 06 August 2002
'lngCount = 2: Output: e.g. 06/08/2002
'lngCount = 3: Output: e.g. 9:07:50
'lngCount = 4: Output: e.g. 9:07

608

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example:
The following example issues the time stamp of the tag "Tag1":

'VBS88
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
MsgBox objTag.TimeStamp

See also
Tag Object (Page 152)
Alarms object (list) (Page 126)

TimeStepBase property
Precision - TimeStepBase
Defines the precision of the time stamp displayed in a table.
Calculate the precision by multiplying the factor with the time unit. Enter factor "3" and time
unit "1s" to display all values which were generated within 3 seconds in the same row, for
example.
Value

Description

Explanation

Exact

Only values with precisely the same time stamp are displayed in a table
row.

100

100 ms

All values generated within 100 milliseconds are grouped in a table row.

250

250 ms

All values generated within 250 milliseconds are grouped in a table row.

500

500 ms

All values generated within 500 milliseconds are grouped in a table row.

1000

1s

All values generated within 1 second are grouped in a table row.

The attribute can be assigned dynamic properties by means of the name TimeStepBase. The
data type is LONG.

TimeStepFactor property
Precision - TimeStepFactor
Defines the precision of the time stamp displayed in a table.
Calculate the precision by multiplying the factor with the time unit. Enter factor "3" and time
unit "1s" to display all values which were generated within 3 seconds in the same row.
The factor entered is disabled if "Exact" is selected for the time unit or "0" is selected for
"TimeStepBase".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

609

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name TimeStepFactor. The
data type is LONG.

TimeZone Property
Description
Defines the time zone used as a basis for displaying time values. Four settings are possible:
Local time zone
Server's time zone
UTC (Universal Time Coordinated)
Apply project settings (=> Use WinCC Explorer and access the computer's properties page
to define the time mode specifically for the computer. The following are available for
selection: WinCC V50 (Compatibility mode => Display as was standard in the individual
display sections to V5 ), local time and UTC.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

TitleColor property
Table header background - TitleColor
Specifies the background color of the table headers. The button opens the "Color selection"
dialog.
The attribute can be assigned dynamic properties by means of the name TitleColor. The data
type is LONG.

TitleCut property
Shorten contents - TitleCut
Truncates the content of column headers if the column is insufficient.
Value

Explanation

TRUE

The column headers are truncated.

FALSE

The column headers are not truncated.

610

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name TitleCut . The data
type is BOOLEAN.

TitleCut property (before WinCC V7)


Description
Defines whether the content of the fields of a title bar should be shortened if the column width
is too small. Write/Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

TitleDarkShadowColor property
Dark shading color - TitleDarkShadowColor
Specifies the color of the dark side of shading. The button opens the "Color selection" dialog.
The setting is only active if the "Shading Color" option or "TitleStyle" is activated.
The attribute can be assigned dynamic properties by means of the name
TitleDarkShadowColor. The data type is LONG.

TitleForeColor property
Table header font color - TitleForeColor
Specifies the color of the table header. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name TitleForeColor. The
data type is LONG.

TitleGridLineColor property
Color of the divider / header - TitleGridLineColor
Defines the color of row/column dividers in the table header. The button opens the "Color
selection" dialog.
The attribute can be assigned dynamic properties by means of the name TitleGridLineColor.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

611

VBS for Creating Procedures and Actions


1.14 VBS Reference

TitleLightShadowColor property
Bright shading color - TitleLightShadowColor
Specifies the color of the bright side of shading. The button opens the "Color selection" dialog.
The setting is only active if the "Shading Color" option or "TitleStyle" is activated.
The attribute can be assigned dynamic properties by means of the name
TitleLightShadowColor. The data type is LONG.

Titleline Property
Description
TRUE, when the control has a title bar and it can be moved in Runtime. BOOLEAN write-read
access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

TitleSort property
Sort by column title- TitleSort
Defines how to trigger sorting by column title. You can only sort by column title if the "Autoscrolling" option is deactivated.
Value

Description

Explanation

No

Sorting by column title is not possible.

With click

Sorting is triggered by clicking in the column header.

With double-click

Sorting is triggered by double-clicking in the column title.

The attribute can be assigned dynamic properties by means of the name TitleSort. The data
type is LONG.

612

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TitleStyle property
Shading color - TitleStyle
Specifies whether to set a shading color for the table header.
Value

Description

Explanation

Flat

Disables the use of shading colors. Flat header style.

Button

Enables the use of shading colors. 3D representation of the header.

The attribute can be assigned dynamic properties by means of the name TitleStyle. The data
type is LONG.

Toggle Property
Description
TRUE, when the button or round button should lock after being operated in Runtime.
BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

ToleranceHigh Property
Description
Defines or returns the limit value for "Tolerance high".
The type of the evaluation (in percent or absolute) is defined in the "TypeToleranceHigh"
property.
The monitoring of the limit value is only valid if the "CheckToleranceHigh" property is set to
"TRUE".

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

613

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToleranceLow Property
Description
Defines or returns the limit value for "Tolerance low".
The type of the evaluation (in percent or absolute) is defined in the "TypeToleranceLow"
property.
The monitoring of the limit value is only valid if the "CheckToleranceLow" property is set to
"TRUE".

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Toolbar
Toolbar Property
Description
TRUE, when a toolbar is to be displayed. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ToolbarAlignment property (before WinCC V7)


Description
Defines or returns the position of the toolbar. Write/Read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)

614

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ToolbarAlignment Property
Alignment - ToolbarAlignment
Defines the orientation of the Control toolbar.
The following settings are available:
Value

Description

Explanation

Top

The toolbar is aligned to the top edge.

Bottom

The toolbar is aligned to the bottom edge.

Left

The toolbar is aligned to the left edge.

Right

The toolbar is aligned to the right edge.

The attribute can be assigned dynamic properties by means of the name ToolbarAlignment.
The data type is LONG.

ToolbarBackColor property
Background color - ToolbarBackColor
Specifies the background color of the toolbar. Open the "Color selection" dialog by clicking the
button.
The background color you configured is only displayed if the "Display" option is activated or
"ToolbarUseBackColor" is "TRUE".
The attribute can be assigned dynamic properties by means of the name ToolbarBackColor.
The data type is LONG.

ToolbarButtonActive property
Active - ToolbarButtonActive
Activates a button function in Runtime. Clicking the button in Runtime triggers the
corresponding function.
Value

Explanation

TRUE

The button function is enabled.

FALSE

The button function is disabled. You can assign custom functions to the button by means of scripting.

The attribute can be assigned dynamic properties by means of the name


ToolbarButtonActive. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

615

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolbarButtonAdd property
New - ToolbarButtonAdd
Creates a new, user-defined button function. The name set by WinCC can be edited in the
"Object name" field.
The attribute can be assigned dynamic properties by means of the name ToolbarButtonAdd .
The data type is STRING.

ToolbarButtonBeginGroup property
Separator - ToolbarButtonBeginGroup
Inserts a leading separator (vertical line) for the selected button function on the toolbar. These
separators can be used to group the icons of the button functions.
Value

Explanation

TRUE

A separator prefix is inserted for the button function selected.

FALSE

A separator prefix is not inserted for the button function selected.

The attribute can be assigned dynamic properties by means of the name


ToolbarButtonBeginGroup. The data type is BOOLEAN.

ToolbarButtonClick AlarmControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.

616

ID

Button function

ID

Button function

"Help"

21

"Next message"

"Configuration dialog"

22

"Last message"

"Message list".

23

"Info text dialog"

"Short-term archive list".

24

"Comments dialog"

"Long-term archive list"

25

"Loop In Alarm"

"Lock List".

26

"Lock message"

"Hit List"

27

"Enable message"

"List of messages to be hidden"

28

"Hide messages"

"Ackn. Central Signaling Devices"

29

'Unhide messages"

10

"Single acknowledgment"

30

"Sort dialog"

11

"Group acknowledgement"

31

"Time base dialog"

18

"Emergency acknowledgement"

32

"Copy rows"

13

"Selection dialog"

33

"Connect backup"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
14

"Display options dialog"

34

"Disconnect backup"

15

"Lock dialog"

36

"First page"

17

"Print"

37

"Previous page"

35

"Export data"

38

"Next page"

12

"Autoscroll"

39

"Last page"

19

"First message"

1001

"User-defined 1"

20

"Previous message"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick FunctionTrendControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

ID

Button function

"Help"

13

"Select time range"

"Configuration dialog"

14

"Previous trend"

"Zoom area"

15

"Next trend"

"Zoom +/-"

16

"Stop"

"Zoom X axis +/-"

16

"Start"

"Zoom Y axis +/-"

17

"Print"

"Shift trend range"

20

"Export data"

"Shift axes range"

"Ruler"

10

"Original view"

18

"Connect backup"

11

"Select data connection"

19

"Disconnect backup"

12

"Select trends"

1001

"User-defined 1"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick OnlineTableControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

ID

Button function

"Help"

13

"Next column"

"Configuration dialog"

14

"Stop"

"First data record"

14

"Start"

"Previous data record"

15

"Print"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

617

VBS for Creating Procedures and Actions


1.14 VBS Reference
5

"Next data record"

20

"Export data"

"Last data record"

16

"Define statistics area"

"Edit"

17

"Calculate statistics"

"Copy rows"

18

"Connect backup"

"Select data connection"

19

"Disconnect backup"

10

"Select columns"

21

"Create archive value"

11

"Select time range"

1001

"User-defined 1"

12

"Previous column"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick OnlineTrendControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

ID

Button function

"Help"

17

"Select time range"

"Configuration dialog"

18

"Previous trend"

"First data record"

19

"Next trend"

"Previous data record"

20

"Stop"

"Next data record"

20

"Start"

"Last data record"

21

"Print"

"Zoom area"

26

"Export data"

"Zoom +/-"

"Ruler"

10

"Zoom time axis +/-"

22

"Define statistics area"

11

"Zoom value axis +/-"

23

"Calculate statistics"

12

"Shift trend range"

24

"Connect backup"

13

"Shift axes range"

25

"Disconnect backup"

14

"Original view"

27

"Relative axis"

15

"Select data connection"

1001

"User-defined 1"

16

"Select trends"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

618

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolbarButtonClick RulerControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

"Help"

"Configuration dialog"

"Ruler window"

"Statistics range"

"Statistics"

"Print"

"Export data"

1001

"User-defined 1"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick UserArchiveControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

ID

Button function

"Help"

12

"Read tags"

"Configuration dialog"

13

"Write tags"

"Select data connection"

14

"Import archive"

"First row"

15

"Export archive"

"Previous row"

16

"Sort dialog"

"Next row"

17

"Selection dialog"

"Last row"

18

"Print"

"Delete rows"

20

"Export data"

"Cut rows"

19

"Time base dialog"

10

"Copy rows"

1001

"User-defined 1"

11

"Insert rows"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

619

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolbarButtonCount property
ToolbarButtonCount
Defines the number of configurable button functions.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonCount. The data type is LONG.

ToolbarButtonEnabled property
ToolbarButtonEnabled
Enables operation of custom toolbar buttons.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonEnabled. The data type is BOOLEAN.

ToolbarButtonHotKey property
Hotkey - ToolbarButtonHotKey
Shows the hotkey for a button function selected.
You create or edit a hotkey by clicking in the "Hotkey" field and pressing the button or key
shortcut required.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonHotKey. The data type is LONG.

ToolbarButtonID property
Object ID - ToolbarButtonID
Unique ID number for the selected button function. WinCC assigns this read only ID number.
The attribute can be assigned dynamic properties by means of the name ToolbarButtonID.
The data type is LONG.

ToolbarButtonIndex property
ToolbarButtonIndex
References a button function. Using this attribute you can assign the values of other attributes
to a specific button function.
Values between 0 and "ToolbarButtonIndex" minus 1 are valid for "ToolbarButtonCount".
Attribute "ToolbarButtonCount" defines the number of configurable button functions.

620

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "ToolbarButtonIndex" attribute can be assigned dynamic properties by means of attribute
ToolbarButtonRepos. The data type is LONG.

ToolbarButtonLocked property
ToolbarButtonLocked
Enables/disables the display of the pressed state of a user-defined toolbar button.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonLocked. The data type is BOOLEAN.

ToolbarButtonName property
Object name - ToolbarButtonName
Shows the name for the selected button function. You rename user-defined button functions.
The "ToolbarButtonName" attribute can be assigned dynamic properties by means of attribute
ToolbarButtonRename. The data type is STRING.

ToolbarButtonPasswordLevel property
Operator authorization - ToolbarButtonPasswordLevel
Shows the authorization for a button function selected. You can edit the authorization using
the selection button.
Authorizations are configured in the "User Administrator" editor.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonPasswordLevel. The data type is LONG.

ToolbarButtonRemove property
Remove - ToolbarButtonRemove
Removes the selected button function from the list. Only user-defined button functions can be
removed.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonRemove. The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

621

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolbarButtonRename property
ToolbarButtonRename
Renames a custom toolbar element which is referenced by means of "ToolbarButtonIndex"
attribute.
The attribute for custom elements can be assigned dynamic properties by means of the name
ToolbarButtonRename. "ToolbarButtonRename" also sets a dynamic attribute
"ToolbarButtonName". The data type is STRING.

ToolbarButtonRepos property
Up/Down - ToolbarButtonRepos
Changes the sorting order of button functions. "Up" and "Down" move the button function
selected up or down in the list. This moves the button function in the toolbar of a Control towards
the front or towards the back.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonRepos. The data type is LONG.

ToolbarButtonTooltipText property
ToolbarButtonTooltipText
Specifies the tooltip text for the button.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonTooltipText. The data type is STRING.

ToolbarButtonUserDefined property
ToolbarButtonUserDefined
Indicates whether the project engineer has added a new user-defined toolbar button.
Value

Explanation

TRUE

The toolbar button is assigned a user-defined function.

FALSE

The toolbar button is defined by the system.

The attribute can be assigned dynamic properties by means of the name


ToolbarButtonUserDefined. The data type is BOOLEAN.

622

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolbarButtonVisible property
Button functions - ToolbarButtonVisible
Select the button functions to be displayed in the toolbar from the list.
Click a list entry to adapt the properties, or to change the position in the status bar of the Control
by means of the "Up" and "Down" buttons.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonVisible . The data type is BOOLEAN.

ToolbarButtons Property
Description
Defines or returns the buttons contained in the toolbar by setting or resetting the corresponding
bits. Each button is assigned a bit. There are no limitations as to the bit combinations.
Bit - Value (hex) ; Value (dec) ; Button:
0 - 0x00000001; 1; Message List
1 - 0x00000002; 2; Short-term archive list
2 - 0x00000004; 4; Long-term archive list
3 - 0x00000008; 8; Acknowledgment of central signaling device
4 - 0x00000010; 16; Single Acknowledgment
5 - 0x00000020; 32; Group acknowledgment
6 - 0x00000040; 64; Autoscroll
7 - 0x00000080; 128; Selection Dialog
8 - 0x00000100; 256; Lock Dialog
9 - 0x00000200; 512; Print message log
11 - 0x00000800; 2048; Emergency acknowledgment
12 - 0x00001000; 4096; First message
13 - 0x00002000; 8192; Last message
14 - 0x00004000; 16384; Next message
15- 0x00008000; 32768; Previous message
16 - 0x00010000; 65536; Infotext Dialog
17 -0x00020000; 131072; Comment Dialog
18 - 0x00040000; 262144; Loop in Alarm
20 - 0x00100000; 1048576; Print current view
21 - 0x00200000; 2097152; Lock list
22 - 0x00400000; 4194304; Lock/release message

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

623

VBS for Creating Procedures and Actions


1.14 VBS Reference
23 - 0x00800000; 8388608; Sorting Dialog
24 - 0x01000000; 16777216; Time basis dialog
25 - 0x02000000; 33554432; Hit list
In order to display more buttons, their values must be logically linked with OR. Write/Read
access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ToolbarHotKeys Property
Description
Defines or returns hotkeys of the buttons in the toolbar. Write/Read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ToolbarShowTooltips property
Tooltips - ToolbarShowTooltips
Enables the display of tooltips for the button functions in Runtime.
Value

Explanation

TRUE

Enables the display of tooltips.

FALSE

Disables the display of tooltips.

The attribute can be assigned dynamic properties by means of the name


ToolbarShowTooltips. The data type is BOOLEAN.
Attribute "ToolbarButtonTooltipText" defines the tooltip text.

624

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolbarUseBackColor property
Show background color - ToolbarUseBackColor
Enables the display of the background color for a toolbar.
Value

Explanation

TRUE

Enables the display of the background color of a toolbar.

FALSE

Disables the display of the background color of a toolbar.

The attribute can be assigned dynamic properties by means of the name


ToolbarUseBackColor. The data type is BOOLEAN.

ToolbarUseHotKeys property
Hotkeys - ToolbarUseHotKeys
Activates the hotkeys for button functions in Runtime. Insert the hotkeys for button functions
in the "Hotkey" field.
Value

Explanation

TRUE

The hotkeys are activated.

FALSE

The hotkeys are deactivated.

The attribute can be assigned dynamic properties by means of the name


ToolbarUseHotKeys. The data type is BOOLEAN.

ToolbarVisible property
Show toolbar - ToolbarVisible
Enables the display of the Control toolbar.
Value

Explanation

TRUE

Enables the display of the toolbar.

FALSE

Disables the display of the toolbar.

The attribute can be assigned dynamic properties by means of the name ToolbarVisible . The
data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

625

VBS for Creating Procedures and Actions


1.14 VBS Reference

ToolTip - TrendLower
ToolTipText Property
Description
Defines or returns the text to be displayed as a tooltip when the mouse is positioned over the
object.
STRING (write-read access)

Example:
The following example assigns a tool tip text to every object in the picture "NewPDL1": The
picture "NewPDL1" comprises only objects containing the ToolTipText property:

'VBS89
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
'
'Assign tooltiptexts to the objects
objScrItem.ToolTipText = "Name of object is " & strName
Next

See also
Radio box (Page 221)
Status display (Page 213)
Connector (Page 182)
Text list (Page 211)
Static text (Page 180)
Slider (Page 226)
Group Display (Page 208)
Rounded rectangle (Page 177)
Round Button (Page 223)
Rectangle (Page 174)
Polyline (Page 173)

626

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Polygon (Page 171)
OLE object (Page 206)
Line (Page 169)
Pie segment (Page 167)
Circular arc (Page 166)
Circle (Page 164)
Group (Page 302)
Graphic Object (Page 202)
Ellipse segment (Page 162)
Ellipse arc (Page 161)
Ellipse (Page 159)
I/O Field (Page 199)
Check box (Page 219)
Button (Page 215)
Bar (Page 189)
Customized Object (Page 300)
3D Bar (Page 184)

Top Property
Function
Defines or returns the Y-coordinate of an object (measured from the top left edge of the picture)
in pixels. The Y-coordinate relates to the top left corner of the rectangle enclosing the object.
LONG (write-read access)

Example:
The following example shifts all objects in the picture "NewPDL1" 5 pixels upwards:

'VBS90
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Top = objScrItem.Top - 5

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

627

VBS for Creating Procedures and Actions


1.14 VBS Reference

Next

See also
Left Property (Page 463)
ScreenItem Object (Page 141)

TopConnectedConnectionPointIndex Property
Description
Specifies or sets the index number of the top connecting point.
LONG write-read access.

See also
Connector (Page 182)
ScreenItem Object (Page 141)

TopConnectedObjectName Property
Description
Specifies or sets the object name of the object which is docked on at the bottom connecting
point.
LONG write-read access.

See also
Connector (Page 182)
ScreenItem Object (Page 141)

Transparency property
Description
Defines and returns the percentage transparency of the object.
0 = no transparency; 100 = complete transparency (invisible)
The text and fields of the graphic objects are only transparent at "100."
In runtime, a completely transparent object (invisible) is also functional.

628

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Transparent Property
Description
TRUE, when the button appears completely filled in the color specified in "BackColor".
BOOLEAN write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

Trend Property
Description
TRUE, when the tendency (rising or falling) of the measuring value being monitored should
be displayed by a small arrow. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TrendActualize property
Update -TrendActualize
Enables the update of a selected trend.
Value

Explanation

TRUE

Enables updates of the trend selected.

FALSE

Disables updates of the trend selected. This setting can be useful when comparing a logged trend with a current
trend.

The attribute can be assigned dynamic properties by means of the name TrendActualize. The
data type is BOOLEAN.

TrendAdd property
New - TrendAdd
Creates a new trend.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

629

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name TrendAdd. The data
type is STRING.

TrendAutoRangeBeginTagName property
TrendAutoRangeBeginTagName
This attribute sets the low limit tag for the range of values if the range of values is calculated
automatically by means of online tags.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeBeginTagName. The data type is STRING.

TrendAutoRangeBeginValue property
TrendAutoRangeBeginValue
This attribute sets the low limit tag for the range of values if the range of values is calculated
based on the configuration of high and low limits.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeBeginValue. The data type is DOUBLE.

TrendAutoRangeEndTagName property
TrendAutoRangeEndTagName
This attribute sets the high limit tag for the range of values if the range of values is calculated
automatically by means of online tags.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeEndTagName. The data type is STRING.

TrendAutoRangeEndValue property
TrendAutoRangeEndValue
This attribute sets the high limit tag for the range of values if the range of values is calculated
based on the configuration of high and low limits.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeEndValue. The data type is DOUBLE.

630

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendAutoRangeSource property
TrendAutoRangeSource
Defines the mode for automatic calculation of the range of values of trend data.
Value

Description

Explanation

Display data

The range of values is calculated automatically based on the data displayed.

Value range

The range of values is defined based on its configured low and high limit. The low and high
limits are emulated in the "TrendAutoRangeBeginValue" and "TrendAutoRangeEndValue"
attributes.

Online tags

The low and high limits of the range of values are derived from the values of connected online
tags. The low and high limits are emulated in the "TrendAutoRangeBeginTagName" and
"TrendAutoRangeEndTagName" attributes.

The attribute can be assigned dynamic properties by means of the name


TrendAutoRangeSource. The data type is LONG.

TrendBeginTime property
Start time - TrendBeginTime
Defines the start time of the time range for data transfer to the selected trend.
The attribute can be assigned dynamic properties by means of the name TrendBeginTime.
The data type is Date.

TrendColor property
Trend color - TrendColor
Specifies the trend color. Open the "Color selection" dialog by clicking the button.
The attribute can be assigned dynamic properties by means of the name TrendColor. The data
type is LONG.

LTrendColor property (before WinCC V7)


Description
Determines the color of the trend display or returns it.
The trend display indicates the tendency (rising or falling) of the measuring value being
monitored by a small arrow. In order to activate the trend display, the Trend property must be
set to "True". LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

631

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TrendCount property
TrendCount
Defines the number of configured trends.
The attribute can be assigned dynamic properties by means of the name TrendCount. The
data type is LONG.

TrendEndTime property
End time - TrendEndTime
Defines the end of the time range for data connections of a selected trend.
The attribute can be assigned dynamic properties by means of the name TrendEndTime. The
data type is Date.

TrendExtendedColorSet property
Extended - TrendExtendedColorSet
Enables configuration of the point and fill colors and the display of colors in Runtime.
Value

Explanation

TRUE

The "Point color" and "Fill color" field settings can be configured and are active in Runtime.

FALSE

The "Point color" and "Fill color" field settings cannot be configured and are inactive in
Runtime.

The attribute can be assigned dynamic properties by means of the name


TrendExtendedColorSet. The data type is BOOLEAN.

632

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendFill property
Filled - TrendFill
Specifies if the area beneath the trend is to be filled.
Value

Explanation

TRUE

The area beneath the trend is shown filled. You can define the trend color as fill color if the "Advanced"
option is deactivated.
The text background is displayed in the trend color for the trend type "Values". The background color
of the control is used as text color.

FALSE

The trend is not visualized with fill color.

The attribute can be assigned dynamic properties by means of the name TrendFill. The data
type is BOOLEAN.

TrendFillColor property
Fill color - TrendFillColor
Specifies the fill color of the trend. The text fill color is specified for the trend type "Values".
The fill color is used if the "Filled" option is activated or "TrendFill" is "TRUE". Open the "Color
selection" dialog by clicking the button.
The configuration is only possible if the "Advanced" option is activated or
"TrendExtendedColorSet" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendFillColor. The
data type is LONG.

TrendIndex property
TrendIndex
References a configured trend. Using this attribute you can assign the values of other attributes
to a specific trend. The index must always be set before you change the properties of a trend
in runtime.
Values between 0 and "TrendIndex" minus 1 are valid for "TrendCount". Attribute "TrendCount"
defines the number of trends configured.
The "TrendIndex" attribute can be assigned dynamic properties by means of attribute
TrendRepos. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

633

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendLabel property
Label - TrendLabel
Defines the label of the trend selected. The label is displayed in Runtime if the value at attribute
"UseTrendNameAsLabel" is "FALSE".
The attribute can be assigned dynamic properties by means of the name TrendLabel. The data
type is STRING.

TrendLineStyle property
Line style - TrendLineStyle
Defines the line style for trend visualization.
The following settings are available:
Value

Description

Explanation

Solid

The trend is visualized as solid line.

Dashed

The trend is visualized as dashed line.

Dotted

The trend is visualized as dotted line.

Dash dot

The trend is visualized as dot-dash line.

Dash Dot Dot

The trend is visualized as dash-dot-dot line.

The attribute can be assigned dynamic properties by means of the name TrendLineStyle. The
data type is LONG.

TrendLineType property
Trend type - TrendLineType
Defines how to visualize a trend.
The following settings are available:
Value

Description

Explanation

None

Only the dots are displayed.

Connect dots
linearly

Visualizes a trend with linear interconnection of points.

Stepped

Visualizes a stepped trend and its interconnected points.

Values

Can only be configured with OnlineTrendControl.


A value is displayed at each time stamp or at the main grid line of the time axis instead of
trend points.

The attribute can be assigned dynamic properties by means of the name TrendLineType. The
data type is LONG.

634

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendLineWidth property
Line weight - TrendLineWidth
Defines the line weight of the line displayed.
The attribute can be assigned dynamic properties by means of the name TrendLineWidth. The
data type is LONG.

TrendLowerLimit property
TrendLowerLimit
Specifies the low limit of a tag. The values are identified based on the color set in
"TrendLowerLimitColor" if the tag value is less than "TrendLowerLimit". This setting is only
active if the value at attribute "TrendLowerLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendLowerLimit.
The data type is DOUBLE.

TrendLowerLimitColor property
TrendLowerLimitColor
Specifies the color of tag values which are less than the value at "TrendLowerLimit". This
setting is only active if the value at attribute "TrendLowerLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name
TrendLowerLimitColor. The data type is LONG.

TrendLowerLimitColoring property
TrendLowerLimitColoring
Enables the "TrendLowerLimitColor" attribute for identifying tag values which are less than the
value at "TrendLowerLimitValue".
Value

Explanation

TRUE

Attribute "TrendLowerLimitColor" is active.

FALSE

Attribute "TrendLowerLimitColor" is inactive.

The attribute can be assigned dynamic properties by means of the name


TrendLowerLimitColoring. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

635

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendMeasure - TrendVisible
TrendMeasurePoints property
Number of measurement points - TrendMeasurePoints
Defines the number of measurement points for visualization of selected trends.
Defines the number of value pairs provided to the trend from a user archive.
The attribute can be assigned dynamic properties by means of the name
TrendMeasurePoints. The data type is LONG.

TrendName property
Object name - TrendName
Displays the name of the selected trend. The name is defined on the "Trends" tab.
The "TrendName" attribute can be assigned dynamic properties by means of attribute
TrendRename. The data type is STRING.

TrendPointColor property
Point color - TrendPointColor
Defines the color of trend points. Open the "Color selection" dialog by clicking the button.
The configuration is only possible if the "Advanced" option is activated or
"TrendExtendedColorSet" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendPointColor.
The data type is LONG.

TrendPointStyle property
Dot type - TrendPointStyle
Defines the dot style for trend visualization.
The following settings are available:

636

Value

Description

Explanation

None

The points are not displayed.

Dots

The trend points are visualized with a size of one pixel. The setting
in the "Dot width" field is deactivated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Explanation

Squares

The dots are displayed as square. The setting in the "Dot width"
field is active.

Circles

The dots are displayed as circles. The setting in the "Dot width" field
is active.

The attribute can be assigned dynamic properties by means of the name TrendPointStyle. The
data type is LONG.

TrendPointWidth property
Dot width - TrendPointWidth
Sets the dot width in pixels. You can only define the dot width for the "square" and "circular"
type.
The attribute can be assigned dynamic properties by means of the name TrendPointWidth.
The data type is LONG.

TrendProvider property
Data source - TrendProvider
Specifies the data source for a selected trend.
The following settings are available:
Value

Description

Explanation

None

No data source configured for implementation in Runtime by means of script.

Archive tags

Data source with archive tags of a process value archive.

Online tags

Data source with online tags derived from tag management.

User archive

Data source with columns of a user archive.

The attribute can be assigned dynamic properties by means of the name TrendProvider. The
data type is LONG.

TrendProviderCLSID_FunctionTrend property
TrendProviderCLSID_FunctionTrend
Indicates the data source of the trend selected.
Value

Explanation
No data source configured for implementation in Runtime by means of script.

{416A09D2-8B5A-11D28B81-006097A45D48}

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Data source with archive tags of a process value archive.

637

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Explanation

{A3F69593-8AB0-11D2A440-00A0C9DBB64E}

Data source with online tags derived from tag management.

{2DC9B1C8-4FC1-41B1B354-3E469A13FBFD}

Data source with columns of a user archive.

The attribute can be assigned dynamic properties by means of the name


TrendProviderCLSID. The data type is STRING.

TrendProviderCLSID_OnlineTrend property
TrendProviderCLSID_OnlineTrend
Indicates the data source of the trend selected.
Value

Explanation
No data source configured for implementation in Runtime by means of script.

{416A09D2-8B5A-11D28B81-006097A45D48}

Data source with archive tags of a process value archive.

{A3F69593-8AB0-11D2A440-00A0C9DBB64E}

Data source with online tags derived from tag management.

The attribute can be assigned dynamic properties by means of the name


TrendProviderCLSID. The data type is STRING.

TrendRangeType property
Time range setting - TrendRangeType
Defines the time range for providing data to the selected trend.
You can only define the number of measuring points if you select user archives as the data
source.
The following configuration options are available:
Value

Description

Explanation

Time range

Defines the start time and the time range for the data
connection.

Start to end time

Defines the start and end time for the data connection.

Number of measurement
points

Defines the start time and the number of measurement points


for the data connection.

The attribute can be assigned dynamic properties by means of the name TrendRangeType.
The data type is LONG.

638

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendRemove property
Remove - TrendRemove
Removes selected trends from the list.
The attribute can be assigned dynamic properties by means of the name TrendRemove. The
data type is STRING.

TrendRename property
TrendRename
Renames a trend which is referenced by means of "TrendIndex" attribute.
The attribute can be assigned dynamic properties by means of the name TrendRename.
"TrendRename" also sets a dynamic attribute "TrendName". The data type is STRING.

TrendRepos property
Up/Down - TrendRepos
Repositions the trend in the trend window. "Up" and "Down" move the selected trend up or
down in the list. This moves the trend towards the foreground or background for visualization
in Runtime.
The attribute can be assigned dynamic properties by means of the name TrendRepos. The
data type is LONG.

TrendSelectTagName property
TrendSelectTagName
Opens a dialog for selecting the tag name for the source of Y axis data in WinCC
OnlineTrendControl. Programmers can set this attribute to allow users to select a tag name
by means of a button, for example.
The attribute can be assigned dynamic properties by means of the name
TrendSelectTagName. The data type is BOOLEAN.

TrendSelectTagNameX property
TrendSelectTagNameX
Opens a dialog for selecting the tag name for the source of X axis data in WinCC
FunctionTrendControl. Programmers can set this attribute to allow users to select a tag name
by means of a button, for example.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

639

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
TrendSelectTagNameX. The data type is BOOLEAN.

TrendSelectTagNameY property
TrendSelectTagNameY
Opens a dialog for selecting the tag name for the source of Y axis data in WinCC
FunctionTrendControl. Programmers can set this attribute to allow users to select a tag name
by means of a button, for example.
The attribute can be assigned dynamic properties by means of the name
TrendSelectTagNameY. The data type is BOOLEAN.

TrendState property
TrendState
Shows the status of the data link of the selected curve in Runtime.
The attribute can be made dynamic with the name TrendState. The data type is LONG.

TrendTagName property
Tag name - TrendTagName
Displays the name of connected tags. Use the Open button to open a dialog for selecting an
online or archive tag.
The attribute can be assigned dynamic properties by means of the name TrendTagName. The
data type is STRING.

TrendTagNameX property
Tag Name X / Column X - TrendTagNameX
Shows the name of interconnected tags or of the column for the X axis. Using the selection
button, select a tag or a column for the data source you configured.
The attribute can be assigned dynamic properties by means of the name TrendTagNameX.
The data type is STRING.

640

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendTagNameY property
Tag Name Y / Column Y - TrendTagNameY
Shows the name of interconnected tags or of the column for the Y axis. Using the selection
button, select a tag or a column for the data source you configured.
The attribute can be assigned dynamic properties by means of the name TrendTagNameY.
The data type is STRING.

TrendTimeAxis property
Time axis - TrendTimeAxis
Defines the time axis to be used for the trend selected. Define the available time axes in the
"Time axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendTimeAxis. The
data type is STRING.

TrendTimeRangeBase property
Time Range - TrendTimeRangeBase
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

500

500 ms

1000

1 second

60000

1 minute

3600000

1 hour

86400000

1 day

The attribute can be assigned dynamic properties by means of the name


TrendTimeRangeBase. The data type is LONG.

TrendTimeRangeFactor property
Time range - TrendTimeRangeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
TrendTimeRangeFactor. The data type is SHORT.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

641

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendTrendWindow property
Trend window - TrendTrendWindow
Defines the trend window for visualizing the trend selected. Define the available trend windows
in the "Trend window" tab.
The attribute can be assigned dynamic properties by means of the name
TrendTrendWindow. The data type is STRING.

TrendUncertainColor property
TrendUncertainColor
Value are in uncertain state if the initial value is unknown after runtime has been activated, or
if a substitute value is used. Set attribute "TrendUncertainColor" to define the color identifier
of these values. The "TrendUncertainColoring" attribute determines whether or not this setting
is evaluated.
The attribute can be assigned dynamic properties by means of the name
TrendUncertainColor. The data type is LONG.

TrendUncertainColoring property
TrendUncertainColoring
Value are in uncertain state if the initial value is unknown after runtime has been activated, or
if a substitute value is used. The "TrendUncertainColoring" attribute is used to enable
identification of such values based on the color set in "TrendUncertainColor".
Value

Explanation

TRUE

The settings of the "TrendUncertainColor" attribute are active.

FALSE

The settings of the "TrendUncertainColor" attribute are inactive.

The attribute can be assigned dynamic properties by means of the name


TrendUncertainColoring. The data type is BOOLEAN.

TrendUpperLimit property
TrendUpperLimit
Specifies the high limit of a tag. The values are identified based on the color set in
"TrendUpperLimitColor" if the tag value exceeds the "TrendUpperLimit". This setting is only
active if the value at attribute "TrendUpperLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendUpperLimit.
The data type is DOUBLE.

642

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendUpperLimitColor property
TrendUpperLimitColor
Specifies the color of tag values which are less than the value at "TrendLowerLimit". This
setting is only active if the value at attribute "TrendUpperLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name
TrendUpperLimitColor. The data type is LONG.

TrendUpperLimitColoring property
TrendUpperLimitColoring
Enables the "TrendUpperLimitColor" attribute for identifying tag values which are less than the
value at "TrendUpperLimit".
Value

Explanation

TRUE

The setting of the "TrendUpperLimitColor" attribute is active.

FALSE

The setting of the "TrendUpperLimitColor" attribute is inactive.

The attribute can be assigned dynamic properties by means of the name


TrendUpperLimitColoring. The data type is BOOLEAN.

TrendValueAlignment property
Alignment - TrendValueAlignment
Specifies the alignment of the displayed values for the trend type "Values".
The following settings are available depending on the writing direction of the trend:
The writing direction of the trend is "from right" or "from left"
Value

Description

Explanation

Bottom

The values are displayed at the bottom in the trend window.

Centered

The values are displayed centered in the trend window.

Top

The values are displayed at the top in the trend window.

The writing direction of the trend is "from top" or "from bottom"


Value

Description

Explanation

Left

The values are displayed on the left in the trend window.

Centered

The values are displayed centered in the trend window.

Right

The values are displayed on the right in the trend window.

The attribute can be assigned dynamic properties by means of the name


TrendValueAlignment. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

643

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendValueAxis property
Value axis - TrendValueAxis
Defines the value axis to be used for the trend selected. Define the available value axes in the
"Value axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendValueAxis. The
data type is STRING.

TrendValueUnit property
Unit - TrendValueUnit
Specifies a unit for the trend type "Values" that is appended to the displayed value, e.g., "%"
or "C".
The attribute can be assigned dynamic properties by means of the name TrendValueUnit. The
data type is STRING.

TrendVisible property
Trends - TrendVisible
The list shows all trends you created.
Select the trends to be displayed in the trend window from the list.
Click a trend entry in the list to adapt the properties and to assign axes and trend windows to
the trend.
The attribute can be assigned dynamic properties by means of the name TrendVisible. The
data type is BOOLEAN.

TrendWindow - TrendYAxis
TrendWindowAdd property
New - TrendWindowAdd
Creates a new trend window.
The attribute can be assigned dynamic properties by means of the name TrendWindowAdd.
The data type is STRING.

644

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendWindowCoarseGrid property
Main grid lines - TrendWindowCoarseGrid
Enables the display of grid lines for the main scale.
Value

Explanation

TRUE

Enables the display of grid lines for the main scale.

FALSE

Disables the display of grid lines for the main scale.

The attribute can be assigned dynamic properties by means of the name


TrendWindowCoarseGrid. The data type is BOOLEAN.

TrendWindowCoarseGridColor property
Color of main scale - TrendWindowCoarseGridColor
Specifies the grid color of the main scale. Open the "Color selection" dialog by clicking the
button.
The attribute can be assigned dynamic properties by means of the name
TrendWindowCoarseGridColor. The data type is LONG.

TrendWindowCount property
TrendWindowCount
Defines the number of configured trend views.
The attribute can be assigned dynamic properties by means of the name
TrendWindowCount. The data type is LONG.

TrendWindowFineGrid property
Secondary grid lines - TrendWindowFineGrid
Enables the display of grid lines for the secondary scale.
Value

Explanation

TRUE

Enables the display of grid lines for the secondary scale.

FALSE

Disables the display of grid lines for the secondary scale.

The attribute can be assigned dynamic properties by means of the name


TrendWindowFineGrid. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

645

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendWindowFineGridColor property
Color of secondary scale - TrendWindowFineGridColor
Specifies the grid color of the main scale. Open the "Color selection" dialog by clicking the
button.
The attribute can be assigned dynamic properties by means of the name
TrendWindowFineGridColor. The data type is LONG.

TrendWindowForegroundTrendGrid property
Only for foreground trend - TrendWindowForegroundTrendGrid
Enables the display of grid lines only for the foreground trend in the trend window.
Value

Explanation

TRUE

Enables the display of grid lines for the foreground trend in the trend window.

FALSE

Enables the display of grid lines for all trends in the trend window.

The attribute can be assigned dynamic properties by means of the name


TrendWindowForegroundTrendGrid. The data type is BOOLEAN.

TrendWindowGridInTrendColor property
Use trend color - TrendWindowGridInTrendColor
Sets the trend color for the visualization of the grid lines for the main scale.
Value

Explanation

TRUE

The grid is displayed in the trend color.

FALSE

The grid is displayed with the color set in the "Color" field.

The attribute can be assigned dynamic properties by means of the name


TrendWindowGridInTrendColor. The data type is BOOLEAN.

TrendWindowHorizontalGrid property
For X axis - TrendWindowVerticalGrid
Enables the display of horizontal grid lines.
Value

Explanation

TRUE

The display of horizontal grid lines is enabled.

FALSE

The display of horizontal grid lines is disabled.

646

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
TrendWindowHorizontalGrid. The data type is BOOLEAN.

TrendWindowIndex property
TrendWindowIndex
References a configured trend view. Using this attribute you can assign the values of other
attributes to a specific trend view.
Values between 0 and "TrendWindowIndex" minus 1 are valid for "TrendWindowCount".
Attribute "TrendWindowCount" defines the number of trend views configured.
The "TrendWindowIndex" attribute can be assigned dynamic properties by means of attribute
TrendWindowRepos. The data type is LONG.

TrendWindowName property
Object name - TrendWindowName
Defines the name of the trend window selected.
The "TrendWindowName" attribute can be assigned dynamic properties by means of attribute
TrendWindowRename. The data type is STRING.

TrendWindowRemove property
Remove - TrendWindowRemove
Removes the selected trend window from the list.
The attribute can be assigned dynamic properties by means of the name
TrendWindowRemove. The data type is STRING.

TrendWindowRename property
TrendWindowRename
Renames a trend view which is referenced by means of "TrendWindowIndex" attribute.
The attribute can be assigned dynamic properties by means of the name
TrendWIndowRename. "TrendWindowRename" also sets a dynamic attribute
"TrendWindowName". The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

647

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendWindowRepos property
Up/Down - TrendWindowRepos
Changes the sorting order of the trend windows. "Up" and "Down" move the selected trend up
or down in the list.
The sorting order in the list defines the position in the Control. The first trend window is
displayed at the last position, while the last is displayed at the top position.
The attribute can be assigned dynamic properties by means of the name
TrendWindowRepos. The data type is LONG.

TrendWindowRulerColor property
Ruler color - TrendWindowRulerColor
Specifies the ruler color. Open the "Color selection" dialog by clicking the button.
The color can be configured and displayed if "1 - graphic" is set for display of the ruler or
"TrendWindowRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowRulerColor. The data type is LONG.

TrendWindowRulerLayer property
Ruler layer - TrendWindowRulerLayer
Defines the representation layer of a ruler in the trend window.
The following settings are available:
Value

Description

Explanation

Under grid

The ruler is visualized on a layer under the grid.

Between grid and


trend

The ruler is positioned on top of the trend and under the grid.

On top of trend

The ruler is positioned on top of the trend.

The attribute can be assigned dynamic properties by means of the name


TrendWindowRulerLayer. The data type is LONG.

TrendWindowRulerStyle property
Ruler - TrendWindowRulerStyle
Defines the appearance of the ruler.
The following settings are available:

648

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Explanation

Simple

The ruler is displayed as basic black line.

Graphic

The ruler is displayed based on the "color" and "weight" configured.

The attribute can be assigned dynamic properties by means of the name


TrendWindowRulerStyle. The data type is LONG.

TrendWindowRulerWidth property
Ruler width - TrendWindowRulerWidth
Defines the width of the ruler in pixels.
The width can be configured and displayed if "1 - graphic" is set for display of the ruler or
"TrendWindowRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowRulerWidth. The data type is LONG.

TrendWindowSpacePortion property
Proportional area - TrendWindowSpacePortion
Specifies the proportion of the trend widow to be used for the selected curve.
The attribute can be assigned dynamic properties by means of the name
TrendWindowSpacePortion. The data type is LONG.

TrendWindowStatisticRulerColor property
Color of ruler for statistics area - TrendWindowStatisticRulerColor
Specifies the color of the ruler for the statistics area. The button opens the "Color selection"
dialog to select the color.
The color can be configured and displayed if "1 - graphic" is set for display of the ruler for the
statistics area or "TrendWindowStatisticRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowStatisticRulerColor. The data type is LONG.

TrendWindowStatisticRulerStyle property
Ruler for statistics area - TrendWindowStatisticRulerStyle
Enables the display of a ruler for defining the statistics area.
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

649

VBS for Creating Procedures and Actions


1.14 VBS Reference
Value

Description

Explanation

Simple

The ruler is displayed as basic black line.

Graphic

The ruler is displayed based on the "color" and "weight" configured.

The attribute can be assigned dynamic properties by means of the name


TrendWindowStatisticRulerStyle. The data type is LONG.

TrendWindowStatisticRulerWidth property
Width of ruler for statistics area - TrendWindowStatisticRulerWidth
Defines the width of the ruler for the statistics area in pixels.
The width of the ruler can be configured and displayed if "1 - graphic" is set for display of the
ruler for the statistics area or "TrendWindowStatisticRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowStatisticRulerWidth. The data type is LONG.

TrendWindowVerticalGrid property
for Y axis - TrendWindowVerticalGrid
Enables the display of vertical grid lines.
Value

Explanation

TRUE

The display of vertical grid lines is enabled.

FALSE

The display of vertical grid lines is disabled.

The attribute can be assigned dynamic properties by means of the name


TrendWindowVerticalGrid. The data type is BOOLEAN.

TrendWindowVisible property
Trend window - TimeAxisTrendWindow
The list shows all trend windows you created.
Select the trend windows to be displayed in the control from the list.
Click a list entry to adapt the ruler and grid line properties.
The attribute can be assigned dynamic properties by means of the name
TrendWindowVisible. The data type is BOOLEAN.

650

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TrendXAxis property
X axis - TrendXAxis
Defines the X axis to be used for the trend selected. Define the available X axes inn the "X
Axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendXAxis. The
data type is STRING.

TrendYAxis property
Y axis - TrendYAxis
Defines the Y axis to be used for the trend selected. Define the available Y axes inn the "Y
Axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendYAxis. The
data type is STRING.

Type
Type Property
Description
Reads out the object type, e.g. "Rectangle", "Circle" or "Line".
The object type is returned as a string. Read only
A special ID is returned as the type for all the graphic elements provided by WinCC. It can be
found under the topic "Type Identification in VBS in the individual descriptions of the WinCC
Object Types.

Special feature
In the case of non-WinCC controls and OLE objects, the version-independent ProgID is
returned as the type.
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "Control1" is a control embedded in the picture which already
returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

651

VBS for Creating Procedures and Actions


1.14 VBS Reference

Determine the version-dependent ProgID as follows:

'VBS91
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("Control1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

Note
In order that example above works, a multimedia control should be inserted in the picture.
Determine the User Friendly Name as follows:

'VBS92
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("Control1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that example above works, a multimedia control should be inserted in the picture.

Example:
The following example displays the type for all objects in the picture "NewPDL1":

'VBS93
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)

652

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

lngAnswer = MsgBox(objScrItem.Type, vbOKCancel)


If vbCancel = lngAnswer Then Exit For
Next

See also
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)

TypeAlarmHigh Property
Description
TRUE, when the upper limit value, at which an alarm is triggered, should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value. BOOLEAN writeread access.

See also
ScreenItem Object (Page 141)
Bar (Page 189)

TypeAlarmLow Property
Description
TRUE, when the lower limit value, at which an alarm is triggered, should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value. BOOLEAN writeread access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitHigh4 Property
Description
TRUE, when the "Reserve 4" upper limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

653

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitHigh5 Property
Description
TRUE, when the "Reserve 5" upper limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitLow4 Property
Description
TRUE, when the "Reserve 4" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitLow5 Property
Description
TRUE, when the "Reserve 5" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

654

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

TypeToleranceHigh Property
Description
TRUE, when the "Tolerance high" lower limit value should be evaluated as a percentage.
FALSE, when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeToleranceLow Property
Description
TRUE, when the "Tolerance low" lower limit value should be evaluated as a percentage.
FALSE, when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeWarningHigh Property
Description
TRUE, when the "Warning high" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeWarningLow Property
Description
TRUE, when the "Warning low" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

655

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1.14.4.20 U
Un - Up
UnitColor Property
Description
Defines the text color for the names of the unit of measurement. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

UnitFont Property
Description
Controls the display of the labeling for the unit of measurement. Read only access.
The following properties can be set:
- Font
- Font Style
- Font Size
- "Strikethrough" effect
- "Underline" effect

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

656

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

UnitOffset Property
Description
This attribute defines the distance of the text for the unit of measurement in relation to the top
edge of the object. The text can only be positioned along the vertical diameter of the graduated
scale disk. The value of the property is related to the height of the object and is measured from
the top edge of the object to the base of the text.
The value range is 0 is 1.
0: The base of the text is at the top limit of the object. The text is no longer visible because it
is outside the object.
1: The base of the text is at the bottom limit of the object.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

UnitText Property
Description
Defines the text for the unit of measurement. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

UnselBGColor Property
Description
Defines or returns the background color of entries in the text list object which are not selected.
LONG write-read access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

657

VBS for Creating Procedures and Actions


1.14 VBS Reference

UnselTextColor Property
Description
Defines or returns the color of the text for entries in the text list object which are not selected.
LONG write-read access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

UpdateCycle Property
Description
Returns the type and frequency of updating the picture window in Runtime. Read only access.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

UpperLimit Property
Description
TRUE, when the "UpperLimitColor" specification is to be used in order to identify the tag values
(from a trend referenced via "Index") which lie above the value defined in "UpperLimitValue".
BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

658

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

UpperLimitColor Property
Description
Defines the color to be used in order to identify the tag values (from a trend referenced via
"Index") which lie above the value defined in "UpperLimitValue". Whether the information is
evaluated is dependent on the value of the "UpperLimit" property. The color is defined as an
RGB value. LONG write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

UpperLimitTagName Property
Description
This defines the upper limit of the trend range, which is automatically taken from the variable
properties configured in PCS 7. Write/Read access.

UpperLimitValue Property
Description
Tag values (from a trend referenced via "Index") which lie above the value defined by
"UpperLimitValue" are identified by the color specified in "UpperLimitColor". Whether the
information is evaluated is dependent on the value of the "UpperLimit" property.

See also
ScreenItem Object (Page 141)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

659

VBS for Creating Procedures and Actions


1.14 VBS Reference

Us
UseColumnBackColor property
Use column color / background - UseColumnBackColor
Specifies the settings to be activated for the background colors of columns.
Value

Explanation

TRUE

The background color settings are active in the "Time columns" or "TimeColumnBackColor" tabs and in the
"Value columns" or "ValueColumnBackColor" tabs.

FALSE

The background color settings are active in the "Display" tab.

The attribute can be assigned dynamic properties by means of the name


UseColumnBackColors. The data type is BOOLEAN.

UseColumnForeColor property
Use column color / font - UseColumnForeColor
Defines the active font color settings for the columns.
Value

Explanation

TRUE

The font color color settings are active in the "Time columns" or "TimeColumnForeColor" tabs and in the "Value
columns" or "ValueColumnForeColor" tabs.

FALSE

The font color settings are active in the "Display" tab.

The attribute can be assigned dynamic properties by means of the name


UseColumnForeColors. The data type is BOOLEAN.

UseMessageColor property
Show message colors - UseMessageColor
Sets the outputs of messages with colors as agreed by handshake.
Value

Explanation

TRUE

The message colors are displayed.

FALSE

The message colors are not displayed. Instead, the color settings defined for the table content are activated
on the "Display" tab.

The attribute can be assigned dynamic properties by means of the name UseMessageColor.
The data type is BOOLEAN.

660

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

UseOnlineTags Property
Description
This defines whether or not the variable properties configured in PCS 7 are applied as trend
parameters. Write/Read access.

UseRangeSubstitutes Property
Description
TRUE, if a separate scaling of the value axis is displayed for the trends in Trend Control.
BOOLEAN write-read access.

UserData-Property
Description
Contains the value that is to be transferred to the VB script while running a customized menu
item or icon. STRING (write-read access)

Example:
Use the "User data" field in the "Menus and Toolbars" editor to apply a parameter to the
procedure
The following example shows the "ActivateScreen" procedure that executes the picture
change. Enter the picture name in the "User Data" field:

Sub ActivateScreen (ByVal Item)


Dim objScreen
Dim strScreenName
' "UserData" contains the screen name specified
' in editor menus and toolbars.
strScreenName = Item.Userdata
HMIRuntime.BaseScreenName = strScreenName
End Sub

UserName property
Description
Returns the name of the user who triggered the alarm object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

661

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Alarms object (list) (Page 126)

UserValue1 Property
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
ScreenItem Object (Page 141)
Group Display (Page 208)

UserValue2-Eigenschaft
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

UserValue3 Property
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

662

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

UserValue4 Property
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

UseSelectedTitleColor property
Selection color - UseSelectedTitleColor
Specifies whether to use a selection color for the headers of selected table cells.
Value

Explanation

TRUE

A selection color is used. The "Background" or "SelectedTitleColor" and "Font" or "SelectedTitleForeColor"


settings are active in Runtime.

FALSE

Selection color is not used. The "Background" and "Font" settings are disabled in Runtime.

The attribute can be assigned dynamic properties by means of the name


UseSelectedTitleColor. The data type is BOOLEAN.

UseSourceBackColors property
Apply background colors - UseSourceBackColors
Sets the background color derived from the control defined in the "Source" field.
Value

Explanation

TRUE

The background color from the interconnected control is used.

FALSE

The background color from the interconnected control is not used. The settings on the "Layout" tab are used.

The attribute can be assigned dynamic properties by means of the name


UseSourceBackColors. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

663

VBS for Creating Procedures and Actions


1.14 VBS Reference

UseSourceForeColors property
Apply font colors - UseSourceForeColors
Sets the font colors derived from the control defined in the "Source" field.
Value

Explanation

TRUE

The font color of the interconnected control is activated.

FALSE

The font color from the connected control is not used. The settings on the "Layout" tab are used.

The attribute can be assigned dynamic properties by means of the name


UseSourceForeColors. The data type is BOOLEAN.

UseTableColor2 property
Row Color 2 - UseTableColor2
Specifies whether to use a second row color for the representation of the table.
Value

Explanation

TRUE

"Row color 2" and "Row color 1" are used alternately.

FALSE

The "Row color 1" settings are used for all rows.

The attribute can be assigned dynamic properties by means of the name UseTableColor2.
The data type is BOOLEAN.

UseTrendNameAsLabel property
UseTrendNameAsLabel
Sets the "TrendName" or "TrendLabel" attribute for labeling the trend in Runtime.
Value

Explanation

TRUE

Sets the "TrendName" attribute for labeling the trend in Runtime.

FALSE

Sets the "TrendLabel" attribute for labeling the trend in Runtime.

The attribute can be assigned dynamic properties by means of the name


UseTrendNameAsLabel. The data type is BOOLEAN.

664

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.4.21 V
Val - ValueAxis
Value Property
Description of Tag Object
Displays the value of the tags at the last read access or the value written or to be written. Value
represents the value of a tag. After calling in the "Read" method, the tag value read is returned.
Before writing, the new tag value required can be assigned to the property. After calling in the
"Write" method, the property contains the value last written.
VARIANT (write-read access)

Example:
The following example writes a new value in the "Tag1" tag:

'VBS94
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Value = 50
objTag.Write

Description of WinCC Gauge Control


Defines the value to which the pointer points. Value Range: "ValueMin" to "ValueMax".

Description of DataItem Object


Returns a value copy or object reference. Furthermore, an already added value can be
changed via the value property.

Example:
The example shows how to add a value to the list, and how to output it as a trace. After that,
the value is changed, output again and then removed. It make sense to perform this in several
different actions.

'VBS198
HMIRuntime.DataSet.Add "motor1", 23
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine
HMIRuntime.DataSet("motor1").Value = 55
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

665

VBS for Creating Procedures and Actions


1.14 VBS Reference

HMIRuntime.DataSet.Remove("motor1")

Note
For object references it must be ascertained that objects are multiread-enabled.

See also
WinCC Gauge Control (Page 264)
Write Method (Page 797)
Read Method (Page 768)
Tag Object (Page 152)
DataItem Object (Page 129)
ProcessValues Object (List) (Page 140)

ValueAxisAdd property
New - ValueAxisAdd
Creates a new value axis.
The attribute can be assigned dynamic properties by means of the name ValueAxisAdd. The
data type is STRING.

ValueAxisAlign property
Alignment - ValueAxisAlign
Specifies the mode of alignment of a selected value axis.
The following settings are available:
Value

Description

Explanation

left

The value axis selected is displayed on left side of the trend.

right

The value axis selected is displayed on right side of the trend.

The attribute can be assigned dynamic properties by means of the name ValueAxisAlign. The
data type is LONG.

666

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueAxisAutoPrecisions property
Decimal places automatic - ValueAxisAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" or
"ValueAxisPrecisions" field is disabled.

FALSE

The value in the "Decimal places" or "ValueAxisPrecisions" field is active.

The attribute can be assigned dynamic properties by means of the name


ValueAxisAutoPrecisions. The data type is BOOLEAN.

ValueAxisAutoRange property
Value range automatic - ValueAxisAutoRange
Enables automatic calculation of the range of values.
Value

Explanation

TRUE

The range of values is calculated automatically.

FALSE

The range of values is calculated based on the values configured in the "from" and "to" or
"ValueAxisBeginValue" and "ValueAxisEndValue" fields.

The attribute can be assigned dynamic properties by means of the name


ValueAxisAutoRange. The data type is BOOLEAN.

ValueAxisBeginValue property
Value range from - ValueAxisBeginValue
Specifies the start value of the value axis selected. You can configure the value if the
"Automatic" option is disabled or "ValueAxisAutoRange" is "FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueAxisBeginValue. The data type is DOUBLE.

ValueAxisColor property
Value axis color - ValueAxisColor
Specifies the color of the time axis. The button opens the "Color selection" dialog to select the
color.
The setting is only active if the "Use trend color" option is disabled or if "ValueAxisInTrendColor"
is "FALSE".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

667

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name ValueAxisColor. The
data type is LONG.

ValueAxisCount property
ValueAxisCount
Defines the number of value axes configured.
The attribute can be assigned dynamic properties by means of the name ValueAxisCount. The
data type is LONG.

ValueAxisEndValue property
Value range to - ValueAxisEndValue
Specifies the end value of the value axis selected. You can configure the value if the
"Automatic" option is disabled or "ValueAxisAutoRange" is "FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueAxisEndValue. The data type is DOUBLE.

ValueAxisExponentialFormat property
Exponential notation - ValueAxisExponentialFormat
Sets exponential notation for the display of values of a value axis selected.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


ValueAxisExponentialFormat. The data type is BOOLEAN.

ValueAxisIndex property
ValueAxisIndex
References a value axis. Using this attribute you can assign the values of other attributes to
a specific value axis.
Values between 0 and "ValueAxisCount" minus 1 are valid for "ValueAxisIndex". Attribute
"ValueAxisCount" defines the number of value axes configured.
The "ValueAxisIndex" attribute can be assigned dynamic properties by means of attribute
ValueAxisRepos. The data type is LONG.

668

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueAxisInTrendColor property
Use trend color - ValueAxisInTrendColor
Sets the trend color for displaying the value axis selected. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The selected value axis is displayed in the trend color. The setting in the "Color" or
"ValueAxisColor" field is disabled.

FALSE

The value axis selected is displayed in the color set in the "Color" or "ValueAxisColor" field.

The attribute can be assigned dynamic properties by means of the name


ValueAxisInTrendColor. The data type is BOOLEAN.

ValueAxisInTrendColor property
Use trend color - ValueAxisInTrendColor
Sets the trend color for displaying the value axis selected. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The selected value axis is displayed in the trend color. The setting in the "Color" or "ValueAxisColor" field is
disabled.

FALSE

The value axis selected is displayed in the color set in the "Color" or "ValueAxisColor" field.

The attribute can be assigned dynamic properties by means of the name


ValueAxisInTrendColor. The data type is BOOLEAN.

ValueAxisLabel property
Label - ValueAxisLabel
Specifies the label of a value axis selected.
The attribute can be assigned dynamic properties by means of the name ValueAxisLabel. The
data type is STRING.

ValueAxisName property
Object name - ValueAxisName
Specifies the name of a value axis selected.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

669

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "ValueAxisName" attribute can be assigned dynamic properties by means of attribute
ValueAxisRename. The data type is STRING.

ValueAxisPrecisions property
Decimal places - ValueAxisPrecisions
Specifies the decimal precision for displaying the value axis selected. The value can be
configured and is active in Runtime, if the "Automatic" option is disabled or
"ValueAxisAutoPrecisions" is "FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueAxisPrecisions. The data type is SHORT.

ValueAxisRemove property
Remove - ValueAxisRemove
Removes the selected value axis from the list.
The attribute can be assigned dynamic properties by means of the name ValueAxisRemove.
The data type is STRING.

ValueAxisRename property
ValueAxisRename
Renames a value axis which is referenced by means of "ValueAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name ValueAxisRename.
"ValueAxisRename" also sets a dynamic attribute "ValueAxisName". The data type is STRING.

ValueAxisRepos property
Up/Down - ValueAxisRepos
Changes the order of value axes. "Up" and "Down" move the value axis selected up or down
in the list.
The list order determines the value axis position in the trend window. The axis output position
is moved away from the trend if the value axis is moved further up in the list and the orientation
is the same.
The attribute can be assigned dynamic properties by means of the name ValueAxisRepos .
The data type is LONG.

670

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueAxisScalingType property
Scaling - ValueAxisScalingType
Specifies the scaling mode for a selected value axis.
The following settings are available:
Value

Description

Explanation

Linear

Enables linear scaling of a value axis selected.

Logarithmic

Enables logarithmic scaling of a value axis selected.

Logarithmically negated

Enables scaling of a selected value value axis with logarithmic negation.

The attribute can be assigned dynamic properties by means of the name


ValueAxisScalingType. The data type is LONG.

ValueAxisTrendWindow property
Trend window - ValueAxisTrendWindow
Specifies the trend window for displaying the value axis selected. Define the available trend
windows in the "Trend window" tab.
The attribute can be assigned dynamic properties by means of the name
ValueAxisTrendWindow. The data type is STRING.

ValueAxisVisible property
Value axes - ValueAxisVisible
The list shows all value axes you created. Click a value axis entry in the list to adapt the
properties and to assign the value axis to a trend window.
Activate the value axes to be displayed in the trend windows in the list.
The attribute can be assigned dynamic properties by means of the name ValueAxisVisible .
The data type is BOOLEAN.

ValueColumn - Vi
ValueColumnAdd property
New - ValueColumnAdd
Creates a new value column.
The attribute can be assigned dynamic properties by means of the name ValueColumnAdd.
The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

671

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueColumnAlign property
Alignment - ValueColumnAlign
Defines the mode of alignment of a selected value column.
The following settings are available:
Value

Description

Explanation

left

The selected value column is displayed on the left.

Centered

The selected value column is aligned to center.

right

The selected value column is displayed on the right.

The attribute can be assigned dynamic properties by means of the name ValueColumnAlign.
The data type is LONG.

ValueColumnAlignment Property
Description
The "Index" property references a pair of columns. "ValueColumnAlignment" defines the
alignment of the tag value for this column pair.
0: Tag values are entered aligned left.
1: Tag values are entered centered.
2: Tag values are entered aligned right.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

ValueColumnAutoPrecisions property
Automatic - ValueColumnAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" or
"ValueColumnPrecisions" field is disabled.

FALSE

The value in the "Decimal places" or "ValueColumnPrecisions" field is active.

The attribute can be assigned dynamic properties by means of the name


ValueColumnAutoPrecisions. The data type is BOOLEAN.

672

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueColumnBackColor property
Background color - ValueColumnBackColor
Specifies the background color of the value column selected. Use the button to open the "Color
selection" dialog.
The setting is only active if the "Background color" option is set or "UseColumnBackColor" is
"TRUE" in the "Use column color" field of the "General" tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnBackColor. The data type is LONG.

ValueColumnCaption property
Description - ValueColumnCaption
Defines the label of the value column selected.
The attribute can be assigned dynamic properties by means of the name
ValueColumnCaption. The data type is STRING.

ValueColumnCount property
ValueColumnCount
Defines the number of value columns configured.
The attribute can be assigned dynamic properties by means of the name ValueColumnCount.
The data type is LONG.

ValueColumnExponentialFormat property
Exponential notation - ValueColumnExponentialFormat
Sets exponential notation for the display of values of a value column selected.
Value

Explanation

TRUE

Display with exponential notation.

FALSE

Display with decimal notation.

The attribute can be assigned dynamic properties by means of the name


ValueColumnExponentialFormat. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

673

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueColumnForeColor property
Font color - ValueColumnForeColor
Specifies the font color of the value column selected. Use the button to open the "Color
selection" dialog.
The setting is only active if the "Font color" option is set or "UseColumnForeColor" is "TRUE"
in the "Use column color" field of the "General" tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnForeColor. The data type is LONG.

ValueColumnHideText property
ValueColumnHideText
Sets text format for displaying the content of a value column.
Value

Explanation

TRUE

The content is not displayed in text format.

FALSE

The content is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


ValueColumnHideText. The data type is BOOLEAN.

ValueColumnHideTitleText property
ValueColumnHideTitleText
Sets text format for displaying the value column header.
Value

Explanation

TRUE

The header is not displayed in text format.

FALSE

The header is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


ValueColumnHideTitleText. The data type is BOOLEAN.

ValueColumnIndex property
ValueColumnIndex
References a configured value column. Using this attribute you can assign the values of other
attributes to a specific value column.

674

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Values between 0 and "ValueColumnCount" minus 1 are valid for "ValueColumnIndex".
Attribute "ValueColumnCount" defines the number of value columns configured.
The "ValueColumnIndex" attribute can be assigned dynamic properties by means of attribute
ValueColumnRepos. The data type is LONG.

ValueColumnLength property
Length in characters - ValueColumnLength
Specifies the width of a selected value column.
The attribute can be assigned dynamic properties by means of the name
ValueColumnLength. The data type is LONG.

ValueColumnName property
Object name - ValueColumnName
Specifies the name of a selected value column.
The "ValueColumnName" attribute can be assigned dynamic properties by means of attribute
ValueColumnRename. The data type is STRING.

ValueColumnPrecisions property
Decimal places - ValueColumnPrecisions
Specifies the decimal precision for displaying the data of a value column selected. The value
can be entered if the "Automatic" option is disabled or "ValueColumnAutoPrecisions" is
"FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueColumnPrecisions. The data type is SHORT.

ValueColumnProvider property
Data source - ValueColumnProvider
Specifies the data source for a selected value column.
The following settings are available:
Value

Description

Explanation

Archive tags

Data source with archive tags of a process value archive.

Online tags

Data source with online tags derived from tag management.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

675

VBS for Creating Procedures and Actions


1.14 VBS Reference
The attribute can be assigned dynamic properties by means of the name
ValueColumnProvider. The data type is LONG.

ValueColumnProviderCLSID property
ValueColumnProviderCLSID
Indicates the data source of the value column selected.
Value

Explanation

{416A09D2-8B5A-11D28B81-006097A45D48}

Data source with archive tags of a process value archive.

{A3F69593-8AB0-11D2A440-00A0C9DBB64E}

Data source with online tags derived from tag management.

The attribute can be assigned dynamic properties by means of the name


ValueColumnProviderCLSID. The data type is STRING.

ValueColumnRemove property
Remove - ValueColumnRemove
Removes the selected value column from the list.
The attribute can be assigned dynamic properties by means of the name
ValueColumnRemove. The data type is STRING.

ValueColumnRename property
ValueColumnRename
Renames a value column which is referenced by means of "ValueColumnIndex" attribute.
The attribute can be assigned dynamic properties by means of the name
ValueColumnRename. "ValueColumnRename" also sets a dynamic attribute
"ValueColumnName". The data type is STRING.

ValueColumnRepos property
Up/Down - ValueColumnRepos
Changes the sorting order of the value columns. "Up" and "Down" move the value column
selected up or down in the list.
The sorting order in the list determines the order of value columns after the time column if
several value columns are assigned to the same time column. Higher positions of the value
column in the list moves it to closer proximity towards the time column.

676

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
You change the order of time columns and their assigned value columns in the "Time columns"
tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnRepos. The data type is LONG.

ValueColumnSelectTagName property
ValueColumnSelectTagName
Opens a dialog for selecting the tag name for the data source of the value column in WinCC
OnlineTableControl. Programmers can set this attribute to allow users to select a tag name by
means of a button, for example.
The attribute can be assigned dynamic properties by means of the name
ValueColumnSelectTagName. The data type is BOOLEAN.

ValueColumnShowIcon property
ValueColumnShowIcon
Enables the display of value column contents as icon.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name


ValueColumnShowIcon. The data type is BOOLEAN.

ValueColumnShowTitleIcon property
ValueColumnShowTitleIcon
Enables display of the value column header as icon.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


ValueColumnShowTitleIcon. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

677

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueColumnSort property
ValueColumnSort
Defines the sorting order of the value column referenced in "ValueColumnIndex" .
The following settings are available:
Value

Description

Explanation

No

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name ValueColumnSort .
The data type is LONG.

ValueColumnSortIndex property
ValueColumnSortIndex
Defines the sorting order of the value column referenced in "ValueColumnIndex". The sorting
criterion is removed from "ValueColumnSort" if you set a "0" value..
The attribute can be assigned dynamic properties by means of the name
ValueColumnSortIndex. The data type is LONG.

ValueColumnState property
ValueColumnState
Displays the data connection status of a selected value column in Runtime.
The attribute can be assigned dynamic properties by means of the name ValueColumnState.
The data type is LONG.

ValueColumnTagName property
Tag name - ValueColumnTagName
Displays the name of connected tags. You can change the tag connection using the selection
button.
The attribute can be assigned dynamic properties by means of the name
ValueColumnTagName. The data type is STRING.

678

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ValueColumnTimeColumn property
Time column - ValueColumnTimeColumn
Specifies the time column for displaying the value column selected. Define the available time
columns in the "Time columns" tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnTimeColumn. The data type is STRING.

ValueColumnVisible property
Value columns - ValueColumnVisible
The list shows all value columns you created. Click a value column entry in the list to adapt
the properties, to assign the value column, and to define the data connection.
Select the value columns to be displayed in the table from the list. Value columns are displayed
if interconnected with a time column.
The attribute can be assigned dynamic properties by means of the name
ValueColumnVisible . The data type is BOOLEAN.

ValueMax Property
Description
Defines the value at the end of the scale. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ValueMin Property
Description
Defines the value at the start of the scale. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

679

VBS for Creating Procedures and Actions


1.14 VBS Reference

Variable Property
Description
The "Index" property references a pair of columns. "Tag" defines the name of the tag which
should be connected to this column pair.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

VerticalGridLines property
Vertical - VerticalGridLines
Enables the display of vertical dividers.
Value

Explanation

TRUE

Enables the displays of vertical dividers.

FALSE

Disables the display of vertical dividers.

The attribute can be assigned dynamic properties by means of the name VerticalGridLines.
The data type is BOOLEAN.

Visible Property
Description
witches an object visible or invisible or issues a corresponding value:
TRUE : Object is visible
FALSE : Object is invisible
VARIANT_BOOL (write-read access)

Example:
The following example sets all the objects in the picture "NewPDL1" to invisible:

'VBS95
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1

680

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Set objScreen = HMIRuntime.Screens("NewPDL1")


For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Visible = False
Next

See also
ScreenItem Object (Page 141)
Layer Object (Page 136)
HMIRuntime Object (Page 134)

1.14.4.22 W
Warning Property
Description
Defines the start of the "Warning zone" as a scale value. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

WarningColor Property
Description
Defines the color of the "Warning zone" o the scale. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

681

VBS for Creating Procedures and Actions


1.14 VBS Reference

WarningHigh Property
Description
Defines or returns the upper limit value for "Warning High".
In order that the limit value is monitored, the "CheckWarningHigh" property must be set to
TRUE.
The display on reaching the limit value and the type of evaluation are defined by means of the
"ColorWarningHigh" and "TypeWarningHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WarningLow Property
Description
Defines or returns the lower limit value for "Warning Low".
In order that the limit value is monitored, the "CheckWarningLow" property must be set to
TRUE.
The display on reaching the limit value and the type of evaluation are defined by means of the
"ColorWarningLow" and "TypeWarningLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Width Property
Description
Sets or outputs the width of an object in pixels.
LONG

Example:
The following example doubles the width of all objects in the pictures "NewPDL1" whose name
begins with "Button":

'VBS96
Dim objScreen

682

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Dim cmdButton
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'Get all "Buttons"
strName = objScreen.ScreenItems(lngIndex).ObjectName
If "Button" = Left(strName, 6) Then
Set cmdButton = objScreen.ScreenItems(strName)
cmdButton.Width = cmdButton.Width * 2
End If
Next

See also
Height Property (Page 430)
ScreenItem Object (Page 141)

WinCCStyle property
Description
Defines the style in which the object is displayed.
User Defined
Global
Windows Style

Shows the object according to the respective settings.


Shows the object in a globally defined design.
Shows the object in Windows style.

WindowBorder Property
Description
TRUE, when the window is displayed with borders in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

683

VBS for Creating Procedures and Actions


1.14 VBS Reference

WindowPositionMode property
Description
Defines the position and scaling of the picture window on the screen. It is only effective if the
"Independent window" attribute is set to TRUE.
Standard
Center
Maximize

The picture window is positioned in its original size in the configured position on
the screen.
The picture window is positioned in its original size, centered on the screen.
The picture window is scaled to the size of the screen.

WindowsStyle property
Description
Defines whether the object is displayed in the Windows style of WinCC version 6.2. It can only
be selected if "WinCC Classic" is chosen as the current design.
TRUE if the object is displayed in the Windows style of WinCC version 6.2.
FALSE if the object is not displayed in the Windows style of WinCC version 6.2.

WindowsStyle Property
Description
TRUE, when the object complies with the general Windows style (e.g. gray buttons without
borders). BOOLEAN write-read access. Note:
When this property is set to "True", the properties which do not comply with the Windows
style are ignored (e.g. "BorderWidth").
On the other hand, the definition of a "BorderWidth" or a background color other than gray
causes "WindowsStyle" to receive the value"False".
Exceptions here are the flash attributes: The definition of flash attributes does not
automatically lead to the deactivation of the "WindowsStyle" attribute.

See also
Slider (Page 226)
Button (Page 215)
ScreenItem Object (Page 141)

684

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

WindowType Property
Description
Defines the use of the message window.
0 - Message list: shows the currently pending messages.
1 - Short-term archive list: shows the archived messages.
2 - Long-term archive list: shows the archived messages.
3 - Lock list: shows the currently locked messages.
4 - Hit list: To display the statistical information of messages.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

WithAxes Property
Description
TRUE, when the scale should be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WithLabels Property
Description
TRUE, when the scale labels should be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

685

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.4.23 X - Z
XAxisColor property (before WinCC V7)
Description
Use this attribute to define the color for the common X-axis. The color is defined as an RGB
value. LONG write-read access.

X/YAxisAdd property
New - X/YAxisAdd
Creates a new X or Y axis.
The X axis attribute can be assigned dynamic properties by means of the name XAxisAdd .
The Y axis attribute can be assigned dynamic properties by means of the name YAxisAdd .
The data type is STRING.

X/YAxisAlign property
Alignment - X/YAxisAlign
Defines the alignment mode for a selected axis.
The following settings are available for the X axis:
Value

Description

Explanation

Bottom

The X axis selected is displayed below the trend.

Top

The X axis selected is displayed above the trend.

The X axis attribute can be assigned dynamic properties by means of the name XAxisAlign.
The data type is LONG.
The following settings are available for the Y axis:
Value

Description

Explanation

left

The X axis selected is displayed on left side of the trend.

right

The X axis selected is displayed on right side of the trend.

The Y axis attribute can be assigned dynamic properties by means of the name YAxisAlign.
The data type is LONG.

686

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

X/YAxisAutoPrecisions property
Decimal places automatic - X/YAxisAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The number of decimal places is set automatically. The value in the "Decimal places" or "X/
YAxisPrecisions" field is disabled.

FALSE

The value in the "Decimal places" or "X/YAxisPrecisions" field is active.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisAutoPrecisions.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisAutoPrecisions.
The data type is BOOLEAN.

X/YAxisAutoRange property
Value range automatic - X/YAxisAutoRange
Enables automatic calculation of the value range of the axis selected.
Value

Explanation

TRUE

The range of values is calculated automatically.

FALSE

The range of values is calculated based on the values configured in the "from" and "to" or "X/YAxisBeginValue"
and "X/YAxisEndValue" fields.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisAutoRange.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisAutoRange.
The data type is BOOLEAN.

X/YAxisBeginValue property
Value range from - X/YAxisBeginValue
Specifies the lower range of values of the axis selected. You can configure the value if the
"Automatic" option is disabled or "X/YAxisAutoRange" is "FALSE".
The X axis attribute can be assigned dynamic properties by means of the name
XAxisBeginValue.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisBeginValue.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

687

VBS for Creating Procedures and Actions


1.14 VBS Reference
The data type is DOUBLE.

X/YAxisColor property
Color XY axis - X/YAxisColor
Specifies the color of the axis selected. The button opens the "Color selection" dialog to select
the color.
The setting is only active if the "Use trend color" field is disabled or "X/YAxisInTrendColor" is
"FALSE".
The X axis attribute can be assigned dynamic properties by means of the name XAxisColor.
The Y axis attribute can be assigned dynamic properties by means of the name YAxisColor.
The data type is LONG.

X/YAxisEndValue property
Value range to - X/YAxisEndValue
Specifies the upper range of values of the axis selected. You can configure the value if the
"Automatic" option is disabled or "X/YAxisAutoRange" is "FALSE".
The X axis attribute can be assigned dynamic properties by means of the name
XAxisEndValue.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisEndValue.
The data type is DOUBLE.

X/YAxisExponentialFormat property
Exponential notation - X/YAxisExponentialFormat
Enables the exponential notation for visualization of a selected axis.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisExponentialFormat.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisExponentialFormat.
The data type is BOOLEAN.

688

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

X/YAxisInTrendColor property
Use trend color - X/YAxisInTrendColor
Enables the display of an axis selected in the trend color. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The axis selected is displayed in the trend color. The setting in the "Color" or "X/YAxisColor"
field is disabled.

FALSE

The axis selected is displayed in the color set in the "Color" or "X/YAxisColor" field.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisInTrendColor.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisInTrendColor.
The data type is BOOLEAN.

X/YAxisLabel property
Label - X/YAxisLabel
Defines the label text for a selected axis.
The X axis attribute can be assigned dynamic properties by means of the name XAxisLabel.
The Y axis attribute can be assigned dynamic properties by means of the name YAxisLabel.
The data type is STRING.

X/YAxisName property
Object name - X/YAxisName
Specifies the name of a selected axis.
Attribute "XAxisName" can be assigned dynamic properties for the X axis by means of
XAxisRename attribute.
Attribute "YAxisName" can be assigned dynamic properties for the Y axis by means of
YAxisRename attribute.
The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

689

VBS for Creating Procedures and Actions


1.14 VBS Reference

X/YAxisPrecisions property
Decimal places - X/YAxisPrecisions
Specifies the decimal precision for displaying the axis selected. The value can be configured
and is active in Runtime, if the "Automatic" option is disabled or "X/YAxisAutoPrecisions" is
"FALSE".
The X axis attribute can be assigned dynamic properties by means of the name
XAxisPrecisions.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisPrecisions.
The data type is SHORT.

X/YAxisRemove property
Remove - X/YAxisRemove
Removes the selected axis from the list.
The X axis attribute can be assigned dynamic properties by means of the name
XAxisRemove .
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisRemove .
The data type is STRING.

X/YAxisRepos property
Up/Down - X/YAxisRepos
Changes the sorting order of the axes. "Up" and "Down" move the axis selected up or down
in the list.
The list order determines the axis position in the trend window. The axis output position is
moved away from the trend if the axis is moved further up in the list and the orientation is the
same.
The X axis attribute can be assigned dynamic properties by means of the name XAxisRepos .
The Y axis attribute can be assigned dynamic properties by means of the name YAxisRepos .
The data type is LONG.

X/YAxisScalingType property
Scaling - X/YAxisScalingType
Defines the scaling mode for a selected axis.

690

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The following settings are available:
Value

Description

Linear

Logarithmic

Logarithmically negated

The X axis attribute can be assigned dynamic properties by means of the name
XAxisScalingType.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisScalingType.
The data type is LONG.

X/YAxisTrendWindow property
Trend window - X/YAxisTrendWindow
Specifies the trend window for a selected axis. Define the available trend windows in the "Trend
window" tab.
The X axis attribute can be assigned dynamic properties by means of the name
XAxisTrendWindow.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisTrendWindow.
The data type is STRING.

X/YAxisVisible property
X/Y axes - X/YAxisVisible
The list shows all axes you created. Click an axis entry in the list to adapt the properties and
to assign the axis to a trend window.
Activate the axes to be displayed in the trend windows in the list.
The X axis attribute can be assigned dynamic properties by means of the name
XAxisVisible .
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisVisible .
The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

691

VBS for Creating Procedures and Actions


1.14 VBS Reference

XAxisCount property
XAxisCount
Defines the number of X axes configured.
The attribute can be assigned dynamic properties by means of the name XAxisCount. The
data type is LONG.

XAxisIndex property
XAxisIndex
References a configured X axis. Using this attribute you can assign the values of other
attributes to a specific X axis.
Values between 0 and "XAxisCount" minus 1 are valid for "Index"; the attribute "XAxisCount"
defines the number of configured X axes.
The "XAxisIndex" attribute can be assigned dynamic properties by means of attribute
XAxisRepos. The data type is LONG.

XAxisRename property
XAxisRename
Renames the X axis which is referenced by means of "XAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name XAxisRename.
"XAxisRename" also sets a dynamic attribute "XAxisName". The data type is STRING.

YAxisCount property
YAxisCount
Defines the number of Y axes configured.
The attribute can be assigned dynamic properties by means of the name YAxisCount. The
data type is LONG.

YAxisIndex property
YAxisIndex
References a configured Y axis. Using this attribute you can assign the values of other
attributes to a specific Y axis.
Values between 0 and "YAxisCount" minus 1 are valid for "Index". Attribute "YAxisCount"
defines the number of configured Y axes.

692

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
The "YAxisIndex" attribute can be assigned dynamic properties by means of attribute
YAxisRepos. The data type is LONG.

YAxisRename property
YAxisRename
Renames the Y axis which is referenced by means of "YAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name YAxisRename.
"YAxisRename" also sets a dynamic attribute "YAxisName". The data type is STRING.

ZeroPoint Property
Description
Defines or returns the position of the zero point of the bar graph.
Specify the value as a %age of the total bar height. The zero point can also be outside of the
range represented.
The "ScalingType" property must be set to "2" and "Scaling" to TRUE.

See also
ScreenItem Object (Page 141)
Bar (Page 189)

ZeroPointValue Property
Description
Defines the value of the zero point of the scale indicator.
Defines or returns the absolute value for the zero point.

See also
Bar (Page 189)
3D Bar (Page 184)
ScreenItem Object (Page 141)

Zoom Property
Description
Sets the zoom factor within a picture or picture window or reads it out.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

693

VBS for Creating Procedures and Actions


1.14 VBS Reference
If the indicated zoom factor is smaller than the minimum value, the zoom factor is automatically
set to the minimum value. If the indicated zoom factor is larger than the minimum value, the
zoom factor is automatically set to the maximum value.
The minimum value of the zoom factor is at 2%, the maximum value at 800%.
With the Screen Object the zoom factor is indicated as a numeric value and with a picture
window object, it is indicated in percent.

Example:
The following example doubles the zoom factor of the current picture:

'VBS97
HMIRuntime.ActiveScreen.Zoom = HMIRuntime.ActiveScreen.Zoom * 2

See also
Picture Window (Page 194)
Screen Object (Page 146)

1.14.5

Methods

1.14.5.1

Methods

Overview
Methods, which are applied to individual objects, can be used to read out tag values for further
processing or displaying diagnostics messages in Runtime.

Available Methods in VBS


MoveToNext

ShowInfoText

ActivateDynami GetStatusbarElementCollection
c

Activate

GetStatusbarElement

MoveToNextLine

ShowLockDialog

Add

GetTimeAxis

MoveToNextPage

ShowLockList

AttachDB

GetTimeAxisCollection

MoveToPrevious

ShowLongTermArchiveList

CalculateStatist GetTimeColumn
ic

MoveToPreviousLine

ShowMessageList

CopyRows

GetTimeColumnCollection

MoveToPreviousPage

ShowPercentageAxis

CreateTagSet

GetToolbarButton

NextColumn

ShowPropertyDialog

CutRows

GetToolbarButtonCollection

NextTrend

ShowSelectArchive

694

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
DeactivateDyna GetTrend
mic

OneToOneView

ShowSelection

DeleteRows

GetTrendCollection

PasteRows

ShowSelectionDialog

DetachDB

GetTrendWindow

PreviousColumn

ShowSelectTimeBase

Edit

GetTrendWindowCollection

PreviousTrend

ShowShortTermArchiveList

Export

GetValueAxis

Print

ShowSort

GetColumn

GetValueAxisCollection

QuitHorn

ShowSortDialog

GetColumnColl
ection

GetValueColumn

QuitSelected

ShowTagSelection

GetHitlistColum GetValueColumnCollection
n

QuitVisible

ShowTimebaseDialog

GetHitlistColum GetXAxis
nCollection

Read

ShowTimeSelection

GetMessageBl
ock

GetXAxisCollection

ReadTags

ShowTrendSelection

GetMessageBl
ockCollection

GetYAxis

Refresh

StartStopUpdate

GetMessageCo GetYAxisCollection
lumn

Remove

Stop

GetMessageCo HideAlarm
lumnCollection

RemoveAll

Trace

GetOperatorMe Item Method


ssage

Restore

UnhideAlarm

GetOperatorMe LockAlarm
ssageCollection

SelectedStatisticArea

UnlockAlarm

GetRulerBlock

LoopInAlarm

ServerExport

Write

GetRulerBlock
Collection

MoveAxis

ServerImport

WriteTags

GetRulerColum MoveRuler (Page 757)


n

ShowColumnSelection

ZoomArea

GetRulerColum MoveToFirst
nCollection

ShowComment

ZoomInOut

GetRulerData

MoveToFirstLine

ShowDisplayOptionsDialog

ZoomInOutTime

GetStatisticAre
aColumn

MoveToFirstPage

ShowEmergencyQuitDialog

ZoomInOutValues

GetStatisticAre MoveToLast
aColumnCollect
ion

ShowHelp

ZoomInOutX

GetStatisticRes MoveToLastLine
ultColumn

ShowHideList

ZoomInOutY

GetStatisticRes MoveToLastPage
ultColumnColle
ction

ShowHitList

ZoomMove

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

695

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.5.2

Methods A to E

Activate Method
Function
Activates the specified picture and picture element, respectively.
Note
Focus assignments should not be configured during a ButtonDown event. Since the focus is
specifically requested during the ButtonDown event, invalid states may occur.

Syntax
Expression.Activate
Expression
Necessary. An expression which returns an object of type "Screen" or "ScreenItem".

Parameters
--

Examples
The following example shows the use for type "Screen":

'VBS98
Dim objScreen
MsgBox HMIRuntime.ActiveScreen.ObjectName
'Output of active screen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.Activate
'Activate "ScreenWindow1"
MsgBox HMIRuntime.ActiveScreen.ObjectName
'New output of active screen

The following example shows the use for type "ScreenItem":

'VBS158
MsgBox HMIRuntime.ActiveScreen.ActiveScreenItem.ObjectName
HMIRuntime.ActiveScreen.ScreenItems("IOField1").Activate
MsgBox HMIRuntime.ActiveScreen.ActiveScreenItem.ObjectName
item

696

'Output of active screen item


'New output of active screen

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ScreenItem Object (Page 141)
Screen Object (Page 146)

ActivateDynamic method
Function
Dynamically activates a trigger for the defined property and with the defined cycle during
runtime. Every time the trigger is activated a different activation cycle can be used.
Examples of this method are available in chapter "VBS for creating procedures and action >
Creating and editing actions > Trigger > Animation trigger".

Syntax
Expression.ActivateDynamic (ByVAl bstrPropertyName As String, ByVal
bstrCycleName As String)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Parameters

Description

bstrPropertyName

Name of property to which trigger relates.

bstrCycleName

Name of activation cycle, e.g. "CycleTime1s".

See also
Animation trigger (Page 82)

Add Method
Description of TagSet Object
Adds a tag to the list. A tag may be added to the tag object by using name or reference.

syntax
Expression.Add [Tag]
Expression
Necessary. An expression which returns an object of type "TagSet".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

697

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
VARIANT
Parameters

Description

Tag

Name of a WinCC tag or reference to a tag object


to be added to the list.

Example:
In the following example, a TagSet object is generated and a tag is added.

'VBS170
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"

Tag objects may also be added as follows.

'VBS171
Dim Tag
Set Tag = HMIRuntime.Tags("Motor2")
Dim group2
Set group2 = HMIRuntime.Tags.CreateTagSet
group2.Add Tag

Description of DataSet Object


Adds a value or object reference to the list.
Note
The Data Set Object does not support classes.
Objects of type Screen, Screens, ScreenItem, ScreenItems, Tag and TagSet cannot be
included in the DataSet list.
For object references it must be ascertained that objects are multiread-enabled.

syntax
Expression.Add [vtName], [vtUserData]
Expression
Necessary. An expression which returns an object of type "DataSet".

698

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
VARIANT
Parameters

Description

vtName

Name by which value or tag are to be added to list.

vtUserData

Value to be added to list.

Example:
In this example, a value is included in the DataSet list.

'VBS172
HMIRuntime.DataSet.Add "Motor1",23

See also
TagSet Object (List) (Page 156)
DataSet Object (List) (Page 132)

AttachDB method
Function
Executes the "Connect backup" key function of the control.

Syntax
Ausdruck.AttachDB()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

CalculateStatistic method
Function
Executes the "Calculate statistics" key function of the OnlineTrendControl and
OnlineTableControl.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

699

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Ausdruck.CalculateStatistic()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

CopyRows method
Function
Executes the "Copy lines" key function of the control.

Syntax
Ausdruck.CopyRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Create method
Function
Creates a new Alarm object.

Syntax
Expression.Create (VARIANT vtApplication)
Expression
Necessary. An expression which returns an object of type "Alarm".

700

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
VARIANT
Parameters

Description

vtApplication

Name of alarm object (optional)

See also
Alarms object (list) (Page 126)

CreateTagSet Method
Function
Creates a new TagSet object. This object may be used for optimized multi-tag access.

syntax
Expression.CreateTagSet()
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
VARIANT

Example:
The following example shows how to create a TagSet object.

'VBS168
'Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet

See also
TagSet Object (List) (Page 156)
Tags Object (List) (Page 155)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

701

VBS for Creating Procedures and Actions


1.14 VBS Reference

CutRows method
Function
Executes the "Cut lines" key function of the UserArchiveControl.

Syntax
Ausdruck.CutRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

DeactivateDynamic method
Function
Deactivates the trigger used with the "ActivateDynamic" method for the defined property during
runtime.

Syntax
Ausdruck.DeactivateDynamic(ByVal bstrPropertyName As String)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
String
Parameters

Description

bstrPropertyName

Name of property to which trigger relates.

DeleteRows method
Function
Executes the "Delete Rows" key function of the UserArchiveControl.

702

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Ausdruck.DeleteRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

DetachDB method
Function
Executes the "Disconnect backup" key function of the control.

Syntax
Ausdruck.DetachDB()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Edit method
Function
Executes the "Edit" key function of the OnlineTableControl.

Syntax
Ausdruck.Edit()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

703

VBS for Creating Procedures and Actions


1.14 VBS Reference

Export Method
Function
Executes the "Export archive" or "Export data" key function of the control.

Syntax
Ausdruck.Export()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

1.14.5.3

Get methods

GetColumn method
Function
Returns the name or index designated column object of the WinCC UserArchiveControl as
type "ICCAxUAColumn".

Syntax
Ausdruck.GetColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of UserArchiveControl.

Example

'VBS312

704

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Dim ctrl
Dim objColumn
Set ctrl = ScreenItems("UAControl")
Set objColumn = ctrl.GetColumn("Field1")
objColumn.Length = 30
Set objColumn = ctrl.GetColumn(3)
objColumn.Align = 2

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Column" listing, for example, you write "objColumn.Align" instead of
"objColumn.ColumnAlign".

See also
Column object (list) (Page 235)

GetColumnCollection method
Function
Returns the list of all column objects of the WinCC UserArchiveControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

705

VBS for Creating Procedures and Actions


1.14 VBS Reference
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS313
Dim ctrl
Dim coll
Dim field
Set ctrl = ScreenItems("UAControl")
Set coll = ctrl.GetColumnCollection
HMIRuntime.Trace "Number of fields:" & coll.Count & vbCrLf
For Each field In coll
HMIRuntime.Trace field.Name & vbCrLf
HMIRuntime.Trace field.Type & vbCrLf
HMIRuntime.Trace field.Length & vbCrLf
HMIRuntime.Trace field.Caption & vbCrLf
Next

See also
Column object (list) (Page 235)

GetHitlistColumn method
Function
Returns the name or index designated column object of the hitlist of the WinCC AlarmControl
as type "ICCAxMessageColumn".

Syntax
Expression.GetHitlistColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

706

Parameters

Description

vIndex

Index or name of hitlist column

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS314
Dim ctrl
Dim objHitlistColumn
Set ctrl = ScreenItems("AlarmControl")
Set objHitlistColumn = ctrl.GetHitlistColumn("Date")
objHitlistColumn.Sort = 2
Set objHitlistColumn = ctrl.GetHitlistColumn("AverageComeGo")
objHitlistColumn.Visible = FALSE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "HitlistColumn" listing, for example, you write "objHitlistColumn.Visible" instead of
"objHitlistColumn.HitlistColumnVisible".

See also
HitlistColumn object (list) (Page 236)

GetHistlistColumnCollection method
Function
Returns the list of all column objects of the WinCC AlarmControl hitlist as type
"ICCAxCollection".

Syntax
Expression.GetHitlisteColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

707

VBS for Creating Procedures and Actions


1.14 VBS Reference

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS315
Dim ctrl
Dim coll
Dim hitlistcol
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetHitlistColumnCollection
HMIRuntime.Trace "Number of hitlist columns:" & coll.Count & vbCrLf
For Each hitlistcol In coll
HMIRuntime.Trace hitlistcol.Index & vbCrLf
HMIRuntime.Trace hitlistcol.Name & vbCrLf
HMIRuntime.Trace hitlistcol.Sort & vbCrLf
HMIRuntime.Trace hitlistcol.SortIndex & vbCrLf
Next

See also
HitlistColumn object (list) (Page 236)

GetMessageBlock method
Function
Returns the name or index designated message block object of the WinCC AlarmControl as
type "ICCAxMessageBlock".

Syntax
Expression.GetMessageBlock(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

708

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of message block.

Example

'VBS316
Dim ctrl
Dim objMsgBlock
Set ctrl = ScreenItems("AlarmControl")
Set objMsgBlock = ctrl.GetMessageBlock("Date")
objMsgBlock.Align = 2
Set objMsgBlock = ctrl.GetMessageBlock("Number")
objMsgBlock.LeadingZeros = 4

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "MessageBlock" listing, for example, you write "objMsgBlock.Align" instead of
"objMsgBlock.MessageBlockAlign".

See also
MessageBlock object (list) (Page 237)

GetMessageBlockCollection method
Function
Returns the list of all message block objects of the WinCC AlarmControl as type
"ICCAxCollection".

Syntax
Expression.GetMessageBlockCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

709

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS317
Dim ctrl
Dim coll
Dim msgblock
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetMessageBlockCollection
For Each msgblock In coll
msgblock.Align = 1
msgblock.Length = 12
msgblock.Selected = TRUE
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "MessageBlock" listing, for example, you write "msgblock.Align" instead of
"msgblock.MessageBlockAlign".

See also
MessageBlock object (list) (Page 237)

GetMessageColumn method
Function
Returns the name or index designated column object of the WinCC AlarmControl as type
"ICCAxMessageColumn".

710

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Expression.GetMessageColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column in message list.

Example

'VBS318
Dim ctrl
Dim objMessColumn
Set ctrl = ScreenItems("AlarmControl")
Set objMessColumn = ctrl.GetMessageColumn("Date")
objMessColumn.Visible = FALSE
Set objMessColumn = ctrl.GetMessageColumn("Number")
objMessColumn.Sort = 1

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "MessageColumn" listing, for example, you write "objMessColumn.Visible" instead
of "objMessColumn.MessageColumnVisible".

See also
MessageColumn object (list) (Page 238)

GetMessageColumnCollection method
Function
Returns the list of all column objects of the WinCC AlarmControl as type "ICCAxCollection".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

711

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Expression.GetMessageColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS319
Dim ctrl
Dim coll
Dim msgcol
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetMessageColumnCollection
HMIRuntime.Trace "Number of message columns:" & coll.Count & vbCrLf
For Each msgcol In coll
HMIRuntime.Trace msgcol.Index & vbCrLf
HMIRuntime.Trace msgcol.Name & vbCrLf
HMIRuntime.Trace msgcol.Sort & vbCrLf
HMIRuntime.Trace msgcol.SortIndex & vbCrLf
Next

See also
MessageColumn object (list) (Page 238)

712

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetOperatorMessage method
Function
Returns the name or index designated operator message object of the WinCC AlarmControl
as type "ICCAxOperatorMessage".

Syntax
Expression.GetOperatorMessage(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of operator message

Example

'VBS320
Dim ctrl
Dim objOpMess
Set ctrl = ScreenItems("AlarmControl")
Set objOpMess = ctrl.GetOperatorMessage(0)
objOpMess.Source1 = "Number"
objOpMess.SourceType1 = 1

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "OperatorMessage" listing, for example, you write "objOpMess.Source1" instead of
"objOpMess.OperatorMessageSource1".

See also
OperatorMessage object (list) (Page 239)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

713

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetOperatorMessageCollection method
Function
Returns the list of all operator message objects of the WinCC AlarmControl as type
"ICCAxCollection".

Syntax
Expression.GetOperatorMessageCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS321
Dim ctrl
Dim coll
Dim opmsg
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetOperatorMessageCollection
For Each opmsg In coll
HMIRuntime.Trace opmsg.Index & vbCrLf
HMIRuntime.Trace opmsg.Name & vbCrLf
HMIRuntime.Trace opmsg.Number & vbCrLf
HMIRuntime.Trace opmsg.Selected & vbCrLf
Next

See also
OperatorMessage object (list) (Page 239)

714

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetRow method
Function
Returns the row number designated row object of the table-based controls as type
"ICCAxDataRow".

Syntax
Expression.GetRow(ByVal IRow As Long)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Long
Parameters

Description

IRow

Number of the desired line of the control.

Example

'VBS356
Dim ctrl
Dim lIndex
Dim lCellIndex
Set ctrl = ScreenItems("UAControl")
Set coll = ctrl.GetRowCollection
'enumerate and trace out row numbers
For lIndex = 1 To coll.Count
HMIRuntime.trace "Row: " & (ctrl.GetRow(lIndex).RowNumber) & "
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To ctrl.GetRow(lIndex).CellCount
HMIRuntime.Trace ctrl.GetRow(0).CellText(lCellIndex) & " "
HMIRuntime.trace ctrl.GetRow(lIndex).CellText(lCellIndex) & "
Next
HMIRuntime.trace vbNewLine
Next

"

"

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Row" listing, for example, you write "objRow.CellCount" instead of
"objRow.RowCellCount".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

715

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Row object (list) (Page 240)

GetRowCollection method
Function
Returns the list of all row objects of the table-based controls type "ICCAxDataRowCollection".

Syntax
Expression.GetRowCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Properties of the ICCAxDataRowCollection


The ICCAxDataRowCollection refers to runtime data. The data is read-only. It is not possible
to add and edit the data.
The following properties are available for the ICCAxDataRowCollection:
Count - Determines the number of rows in the collection.
Item - Access to an individual row within the collection via the row number. Numbering runs
from 1 to Count. A Row object is returned.

Example

'VBS357
Dim ctrl
Dim coll
Dim lIndex
Dim lCellIndex
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetRowCollection
HMIRuntime.Trace "Number of message rows:" & coll.Count & vbCrLf
'enumerate and trace out row numbers
For lIndex = 1 To coll.Count
HMIRuntime.Trace "Row: " & (ctrl.GetRow(lIndex).RowNumber) & " "

716

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

'enumerate and trace out column titles and cell texts


For lCellIndex = 1 To ctrl.GetRow(lIndex).CellCount
HMIRuntime.Trace ctrl.GetMessageColumn(lCellIndex -1).Name & " "
HMIRuntime.Trace ctrl.GetRow(lIndex).CellText(lCellIndex) & " "
Next
HMIRuntime.Trace vbNewLine
Next

See also
Row object (list) (Page 240)

GetRulerBlock method
Function
Returns the Block object designated as name or index of the WinCC RulerControl as type
"ICCAxRulerBlock".

Syntax
Expression.GetRulerBlock(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of block in RulerControl

Example

'VBS322
Dim ctrl
Dim objRulerBlock
Set ctrl = ScreenItems("RulerControl")
Set objRulerBlock = ctrl.GetRulerBlock(0)
objRulerBlock.Caption = "RulerBlock1"
Set objRulerBlock = ctrl.GetRulerBlock("Name")
objRulerBlock.Length = 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

717

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "RulerBlock" listing, for example, you write "objRulerBlock.Caption" instead of
"objRulerBlock.BlockCaption".

See also
RulerBlock object (list) (Page 241)

GetRulerBlockCollection method
Function
Returns the list of all Block objects of the WinCC RulerControl as type "ICCAxCollection".

Syntax
Expression.GetRulerBlockCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

718

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS323
Dim ctrl
Dim coll
Dim rulerblock
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetRulerBlockCollection
For Each rulerblock In coll
rulerblock.Align = 1
rulerblock.Length = 12
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "RulerBlock" listing, for example, you write "rulerblock.Align" instead of
"rulerblock.RulerBlockAlign".

See also
RulerBlock object (list) (Page 241)

GetRulerColumn method
Function
Returns the Column object designated as name or index of the WinCC RulerControl as type
"ICCAxRulerColumn".

Syntax
Expression.GetRulerColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of RulerControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

719

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS324
Dim ctrl
Dim objRulercol
Set ctrl = ScreenItems("RulerControl")
Set objRulercol = ctrl.GetRulerColumn("Name")
objRulercol.Sort = 0
Set objRulercol = ctrl.GetRulerColumn("ValueY")
objRulercol.Visible = FALSE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "RulerColumn" listing, for example, you write "objRulercol.Visible" instead of
"objRulercol.ColumnVisible".

See also
RulerColumn object (list) (Page 241)

GetRulerColumnCollection method
Function
Returns the list of all Column objects of the WinCC RulerControl as type "ICCAxCollection".

Syntax
Expression.GetRulerColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

720

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS325
Dim ctrl
Dim coll
Dim rulercol
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetRulerColumnCollection
HMIRuntime.Trace "Number of ruler columns:" & coll.Count & vbCrLf
For Each rulercol In coll
HMIRuntime.Trace rulercol.Index & vbCrLf
HMIRuntime.Trace rulercol.Name & vbCrLf
HMIRuntime.Trace rulercol.Sort & vbCrLf
HMIRuntime.Trace rulercol.SortIndex & vbCrLf
Next

See also
RulerColumn object (list) (Page 241)

GetRulerData method
Function
Returns the value of the called trend at the ruler position.

Syntax
Expression.GetRulerData(ByVal RulerIndex As Long, pvValue As
Variant, Optional pvTimeStamp As Variant, Optional pvFlags As
Varian) Long
Expression
Necessary. An expression which returns an object of the "Trend" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

721

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
Parameters

Description

RulerIndex

0 =Ruler

pvValue

Value of X axis

pvTimeStamp

Time or value of the Y axis

pvFlags

Qualitycode

Example

'VBS326
Dim ctrl
Dim objTrend
Dim objIOField1
Dim objIOField2
Dim value
Dim time
Set ctrl = ScreenItems( "Control1" )
Set objTrend = ctrl.GetTrend( "Trend 1" )
Set objIOField1 = ScreenItems( "I/O Field1" )
Set objIOField2 = ScreenItems( "I/O Field2" )
objTrend.GetRulerData 0, value, time
objIOField1.OutputValue = value
objIOField2.OutputValue = time

GetSelectedRow method
Function
Returns the selected row object of the table-based controls as type "ICCAxDataRow".

Syntax
Expression.GetSelectedRow()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

722

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS358
Dim ctrl
Dim lCellIndex
Dim lCellCount
Dim headingRow
Dim selectedRow
Set ctrl = ScreenItems("TableControl")
Set headingRow = ctrl.GetRow(0)
Set selectedRow = ctrl.GetSelectedRow
lCellCount = headingRow.CellCount
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To lCellCount
HMIRuntime.trace headingRow.CellText(lCellIndex) & ":
HMIRuntime.trace selectedRow.CellText(lCellIndex)
HMIRuntime.trace vbNewLine
Next

"

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Row" listing, for example, you write "objRow.CellCount" instead of
"objRow.RowCellCount".

See also
Row object (list) (Page 240)

GetSelectedRows method
Function
Returns the selected row objects of the table-based controls as type "ICCAxDataRow"for
multiple selection.

Syntax
Expression.GetSelectedRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

723

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
--

Example

'VBS359
Dim ctrl
Dim lCellIndex
Dim lCellCount
Dim lRowIndex
Dim lRowCount
Dim headingRow
Dim selectedRow
Dim selectedRows
Set ctrl = ScreenItems("TableControl")
Set headingRow = ctrl.GetRow(0)
Set selectedRows = ctrl.GetSelectedRows
lCellCount = headingRow.CellCount
lRowCount = selectedRows.Count
'enumerate selected rows
For lRowIndex = 1 To lRowCount
Set selectedRow = selectedRows(lRowIndex)
HMIRuntime.Trace "Row number: " & CStr(lRowIndex) & vbNewLine
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To lCellCount
HMIRuntime.trace headingRow.CellText(lCellIndex) & ": "
HMIRuntime.trace selectedRow.CellText(lCellIndex)
HMIRuntime.trace vbNewLine
Next
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Row" listing, for example, you write "objRow.CellCount" instead of
"objRow.RowCellCount".

See also
Row object (list) (Page 240)

724

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetStatisticAreaColumn method
Function
Returns the name or index designated Column object of the WinCC RulerControl statistics
area window as type "ICCAxRulerColumn".

Syntax
Ausdruck.GetStatisticAreaColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of statistics area window.

Example

'VBS327
Dim ctrl
Dim objStatAreaCol
Set ctrl = ScreenItems("RulerControl")
Set objStatAreaCol = ctrl.GetStatisticAreaColumn("DatasourceY")
objStatAreaCol.Visible = FALSE
Set objStatAreaCol = ctrl.GetStatisticAreaColumn("ValueY(LL)")
objStatAreaCol.Sort = 1

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatisticAreaColumn" listing, for example, you write "objStatAreaCol.Visible" instead
of "objStatAreaCol.ColumnVisible".

See also
StatisticAreaColumn object (list) (Page 242)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

725

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetStatisticAreaColumnCollection method
Function
Returns the list of all column objects of the WinCC RulerControl statistics area window as type
"ICCAxCollection".

Syntax
Ausdruck.GetStatisticAreaColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS328
Dim ctrl
Dim coll
Dim statcol
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetStatisticAreaColumnCollection
HMIRuntime.Trace "Number of statistic Area columns:" & coll.Count & vbCrLf
For Each statcol In coll
HMIRuntime.Trace statcol.Index & vbCrLf
HMIRuntime.Trace statcol.Name & vbCrLf
HMIRuntime.Trace statcol.Sort & vbCrLf
HMIRuntime.Trace statcol.SortIndex & vbCrLf
Next

726

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
StatisticAreaColumn object (list) (Page 242)

GetStatisticResultColumn method
Function
Returns the name or index designated Column object of the WinCC RulerControl statistics
window as type "ICCAxRulerColumn".

Syntax
Ausdruck.GetStatisticResultColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of statistics window.

Example

'VBS329
Dim ctrl
Dim objStatResCol
Set ctrl = ScreenItems("RulerControl")
Set objStatResCol = ctrl.GetStatisticResultColumn("MaxValue")
objStatResCol.Visible = FALSE
Set objStatResCol = ctrl.GetStatisticResultColumn("Average")
objStatResCol.Sort = 2

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatisticResultColumn" listing, for example, you write "objStatResCol.Visible" instead
of "objStatResCol.ColumnVisible".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

727

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
StatisticResultColumn object (list) (Page 243)

GetStatisticResultColumnCollection method
Function
Returns the list of all Column objects of the WinCC RulerControl statistics window as type
"ICCAxCollection".

Syntax
Ausdruck.GetStatisticResultColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS330
Dim ctrl
Dim coll
Dim statcol
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetStatisticResultColumnCollection
HMIRuntime.Trace "Number of statistic result columns:" & coll.Count & vbCrLf
For Each statcol In coll
HMIRuntime.Trace statcol.Index & vbCrLf
HMIRuntime.Trace statcol.Name & vbCrLf
HMIRuntime.Trace statcol.Sort & vbCrLf
HMIRuntime.Trace statcol.SortIndex & vbCrLf

728

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Next

See also
StatisticResultColumn object (list) (Page 243)

GetStatusbarElement method
Function
Returns the element of the control status bar designated as name or index as type
"ICCAxStatusbarElement".

Syntax
Ausdruck.GetStatusbarElement(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of status bar element.

Example

'VBS331
Dim ctrl
Dim objStatusBar
Set ctrl = ScreenItems( "Control1" )
Set objStatusBar = ctrl.GetStatusbarElement(1)
objStatusBar.Visible = FALSE
Set objStatusBar = ctrl.GetStatusbarElement(3)
objStatusBar.Width = 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

729

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatusbarElement" listing, for example, you write "objStatusBar.Visible" instead of
"objStatusBar.StatusbarElementVisible".

See also
StatusbarElement object (list) (Page 244)

GetStatusbarElementCollection method
Function
Returns the list of all status bar elements of the control as type "ICCAxCollection".

Syntax
Ausdruck.GetStatusbarElementCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

730

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS332
Dim ctrl
Dim coll
Dim statelement
Set ctrl = ScreenItems.Item("Control1")
Set coll = ctrl.GetStatusbarElementCollection
HMIRuntime.Trace "Number of statusbar elements:" & coll.Count & vbCrLf
For Each statelement In coll
HMIRuntime.Trace statelement.Name & vbCrLf
HMIRuntime.Trace statelement.Width & vbCrLf
HMIRuntime.Trace statelement.Text & vbCrLf
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatusbarElement" listing, for example, you write "statelement.Name" instead of
"statelement.StatusbarElementName".

See also
StatusbarElement object (list) (Page 244)

GetTimeAxis method
Function
Returns the time axis object designated as name or index of the WinCC OnlineTrendControl
as type "ICCAxTimeAxis".

Syntax
Ausdruck.GetTimeAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

731

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of time axis.

Example

'VBS333
Dim ctrl
Dim objTimeAxis
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTimeAxis = ctrl.GetTimeAxis(1)
objTimeAxis.Visible = FALSE
Set objTimeAxis = ctrl.GetTimeAxis("axis 2")
objTimeAxis.Label = "Time axis 2"
objTimeAxis.DateFormat = "dd.MM.yy"
objTimeAxis.TimeFormat = "HH:mm:ss.ms"
objTimeAxis.RangeType = 2
objTimeAxis.BeginTime = "06.04.2010 9:33:18"
objTimeAxis.MeasurePoints = 100

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TimeAxis" listing, for example, you write "objTimeAx.Visible" instead of
"objTimeAx.TimeAxisVisible".

See also
TimeAxis object (list) (Page 244)

GetTimeAxisCollection method
Function
Returns the list of all time axis objects of the WinCC OnlineTrendControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetTimeAxisCollection()

732

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS334
Dim ctrl
Dim objTrendWnd
Dim objTimeAxis1
Dim objTimeAxis2
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis1 = ctrl.GetTimeAxisCollection.AddItem("TimeAxis2010")
Set objTimeAxis2 = ctrl.GetTimeAxisCollection.AddItem("TimeAxis2011")
objTimeAxis1.TrendWindow = objTrendWnd.Name
objTimeAxis1.Label = "2010"
objTimeAxis1.RangeType = 1
objTimeAxis1.BeginTime = "01.01.2010 0:00:00"
objTimeAxis1.EndTime = "31.12.2010 11:59:59"
objTimeAxis2.TrendWindow = objTrendWnd.Name
objTimeAxis2.Label = "2011"
objTimeAxis2.RangeType = 1
objTimeAxis2.BeginTime = "01.01.2011 0:00:00"
objTimeAxis2.EndTime = "31.12.2011 11:59:59"
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend1")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.TimeAxis = objTimeAxis1.Name
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend2")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.TimeAxis = objTimeAxis2.Name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

733

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TimeAxis" listing, for example, you write "objTimeAxis1.Label" instead of
"objTimeAxis1.TimeAxisLabel".

See also
TimeAxis object (list) (Page 244)

GetTimeColumn method
Function
Returns the time column object designated as name or index of the WinCC OnlineTableControl
as type "ICCAxTimeColumn".

Syntax
Ausdruck.GetTimeColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of time column.

Example

'VBS335
Dim ctrl
Dim objTimeCol
Set ctrl = ScreenItems("TableControl")
Set objTimeCol = ctrl.GetTimeColumn("Timecolumn1")
objTimeCol.ShowDate = FALSE
Set objTimeCol = ctrl.GetTimeColumn("Timecolumn2")
objTimeCol.Visible = FALSE

734

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TimeColumn" listing, for example, you write "objTimeColumn.ShowDate" instead of
"objTimeColumn.TimeColumnShowDate".

See also
TimeColumn object (list) (Page 245)

GetTimeColumnCollection method
Function
Returns the list of all time column objects of the WinCC OnlineTableControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetTimeColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS336

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

735

VBS for Creating Procedures and Actions


1.14 VBS Reference

Dim ctrl
Dim objTimeCol1
Dim objTimeCol2
Dim coll
Dim timecol
Set ctrl = ScreenItems("TableControl")
Set objTimeCol1 = ctrl.GetTimeColumnCollection.AddItem("TimeColumn2010")
Set objTimeCol2 = ctrl.GetTimeColumnCollection.AddItem("TimeColumn2011")
objTimeCol1.Caption = "2010"
objTimeCol1.RangeType = 1
objTimeCol1.BeginTime = "01.01.2010 0:00:00"
objTimeCol1.EndTime = "31.12.2010 11:59:59"
objTimeCol2.Caption = "2011"
objTimeCol2.RangeType = 0
objTimeCol2.BeginTime = "01.01.2011 0:00:00"
objTimeCol2.TimeRangeFactor = 1
objTimeCol2.TimeRangeBase = 3600000
Set coll = ctrl.GetTimeColumnCollection
For Each timecol In coll
timecol.Align = 1
timecol.Length = 12
timecol.BackColor = RGB(240,240,0)
timecol.ForeColor = RGB(130,160,255)
Next

See also
TimeColumn object (list) (Page 245)

GetToolbarButton method
Function
Returns the name or index designated toolbar button function of the control as type
"ICCAxToolbarButton".

Syntax
Ausdruck.GetToolbarButton(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

736

Parameters

Description

vIndex

Index or name of toolbar button function.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS337
Dim ctrl
Set ctrl = ScreenItems( "Control1" )
Dim toolbu
Set toolbu = ctrl.GetToolbarButton ("ShowHelp")
HMIRuntime.Trace "Name: " & toolbu.Name & vbCrLf
HMIRuntime.Trace "Index: " & toolbu.Index & vbCrLf
HMIRuntime.Trace "Hotkey: " & toolbu.HotKey & vbCrLf

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ToolbarButton" listing, for example, you write "toolbu.Index" instead of
"toolbu.ToolbarButtonIndex".

See also
ToolbarButton object (list) (Page 246)

GetToolbarButtonCollection method
Function
Returns the list of all toolbar button functions of the control as type "ICCAxCollection".

Syntax
Ausdruck.GetToolbarButtonCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

737

VBS for Creating Procedures and Actions


1.14 VBS Reference
The following methods are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS338
Dim ctrl
Dim coll
Dim toolbu
Set ctrl = ScreenItems( "Control1" )
Set coll = ctrl.GetToolbarButtonCollection
HMIRuntime.Trace "Number of toolbar buttons:" & coll.Count & vbCrLf
For Each toolbu In coll
HMIRuntime.Trace toolbu.Name & vbCrLf
HMIRuntime.Trace "Hotkey: " & toolbu.HotKey & vbCrLf
HMIRuntime.Trace "Authorization: " & toolbu.PasswordLevel & vbCrLf
Next

See also
ToolbarButton object (list) (Page 246)

GetTrend method
Function
Returns the trend object designated as name or index of the WinCC OnlineTrendControl or
WinCC FunctionTrendControl as type "ICCAxTrend" or "ICCAxFunctionTrend".

Syntax
Ausdruck.GetTrend(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

738

Parameters

Description

vIndex

Index or name of curve.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS339
Dim ctrl
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrend = ctrl.GetTrend( "Trend 1" )
objTrend.PointStyle = 1
objTrend.LineWidth = 4
Set objTrend = ctrl.GetTrend(2)
objTrend.Provider = 1
objTrend.TagName = "Archive\ArchiveTag2"

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Trend" listing, for example, you write "objTrend.PointStyle" instead of
"objTrend.TrendPointStyle".

See also
Trend object (list) (Page 247)

GetTrendCollection method
Function
Returns the list of all trend objects of the WinCC OnlineTrendControl or WinCC
FunctionTrendControl as type "ICCAxCollection".

Syntax
Ausdruck.GetTrendCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

739

VBS for Creating Procedures and Actions


1.14 VBS Reference

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS340
Dim ctrl
Dim objTrendWnd
Dim objTimeAxis
Dim objValAxis
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = ctrl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValAxis = ctrl.GetValueAxisCollection.AddItem("myValueAxis")
objTimeAxis.TrendWindow = objTrendWnd.Name
objValAxis.TrendWindow = objTrendWnd.Name
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend1")
objTrend.Provider = 1
objTrend.TagName = "Archive\ArchiveTag1"
objTrend.TrendWindow = objTrendWnd.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValAxis.Name

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Trend" listing, for example, you write "objTrend.TagName" instead of
"objTrend.TrendTagName".

See also
Trend object (list) (Page 247)

740

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetTrendWindow method
Function
Returns the trend window object designated as name or index of the WinCC
OnlineTrendControl or WinCC FunctionTrendControl as type "ICCAxTrendWindow".

Syntax
Ausdruck.GetTrendWindow(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of curve window.

Example

'VBS341
Dim ctrl
Dim objTrendWnd
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindow(1)
objTrendWnd.Visible = FALSE
Set objTrendWnd = ctrl.GetTrendWindow("trend window 2")
objTrendWnd.VerticalGrid = TRUE
objTrendWnd.FineGrid = TRUE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TrendWindow" listing, for example, you write "objTrendWnd.Visible" instead of
"objTrendWnd.TrendWindowVisible".

See also
TrendWindow object (list) (Page 249)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

741

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetTrendWindowCollection method
Function
Returns the list of all trend window objects of the WinCC OnlineTrendControl or WinCC
FunctionTrendControl as type "ICCAxCollection".

Syntax
Ausdruck.GetTrendWindowCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS342
Dim ctrl
Dim objTrendWnd
Dim objTimeAxis
Dim objValAxis
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = ctrl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValAxis = ctrl.GetValueAxisCollection.AddItem("myValueAxis")
objTimeAxis.TrendWindow = objTrendWnd.Name
objValAxis.TrendWindow = objTrendWnd.Name

See also
TrendWindow object (list) (Page 249)

742

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetValueAxis method
Function
Returns the value axis object designated as name or index of the WinCC OnlineTrendControl
as type "ICCAxValueAxis".

Syntax
Ausdruck.GetValueAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of value axis.

Example

'VBS343
Dim ctrl
Dim objValAxis
Set ctrl = ScreenItems("OnlineTrendControl")
Set objValAxis = ctrl.GetValueAxis(1)
objValAxis.Visible = FALSE
Set objValAxis = ctrl.GetValueAxis("axis 2")
objValAxis.Label = "Value axis 2"
objValAxis.ScalingType = 0
objValAxis.Precisions = 2
objValAxis.AutoRange = TRUE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ValueAxis" listing, for example, you write "objValueAx.Visible" instead of
"objValueAx.ValueAxisVisible".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

743

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
ValueAxis object (list) (Page 250)

GetValueAxisCollection method
Function
Returns the list of all value axis objects of the WinCC OnlineTrendControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetValueAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS344
Dim ctrl
Dim objTrendWnd
Dim objValAxis1
Dim objValAxis2
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objValAxis1 = ctrl.GetValueAxisCollection.AddItem("myValueAxis1")
Set objValAxis2 = ctrl.GetValueAxisCollection.AddItem("myValueAxis2")
objValAxis1.TrendWindow = objTrendWnd.Name
objValAxis1.Label = "Value1"

744

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

objValAxis2.TrendWindow = objTrendWnd.Name
objValAxis2.inTrendColor = TRUE
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend1")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.ValueAxis = objValAxis1.Name
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend2")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.ValueAxis = objValAxis2.Name

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ValueAxis" listing, for example, you write "objValueAxis1.Label" instead of
"objValueAxis1.ValueAxisLabel".

See also
ValueAxis object (list) (Page 250)

GetValueColumn method
Function
Returns the column object designated as name or index of the WinCC OnlineTableControl as
type "ICCAxValueColumn".

Syntax
Ausdruck.GetValueColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of value column of


OnlineTableControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

745

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS345
Dim ctrl
Dim objValueColumn
Set ctrl = ScreenItems("TableControl")
Set objValueColumn = ctrl.GetValueColumn("Valuecolumn1")
objValueColumn.Precisions = 4
Set objValueColumn = ctrl.GetValueColumn(2)
objValueColumn.ExponentialFormat = TRUE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ValueColumn" listing, for example, you write "objValueColumn.Precisions" instead
of "objValueColumn.ValueColumnPrecisions".

See also
ValueColumn object (list) (Page 250)

GetValueColumnCollection method
Function
Returns the list of all value column objects of the WinCC OnlineTableControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetValueColulmnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

746

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS346
Dim ctrl
Dim objValCol1
Dim objValCol2
Dim coll
Dim valcol
Set ctrl = ScreenItems("TableControl")
Set objValCol1 = ctrl.GetValueColumnCollection.AddItem("ValueColumn1")
Set objValCol2 = ctrl.GetValueColumnCollection.AddItem("ValueColumn2")
objValCol1.Caption = "Value Archive"
objValCol1.Provider = 1
objValCol1.TagName = "ProcessValueArchive\arch1"
objValCol1.TimeColumn = "TimeColumn1"
objValCol2.Caption = "Value Tag"
objValCol2.Provider = 2
objValCol2.TagName = "tagxx"
objValCol2.TimeColumn = "TimeColumn2"
Set coll = ctrl.GetValueColumnCollection
For Each valcol In coll
valcol.Align = 2
valcol.Length = 10
valcol.AutoPrecisions = TRUE
Next

See also
ValueColumn object (list) (Page 250)

GetXAxis method
Function
Returns the X axis object designated as name or index of the WinCC FunctionTrendControl
as type "ICCAxValueAxis".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

747

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Ausdruck.GetXAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of X axis.

Example

'VBS347
Dim ctrl
Dim objXAx
Set ctrl = ScreenItems("FunctionTrendControl")
Set objXAx = ctrl.GetXAxis(1)
objXAx.Visible = FALSE
Set objXAx = ctrl.GetXAxis("axis 2")
objXAx.Label = "X axis 2"
objXAx.ScalingType = 0
objXAx.Precisions = 2
objXAx.Color = RGB(109,109,109)

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "XAxis" listing, for example, you write "objXAx.Visible" instead of
"objXAx.XAxisVisible".

See also
XAxis object (list) (Page 251)

748

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

GetXAxisCollection method
Function
Returns the list of all X axis objects of the WinCC FunctionTrendControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetXAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS348
Dim ctrl
Dim objXAxis1
Dim objXAxis2
Dim coll
Dim axes
Set ctrl = ScreenItems("FunctionTrendControl")
Set objXAxis1 = ctrl.GetXAxisCollection.AddItem("myXAxis1")
objXAxis1.Label = "temperature"
Set objXAxis2 = ctrl.GetXAxisCollection.AddItem("myXAxis2")
objXAxis2.Label = "pressure"
Set coll = ctrl.GetXAxisCollection
HMIRuntime.Trace "Number of XAxis:" & coll.Count & vbCrLf
For Each axes In coll
HMIRuntime.Trace axes.Name & vbCrLf
HMIRuntime.Trace axes.Label & vbCrLf
Next

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

749

VBS for Creating Procedures and Actions


1.14 VBS Reference

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "XAxis" listing, for example, you write "objXAxis1.Label" instead of
"objXAxis1.XAxisLabel".

See also
XAxis object (list) (Page 251)

GetYAxis method
Function
Returns the Y axis object designated as name or index of the WinCC FunctionTrendControl
as type "ICCAxValueAxis".

Syntax
Ausdruck.GetYAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of Y axis.

Example

'VBS349
Dim ctrl
Dim objYAx
Set ctrl = ScreenItems("FunctionTrendControl")
Set objYAx = ctrl.GetYAxis(1)
objYAx.Visible = FALSE
Set objYAx = ctrl.GetYAxis("axis 2")
objYAx.Label = "Y axis 2"

750

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

objYAx.Align = 0
objYAx.Precisions = 3
objYAx.EndValue = 90.000
objYAx.BeginValue = 10.000

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "YAxis" listing, for example, you write "objYAx.Visible" instead of
"objYAx.YAxisVisible".

See also
YAxis object (list) (Page 252)

GetYAxisCollection method
Function
Returns the list of all Y axis objects of the WinCC FunctionTrendControl of type
"ICCAxCollection".

Syntax
Ausdruck.GetYAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

751

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example

'VBS350
Dim ctrl
Dim objYAxis1
Dim objYAxis2
Dim coll
Dim axes
Set ctrl = ScreenItems("FunctionTrendControl")
Set objYAxis1 = ctrl.GetXAxisCollection.AddItem("myYAxis1")
objYAxis1.Label = "temperature"
Set objYAxis2 = ctrl.GetXAxisCollection.AddItem("myYAxis2")
objYAxis2.Label = "pressure"
Set coll = ctrl.GetYAxisCollection
HMIRuntime.Trace "Number of YAxis:" & coll.Count & vbCrLf
For Each axes In coll
HMIRuntime.Trace axes.Name & vbCrLf
HMIRuntime.Trace axes.Label & vbCrLf
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "YAxis" listing, for example, you write "objYAxis1.Label" instead of
"objYAxis1.YAxisLabel".

See also
YAxis object (list) (Page 252)

1.14.5.4

Methods H to M

HideAlarm method
Function
Executes the "Hide messages" key function of the AlarmControl.

Syntax
Expression.HideAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

752

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
--

InsertData method
Function
Adds data to the called trend.

Syntax
Expression.InsertData(dblAxisX As Variant, dblAxisY As Variant)
Expression
Necessary. An expression which returns an object of the "Trend" type.

Parameters
Parameters

Description

dblAxisX

Value of X axis

dblAxisY

Value of Y axis

Example

'VBS300
Dim lngFactor
Dim dblAxisX
Dim dblAxisY
Dim objTrendControl
Dim objTrend
Set objTrendControl = ScreenItems("Control1")
Set objTrend = objTrendControl.GetTrend("Trend 1")
For lngFactor = -100 To 100
dblAxisX = CDbl(lngFactor * 0.02)
dblAxisY = CDbl(dblAxisX * dblAxisX + 2 * dblAxisX + 1)
objTrend.InsertData dblAxisX, dblAxisY
Next

Item Method
Function
Retrieves an object from a collection and enables access to it via Index.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

753

VBS for Creating Procedures and Actions


1.14 VBS Reference

Description of DataItem Object


Access uses the name under which the value was added to the list. Single access using an
index is not recommended since the index changes during adding or deleting of values.

syntax
Expression.Item()
Expression
Necessary. An expression which returns an object of the type "Screens", "Layers" (or "Tags").
Note
In the case of "Tags", restricted functional scope! The standard methods get_Count and
get_NewEnum are missing so that access via Index nor the counting of all tags is possible.

Parameters
VARIANT

Example:
The following example issues the names of all objects contained in the picture "NewPDL1":

'VBS99
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'The objects will be indicate by Item()
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(objScrItem.ObjectName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

See also
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Tags Object (List) (Page 155)

754

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Alarms object (list) (Page 126)
ProcessValues Object (List) (Page 140)

LockAlarm method
Function
Executes the "Lock Alarm" key function of the AlarmControl.

Syntax
Expression.LockAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

LoopInAlarm method
Function
Executes the "Loop in Alarm" key function of the AlarmControl.

Syntax
Expression.LoopInAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveAxis method
Function
Executes the "Move axis" key function of the OnlineTrendControl and FunctionTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

755

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Expression.MoveAxis()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveRuler
Function
Moves the ruler from a specified reference point by a specified distance.

Syntax
Expression.MoveRuler( RulerIndex As Long, RulerMoveRef As Long,
MoveDistance As Long, Optional vTrendWindow As Variant )
Expression
Required. An expression that returns an object of the "ScreenItem" type.

Parameter
Parameter

Description

RulerIndex

Specifies the ruler to move:


0 = Ruler
1 = Ruler at the start of the statistics area
2 = Ruler at the end of the statistics area

RulerMoveRef

Specifies the reference point as orientation for the third parameter "MoveDistance":
0 = Time axis start position
1 = Current ruler position
2 = Time axis end position

MoveDistance

Number of pixels by which the ruler is moved away from reference point "RulerMoveRef".

vTrendWindow

Optional parameter for handling several, independent trend windows.


Specifies the trend window in which the ruler is moved. The ruler moves in all trend windows
if this parameter is not specified.

Return value
Function that returns the new ruler position.

756

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example
Table 1-1

Move ruler left by 10 pixels

'VBS367
Sub OnClick(ByVal Item)
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
call ctrl.MoveRuler (0, 1, -10)
End Sub

In the example, the ruler is moved by -10 pixels, starting at reference point 1 (current ruler
position). The ruler is now positioned 10 pixels away from the left of its original position.

Example
Table 1-2

Move ruler right by 10 pixels

'VBS368
Sub OnClick(ByVal Item)
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
ctrl.MoveRuler 0, 1, 10
End Sub

In the example, the ruler is moved by 10 pixels, starting at reference point 1 (current ruler
position). The ruler is now positioned 10 pixels away from the right of its original position.

Example
Table 1-3

Move ruler to end on opening of the window

'VBS369
Sub OnOpen()
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
ctrl.MoveRuler 0, 2, 0
End Sub

In the example, the ruler is moved by 0 pixels, starting at reference point 2 (time axis end
position). The ruler is now positioned at the time axis end position.

Example
Table 1-4

Calculate current ruler position

'VBS370

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

757

VBS for Creating Procedures and Actions


1.14 VBS Reference

Sub OnClick(ByVal Item)


Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
Dim pos
pos = ctrl.MoveRuler (0, 1, 0)
HmiRuntime.Trace "RulerPosition=" & pos & vbCrLf
End Sub

In the example, the ruler is moved by 0 pixels, starting at reference point 1 (current ruler
position). The ruler remains in its original position. The ruler position is returned as value.

MoveToFirst method
Function
Executes the "First line" key function of the control.

Syntax
Expression.MoveToFirst()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToFirstLine method
Function
Executes the "First message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToFirstLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

758

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

MoveToFirstPage method
Function
Executes the "First page" key function of the AlarmControl.

Syntax
Ausdruck.MoveToFirstPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToLast method
Function
Executes the "Last data record" key function of the control.

Syntax
Ausdruck.MoveToLast()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToLastLine method
Function
Executes the "Last message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToLastLine()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

759

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToLastPage method
Function
Executes the "Last page" key function of the AlarmControl.

Syntax
Ausdruck.MoveToLastPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToNext method
Function
Executes the "Next data record" key function of the control.

Syntax
Ausdruck.MoveToNext()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

760

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

MoveToNextLine method
Function
Executes the "Next message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToNextLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToNextPage method
Function
Executes the "Next page" key function of the AlarmControl.

Syntax
Ausdruck.MoveToNextPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToPrevious method
Function
Executes the "Previous data record" key function of the control.

Syntax
Ausdruck.MoveToPrevious()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

761

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToPreviousLine method
Function
Executes the "Previous message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToPreviousLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

MoveToPreviousPage method
Function
Executes the "Previous page" key function of the AlarmControl.

syntax
Ausdruck.MoveToPreviousPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

762

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.5.5

Methods N to R

NextColumn method
Function
Executes the "Next column" key function of the OnlineTableControl.

Syntax
Ausdruck.NextColumn()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

NextTrend method
Function
Executes the "Next curve" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Ausdruck.NextTrend()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

OneToOneView method
Function
Executes the "Original view" key function of the OnlineTrendControl and FunctionTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

763

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Ausdruck.OneToOneView()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

PasteRows method
Function
Executes the "Paste Rows" key function of the UserArchiveControl.

Syntax
Expression.PasteRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

PreviousColumn method
Function
Executes the "Previous column" key function of the OnlineTableControl.

Syntax
Ausdruck.PreviousColumn()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

764

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

PreviousTrend method
Function
Executes the "Previous curve" key function of the OnlineTrendControl and
FunctionTrendControl.

Syntax
Ausdruck.PreviousTrend()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Print method
Function
Executes the "Print" key function of the control.

Syntax
Ausdruck.Print()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

QuitHorn method
Function
Executes the "Acknowledge central signaling devices" key function of the AlarmControl.

Syntax
Ausdruck.QuitHorn()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

765

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

QuitSelected method
Function
Executes the "Single acknowledgment" key function of the AlarmControl.

Syntax
Ausdruck.QuitSelected()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

QuitVisible method
Function
Executes the "Group acknowledgment" key function of the AlarmControl.

Syntax
Ausdruck.QuitVisible()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

766

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Read Method
Description of Tag Object
Reads out the status of a tag (tag object) shortly after the moment it was called. At the same
time, the tag object is provided with the values read. Upon reading a tag, its value, quality code
and time stamp are determined. The "LastError" property can be used to determine whether
the call was successful.
The "Name", "ServerPrefix" and "TagPrefix" properties are not changed as a result.
If the value of the tag is read successfully, the properties of the tag object are assigned the
following values:
Property

Assignment

Value

Tag values

Name

Tag name (unchanged)

QualityCode

Quality level

Timestamp

Current tag time stamp

LastError

ErrorDescription

""

If the value of the tag is not read successfully, the properties of the tag object are assigned
the following values:
Property

Allocation

Value

VT_Empty

Name

Tag name (unchanged)

QualityCode

Bad Out of Service

Timestamp

LastError

Read operation error codes

ErrorDescription

Error description on LastError

Note
A summary of possible Quality Codes may be found in WinCC Information System under key
word "Communication" > "Diagnostics" or "Communication" > "Quality Codes".

syntax
Expression.Read([Readmode])
Expression
Necessary. An expression which returns a tag object. The return value of the Read method is
the value of the tag read out.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

767

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
The optional "Readmode" parameter enables the distinction between two types of reading:
Parameters

Description

The tag value is read from the process image


(cache). 0 is the default value.

The value of a tag is read directly from AS or


channel (direct).

If the "Readmode" parameter is omitted, the value is read from the process image by default.
The return value of the Read method is the tag value read out as VARIANT.

Reading From the Process Image


When reading from the process image, the tag is logged on and, from that moment, polled
cyclically from the PLC. The login cycle is dependent on the configured trigger. The value is
read from the tag image by WinCC. For Close Picture, the tag actions are ended again. The
call is characterized by the following:
The value is read by WinCC from the tag image.
The call is faster in comparison to direct reading (except with the first call: The first call
basically takes longer because the value from the PLC must be read out and logged on.)
The duration of the call is not dependent on the bus load or AS.
Behavior in actions with a tag trigger
All of the tags contained in the tag trigger are already known with Open Picture and are
registered with the defined monitoring time. Since all tags are requested at once, the best
possible optimization can be targeted from the channel. If a tag, contained in the trigger, is
requested with Read during an action, the value already exists and is transferred directly to
the call. If a tag is requested which is not contained in the trigger, the behavior is the same as
with a standard trigger.
Behavior in actions with a cyclic trigger
tags are registered with half of the cycle time with the first call. For every other call, the value
is present.
Behavior in event-driven actions
The tag is registered in the "upon change" mode with the first call. Process tags that are
registered in the "upon change" mode correspond with a cyclic read job with a cycle time of
1s.
If an event (e.g. mouse click) requests a value asynchronously, the tag is transferred to the
tag image. The tag is requested cyclically from the AS as of this point in time and therefore
increases the basic load. To bypass this increase in the basic load, the value can also be read
synchronously. The synchronous call causes a one-off increase in the communication load
but the tag is not transferred to the tag image.

768

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Direct reading
In the case of direct reading, the current value is returned. The tag is not registered cyclically,
the value is requested from the AS one time only. Direct reading has the following properties:
The value is read explicitly from the AS.
The call takes longer compared to reading from the process image.
The duration of the call is dependent on the bus load and AS, amongst other things.

Example:
Reading a tag directly from AS or channel

'VBS100
Dim objTag
Dim vntValue
Set objTag = HMIRuntime.Tags("Tagname")
vntValue = objTag.Read(1)
'Read direct
MsgBox vntValue

Reading a tag from the process image

'VBS101
Dim objTag
Dim vntValue
Set objTag = HMIRuntime.Tags("Tagname")
vntValue = objTag.Read
'Read from cache
MsgBox vntValue

Description of TagSet Object


The TagSet object offers the option of reading several tags in one call.
Functionality here is mostly identical with that of a tag object. In the following, only deviations
thereof are described.
Expression
Necessary. An expression which returns an object of type "TagSet".

Reading From the Process Image


The TagSet object offers the advantage of requesting several tags in one read command. The
tags are registered in the process image as a group, improving performance in the process.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

769

VBS for Creating Procedures and Actions


1.14 VBS Reference

Direct reading
Since one call may process several read commands, performance is enhanced in comparison
to single calls.

Example:
The following example shows how tags are included in the TagSet list, how tag values are
imported and subsequently read.

'VBS174
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.Read
HMIRuntime.Trace "Motor1: " & group("Motor1").Value & vbNewLine
HMIRuntime.Trace "Motor2: " & group("Motor2").Value & vbNewLine

If the optional parameter "Readmode" is set to 1, the process tags are not registered but read
directly from AS or channel.

group.Read 1

See also
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
LastError Property (Page 445)
ErrorDescription Property (Page 398)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

Read Tags method


Function
Executes the "Read tags" key function of the UserArchiveControl.

Syntax
Ausdruck.ReadTags()

770

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Refresh Method
Function
Drawing all visible pictures again.

syntax
Expression.Refresh
Expression
Necessary. An expression which returns a "Screens" or "Screen" type object.

Parameters
--

Examples
The first example forces all visible pictures to be drawn again:

'VBS149
HMIRuntime.Screens.Refresh

The second example forces the basic picture to be immediately redrawn:

'VBS150
HMIRuntime.Screens(1).Refresh

See also
Screen Object (Page 146)
Screens Object (List) (Page 149)
HMIRuntime Object (Page 134)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

771

VBS for Creating Procedures and Actions


1.14 VBS Reference

Remove Method
Description of TagSet Object
Removes a tag from the TagSet list. The tag may be removed by name or reference to a tag
object.

syntax
Expression.Remove [Tag]
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
VARIANT
Parameters

Description

Tag

Name of a WinCC tag or reference to a tag object


to be removed from the list.

Example:
The following example shows how several tags are included in the TagSet list, and how to
remove a tag again.

'VBS175
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.Remove "Motor1"

Description of DataSet Object


Deletes the element specified in parameter "Name" from a list.

syntax
Expression.Remove [Name]
Expression
Necessary. An expression which returns an object of type "DataSet".

772

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
VARIANT
Parameters

Description

Name

Name of the object to be removed from the list.

Example:
The example shows how to remove the object "motor1" from the list.

'VBS166
HMIRuntime.DataSet.Remove("motor1")

Description of objects Logging, AlarmLogs, DataLogs


The method deletes a previously swapped archive segment from the Runtime project.
Archive segments deleted with the "Remove" method are removed from the common archiving
directory of the project.
The call may require a somewhat longer time period, depending on archive data. This may
block the processing of subsequent scripts. Blockage of actions within the picture may be
avoided if you start the call in a Global Scripting action, such as starting the action through a
triggering tag.
The archive separation and deletion creates a CPU load. This will affect performance.
Note
Calling up the "Remove" method is presently only possible at the server. There is an example,
however, which shows how the method may be started by the client from a server.
For redundancy, the following applies: Re-swapped archives are deleted with the "Remove"
method only on the computer from which the method was initiated.

syntax
Objects Logging, AlarmLogs
Expression.Remove [TimeFrom] [TimeTo] [TimeOut] [ServerPrefix]
Expression
Necessary. An expression which returns an object of type "Logging" or "AlarmLogs".

Object DataLogs
Expression.Remove [TimeFrom] [TimeTo] [TimeOut] [Type] [ServerPrefix]

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

773

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression which returns an object of type "DataLogs".

Parameters
TimeFrom
Point in time, from which the archives are to be deleted.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
TimeTo
Time up to which archive segments are to be deleted.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
Timeout
Timeout in milliseconds.
If you enter "-1" as a value, the wait will be infinite. If you enter a value of "0", there will be no
wait.
Type:
Type of archive.
The parameter can (optionally) be used only to delete archive segments of the tag logging.
The following values can be entered:
Assigned Value

Type

Description

hmiDataLogFast

Tag Logging Fast data

hmiDataLogSlow

Tag Logging Slow data

hmiDataLogAll

Tag Logging Fast and Slow data

ServerPrefix
Reserved for future versions.

Return value
If an error occurred during deletion of the archive segments, the method will return an error
message. Additional information may be found under the subject heading "Error Messages
from Database Area".

Time format
Time format is defined as follows: YYYY-MM-DD hh:mm:ss, where YYYY represents the year,
MM the month, DD the day, hh the hour, mm the minute and ss the second. For example, the
time of 2 minutes and one second past 11 o'clock on July 26, 2004 is displayed as follows:
2004-07-26 11:02:01.

774

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
For parameters "TimeFrom" and "TimeTo" the statement of data and time is also possible in
short form. Not all format fields must be filled in this case. The short form means that the
information on date and time may be lacking one or several parameters, beginning with the
value for seconds. For example, the statement may be in the form of "YYYY-MM" or "YYYYMM-DD hh". Using the statement "TimeFrom" = "2004-09" and "TimeTo" = "2004-10-04" all
archive segments between September 2004 up to and including October 4th are to be
swapped.

Example:
In the following example, archive segments re-swapped after the fact for a specified time period
may be removed and the return value may be output as Trace.

'VBS182
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Remove("2004-08-22","2004-09-22",-1) &
vbNewLine

In the following example, all archive segments re-swapped after the fact may be removed and
the return value may be output as Trace.

'VBS183
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Remove("","",-1) & vbNewLine

See also
Error Messages from Database Area (Page 804)
Example: How to Start an Action on the Server (Logging Object) (Page 818)
Logging Object (Page 138)
DataSet Object (List) (Page 132)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)
TagSet Object (List) (Page 156)

RemoveAll Method
Description of TagSet Object
Deletes all tags from a TagSet list.

syntax
Expression.RemoveAll

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

775

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
--

Example:
The following example shows how several tags are included in the TagSet list, and how to
remove all tags again.

'VBS176
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.RemoveAll

Description of DataSet Object


Deletes all values or object references from a DataSet list.

syntax
Expression.RemoveAll
Expression
Necessary. An expression which returns an object of type "DataSet".

Parameters
--

Example:
The example shows how all objects are removed from the list.

'VBS167
HMIRuntime.DataSet.RemoveAll

776

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
DataSet Object (List) (Page 132)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

RemoveData method
Function
Deletes the data of the called trend.

Syntax
Expression.RemoveData
Expression
Necessary. An expression which returns an object of the "Trend" type.

Example

'VBS310
Dim objTrendControl
Dim objTrend
Set objTrendControl = ScreenItems("Control1")
Set objTrend = objTrendControl.GetTrend("Trend 1")
objTrend.RemoveData

Restore Method
Description of objects Logging, AlarmLogs, DataLogs
The method adds swapped archive segments to the Runtime project.
Upon swapping, the archive segments are copied to the common archiving directory of the
project. Therefore, the appropriate storage capacity must be available.
The call may require a somewhat longer time period, depending on archive data. This may
block the processing of subsequent scripts. Blockage of actions within the picture may be
avoided if you start the call in a Global Scripting action, such as starting the action through a
triggering tag.
Linking / copying of the archives generates a CPU load because the SQL server experiences
additional load because of turned-on signature checking in particular. Copying of archive
segments will slow down hard disk access.
Upon turned-on signature checking, an error message is returned if an unsigned or modified
archive is to be swapped. There is always only one error message returned, even if several
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

777

VBS for Creating Procedures and Actions


1.14 VBS Reference
errors occurred during the swap process. Additionally, a WinCC system message is generated
for each archive segment. An entry is added to the Windows event log in the "Application"
section. This provides the opportunity to check which archive segments are creating the error.
With an unsigned archive, the return value "0x8004720F" is returned. The archive is stored.
The following text is entered in the event display:
"Validation of database <db_name> failed! No signature found!"
With an changed archive, the return value "0x80047207" is returned. The even screen, the
entry is "Validation of database <db_name> failed !".
The archive is not stored.
Note
Calling up the "Restore" method is presently only possible at the server. There is an
example, however, which shows how the method may be started by the client from a
server.
For redundancy, the following applies: Upon re-swapping of archives with the "Restore"
method, only archive segments are added to the Runtime project on the computer from
which the method was called.

Syntax
Objects Logging, AlarmLogs
Expression.Restore [SourcePath] [TimeFrom] [TimeTo] [TimeOut]
[ServerPrefix]
Expression
Required. An expression which returns an object of type "Logging" or "AlarmLogs".

Object DataLogs
Expression.Restore [SourcePath] [TimeFrom] [TimeTo] [TimeOut] [Type]
[ServerPrefix]
Expression
Required. An expression which returns an object of type "DataLogs".

Parameter
SourcePath
Path to archive data.
TimeFrom
Point in time, from which the archives are to be stored.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.

778

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
TimeTo
Time up to which archive segments are to be swapped.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
Timeout
Timeout in milliseconds.
If you enter "-1" as a value, the wait will be infinite. If you enter a value of "0", there will be no
wait.
Type
Type of archive.
The parameter can (optionally) be used only to store archive segments of the tag logging.
The following values can be entered:
Assigned Value

Type

Description

hmiDataLogFast

Tag Logging Fast data

hmiDataLogSlow

Tag Logging Slow data

hmiDataLogAll

Tag Logging Fast and Slow data

ServerPrefix
Reserved for future versions.

Return value
If an error occurred during swapping of archive segments, the method will return an error
message. Additional information may be found under the subject heading "Error Messages
from Database Area".

Time format
Time format is defined as follows: YYYY-MM-DD hh:mm:ss, where YYYY represents the year,
MM the month, DD the day, hh the hour, mm the minute and ss the second. For example, the
time of 2 minutes and one second past 11 o'clock on July 26, 2004 is displayed as follows:
2004-07-26 11:02:01.
For parameters "TimeFrom" and "TimeTo" the statement of data and time is also possible in
short form. Not all format fields must be filled in this case. The short form means that the
information on date and time may be lacking one or several parameters, beginning with the
value for seconds. For example, the statement may be in the form of "YYYY-MM" or "YYYYMM-DD hh". Using the statement "TimeFrom" = "2004-09" and "TimeTo" = "2004-10-04" all
archive segments between September 2004 up to and including October 4th are to be
swapped.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

779

VBS for Creating Procedures and Actions


1.14 VBS Reference

Example
In the following example, all archive segments since the specified time period are re-swapped,
and the return value is output as Trace.

'VBS184
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Restore("D:\Folder","2004-09-14","",-1) &
vbNewLine

In the following example, all Tag Logging Slow archive segments since the specified time
period are re-swapped, and the return value is output as Trace.

'VBS185
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.DataLogs.Restore("D:\Folder","2004-09-14
12:30:05","2004-09-20 18:30",-1,2) & vbNewLine

In the following example, all Alarm Logging archive segments up to the specified time period
are re-swapped, and the return value is output as Trace.

'VBS186
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.AlarmLogs.Restore("","2004-09-20",-1) &
vbNewLine

See also
Error Messages from Database Area (Page 804)
Example: How to Start an Action on the Server (Logging Object) (Page 818)
Logging Object (Page 138)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)

1.14.5.6

Methods S to T

SelectAll
Function
Selects all rows in the table-based control.

780

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Expression.SelectAll()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

See also
Row object (list) (Page 240)

SelectRow
Function
Selects a particular row in the table-based control.

Syntax
Expression.SelectRow(ByVal IRow As Long, Optional bExtendSelection
As Boolean)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Parameters

Description

IRow

Number of the row to be selected.

bExtendSelection

Indicates as an option whether the current selection will be extended. Is only


relevant if multiple selections are possible.

Example
Row 1 is currently selected. If SelectRow( 2, True ) is called, then row 1 and row 2 will be
selected.
Row 1 is currently selected. If SelectRow( 2, False ) or SelectRow( 2 ) is called without an
optional parameter, then only row 2 will be selected.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

781

VBS for Creating Procedures and Actions


1.14 VBS Reference

See also
Row object (list) (Page 240)

SelectedStatisticArea method
Function
Executes the "Set statistic area" key function of the OnlineTableControl.

Syntax
Ausdruck.SelectedStatisticArea()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ServerExport method
Function
Executes the "Export archive" key function of the UserArchiveControl.

Syntax
Ausdruck.ServerExport()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ServerImport method
Function
Executes the "Import archive" key function of the UserArchiveControl.

782

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Ausdruck.ServerImport()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowColumnSelection method
Function
Executes the "Select columns" key function of the OnlineTableControl.

Syntax
Ausdruck.ShowColumnSelection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowComment method
Function
Executes the "Comments dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowComment()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

783

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowDisplayOptionsDialog method
Function
Executes the "Display options dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowDisplayOptionsDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowEmergencyQuitDialog method
Function
Executes the "Emergency acknowledgment" key function of the AlarmControl.

Syntax
Ausdruck.ShowEmergencyQuitDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowHelp method
Function
Executes the "Help" key function of the control.

Syntax
Ausdruck.ShowHelp()

784

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

ShowHideList method
Function
Executes the "List of messages to be hidden" key function of the AlarmControl.

Syntax
Ausdruck.ShowHideList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowHitList method
Function
Executes the "Hitlist" key function of the AlarmControl.

Syntax
Ausdruck.ShowHitList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

785

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowInfoText method
Function
Executes the "Info text dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowInfoText()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowInsertValue method
Function
Executes the "Create archive value" key function of the OnlineTableControl.

Syntax
Expression.ShowInsertValue()
Expression
Required. An expression that returns an object of the "ScreenItem" type.

ShowLockDialog method
Function
Executes the "Lock dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowLockDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

786

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
--

ShowLockList method
Function
Executes the "Lock list" key function of the AlarmControl.

Syntax
Ausdruck.ShowLockList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowLongTermArchiveList method
Function
Executes the "Long-term archive list" key function of the AlarmControl.

Syntax
Ausdruck.ShowLongTermArchiveList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowMessageList method
Function
Executes the "Message list" key function of the AlarmControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

787

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Ausdruck.ShowMessageList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowPercentageAxis method
Function
Executes the "Relative axis" key function of the OnlineTrendControl.

Syntax
Ausdruck.ShowPercentageAxis()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowPropertyDialog method
Function
Executes the "Configuration dialog" key function of the control.

Syntax
Ausdruck.ShowPropertyDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

788

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowSelectArchive method
Function
Executes the "Select data connection" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSelectArchive()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowSelection method
Function
Executes the "Selection dialog" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSelection ()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowSelectTimeBase method
Function
Executes the "Time base dialog" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSelectTimeBase()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

789

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowSelectionDialog method
Function
Executes the "Selection dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowSelectionDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowShortTermArchiveList method
Function
Executes the "Short-term archive list" key function of the AlarmControl.

Syntax
Ausdruck.ShowShortTermArchiveList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

790

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowSort method
Function
Executes the "Sort dialog" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSort()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowSortDialog method
Function
Executes the "Sort dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowSortDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowTagSelection method
Function
Executes the "Select data connection" key function of the control.

Syntax
Ausdruck.ShowTagSelection()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

791

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowTimebaseDialog method
Function
Executes the "Time base dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowTimebaseDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ShowTimeSelection method
Function
Executes the "Select time range" key function of the control.

Syntax
Ausdruck.ShowTimeSelection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

792

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ShowTrendSelection method
Function
Executes the "Select trends" key function of the OnlineTrendControl and
FunctionTrendControl.

Syntax
Ausdruck.ShowTrendSelection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
-- -

StartStopUpdate method
Function
Executes the "Start" or "Stop" key function of the control.

Syntax
Ausdruck.StartStopUpdate()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Stop Method
Function
Terminates WinCC Runtime.

syntax
HMIRuntime.Stop

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

793

VBS for Creating Procedures and Actions


1.14 VBS Reference

Parameters
---

Example:
The following example terminates WinCC Runtime:

'VBS124
HMIRuntime.Stop

See also
HMIRuntime Object (Page 134)

Trace Method
Description
Displays messages in the diagnostics window.

syntax
HMIRuntime.Trace

Parameters
STRING

Example:
The following example writes a text in the diagnostics window:

'VBS103
HMIRuntime.Trace "Customized error message"

See also
HMIRuntime Object (Page 134)

794

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

1.14.5.7

Methods U to Z

UnhideAlarm method
Function
Executes the "Unhide alarm" key function of the AlarmControl.

Syntax
Ausdruck.UnhideAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

UnlockAlarm method
Function
Executes the "Unlock alarm" key function of the AlarmControl.

Syntax
Ausdruck.UnlockAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

UnselectAll
Function
Deselects all rows in the table-based control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

795

VBS for Creating Procedures and Actions


1.14 VBS Reference

Syntax
Expression.UnselectAll()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

See also
Row object (list) (Page 240)

UnselectRow
Function
Deselects a particular row in the table-based control.

Syntax
Expression.UnselectRow(ByVal IRow As Long)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Long
Parameters

Description

IRow

Number of the row to be selected.

See also
Row object (list) (Page 240)

Write Method
Description of Tag Object
Writes a value synchronously or asynchronously in a tag. The "LastError" property can be used
to determine whether the call was successful.

796

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference
If the value of the tag is set successfully, the properties of the tag object are assigned the
following values:
Property

Allocation

Value

Tag values set by the user (unchanged)

Name

Tag name (unchanged)

QualityCode

Bad Out of Service

Timestamp

LastError

ErrorDescription

""

If the value of the tag is not set successfully, the properties of the tag object are assigned the
following values:
Property

Allocation

Value

Tag values set by the user (unchanged)

Name

Tag name (unchanged)

QualityCode

Bad Out of Service

Timestamp

LastError

Write operation error codes

ErrorDescription

Error description on LastError

syntax
Expression.Write [Value],[Writemode]
Expression
Necessary. An expression which returns a tag object.

Parameters
The value to be written can be transferred directly to the method as a parameter. If the
parameter is not specified, the value in the "Value" property is used. The "Writemode" option
parameter can be used to select whether the tag value should be written synchronously or
asynchronously. If the "Writemode" parameter is not used, writing is performed asynchronously
as its default value.
During the writing process, no information is supplied on the status of the tags.
The "Value" property contains the value which was set before or during the writing operation,
therefore is may not correspond to the real current value of the tag. If the data on the tag should
be updated, use the Read method.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

797

VBS for Creating Procedures and Actions


1.14 VBS Reference
Parameters

Description

Value (optional)

The tag value is specified. The specified value


overwrites the value in the "Value" property in the
tag object.
The tag value is not specified. The tag receives the
current value from the "Value" property of the tag
object.

Writemode (optional)

0 or empty: The tag value is written


asynchronously. 0 is the default value.
1: The tag value is written synchronously.

On asynchronous writing, it is written immediately into the tag image. The user does not receive
any feedback if the value has been written in the programmable controller, too.
In the case of synchronous writing (direct to the PLC), the writing operation actually occurs
when the PLC is ready to operate. The use receives a check-back message if the writing
operation was not successful.

Example:
Asynchronous writing

'VBS104
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Value = 5
objTag.Write
MsgBox objTag.Value

or

'VBS105
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Write 5
MsgBox objTag.Value

Synchronous writing

'VBS106
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Value = 5
objTag.Write ,1
MsgBox objTag.Value

798

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

or

'VBS107
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Write 5, 1
MsgBox objTag.Value

Description of TagSet Object


The TagSet object offers the option of writing several tags in one call.
Functionality here is mostly identical with that of a tag object. In the following, only deviations
thereof are described.
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
In order to write different values, the "Value" property of individual tag objects must be set, and
write must be called thereafter without the "Value" parameter. Since the write commands are
grouped into one call, it results in improved performance compared to single calls.
In a TagSet object, it is not possible to pass on a value using the "Write" method. Individual
values must be set using the "Value" property of the individual tag objects.

Example:
The following example shows how tags are included in the TagSet list, how tag values are set
and subsequently written.

'VBS173
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Wert1"
group.Add "Wert2"
group("Wert1").Value = 3
group("Wert2").Value = 9
group.Write

If you set the optional parameter "Writemode" equal to 1, the process tags are written
synchronously (directly to AS).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

799

VBS for Creating Procedures and Actions


1.14 VBS Reference

group.Write 1

See also
LastError Property (Page 445)
ErrorDescription Property (Page 398)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

WriteTags method
Function
Executes the "Write tags" key function of the UserArchiveControl.

Syntax
Expression.WriteTags()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ZoomArea - Method
Function
Executes the "Zoom area" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Ausdruck.ZoomArea()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

800

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ZoomInOut - Method
Function
Executes the "Zoom +/-" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Ausdruck.ZoomInOut()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ZoomInOutTime method
Function
Executes the "Zoom time axis +/-" key function of the OnlineTrendControl.

Syntax
Ausdruck.ZoomInOutTime()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ZoomInOutValues - Method
Function
Executes the "Zoom value axis +/-" key function of the OnlineTrendControl.

Syntax
Ausdruck.ZoomInOutValues()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

801

VBS for Creating Procedures and Actions


1.14 VBS Reference
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ZoomInOutX method
Function
Executes the "Zoom X axis +/-" key function of the FunctionTrendControl.

Syntax
Ausdruck.ZoomInOutX()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

ZoomInOutY - Method
Function
Executes the "Zoom Y axis +/-" key function of the FunctionTrendControl.

Syntax
Ausdruck.ZoomInOutY()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

802

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.14 VBS Reference

ZoomMove method
Function
Executes the "Move trend area" key function of the OnlineTrendControl and
FunctionTrendControl.

Syntax
Ausdruck.ZoomMove()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

1.14.6

Appendix

1.14.6.1

Error Messages from Database Area

Introduction
Upon access to databases, a value is returned upon execution. Values in the range "0x8..."
represent an error message. Values not equal to "0x8..." represent a status message.
Status Messages
The following status messages are defined:
0x0

OK

0x1

Function did not find any errors in parameter supply and did not find any internal errors. The
following causes may result in this value.
When connecting databases:
- No archive could be found in the given time window.
- Archives were found in the given time window, but they were already connected.
When separating databases:
- No connected archives could be found in the given time window. No checks are performed
on whether or not archives are attached at all.

Error Messages
The following error messages are defined (n in English only):

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

803

VBS for Creating Procedures and Actions


1.14 VBS Reference
Error code

Error Message

0x80047200

WinCC is not activated

0x80047201

Invalid archive type

0x80047202

Invalid lower boundary

0x80047203

Invalid upper boundary

0x80047204

Path 'CommonArchiving' could not be created in the project path

0x80047205

Timeout, please retry

0x80047206

WinCC was deactivated

0x80047207

Wrong signification
At least one database had a invalid signature and has not been attached.

0x80047208

Database could not be attached

0x80047209

Copy to 'CommonArchiving' is not possible.

0x8004720A

Invalid syntax for database filename.

0x8004720B

No list of databases.

0x8004720C

Database already detached.

0x8004720D

Database could not be detached.

0x8004720F

Unsigned database attached.


At least one database without signature has been attached.

0x80047210

Path error :
- Path invalid,
- no *.MDF files found in specified path or
- no permission to specified path.

See also
Remove Method (Page 772)
Write Method (Page 796)
Read Method (Page 767)
Restore Method (Page 777)
Logging Object (Page 138)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)

804

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

1.15

Examples of VBScript

1.15.1

Examples of VBScript

Introduction
The following section contains application examples of VBS in WinCC. The "Examples in
WinCC" section contains examples of codes with which the WinCC Runtime environment can
be made dynamic. These examples have been conceived so that they can be assumed 1:1 in
the configuration.
The "General Examples" section contains examples with which to influence the Microsoft
environment. There is no guarantee nor support for the running capability of these examples.

See also
Examples in WinCC (Page 806)

1.15.2

Examples in WinCC

1.15.2.1

Examples in WinCC

Introduction
This section contains examples of using VBScript in WinCC with regard to the following topics:
Access to objects in the Graphics Designer (e.g. color or text change)
Set color of objects above RGB colors
Configuring language change
Deactivate Runtime
Start external program
Globally configure picture change (from Global Script)
Configuring Change Picture Via Property
Use trace for diagnostics output
Set value of a tag
Read value of a tag
Check the success of a read/write action into a tag
Asynchronously set value of a tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

805

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

See also
Example: Starting an external application (Page 837)
Example: Writing Object Properties (Page 816)
Example: How to Read Tag Values (Page 813)
Example: Writing tag values (Page 811)
Example: Configuring diagnostics output via Trace (Page 810)
Example: Configuring Change Picture Via Property (Page 810)
Example: Configuring change picture globally (Page 809)
Example: Deactivating Runtime (Page 809)
Example: How to Configure Language Changes (Page 808)
Example: Defining the color of objects (Page 808)
Example: Accessing objects in Graphics Designer (Page 807)

1.15.2.2

Example: Accessing objects in Graphics Designer

Introduction
Access can be made to all Graphic Designer objects using VBS WinCC in order to make the
graphic Runtime environment dynamic. Graphic objects can be made dynamic on operation
(e.g. clicking the mouse on a button), depending on a tag or cyclically (e.g. flashing).
The following examples illustrate how to change a graphic object following a mouse click.

Procedure
In the following example, the radius of a circle is set to 20 in Runtime per mouse click:

'VBS121
Dim objCircle
Set objCircle= ScreenItems("Circle1")
objCircle.Radius = 20

Note
The expression used in the example only applies to Graphics Designer. In the case of analog
actions in Global Script, address the objects using the HMIRuntime object.

See also
Examples in WinCC (Page 805)

806

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

1.15.2.3

Example: Defining the color of objects

Introduction
The colors of graphic objects are defined via RGB values (Red/Green/Blue). The color values
for graphic objects can be set or read out.

Procedure
The following example defines the fill color for "ScreenWindow1" to blue:

'VBS122
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.FillStyle = 131075
objScreen.FillColor = RGB(0, 0, 255)

See also
Examples in WinCC (Page 805)

1.15.2.4

Example: How to Configure Language Changes

Introduction
The Runtime language of WinCC can be changed using VBS. The most typical use is buttons
with the corresponding language codes which are placed on the start page of a project.
You specify the Runtime language in VBS by using a country code, e.g., 1031 for German Default, 1033 for English - USA etc. A summary of all country codes may be found in the Basics
of VBScript under the subject header "Regional Scheme ID (LCID) Diagram".

Procedure
Use the "Mouse click" event on a button to create a VBS action and enter the following action
code to switch the Runtime language to German:

'VBS123
HMIRuntime.Language = 1031

See also
Examples in WinCC (Page 805)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

807

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

1.15.2.5

Example: Deactivating Runtime

Introduction
It is possible to terminate WinCC Runtime with VBS, e.g. via a mouse click or in dependence
on tag values or other events, such as multiple faulty input of a password when starting
Runtime.

What to do
The following example terminates WinCC Runtime:

'VBS124
HMIRuntime.Stop

See also
Examples in WinCC (Page 805)

1.15.2.6

Example: Configuring change picture globally

Introduction
VBS can be used to initiate a global picture change and thus, for example, display a picture
from a server on a client in a distributed system. To do this, server's server prefix must precede
the target picture.

What to do
Configure the following code for a picture change to a button, for example:

'VBS125
HMIRuntime.BaseScreenName = "Serverprefix::New screen"

See also
Examples in WinCC (Page 805)

808

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

1.15.2.7

Example: Configuring Change Picture Via Property

Introduction
If partitioned pictures are used in the configuration, e.g. in a basic picture title and operating
bar for the user interface and an embedded picture window for the actual picture display,
configure a picture change using the properties of the picture window.
The property of the "ScreenName" picture window must be changed in order for the other
picture to appear. The action and picture window must be configured in the same picture.

What to do
In the following example, the "test.pdl" picture is displayed in the "ScreenWindow" picture
window when executing the action:

'VBS126
Dim objScrWindow
Set objScrWindow = ScreenItems("ScreenWindow")
objScrWindow.ScreenName = "test"

See also
Examples in WinCC (Page 805)

1.15.2.8

Example: Configuring diagnostics output via Trace

Introduction
If a GSC diagnostics window has been inserted in the picture, diagnostics output can be
displayed in the diagnostics window in Runtime using the Trace command.
GSC Diagnostics issues the Trace methods contained in the actions in the chronological
sequence they are called. This also applies to Trace instructions in procedures which are called
in actions. The targeted implementation of Trace instructions, e.g. for the output of tag values,
enables the progress of actions and the procedures called in them to be traced. The Trace
instructions are entered in the form "HMIRuntime.Trace(<Ausgabe>)".
The GSC Diagnostics displays trace output from C and VBS.

What to do
The following example writes a text in the diagnostics window:

'VBS127
HMIRuntime.Trace "Customized error message"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

809

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

See also
Examples in WinCC (Page 805)

1.15.2.9

Example: Writing tag values

Introduction
Using VBS, it is possible to write a tag value to the PLC, e.g. by clicking the mouse on a button
to specify setpoint values, or to set internal tag values to trigger other actions.
Various write variations are mentioned and explained below.

Simple writing
In the following example, a value is written to the "Tag1" tag:

'VBS128
HMIRuntime.Tags("Tag1").Write 6

This is the simplest form of writing since no object reference is generated.

Writing with object reference


In the following example, a local copy of the tag object is created and a value written to "Tag1":

'VBS129
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Write 7

Referencing offers the advantage of being able to work with the tag object before writing. The
tag value can be read, calculations executed and written again:

'VBS130
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
objTag.Value = objTag.Value + 1
objTag.Write

Synchronous writing
Normally, the value to be written is transferred to the tag management and processing of the
action resumed. In some cases, however, it must be ensured that the value has actually been
written before processing of the action can be resumed.

810

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript
This type of writing is realized by specifying the value 1 for the additional, optional parameters:

'VBS131
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Write 8.1

or

'VBS132
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Value = 8
objTag.Write ,1

Note
Please note that the call takes longer in comparison to the standard call. The duration is also
dependent on the channel and AS, amongst other things.
The type of writing complies to the SetTagXXXWait() call in C scripting.

Writing with status handling


In order to ensure that a value has been written successfully, it is necessary to execute an
error check or determine the status of the tag, after the writing process.
This is done by checking the value of the "LastError" property after writing. When the test
proves successful, i.e. the job has been placed successfully, the tag status is checked.
In the case of a write job, the current status from the process is not determined. To establish
this, it is necessary to read the tag. The value specified in the Quality Code property after the
read process provides an indication of the tag status and, if necessary, makes reference to a
failed AS connection.
In the following example, the "Tag1" tag is written. If an error occurs during writing, the error
value and error description appear in the Global Script diagnostics window. Finally, the Quality
Code is checked. If the Quality Code is no OK (0x80), it is displayed in the diagnostics window.

'VBS133
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Write 9
If 0 <> objTag.LastError Then
HMIRuntime.Trace "Error: " & objTag.LastError & vbCrLf & "ErrorDescription: " &
objTag.ErrorDescription & vbCrLf
Else
objTag.Read

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

811

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

If &H80 <> objTag.QualityCode Then


HMIRuntime.Trace "QualityCode: 0x" & Hex(objTag.QualityCode) & vbCrLf
End If
End If

Note
After writing a tag, the QualityCode property of the local tag object is set to "BAD Out of
Service" because it is not known which Quality Code manages the tag in the process.
The Quality Code cannot be written from VBS.

See also
Write Method (Page 796)
Examples in WinCC (Page 805)

1.15.2.10 Example: How to Read Tag Values


Introduction
VBS can be used to read and further process a tag value. This makes it possible, for example,
to click the mouse on a button to obtain information on the system status or to execute a
calculation.
Various read variations are mentioned and explained below.

Simple reading
In the following example, the value of "Tag1" is read and displayed in the Global Script
diagnostics window:

'VBS134
HMIRuntime.Trace "Value: " & HMIRuntime.Tags("Tag1").Read & vbCrLf

This is the simplest form of reading since no object reference is generated.

Reading with object reference


In the following example, a local copy of the tag object is created, the tag value read and
displayed in the Global Script diagnostics window:

'VBS135

812

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
HMIRuntime.Trace "Value: " & objTag.Read & vbCrLf

Referencing offers the advantage of being able to work with the tag object. The tag value can
be read, calculations executed and written again:

'VBS136
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
objTag.Value = objTag.Value + 1
objTag.Write

Using the Read method, process tags which have been read are added to the image, from
this moment on they cyclically requested from the AS. If the tag is already in the image, the
value contained in it is returned.
For Close Picture, the tag actions are ended again.
Note
If a tag is requested in a Global Script action, it remains registered throughout the enter
Runtime of WinCC.

Direct reading
Normally, the tag values are read from the tag image. In certain situations, however, it may be
necessary to read the value direct from the AS, e.g. to synchronize fast processes.
If the optional parameter is set to 1 for the read process, the tag is not logged in cyclically but
the value is requested once from the AS.

'VBS137
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
HMIRuntime.Trace "Value: " & objTag.Read(1) & vbCrLf

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

813

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Note
Please note that the call takes longer in comparison to the standard call. The duration is also
dependent on the channel and AS, amongst other things.
This type of call must be avoided in the case of cyclic C actions because this is the main
reason for performance problems.
This type of read process corresponds to GetTagXXXWait() call from C scripting.

Reading with status handling


In order to ensure that a value is valid, a check should be made following reading. This occurs
by the fact that the Quality Code is controlled.
In the following example, the "myWord" tag is read and the QualityCode then checked. When
the Quality Code does not correspond to OK (0x80) the LastError, ErrorDescription and
QualityCode properties are displayed in the Global Script diagnostics window.

'VBS138
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
If &H80 <> objTag.QualityCode Then
HMIRuntime.Trace "Error: " & objTag.LastError & vbCrLf & "ErrorDescription: " &
objTag.ErrorDescription & vbCrLf & "QualityCode: 0x" & Hex(objTag.QualityCode) & vbCrLf
Else
HMIRuntime.Trace "Value: " & objTag.Value & vbCrLf
End If

Note
If an error occurs during reading, QualityCode is set to BAD NON-SPECIFIC. Therefore, it is
sufficient to check the QualityCode following reading.

See also
Read Method (Page 767)
Examples in WinCC (Page 805)

814

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

1.15.2.11 Example: Writing Object Properties


Introduction
VBS enables access to the properties of all Graphics Designer picture objects. Properties can
be read out to be modified or changed during Runtime.
The following examples illustrate various forms of access.

Simple setting of a property


In the following example, the background color of the "Rectangle1" object contained in the
picture is set to red:

'VBS139
ScreenItems("Rectangle1").BackColor = RGB(255,0,0)
This is the simplest form of writing since no object reference is generated.

Note
If the work is completed without an object reference, only the standard properties are provided
in Intellisense.
The form of expression used in the example only applies to Graphics Designer. In the case
of analog actions in Global Script, address the objects using the HMIRuntime object.

Setting a property with object reference


In the following example, a reference is created to the "Rectangle1" object contained in the
picture and the background is set to red using the VBS standard function RGB():

'VBS140
Dim objRectangle
Set objRectangle = ScreenItems("Rectangle1")
objRectangle.BackColor = RGB(255,0,0)

Referencing is useful when several object properties must be changed. When using
Intellisense, this process then lists all the object properties.
Note
The form of expression used in the example only applies to Graphics Designer. In the case
of analog actions in Global Script, address the objects using the HMIRuntime object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

815

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Setting properties via the picture window


VBS in Graphics Designer offers two possibilities for picture transcending addressing:
via the Screen object of a picture window with "ScreenItems"
from the basic picture with "HMIRuntime.Screens"
Referencing via the picture window
In the following example, the color of a rectangle is changed in an subordinate picture window.
The script is executed in the picture "BaseScreen", in which the picture window
"ScreenWindow1" is located. The picture window displays a picture, which contains an object
of the type "Rectangle" with the name "Rectangle1".

'VBS199
Sub OnLButtonUp(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim objRectangle
Set objRectangle = ScreenItems("ScreenWindow1").Screen.ScreenItems("Rectangle1")
objRectangle.BackColor = RGB(255,0,0)
End Sub

Referencing from the basic picture


You can reference the picture with the object to be modified via HMIRuntime.Screens. The
specification of the picture is defined relative to the basic picture via the following access code:
[<Grundbildname>.]<Bildfenstername>[:<Bildname>]... .<Bildfenstername>[:<Bildname>]
In the following example, a reference is created to the "Screen2" object contained in the
"Rectangle1" picture and the background color is set to red.
The picture "Screen2", in this case, is in "Screen1". "Screen1" is displayed in the basic picture
"BaseScreen".

'VBS141
Dim objRectangle
Set objRectangle =
HMIRuntime.Screens("BaseScreen.ScreenWindow1:Screen1.ScreenWindow1:Screen2").ScreenItems("
Rectangle1")
objRectangle.BackColor = RGB(255,0,0)

It is not necessary to specify the picture name. It is possible to address a picture uniquely using
the picture window name. Therefore, it is sufficient to specify the name of the picture window,
as in the following example:

'VBS142
Dim objRectangle
Set objRectangle =
HMIRuntime.Screens("ScreenWindow1.ScreenWindow2").ScreenItems("Rectangle1")

816

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

objRectangle.BackColor = RGB(255,0,0)

This type of addressing enables objects in picture windows to be addressed in different


pictures. This is a particularly interesting aspect in respect of the picture module technique.

Make the property dynamic using the return value


Actions on properties can not only be triggered by events or cyclically but properties can also
be made dynamic directly via an action.
In the following example, the background color of an object is made dynamic via a return value.
The value transferred can come from the evaluation of events in the PLC, for example and
used for the graphic display of an operating status:

'VBS146
Function BackColor_Trigger(ByVal Item)
BackColor_Trigger = RGB(125,0,0)
End Function

Note
If you make an object property dynamic with a VBS action via the return value of a script, the
value of the object property is written only if it has changed in relation to the last script run.
It is not considered if the value had been changed from another location.
Therefore it is illegal to change properties which have been made dynamic by VBS action via
the return value from another location (e.g., other C scripts or VBS scripts).
if you do not observe this, wrong values can be the results.

See also
VBS Reference (Page 120)
Examples in WinCC (Page 805)

1.15.2.12 Example: How to Start an Action on the Server (Logging Object)


Introduction
In multi-user projects, the Logging object presently functions on the server only. The following
example shows how to start an action on the server from the client, and how to swap and
delete archive segments on client accordingly.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

817

VBS for Creating Procedures and Actions


1.15 Examples of VBScript
The example shows a global action started with a control tag. The contents of the control tag
determine whether the "Restore" method or the "Remove" method is called. At the end of the
action, the control tag is set to "0".
A query prevents the action from being started on client computers.
Path and time period are passed on by internal tags.
The path information may also contain a network release. Archive segments to be swapped
must therefore not be stored locally at the server. It must be warranted, though, that the server
may directly access the path.
Note
The example shows a delete suggestion and may be adjusted as needed.

What to do
1. Create the following internal tags with project-wide updating in the WinCC Explorer:
- StartLogging (unsigned 8 bit value)
- SourcePath (Text tag 8 bit character set)
- TimeFrom (Text tag 8 bit character set)
- TimeTo (Text tag 8 bit character set)
- RetVal (signed 32 bit value)
2. Create a global VBS action and enter the tag StartLogging as tag trigger with cycle "Upon
Change".
3. Copy the following script into the action

'VBS180
Dim StartLogging
Dim SourcePath
Dim TimeFrom
Dim TimeTo
Dim RetVal
'Exit when running on client
If (Left(HMIRuntime.ActiveProject.Path, 1) = "\") Then
Exit Function
End If
'read parameters
StartLogging = HMIRuntime.Tags("StartLogging").Read
SourcePath = HMIRuntime.Tags("SourcePath").Read(1)
TimeFrom = HMIRuntime.Tags("TimeFrom").Read(1)
TimeTo = HMIRuntime.Tags("TimeTo").Read(1)
'restore or remove depends on the parameter
If (StartLogging = 1) Then
RetVal = HMIRuntime.Logging.Restore(SourcePath, TimeFrom, TimeTo, -1)
HMIRuntime.Tags("RetVal").Write RetVal, 1
HMIRuntime.Tags("StartLogging").Write 0,1
Elseif (StartLogging = 2) Then
RetVal = HMIRuntime.Logging.Remove(TimeFrom, TimeTo, -1)
HMIRuntime.Tags("RetVal").Write RetVal, 1

818

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

HMIRuntime.Tags("StartLogging").Write 0,1
End If

The action may be started on a client with the following action, for example. Please note that
parameters must be written prior to setting the control tag.

'VBS181
'set parameters
HMIRuntime.Tags("SourcePath").Write "\\client_pc\temp",1
HMIRuntime.Tags("TimeFrom").Write "2004",1
HMIRuntime.Tags("TimeTo").Write "2004",1
'start action
HMIRuntime.Tags("StartLogging").Write 1.1

Note
Tags are predominantly written and read in "direct" mode. This will synchronize the
sequences. Since this deals with internal tags, this mode may be used without any further
concerns.

1.15.2.13 Dynamization of Controls


Example: Calling Methods of an ActiveX Control
Introduction
The following examples illustrate how to call methods and properties of an ActiveX control
which is embedded in a WinCC picture.

Example 1: WinCC FunctionTrendControl


This example fills "Trend 1" of the FuntionTrendControl "Control1" with values which describe
a parabola.
To dynamize a trend with VBS, in the configuration dialog of the control on the "Data
connection" tab under "Data supply" set "0 - None".

'VBS300
Dim lngFactor
Dim dblAxisX
Dim dblAxisY

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

819

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Dim objTrendControl
Dim objTrend
Set objTrendControl = ScreenItems("Control1")
Set objTrend = objTrendControl.GetTrend("Trend 1")
For lngFactor = -100 To 100
dblAxisX = CDbl(lngFactor * 0.02)
dblAxisY = CDbl(dblAxisX * dblAxisX + 2 * dblAxisX + 1)
objTrend.InsertData dblAxisX, dblAxisY
Next

Example 2: WinCC FunctionTrendControl with value supply via array


In this example, "Trend 1" of the FunctionTrendControl "Control1" is supplied with values stored
in arrays.
To dynamize a trend with VBS, in the configuration dialog of the control on the "Data
connection" tab under "Data supply" set "0 - None".

'VBS301
Dim lngIndex
Dim dblAxisX(100)
Dim dblAxisY(100)
Dim objTrendControl
Dim objTrend
Set objTrendControl = ScreenItems("Control1")
Set objTrend = objTrendControl.GetTrend("Trend 1")
For lngIndex = 0 To 100
dblAxisX(lngIndex) = CDbl(lngIndex * 0.8)
dblAxisY(lngIndex) = CDbl(lngIndex)
Next
objTrend.InsertData dblAxisX, dblAxisY

Example 3: WinCC FunctionTrendControl (before WinCC V7)


This example fills the FunctionTrendControl named "Control1" with values that describe a
parabola.

'VBS111
Dim lngFactor
Dim dblAxisX
Dim dblAxisY
Dim objTrendControl
Set objTrendControl = ScreenItems("Control1")
For lngFactor = -100 To 100
dblAxisX = CDbl(lngFactor * 0.02)
dblAxisY = CDbl(dblAxisX * dblAxisX + 2 * dblAxisX + 1)
objTrendControl.DataX = dblAxisX
objTrendControl.DataY = dblAxisY

820

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

objTrendControl.InsertData = True
Next

Example 4: WinCC FunctionTrendControl with value supply via array (before WinCC V7)
In this example, a FunctionTrendControl called "Control1" is supplied with 100 value pairs. In
order that the value pair can be transferred correctly, the transfer e.g. in "dblAxisXY" must not
occur directly but via an intermediate tag, e.g. "varTemp".

'VBS152
Dim lngIndex
Dim dblXY(1)
Dim dblAxisXY(100)
Dim varTemp
Dim objTrendControl
Set objTrendControl = ScreenItems("Control1")
For lngIndex = 0 To 100
dblXY(0) = CDbl(lngIndex * 0.8)
dblXY(1) = CDbl(lngIndex)
dblAxisXY(lngIndex) = dblXY
Next
varTemp = (dblAxisXY)
objTrendControl.DataXY = varTemp
objTrendControl.InsertData = True

Example 5: Microsoft Web Browser


This example controls MS Web Browser.

'VBS112
Dim objWebBrowser
Set objWebBrowser = ScreenItems("WebControl")
objWebBrowser.Navigate "http://www.siemens.de"
...
objWebBrowser.GoBack
...
objWebBrowser.GoForward
...
objWebBrowser.Refresh
...
objWebBrowser.GoHome
...
objWebBrowser.GoSearch
...
objWebBrowser.Stop
...

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

821

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Note
Insert the instructions, separated by stops, in self-defined procedures. Declaration and
assignments must always precede them.

See also
General examples for VBScript (Page 833)

Example: How to configure a user-defined toolbar button with a self-created selection dialog
Introduction
In the following example you create a user-defined toolbar button of an OnlineTrendControl.
On this toolbar button you configure a self-created selection dialog with which you can
optionally set one of two different time ranges of the OnlineTrendControl.

Requirement
The Graphics Designer is open.
An archive is created in the Tag Logging Editor.

Inserting and configuring WinCC OnlineTrendControl


1. Create a new process picture in the Graphics Designer.
2. Save the process picture under "OnlineTrend.pdl".
3. Insert a WinCC OnlineTrendControl into the process picture.
4. Select "Configuration dialog..." from the shortcut menu of the control.
The "Properties of WinCC OnlineTrendControl" dialog opens.
5. On the "Trend" tab under "Data connection" connect the trend to an archive tag.
6. On the "Toolbar" tab under "Button functions" create a new user-defined toolbar button with
object ID "1001" for the OnlineTrendControl.
7. Click on "Accept" to save the changes.
8. Click "OK" to close the dialog box.
9. Select "Properties" from the shortcut menu of the control.
The "Object properties" dialog box opens.
10.Enter "Control1" as the object name for the control.
11.In the Object Properties of "Control1" select the "Event" tab.

822

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript
12.On the "OnToolbarButtonClicked" object event, configure the VB script "Create VBS action
on "OnToolbarButtonClicked" event of user-defined toolbar button (VBS302)".
13.Close the "Object properties" dialog box.

Creating a process picture for the selection dialog


1. Create a new process picture in the Graphics Designer.
2. Save the process picture under "Selectiondialog.pdl".
3. Click the "Properties" button on the shortcut menu of the process picture.
The "Object properties" dialog box opens.
4. Under "Geometry", set value "200" for the "Picture width" and "Picture height" attributes.
5. Close the "Object properties" dialog box.
6. Insert two "Button" objects into the process picture.
7. Enter "Morning" or "Afternoon" as text for the button.

Dynamizing selection dialog button


1. In the Object Properties of the "Morning" button select the "Event" tab.
2. On the "Mouse-click" event, configure the VB script "Create VBS action on "Mouse-click"
event of "Morning" button (VBS303)".
3. Close the "Object properties" dialog box.
4. In the Object Properties of the "Afternoon" button select the "Event" tab.
5. On the "Mouse-click" event configure the VB script "Create VBS action on "Mouse-click"
event of "Afternoon" button (VBS304)".
6. Close the "Object properties" dialog box.

Inserting and configuring a picture window


1. Insert a "Picture window" object into the "OnlineTrend.pdl" process picture.
2. Select "Properties" from the shortcut menu of the picture window.
The "Object properties" dialog box opens.
3. Enter "PictureWindow1" as the object name for the picture window.
4. Under "Miscellaneous" set the "Display" attribute to "no".
5. Under "Miscellaneous", select the "Selectiondialog.pdl" process picture for the "Picture
name" attribute.
6. Close the "Object properties" dialog box.

Create VBS action on "OnToolbarButtonClicked" event of user-defined toolbar button (VBS302)

'VBS302

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

823

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

'Open selection window if Toolbarbutton with ID 1001 is pressed


If lId = 1001 Then
ScreenItems("PictureWindow1").Visible = True
End If

Create VBS action on "Mouse-click" event of "Morning" button (VBS303)

'VBS303
Dim obj
Set obj = Parent.Parent.ScreenItems("Control1")
'choose time axis, stop update, set begin time and time range
obj.TimeAxisName = "Time axis 1"
obj.TimeAxisActualize = False
obj.TimeAxisBeginTime = CStr(Date & " 4:00:00")
obj.TimeAxisTimeRangeBase = 3600000
obj.TimeAxisTimeRangeFactor = 8
'close the selection window
Parent.Visible = False

Create VBS action on "Mouse-click" event of "Afternoon" button (VBS304)

'VBS304
Dim obj
Set obj = Parent.Parent.ScreenItems("Control1")
'choose time axis, stop update, set begin time and time range
obj.TimeAxisName = "Time axis 1"
obj.TimeAxisActualize = False
obj.TimeAxisBeginTime = CStr(Date & " 12:00:00")
obj.TimeAxisTimeRangeBase = 3600000
obj.TimeAxisTimeRangeFactor = 8
'close the selection window
Parent.Visible = False

Example: How to add elements to an empty WinCC OnlineTrendControl


Introduction
In the following example you insert the Trend Window, Value Axis, Time Axis and Trends
elements into an empty WinCC OnlineTrendControl.

824

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Requirement
The Graphics Designer is open.
An archive is created in the Tag Logging Editor with three archive tags.

Inserting and configuring WinCC OnlineTrendControl


1. Create a new process picture in the Graphics Designer.
2. Insert a WinCC OnlineTrendControl into the process picture.
3. Select "Configuration dialog..." from the shortcut menu of the control.
The "Properties of WinCC OnlineTrendControl" dialog opens.
4. In the "Trends" area of the "Trends" tab delete the default trend window "Trend 1".
5. Click on "Accept" to save the changes.
6. Click "OK" to close the dialog box.
7. Select "Properties" from the shortcut menu of the control.
The "Object properties" dialog box opens.
8. Enter "Control1" as the object name for the control.
9. Close the "Object properties" dialog box.

Inserting and configuring a button


1. Insert a "Button" object into the process picture.
2. Enter "Paste elements" as text for the button.
3. Select "Properties" from the shortcut menu of the button.
The "Object properties" dialog box opens.
4. In the Object Properties of the button select the "Event" tab.
5. On the "Mouse-click" event configure the VB script "Create VBS action on "Mouse-click"
event of button (VBS305)".
6. Close the "Object properties" dialog box.

Create VBS action on "Mouse-click" event of button (VBS305)

'VBS305
Dim objTrendControl
Dim objTrendWindow
Dim objTimeAxis
Dim objValueAxis
Dim objTrend
'create reference to TrendControl
Set objTrendControl = ScreenItems("Control1")
'create reference to new window, time and value axis

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

825

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Set objTrendWindow =
objTrendControl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis =
objTrendControl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValueAxis =
objTrendControl.GetValueAxisCollection.AddItem("myValueAxis")
'assign time and value axis to the window
objTimeAxis.TrendWindow = objTrendWindow.Name
objValueAxis.TrendWindow = objTrendWindow.Name
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend1")
objTrend.Provider = 1
objTrend.TagName = "TestArchive\ArchivTag1"
objTrend.Color = RGB(255,0,0)
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend2")
objTrend.Provider = 1
objTrend.TagName = "TestArchive\ArchivTag2"
objTrend.Color = RGB(0,255,0)
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend3")
objTrend.Provider = 1
objTrend.TagName = "TestArchive\ArchivTag3"
objTrend.Color = RGB(0,0,255)
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name

Note
In the VB script, replace the archive used and the archive tags "Archive\ArchiveTagX" with
the names of the archive and archive tags that have been created.

Example: How to add a trend and a setpoint trend to an empty OnlineTrendControl.


Introduction
In the following example, you add a trend and a setpoint trend to an empty WinCC
OnlineTrendControl. The time axis and value axis are added for the trends in a trend window.

826

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Requirement
A "WinCC OnlineTrendControl" with the name "Control2" is inserted in the process picture
in the Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click",
for example, for the button, with a VBS action and the following script.

Example

'VBS352
Dim objTrendControl
Dim objTrendWindow
Dim objTimeAxis
Dim objValueAxis
Dim objTrend
'tags used to generate trend data
Dim dtCurrent
Dim dblCurrent
Dim lIndex
Dim vValues(360)
Dim vTimeStamps(360)
'create reference to TrendControl
Set objTrendControl = ScreenItems("Control2")
'---- reference trend ---'create reference to new window, time and value axis
Set objTrendWindow = objTrendControl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = objTrendControl.GetTimeAxisCollection.AddItem("myRefTimeAxis")
Set objValueAxis = objTrendControl.GetValueAxisCollection.AddItem("myRefValueAxis")
'assign time and value axis to the window
objTimeAxis.TrendWindow = objTrendWindow.Name
objTimeAxis.ShowDate = False
objValueAxis.TrendWindow = objTrendWindow.Name
'add trend and assign propertys
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myRefTrend")
objTrend.Provider = 0
objTrend.Color = RGB(0,0,0)
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
'generate values for reference trend
dtCurrent = CDate("23.11.2006 00:00:00")
For lIndex = 0 To 360
vValues(lIndex) = ( Sin(dblCurrent) * 60 ) + 60
vTimeStamps(lIndex) = dtCurrent
dblCurrent = dblCurrent + 0.105
dtCurrent = dtCurrent + CDate ("00:00:01")
Next

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

827

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

'insert data to the reference trend


objTrend.RemoveData
objTrend.InsertData vValues, vTimeStamps
'---- data trend ---'add time and value axis to the existing window
Set objTimeAxis = objTrendControl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValueAxis = objTrendControl.GetValueAxisCollection.AddItem("myValueAxis")
'assign time and value axis to the window
objTimeAxis.TrendWindow = objTrendWindow.Name
objTimeAxis.ShowDate = False
objValueAxis.TrendWindow = objTrendWindow.Name
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend")
objTrend.Provider = 0
objTrend.Color = RGB(255,200,0)
objTrend.Fill = True
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
'generate values for data trend
dtCurrent = CDate("23.11.2006 00:00:00")
For lIndex = 0 To 360
vValues(lIndex) = ( Sin(dblCurrent) * 60 ) + 60
vTimeStamps(lIndex) = dtCurrent
dblCurrent = dblCurrent + 0.106
dtCurrent = dtCurrent + CDate ("00:00:01")
Next
'insert values to the data trend
objTrend.RemoveData
objTrend.InsertData vValues, vTimeStamps

Result

828

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Example: How to add elements to a WinCC OnlineTrendControl


Introduction
In the following example, insert value columns with properties in an empty WinCC
OnlineTableControl and link the columns to archive tags.

Requirement
An archive is created in the "Tag Logging Editor" with three archive tags.
A "WinCC OnlineTableControl" with the name "Control2" is inserted in the process picture
in the Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click",
for example, for the button, with a VBS action and the following script.

Example

'VBS351
Dim objTableControl
Dim objTimeColumn
Dim objValueColumn
Dim objTrend
'create reference to TableControl and enable BackColor
Set objTableControl = ScreenItems("Control2")
objTableControl.UseColumnBackColor = True
'create reference to new TimeColumn and assign column length
Set objTimeColumn = objTableControl.GetTimeColumnCollection.AddItem("myRefTimeAxis")
objTimeColumn.Length = 20
'add new ValueColumn and assign propertys
Set objValueColumn = objTableControl.GetValueColumnCollection.AddItem("myValueTable1")
objValueColumn.Provider = 1
objValueColumn.TagName = "Process value archive\PDL_ZT_1"
objValueColumn.BackColor = RGB(255,255,255)
objValueColumn.TimeColumn = objTimeColumn.Name
'add new ValueColumn and assign propertys
Set objValueColumn = objTableControl.GetValueColumnCollection.AddItem("myValueTable2")
objValueColumn.Provider = 1
objValueColumn.TagName = "Process value archive\PDL_ZT_2"
objValueColumn.BackColor = RGB(0,255,255)
objValueColumn.TimeColumn = objTimeColumn.Name
'add new ValueColumn and assign propertys
Set objValueColumn = objTableControl.GetValueColumnCollection.AddItem("myValueTable3")
objValueColumn.Provider = 1
objValueColumn.TagName = "Process value archive\PDL_ZT_3"
objValueColumn.BackColor = RGB(255,255,0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

829

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

objValueColumn.TimeColumn = objTimeColumn.Name

Result

Example: Scripts for WinCC AlarmControl


Introduction
The following examples demonstrate the use of scripts for WinCC AlarmControl.

Requirement
You have already configured messages in the "Alarm Logging" editor.

Example 1: Setting filters


A filter with message number "2" is set, or reset if the filter has already been set. The status
is also output in the dialog window.

'VBS353
Dim objAlarmControl
'create reference to AlarmControl
Set objAlarmControl = ScreenItems("Control1")
'set / reset the filter and create a trace
If (objAlarmControl.MsgFilterSQL = "") Then
objAlarmControl.MsgFilterSQL = "MSGNR = 2"
HMIRuntime.Trace "MsgFilterSQL set to MSGNR = 2" & vbNewLine
Else
objAlarmControl.MsgFilterSQL = ""
HMIRuntime.Trace "no filter" & vbNewLine
End If

830

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Example 2: Adding a column to WinCC AlarmContol


The column "Message text" is added or removed if the column already exists. The status is
also output in the dialog window. The message block of the "Message text" column has the
object name "Text1".

'VBS354
'add this function to the declaration section
Function IsExistingMsgColumn( objAlarmControl, strName )
'this function checks if the MessageColumn exists
on error resume next
objAlarmControl.GetMessageColumn( strName )
If err.number = 0 Then
IsExistingMsgColumn = True
else
err.Clear
IsExistingMsgColumn = False
end if
End Function
'example code
Dim objAlarmControl
Dim colMsgColumn
'create reference to the alarm control
Set objAlarmControl = ScreenItems("Control1")
Set colMsgColumn = objAlarmControl.GetMessageColumnCollection
'add or remove the MsgColumn
If ( IsExistingMsgColumn(objAlarmControl, "Text1") ) Then
HMIRuntime.Trace "Remove MsgColumn" & vbNewLine
colMsgColumn.RemoveItem("Text1")
Else
HMIRuntime.Trace "Add MsgColumn" & vbNewLine
colMsgColumn.AddItem("Text1")
End If

Example 3: Output content of message window in dialog window

'VBS355
Dim objAlarmControl
Dim lIndex
Dim lCellIndex
'create reference to the alarm control
Set objAlarmControl = ScreenItems("Control1")
'enumerate and trace out row numbers
For lIndex = 1 To objAlarmControl.GetRowCollection.Count
HMIRuntime.trace "Row: " & (objAlarmControl.GetRow(lIndex).RowNumber) & " "
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To objAlarmControl.GetRow(lIndex).CellCount
HMIRuntime.trace objAlarmControl.GetMessageColumn(lCellIndex -1).Name & " "
HMIRuntime.trace objAlarmControl.GetRow(lIndex).CellText(lCellIndex) & " "
Next
HMIRuntime.trace vbNewLine

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

831

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Next

1.15.3

General Examples

1.15.3.1

General examples for VBScript

Introduction
This section contains examples of the general use of VBScript with regard to the following
topics:
Program data connection with VBS
To retrieve methods
Using the MS Automation Interface
Starting External Applications
Note
All objects supplied with the Windows Script Host (WSH) from Microsoft can be integrated in
their environment using the standard VBS method "CreateObject". However, there is no direct
access to the WSH object itself using VBS from WinCC.
Example 1: "FileSystemObject" object for working with the file system
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
Example 2: "WScript.Shell"-Object for working with the Windows environment

See also
Example: Configuring a Database Connection with VBS (Page 834)
Example: Starting an external application (Page 837)
Example: Using the MS Automation interface (Page 836)
Example: Calling Methods of an ActiveX Control (Page 819)

832

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

1.15.3.2

Example: Configuring a Database Connection with VBS

Introduction
The following examples describe the configuration of an Access database link via an ODBC
driver.
Example 1 writes a tag value from WinCC in an Access database.
Example 2 reads a value from the database and writes it in a WinCC tag.
The examples do not contain any handling faults.

Procedure, Example 1
1. Create the Access database with the WINCC_DATA table and columns (ID, TagValue) with
the ID as the Auto Value.
2. Set up the ODBC data source with the name "SampleDSN", reference to the above Access
database.
3. Programming.

Example 1

'VBS108
Dim objConnection
Dim strConnectionString
Dim lngValue
Dim strSQL
Dim objCommand
strConnectionString = "Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=;"
lngValue = HMIRuntime.Tags("Tag1").Read
strSQL = "INSERT INTO WINCC_DATA (TagValue) VALUES (" & lngValue & ");"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
With objCommand
.ActiveConnection = objConnection
.CommandText = strSQL
End With
objCommand.Execute
Set objCommand = Nothing
objConnection.Close
Set objConnection = Nothing

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

833

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Procedure, Example 2
1. Create the WinCC tag with the name dbValue.
2. Create Access database with WINCC_DATA table and ID, TagValue columns: ID, create
TagValue (ID as auto value).
3. Set up the ODBC data source with the name "SampleDSN", reference to the above Access
database.
4. Programming.

Example 2

'VBS108a
Dim objConnection
Dim objCommand
Dim objRecordset
Dim strConnectionString
Dim strSQL
Dim lngValue
Dim lngCount
strConnectionString = "Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=;"
strSQL = "select TagValue from WINCC_DATA where ID = 1"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objRecordset = CreateObject("ADODB.Recordset")
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = strSQL
Set objRecordset = objCommand.Execute
lngCount = objRecordset.Fields.Count
If (lngCount>0) Then
objRecordset.movefirst
lngValue = objRecordset.Fields(0).Value
HMIRuntime.Tags("dbValue").Write lngValue
Else
HMIRuntime.Trace "Selection returned no fields" & vbNewLine
End If
Set objCommand = Nothing
objConnection.Close
Set objRecordset = Nothing
Set objConnection = Nothing

There are several ways in which to define the ConnectionString for the connection depending
on the provider used:
Microsoft OLE DB provider for ODBC
Enables connections to any ODBC data source. The corresponding syntax is:

834

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

"[Provider=MSDASQL;]{DSN=name|FileDSN=filename};
[DATABASE=database;]UID=user; PWD=password"

Other Microsoft OLE DB Providers (e.g. MS Jet, MS SQL Server)


It is possible to work without DSN. The corresponding syntax is:

"[Provider=provider;]DRIVER=driver; SERVER=server;
DATABASE=database; UID=user; PWD=password"

See also
General examples for VBScript (Page 832)

1.15.3.3

Example: Using the MS Automation interface

Introduction
The following three examples illustrate how to use the MS Automation interface.

Example 1: MS Excel
In this example, an output value from an input field is written in an Excel table.

'VBS113
Dim objExcelApp
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Visible = True
'
'ExcelExample.xls is to create before executing this procedure.
'Replace <path> with the real path of the file ExcelExample.xls.
objExcelApp.Workbooks.Open "<path>\ExcelExample.xls"
objExcelApp.Cells(4, 3).Value = ScreenItems("IOField1").OutputValue
objExcelApp.ActiveWorkbook.Save
objExcelApp.Workbooks.Close
objExcelApp.Quit
Set objExcelApp = Nothing

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

835

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Example 2: MS Access
This example opens a report from MS Access.

'VBS114
Dim objAccessApp
Set objAccessApp = CreateObject("Access.Application")
objAccessApp.Visible = True
'
'DbSample.mdb and RPT_WINCC_DATA have to create before executing
'this procedure.
'Replace <path> with the real path of the database DbSample.mdb.
objAccessApp.OpenCurrentDatabase "<path>\DbSample.mdb", False
objAccessApp.DoCmd.OpenReport "RPT_WINCC_DATA", 2
objAccessApp.CloseCurrentDatabase
Set objAccessApp = Nothing

Example 3: MS Internet Explorer


This example opens the MS IE.

'VBS115
Dim objIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "http://www.siemens.de"
Do
Loop While objIE.Busy
objIE.Resizable = True
objIE.Width = 500
objIE.Height = 500
objIE.Left = 0
objIE.Top = 0
objIE.Visible = True

See also
General examples for VBScript (Page 832)

1.15.3.4

Example: Starting an external application

Introduction
The following two examples illustrate how to start an external application.

836

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS for Creating Procedures and Actions


1.15 Examples of VBScript

Example:

'VBS117
Dim objWshShell
Set objWshShell = CreateObject("Wscript.Shell")
objWshShell.Run "Notepad Example.txt", 1

See also
General examples for VBScript (Page 832)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

837

VBS for Creating Procedures and Actions


1.16 Basic Principles of VBScript

1.16

Basic Principles of VBScript

1.16.1

Basic Principles of VBScript

Introduction
The most important topics of the Microsoft VBScript Reference are provided below:
VBScript Language Directory
VBScript Tutorial with the most important basic principles
Scripting runtime reference
If a full version of the VBScript Reference is required, it is available under
http://msdn2.microsoft.com/en-us/library/t0aew7h6 (http://msdn2.microsoft.com/en-us/library/
t0aew7h6)

See also
Microsoft VBScript Reference (http://msdn2.microsoft.com/en-us/library/t0aew7h6)

1.16.2

838

VBScript Basics

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.1

VBS Reference

VBS object model in WinCC


The WinCC object model of the graphic Runtime system enables access to graphic objects
and tags in Runtime.
When you click on an object name, you are shown a detailed description.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

839

VBS Reference
2.1 VBS Reference

$FWLYH3URMHFW
7DJV

7DJ6HW

7DJ

7DJ

+0,5XQWLPH

$FWLYH6FUHHQ

6FUHHQV
6FUHHQ

$FWLYH6FUHHQ,WHP
6FUHHQ,WHPV
6FUHHQ,WHP
/D\HUV
/D\HU
'DWD6HW
'DWD,WHP

/RJJLQJ

'DWDORJV
$ODUPORJV

$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

Object and List


Object
Property provided by an object

The VBS object model in a faceplate type


The VBS object model is not valid for WinCC in a Faceplate type. It is replaced by a completely
new model.

840

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.1 VBS Reference
The VBS object model of the Faceplate type provides you with access to the graphic objects
and Faceplate tags of the Faceplate type in Runtime.

Objects
Objects and lists are provided for access to all the objects in the graphic Runtime systems:
Graphic objects, pictures, layers and tags.

Properties
The properties of the individual objects can be used to modify specific graphic objects and
tags in Runtime , e.g. activating an operating element per mouse click or triggering a color
change by modifying a tag value.

Methods
Methods, which are applied to individual objects, can be used to read tag values for further
processing or display diagnostics messages in Runtime.

See also
ActiveScreen Property (Page 305)
Object types of the ScreenItem object (Page 158)
Methods (Page 694)
Properties (Page 303)
Objects and Lists (Page 123)
AlarmLogs Object (Page 128)
DataItem Object (Page 129)
DataLogs Object (Page 130)
DataSet Object (List) (Page 132)
HMIRuntime Object (Page 134)
Layer Object (Page 136)
Layers Object (Listing) (Page 137)
ScreenItem Object (Page 141)
ScreenItems Object (List) (Page 144)
Screen Object (Page 146)
Screens Object (List) (Page 149)
Tag Object (Page 152)
Tags Object (List) (Page 155)
TagSet Object (List) (Page 156)
ActiveProject Property (Page 305)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

841

VBS Reference
2.1 VBS Reference
ActiveScreenItem Property (Page 306)
Logging Object (Page 138)
Alarm object (Page 126)
Alarms object (list) (Page 126)
ProcessValue Object (Page 139)
ProcessValues Object (List) (Page 140)

842

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

2.2

Objects and Lists

2.2.1

Objects and Lists

Overview
The objects and lists provided in WinCC object models enables access to graphic objects and
tags in Runtime.

Navigation in Object Models


Access is made to objects in the VBS object model in hierarchical sequence. If, for example,
a picture element is accessed within a picture, access is made to the picture element in the
picture via its parent object (the surrounding picture).
Example:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

843

VBS Reference
2.2 Objects and Lists
Only the basic picture name is issued in this example.

Access to Graphic Objects


In WinCC, access is made to pictures, layers and graphic objects in Runtime using the
superordinate "HMIRuntime" object. Access to objects and layers is always made via the
picture (screen) in which they are contained.

Access to Tags
In WinCC, tags are accessed directly in Runtime using the superordinate "HMIRuntime" object.
Tag values can be read out or set anew.

Lists
Lists of WinCC object models behave in the same way as standard collections of VBS.
Exception: The "Tags" list has no Enum function.

Available Objects
Alarm
Alarms
AlarmLogs
DataItem
DataLogs
DataSet
HMIRuntime
Item
Layer
Layers
Logging
ProcessValues
ProcessValue
Project
ScreenItem
ScreenItems
Screen
Screens
Tag

844

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists
Tags
TagSet

See also
ScreenItems Object (List) (Page 144)
TagSet Object (List) (Page 156)
Tags Object (List) (Page 155)
Tag Object (Page 152)
Screens Object (List) (Page 149)
Screen Object (Page 146)
ScreenItem Object (Page 141)
Layers Object (Listing) (Page 137)
Layer Object (Page 136)
Item Object (Page 135)
HMIRuntime Object (Page 134)

2.2.2

Alarm object

Description
+0,5XQWLPH

$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

The alarm object is used to access the Alarms object list.


Note
The properties of the alarm object are not automatically updated when the values of the
properties change.

See also
Alarms object (list) (Page 126)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

845

VBS Reference
2.2 Objects and Lists

2.2.3

Alarms object (list)

Description
+0,5XQWLPH

$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

Use the alarm object to trigger existing messages.

Usage
Using the "Alarms" list you can:
Access a message in the list (Item method)
Create a new alarm object (Create method)
Read the alarm ID of the message (AlarmID attribute)
Read the status of a message (State property)
Read the time stamp of the message (Timestamp property)
Generate an instance of the alarm object (Instance property)
Read the name of the computer on which the message came (ComputerName property)
Read or set the name of the user who triggered the message (UserName property)
Read or set the name of the process value blocks (ProcessValues property)
Read or set the message commentary (Comment property)
Read or set the message server prefix (Context property)

Example
In the following example, the message with the alarm number "1" configured in the Alarm
Logging Editor will be triggered:

'VBS360
Dim MyAlarm
Set MyAlarm = HMIRuntime.Alarms(1)
MyAlarm.State = 5 'hmiAlarmStateCome + hmiAlarmStateComment
MyAlarm.Comment = "MyComment"
MyAlarm.UserName = "Hans-Peter"
MyAlarm.ProcessValues(1) = "Process Value 1"
MyAlarm.ProcessValues(4) = "Process Value 4"
MyAlarm.Create "MyApplication"

846

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

See also
TimeStamp Property (Page 608)
ComputerName property (Page 378)
Context property (Page 379)
State property (Page 573)
AlarmID property (Page 309)
Instance property (Page 441)
Comment property (Page 377)
UserName property (Page 661)
ProcessValue property (Page 531)
Alarm object (Page 126)
ProcessValues Object (List) (Page 140)
Create method (Page 700)
Item Method (Page 753)

2.2.4

AlarmLogs Object

Description
/RJJLQJ

$ODUPORJV
'DWDORJV

Using the object, swapped archive segments of Alarm Logging may be reconnected to
Runtime, or previously swapped archive segments of Alarm Logging may be deleted again.
Therein
Archive segments to be swapped are copied to the common archiving directory of the
WinCC project, or
previously swapped archive segments are deleted in the common archiving directory.
Using parameters you may control from where archive segments are to be swapped. You may
also specify the time period over which archive segments are to be swapped or deleted. Archive
segments are copied to the common archiving directory of the project.
If an error occurred during the operation with archiving segments, the method used returns an
error message. Additional information may be found under the subject heading "Error
Messages from Database Area".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

847

VBS Reference
2.2 Objects and Lists

Usage
Previously swapped archive segments of Alarm Logging may be connected with Runtime
("Restore" method).
Previously swapped archive segments of Alarm Logging may be deleted from the Runtime
project ("Remove" method).

Example:
In the following example, archive segments from Alarm Logging are swapped and the return
value is output as Trace.

'VBS187
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.AlarmLogs.Restore("D:
\Folder","2004-09-14","2004-09-20",-1) & vbNewLine

See also
Error Messages from Database Area (Page 803)
Restore Method (Page 777)
Remove Method (Page 772)
DataLogs Object (Page 130)
Logging Object (Page 138)

2.2.5

DataItem Object

Description
+0,5XQWLPH

'DWD6HW
'DWD,WHP
6FUHHQV

'DWD6HW

6FUHHQ

'DWD,WHP

The DataItem object is used to access the contents of the DataSet list. Values or object
references are stored in the list as DataItem.

848

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists
Access uses the name under which the value was added to the list. Single access using an
index is not recommended since the index changes during adding or deleting of values. The
index may be used to output the complete contents of the list. The output is in alphabetical
order.
Note
For object references it must be ascertained that objects are multiread-enabled.

Example:
The example shows how the value of 'Motor1' is output as Trace.

'VBS163
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine

The following example enumerates all DataItem objects of the DataSet list. Name and value
are output as Trace.

'VBS164
Dim data
For Each data In HMIRuntime.DataSet
HMIRuntime.Trace data.Name & ": " & data.Value & vbNewLine
Next

Note
For objects, value may possibly not be output directly

See also
Screen Object (Page 146)
HMIRuntime Object (Page 134)
DataSet Object (List) (Page 132)
Value Property (Page 665)
Name Property (Page 495)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

849

VBS Reference
2.2 Objects and Lists

2.2.6

DataLogs Object

Description
/RJJLQJ

$ODUPORJV
'DWDORJV

Using the object, swapped archive segments of Tag Logging may be reconnected to Runtime,
or previously swapped archive segments of Tag Logging may be deleted again. Therein
Archive segments to be swapped are copied to the common archiving directory of the
WinCC project, or
previously swapped archive segments are deleted in the common archiving directory.
Using parameters you may control from where archive segments are to be swapped. You may
also specify the time period over which archive segments are to be swapped or deleted. In
addition, you may set the archive type ("Tag Logging Fast", "Tag Logging Slow", "Tag Logging
Fast and Tag Logging Slow"). Archive segments are copied to the common archiving directory
of the project.
If an error occurred during the operation with archiving segments, the method used returns an
error message. Additional information may be found under the subject heading "Error
Messages from Database Area".

Usage
Previously swapped archive segments of Tag Logging may be connected with Runtime
("Restore" method).
Previously swapped archive segments of Tag Logging may be deleted from the Runtime
project ("Remove" method).

Example:
In the following example, fast archive segments from Tag Logging are swapped and the return
value is output as Trace.

'VBS188
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.DataLogs.Restore("D:
\Folder","2004-09-14","2004-09-20",-1,1) & vbNewLine

See also
Error Messages from Database Area (Page 803)
Restore Method (Page 777)
Remove Method (Page 772)

850

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists
AlarmLogs Object (Page 128)
Logging Object (Page 138)

2.2.7

DataSet Object (List)

Description
+0,5XQWLPH

'DWD6HW
'DWD,WHP
6FUHHQV

'DWD6HW

6FUHHQ

'DWD,WHP

Using the DataSet object, data may be exchanged across several actions.
A DataSet object is global and defined by the Screen object. Any VBS action may access the
data.
The DataSet object at the Screen object must be addressed according to picture hierarchy
and shall persist as long as the picture is displayed. The global object persists over the entire
Runtime time period.
Access uses the DataItem object.
Note
Objects of type Screen, Screens, ScreenItem, ScreenItems, Tag and TagSet cannot be
included in the DataSet list.
The DataSet object does not support any classes.

Usage
Using the "DataSet" list, you may:
Output or process (enumerate) all objects in the list.
Output the number of elements contained ("Count" property).
To process a specific object in the list ("Item" method).
Add an object to the list ("Add" method).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

851

VBS Reference
2.2 Objects and Lists
Remove a specific object from the list ("Remove" method).
Remove all objects from the list ("RemoveAll" method).
Access to list elements uses:

HMIRuntime.DataSet("Itemname")

For a picture-specific list, access uses:

HMIRuntime.Screens("Screenname").DataSet("Itemname")

In a picture, you may access the DataSet object of the picture by using:

DataSet("Itemname")

If upon access the stated name does not exist in the list, VT_Empty is returned and an
Exception is triggered.

Example:
The example shows how to add a value to the list, how to read it and remove it. It make sense
to perform this in several different actions.

'VBS162
HMIRuntime.DataSet.Add "motor1", 23
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine
HMIRuntime.DataSet.Remove("motor1")

See also
DataItem Object (Page 129)
RemoveAll Method (Page 775)
Remove Method (Page 772)
Item Method (Page 753)
Count Property (Page 380)
Add Method (Page 697)

852

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

2.2.8

HMIRuntime Object

Description
+0,5XQWLPH

$FWLYH3URMHFW
7DJV
7DJ
$FWLYH6FUHHQ
6FUHHQV
6FUHHQ
/RJJLQJ
$ODUPV
$ODUP
The HMIRuntime object represents the graphic Runtime environment.

Usage
The "HMIRuntime" object can be used for the following, for example:
Read or set the current Runtime language ("Language" property).
Read or set the name of the current base picture ("BaseScreenName" property).
Read the path of the active Runtime project ("ActiveProject" property).
Access tags ("Tags" property).
Access tags of a list ("DataSet" property).
Exit Runtime ("Stop" method).
Display messages in a diagnostics window ("Trace" method).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

853

VBS Reference
2.2 Objects and Lists

Example:
The following command terminates WinCC Runtime:

'VBS3
HMIRuntime.Stop

See also
Screens Object (List) (Page 149)
TagSet Object (List) (Page 156)
Tags Object (List) (Page 155)
Logging Object (Page 138)
DataSet Object (List) (Page 132)
Visible Property (Page 680)
Trace Method (Page 794)
Tags Property (Page 582)
Stop Method (Page 793)
AlignmentLeft Property (Page 311)
Logging Property (Page 470)
Language Property (Page 445)
DataSet Property (Page 385)
CurrentContext Property (Page 381)
BaseScreenName Property (Page 330)
ActiveProject Property (Page 305)
ActiveScreen Property (Page 305)
MenuToolBarConfig Property (Page 481)
Alarms object (list) (Page 126)

2.2.9

Item Object

Description
The "Item" object provides a reference to the current object.

854

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

Usage
The "Item" object is used, for example, to address the properties of the object currently selected
in Graphics Designer.

Example:
In the following example, a rectangle has been created. When the object has been selected,
all the properties of the current object can be set a background color red:

'VBS195
Item.BackColor = RGB(255,0,0)

See also
Objects and Lists (Page 123)

2.2.10

Layer Object

Description
6FUHHQV
6FUHHQ

/D\HUV
/D\HU
The layer object returns the result of access to the layers list.

Parent Object
Picture, in which the picture layer is.

Usage
Depending on certain events, the Layer object can be used to obtain access to the properties
of a complete layer in order, for example, to hide or unhide a layer with operating elements
according to the operator authorization.
The "Layer" object can be used to:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

855

VBS Reference
2.2 Objects and Lists
To activate or deactivate the visualization of a layer ("Visible" property).
To read out the name of a layer ("Name" property).
Note
The layer property specifies the layer in which the object is located. The layer "0" is output
as "Layer0".
When accessed, the layers are counted up from 1 in VBS. Therefore, the layer "1" must
be addressed with "layers(2)".

Example:
In the following example, Layer 1 is set invisible:

'VBS4
Layers(2).Visible = vbFalse

See also
Layer Object (Page 136)
Visible Property (Page 680)
Parent Property (Page 514)
Name Property (Page 495)

2.2.11

Layers Object (Listing)

Description
6FUHHQV
6FUHHQ

/D\HUV
/D\HU
The Layers list enables access to all 32 layers of the graphical Runtime system.

Parent Object
Picture, in which the picture layer is.

856

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

Usage
The "Layers" list can be used to:
Process all layers in the list ("_NewEnum" property).
Count all layers contained in the list ("Count" property).
Process a layer from the list ("Item" method).
The properties represent default properties and methods of a list and are not described in detail
in the WinCC documentation.

See also
Parent Property (Page 514)
Item Method (Page 753)
Count Property (Page 380)
Layer Object (Page 136)

2.2.12

Logging Object

Description
+0,5XQWLPH

/RJJLQJ

$ODUPORJV
'DWDORJV

Using the object, swapped archive segments may be reconnected to Runtime, or previously
swapped archive segments may be deleted again. Therein
Archive segments to be swapped are copied to the common archiving directory of the
WinCC project, or
previously swapped archive segments are deleted in the common archiving directory.
Using parameters you may control from where archive segments are to be swapped. You may
also specify the time period over which archive segments are to be swapped or deleted. Archive
segments are copied to the common archiving directory of the project.
If an error occurred during the operation with archiving segments, the method used returns an
error message. Additional information may be found under the subject heading "Error
Messages from Database Area".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

857

VBS Reference
2.2 Objects and Lists

Usage
Previously swapped archive segments of Alarm Logging and Tag Logging may be connected
with Runtime ("Restore" method).
Previously swapped archive segments of Alarm Logging and Tag Logging may be deleted
from the Runtime project ("Remove" method).

Example:
In the following example, archive segments from Alarm Logging and Tag Logging are swapped
and the return value is output as Trace.

'VBS189
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Restore("D:
\Folder","2004-09-14","2004-09-20",-1) & vbNewLine

See also
Error Messages from Database Area (Page 803)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)
Restore Method (Page 777)
Remove Method (Page 772)
DataLogs Property (Page 385)
AlarmLogs Property (Page 310)

2.2.13

ProcessValue Object

Description
$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

The ProcessValue object is used to access the ProcessValues object list.


Note
Only the 10 predefined ProcessValues are supported.

858

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

See also
ProcessValues Object (List) (Page 140)

2.2.14

ProcessValues Object (List)

Description
$ODUPV

3URFHVV9DOXHV

$ODUP

3URFHVV9DOXH

Usage
Using the "ProcessValues" list, you can:
Edit a ProcessValue from the list ("Item" method)
Display or edit all the objects in the list (_NewEnum attribute)
Count all ProcessValues contained in the list (Count property)
Read or set the values of the ProcessValue object (Value property)
The properties represent default properties and methods of a list and are not described in detail
in the WinCC documentation.

See also
Alarms object (list) (Page 126)
ProcessValue Object (Page 139)
Count Property (Page 380)
Value Property (Page 665)
Item Method (Page 753)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

859

VBS Reference
2.2 Objects and Lists

2.2.15

Project Object

Description
+0,5XQWLPH

$FWLYH3URMHFW
Using the object, information may be requested from the current Runtime project.
The project object is returned as the result of ActiveProject.

Usage
Using the "Project" object, you may:
Read the path of the current Runtime project ("Path" property).
Read the name of the current Runtime project, without path or file extension ("Name"
property).

Example:
The following example returns name and path of the current Runtime project as Trace:

'VBS159
HMIRuntime.Trace "Name: " & HMIRuntime.ActiveProject.Name & vbNewLine
HMIRuntime.Trace "Path: " & HMIRuntime.ActiveProject.Path & vbNewLine

See also
ActiveProject Property (Page 305)
Name Property (Page 495)
Path Property (Page 516)

860

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

2.2.16

ScreenItem Object

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
The ScreenItem object returns the result of access to the ScreenItem list.

Parent Object
Picture containing the picture element.

Usage
The ScreenItem object can be used to access the properties of graphic objects within a picture
according to certain events.
The "ScreenItem" object can be used for the following, for example:
To activate or deactivate the visualization of an object ("Visible" property).
To release or block the operation of an object ("Enabled" property).
Change the width and height of an object ("Height" and "Width" properties).
Change the position of an object ("Top" and "Left" properties).
Read and define a layer in which a graphic object is located ("Layer" property).
Read or define the name of a graphic object ("ObjectName" property).
Define a reference to the superordinate picture ("Parent" property).
Using the "Activate" method, the focus is set on the respective ScreenItem object. If the focus
cannot be set because the object is non-operable, for example, an error is generated. Using
error processing (On Error Resume Next), the error may be evaluated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

861

VBS Reference
2.2 Objects and Lists

Possible features of ScreenItem


The "ScreenItem" object can contain the following object types:
Standard
objects

Smart objects Windows


objects

Tube objects Controls

Others

Ellipse

3D bar

Button

Double Tpiece

Siemens HMI
Symbol Library

Customized
Object

Ellipse arc

Application
window

Check box

Polygon
tube

WinCC
AlarmControl

Group

Ellipse
segment

Bar

Radio box

Tube bend

WinCC digital/
analog clock
control

Circle

Picture
window

Round button

T-piece

WinCC
FunctionTrendCon
trol

Circular arc

Control

Slider

Pie segment

I/O field

WinCC
OnlineTrendContr
ol

Line

Faceplate
Instance

WinCC
OnlineTableContr
ol

Polygon

Graphic
object

WinCC push
button control

Polyline

Combo box

WinCC
RulerControl

Rectangle

List box

WinCC slider
control

Rounded
rectangle

Multiple row
text

WinCC
UserArchiveContr
ol

Connector

OLE object

WinCC gauge
control

Group display
Text list
Status display

Detailed descriptions of the individual object types is provided under "ScreenItem Object
Types". The ScreenItem object's "Type" property can be used to address the object types via
the VBS Type ID.

862

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

Object properties
The "ScreenItem" object has different properties according to the features. The following
section describes the properties which all ScreenItem object types have:

When a specific object type is addressed, certain further properties are added to the standard
properties:

The additional properties are indicated in the descriptions of the individual object types.

Example
In the following example, the radius of a circle is set to 2 in Runtime per mouse click:

Sub OnClick(ByVal Item)


'VBS5
Dim objCircle
Set objCircle= ScreenItems("Circle1")
objCircle.Radius = 2
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

863

VBS Reference
2.2 Objects and Lists

See also
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
Parent Property (Page 514)
Left Property (Page 463)
Layer Property (Page 446)
Height Property (Page 430)
Enabled Property (Page 394)
Activate Method (Page 696)
Example: How to Read Tag Values (Page 812)
Example: Writing tag values (Page 810)
Properties (Page 303)
Objects and Lists (Page 123)
Object types of the ScreenItem object (Page 158)

2.2.17

ScreenItems Object (List)

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
The "ScreenItems" list can be used to reference an object in the picture.

Parent Object
Picture containing the picture element.

864

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

Usage
The "ScreenItems" list can be used to:
To display or edit all objects in the list (i.e. all objects within a picture) ("_NewEnum"
property).
To count the objects in a picture ("Count" property).
To process a specific object in the list ("Item" method).
The properties are standard properties and methods of a collection and are not described in
detail in the WinCC documentation.

Special features of the ScreenItem object


If an external control (ActiveX control or OLE object) is embedded in WinCC, it is possible that
the properties of the embedded controls have the same name with the general properties of
the ScreenItem object. In such cases, the ScreenItem properties have priority.
The properties of the embedded controls can also be addressed via the "object" property:
The "object" property is only provided by ActiveX controls and OLE objects.
Example:

'Control1 is an embedded ActiveX-Control with property "type"


'VBS196
Dim Control
Set Control=ScreenItems("Control1")
Control.object.type
'Control1 is a WinCC-Control
'VBS197
Dim Control
Set Control=ScreenItems("Control1")
Control.type

Example
In the following example, the name of the objects in the current picture are displayed in a
message box:

Sub OnClick(ByVal Item)


'VBS6
Dim lngAnswer
Dim lngIndex
lngIndex = 1
For lngIndex = 1 To ScreenItems.Count
lngAnswer = MsgBox(ScreenItems(lngIndex).Objectname, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

865

VBS Reference
2.2 Objects and Lists

See also
Count Property (Page 380)
Example: How to Read Tag Values (Page 812)
Example: Writing tag values (Page 810)
ScreenItem Object (Page 141)
Parent Property (Page 514)
Item Method (Page 753)

2.2.18

Screen Object

Description
+0,5XQWLPH

6FUHHQV
6FUHHQ

$FWLYH6FUHHQ,WHP
6FUHHQ,WHPV
6FUHHQ,WHP
/D\HUV
/D\HU
'DWD6HW
'DWD,WHP

The Screen object returns the result of access to the Screen list. All the properties and methods
of this object can also be edited directly in Runtime. The "Screen" object represents a WinCC
picture in Runtime and contains all the properties of the picture document and picture view.
The "Screen" object also contains the following:
A list of all the graphic objects contained in the addressed picture which can be addressed
by the "ScreenItems" object.
A list of all the layers contained in the addressed picture which can be addressed by the
"Layers" object.

866

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

Parent Object
A picture window in which the Screen object is embedded.
When the Screen object is the basic picture, the Parent object is not defined and set to zero.

Usage
The "Screen" object can be used for the following, for example:
To release or block the operation of a screen ("Enabled" property).
Change the width and height of a screen ("Height" and "Width" properties).
Zoom a picture ("Zoom" property).
Modify the fill pattern, background color and fill pattern color ("Fillstyle", "Backcolor" and
"Fillcolor" properties).
Note
If a Change Picture is executed, all the open references are invalid for pictures no longer
open. It is then no longer possible to work with these references.

Example:
In the following example, the width of the first picture in Runtime is increased by 20 pixels:

'VBS7
Dim objScreen
Set objScreen = HMIRuntime.Screens(1)
MsgBox "Screen width before changing: " & objScreen.Width
objScreen.Width = objScreen.Width + 20
MsgBox "Screen width after changing: " & objScreen.Width

Notes on Cross References


All the pictures which are addressed with the standard formulation
HMIRuntime.BaseScreenName = "Screenname"
are automatically compiled by the CrossReference of WinCC and then listed in the picture
properties.
If pictures are addressed with different formulations in the code, this can be notified by the
following section of the CrossReference:

' ' WINCC:SCREENNAME_SECTION_START


Const ScreenNameInAction = "ScreenName"
' WINCC:SCREENNAME_SECTION_END
The section can be inserted in VBS actions as often as required.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

867

VBS Reference
2.2 Objects and Lists

Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

See also
ScreenItems Property (Page 547)
Refresh Method (Page 771)
Activate Method (Page 696)
Zoom Property (Page 693)
Width Property (Page 682)
Parent Property (Page 514)
ObjectSizeDeclutteringMin Property (Page 500)
ObjectSizeDeclutteringMax Property (Page 499)
ObjectSizeDeclutteringEnable Property (Page 499)
ObjectName Property (Page 498)
Layers Property (Page 462)
DataSet Property (Page 385)
LayerDeclutteringEnable Property (Page 462)
Height Property (Page 430)
FillStyle Property (Page 407)
FillColor Property (Page 405)
ExtendedZoomingEnable Property (Page 403)
Enabled Property (Page 394)
BackColor Property (Page 323)
ActiveScreenItem Property (Page 306)
AccessPath Property (Page 303)

868

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

2.2.19

Screens Object (List)

Description
+0,5XQWLPH

6FUHHQV
6FUHHQ

$FWLYH6FUHHQ,WHP
6FUHHQ,WHPV
6FUHHQ,WHP
/D\HUV
/D\HU
'DWD6HW
'DWD,WHP

By using the picture window technique, several windows can be opened simultaneously in
WinCC Runtime but only one basic picture exists. The "Screens" list enables access to all
open pictures in Runtime using the picture names. The Screens list contains all invisible
pictures.

Usage
When configuring a multi-user project, it is essential to specify the server prefix to access a
picture which is not on the local computer.
The "Screens" list can be used to:
Display or edit all the pictures within the list ("_NewEnum" property).
To count the pictures in a project ("Count" property).
To process a specific picture in the list ("Item" method).
Initiate new drawing of all visible pictures ("Refresh" method).
The properties are standard properties and methods of a collection and are not described in
detail in the WinCC documentation.
The access code, required in the VBS environment in the
HMIRuntime.Screens(<Zugriffsschlssel>) instruction, must fulfill the syntax requirements:
[<Grundbildname>.]<Bildfenstername>[:<Bildname>] ...
.<Bildfenstername>[:<Bildname>]
This means:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

869

VBS Reference
2.2 Objects and Lists
The access code expresses the picture hierarchy.
The picture names in the code can be omitted at any point.
The "AccessPath" property of the "Screen" object corresponds to the full access code.
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.
The basic picture can be addressed by the access code ".
In addition, it has been defined that the basic picture can be addressed with Index 1.

Examples
The pictures are addressed by the hierarchy information in the list. There are two options here,
with or without use of the picture name. In the following examples, a basic picture
"BaseScreenName" is configured with a picture window "ScreenWindow". The picture window
contains the picture "ScreenName".
Addressing with the picture name

'VBS8
Set objScreen = HMIRuntime.Screens("BaseScreenName.ScreenWindow:ScreenName")

Addressing without the picture name

'VBS9
Set objScreen = HMIRuntime.Screens("ScreenWindow")

Referencing the basic picture in various ways

'VBS10
Set objScreen = HMIRuntime.Screens(1)
'VBS11
Set objScreen = HMIRuntime.Screens("")
'VBS12
Set objScreen = HMIRuntime.Screens("BaseScreenName")

See also
ScreenItem Object (Page 141)
Refresh Method (Page 771)

870

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists
Item Method (Page 753)
Count Property (Page 380)

2.2.20

SmartTags Object

Description
The "HMIRuntime" component was deactivated in the faceplate type. The new "SmartTags"
component was added for the faceplate type. With the SmartTags object you can dynamize
the faceplate type. You can only access the faceplate variables and the properties of the
faceplate type. You cannot access the normal WinCC tag management system. The normal
WinCC tag management system is not available in the faceplate type.

Usage
Using the "SmartTags" object, you can:
Access the faceplate tags in a faceplate type.
Syntax: SmartTags("<tagname>")
Access the properties of a faceplate type.
Syntax: SmartTags("Properties\<propertyname>")

Example 1
Insert a rectangle and a button in a faceplate type. Define a faceplate variable var1. Connect
the "Width" property of the rectangle to faceplate variable var1. Dynamize the "OnClick" event
of the button as follows with VBS.

'VBS306
Dim w
w = SmartTags("var1")
w = w + 10
SmartTags("var1") = w

When you activate Runtime, the faceplate variable is incremented by 10 every time you click
the button. This increases the rectangle width by 10.
Direct reading and writing with object reference
In the following example, the SmartTags object is used to create an object reference "w" to
"var1".
Referencing offers the advantage of being able to access the "var1" tag.

'VBS307
Dim w
Set w = SmartTags("var1")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

871

VBS Reference
2.2 Objects and Lists

w.value = w.value + 10

Example 2:
Insert a rectangle and a button in a faceplate type. Define the instance-specific property "wide".
Link the "Width" property of the rectangle to the instance-specific property "wide". Dynamize
the "OnClick" event of the button as follows with VBS:

'VBS308
Dim w
w = SmartTags("Properties\wide")
SmartTags("Properties\wide") = w + 50

When you activate Runtime, the instance-specific property "wide" is increased by 50 every
time you click the button. This increases the rectangle width by 50.

See also
SmartTag property (Page 567)

2.2.21

Tag Object

Description
+0,5XQWLPH

7DJV

7DJ6HW

7DJ

7DJ

A tag object is returned via the "Tags" list. A tag object can be used to address all the properties
and methods of a tag.
When creating a tag object, all the properties are installed with the following values:
Value = VT_EMPTY
Name = Tag name
QualityCode = BAD NON-SPECIFIC
TimeStamp = 0

872

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists
LastError = 0
ErrorDescription = " "
Note
A summary of possible Quality Codes may be found in WinCC Information System under
key word "Communication" > "Diagnostics" or "Communication" > "Quality Codes".

Usage
The "Tag" object can be used to:
Read out information on the tag ("Name", "QualityCode", "TimeStamp", "LastError" and
"ErrorDescription" properties)
Set a value for a tag ("Write" method, "Value" property)
Read a value for a tag ("Read" method, "Value" property)
Read the value of a "Tag1" tag:

'VBS13
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read()
MsgBox objTag.Value

Declaration of tags in WinCC


Always define internal tags in VB script using the "Dim" instruction in order to prevent writing
tags wrongly.
When creating a new action, the "Option explicit" instruction is automatically entered in the
declaration area and cannot be deleted.
Do not use the "Option explicit" instruction in the code because it may cause Runtime errors.
Example: Declaration of a VBScript "lngVar" tag:

'VBS14
Dim lngVar
lngVar = 5
MsgBox lngVar

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

873

VBS Reference
2.2 Objects and Lists

Note
Tag names must not contain any special characters.
Please note that when creating a tag, it must not contain a value (Value = VT_EMPTY).
Initialize the tags after declaration with the corresponding value.

Notes on Cross References


All the pictures which are addressed with the standard formulation

HMIRuntime.Tags("Tagname")

are automatically compiled by the CrossReference of WinCC and then listed in the picture
properties.
If tags are addressed with different formulations in the code, this can be notified by the following
section of the CrossReference:

' ' WINCC:TAGNAME_SECTION_START


Const TagNameInAction = "TagName"
' WINCC:TAGNAME_SECTION_END

The section can be inserted in VBS actions as often as required.


Note
It is not possible to guarantee the compilation of combined tag names from the
CrossReference.

See also
Name Property (Page 495)
Example: How to Read Tag Values (Page 812)
Example: Writing tag values (Page 810)
Write Method (Page 796)
Read Method (Page 767)
Value Property (Page 665)

874

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists
TimeStamp Property (Page 608)
QualityCode Property (Page 532)
LastError Property (Page 445)
ErrorDescription Property (Page 398)

2.2.22

Tags Object (List)

Description
+0,5XQWLPH

7DJV

7DJ6HW

7DJ

7DJ

The "Tags" list enables access to tags in WinCC Runtime. The result of access to the "Tags"
list is returned by an object of the type "Tag". The Tag object can be used to access all the tag
properties and methods.
Note
"Tags" is a list with a restricted functional scope. The tags in the list cannot be accessed via
the index but only by using the tag names. The standard methods get_Count and
get_NewEnum cannot be used in the Tags list.

Usage
Tags in the list are accessed via:

HMIRuntime.Tags("Tagname")

The Tags list is used to declare tags (tag objects) for read and write access. To ensure that
read and write access is carried out without errors, the corresponding tags must be available
in WinCC tag management.
In VBS you can address tags directly via the name and set and read values. If you want to
access additional tag properties, request the quality code, for example, you will always have
to address tags via the tag listing. The tag object returned enables access to all tag properties
and methods. You have to form an instance for the object, to write a binary tag with
HMIRuntime.Tags("Variable").Value=TRUE, for example.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

875

VBS Reference
2.2 Objects and Lists
The "CreateTagSet" method can be used to generate a "TagSet" object that enables
simultaneous access to several tags.

Example:
There are two options when creating tags:
With specification of the server prefix: For tags in multi-user systems which are not stored
locally.
Direct use of the tag name: For tags stored locally on the computer.
Specification of the server prefix

'VBS15
Dim objTag
Set objTag = HMIRuntime.Tags("Serverprefix::Tagname")
If the server prefix is entered directly, the "ServerPrefix" property is assigned the
corresponding value.

Specification of the tag name

'VBS16
Dim objTag
Set objTag = HMIRuntime.Tags("Tagname")
If just the tag name is used, the "ServerPrefix" and "TagPrefix" properties are assigned
the values from the current context (current picture window).

See also
Example: How to Read Tag Values (Page 812)
Example: Writing tag values (Page 810)
Item Method (Page 753)
CreateTagSet Method (Page 701)
Tag Object (Page 152)

2.2.23

TagSet Object (List)

Description
The object "TagSet" enables simultaneous access to several tags in one call. This features
better performance and lower communication load that single access to various tags.

876

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.2 Objects and Lists

Usage
Using the TagSet object, you may:
Add tags to the list ("Add" method)
Access tag objects contained in the list, and their properties ("Item" method)
Write all tags of the list ("Write" method)
Read all tags of the list ("Read" method)
Remove single tags from the list ("Remove" method)
Remove all tags from the list ("RemoveAll" method)
Tags in the list are accessed via:

'VBS169
Dim myTags
myTags = HMIRuntime.Tags.CreateTagSet
myTags("Tagname")

In order to have error-free read/write access to tags (tag objects) of the list, the respective tags
must exist in WinCC tag management.
If an error occurred during read/write access, the method used will return an error message
using the "LastError" and "ErrorDescription" properties.
Synchronous writing and reading of the tags is possible. The optional "Writemode" parameter
can be used to write process tags directly to the AS with "1", for example, "group.Write 1". Use
the optional "Readmode" parameter to read process tags with "1" directly from the AS or
channel, for example, "group.Read 1".

Example:
The following example shows how to generate a TagSet object, how to add tags, and how to
write values.

'VBS168
Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
'Add Tags to the Collection
group.Add "Motor1"
group.Add "Motor2"
'Set the Values of the Tags
group("Motor1").Value = 3
group("Motor2").Value = 9
'Write the Values to the DataManager
group.Write

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

877

VBS Reference
2.2 Objects and Lists

See also
LastError Property (Page 445)
Example: How to Read Tag Values (Page 812)
Example: Writing tag values (Page 810)
Write Method (Page 796)
RemoveAll Method (Page 775)
Remove Method (Page 772)
Read Method (Page 767)
Item Method (Page 753)
ErrorDescription Property (Page 398)
Count Property (Page 380)
Add Method (Page 697)
Tags Object (List) (Page 155)
Tag Object (Page 152)

878

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3

Object types of the ScreenItem object

2.3.1

Object types of the ScreenItem object

Introduction
The following section lists all the available types of the "ScreenItem" object.
The features of the "ScreenItem" object represent all the graphic objects available in WinCC
Graphics Designer.
The object types are divided into the following groups according to their arrangement in
Graphics Designer:
Standard objects
Smart objects
Windows objects
Tube objects
Controls
There are also the object types
Customized Object
Group

See also
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Group (Page 302)
Customized Object (Page 300)
Controls (Page 232)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

879

VBS Reference
2.3 Object types of the ScreenItem object

2.3.2

Standard objects

2.3.2.1

Ellipse

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Ellipse"

Type Identifier in VBS


HMIEllipse

Usage
In the following example, the object with the name "Ellipse1" is moved 10 pixels to the right:

'VBS17
Dim objEllipse
Set objEllipse = ScreenItems("Ellipse1")
objEllipse.Left = objEllipse.Left + 10

See also
FillStyle Property (Page 407)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)

880

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
RadiusWidth Property (Page 534)
RadiusHeight Property (Page 533)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 446)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

881

VBS Reference
2.3 Object types of the ScreenItem object

2.3.2.2

Ellipse arc

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Ellipse Arc"

Type Identifier in VBS


HMIEllipticalArc

Usage
In the following example, the object with the name "EllipseArc1" is moved 10 pixels to the right:

'VBS18
Dim objEllipseArc
Set objEllipseArc = ScreenItems("EllipseArc1")
objEllipseArc.Left = objEllipseArc.Left + 10

See also
RadiusHeight Property (Page 533)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
StartAngle Property (Page 573)
RadiusWidth Property (Page 534)

882

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashBorderColor Property (Page 411)
EndAngle Property (Page 396)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
Layer Property (Page 446)

2.3.2.3

Ellipse segment

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Ellipse Segment"

Type Identifier in VBS


HMIEllipseSegment

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

883

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "EllipseSegment1" is moved 10 pixels to
the right:

'VBS19
Dim objEllipseSeg
Set objEllipseSeg = ScreenItems("EllipseSegment1")
objEllipseSeg.Left = objEllipseSeg.Left + 10

See also
Layer Object (Page 136)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
StartAngle Property (Page 573)
RadiusWidth Property (Page 534)
RadiusHeight Property (Page 533)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)

884

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
EndAngle Property (Page 396)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 446)

2.3.2.4

Circle

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Circle".

Type Identifier in VBS


HMICircle

Usage
In the following example, the object with the name "Circle1" is moved 10 pixels to the right:

'VBS20
Dim objCircle
Set objCircle= ScreenItems("Circle1")
objCircle.Left = objCircle.Left + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

885

VBS Reference
2.3 Object types of the ScreenItem object

See also
Properties (Page 303)
BorderStyle Property (Page 343)
Activate Method (Page 696)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Radius Property (Page 533)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)

886

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
BackColor Property (Page 323)
Layer Property (Page 446)

2.3.2.5

Circular arc

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Circular Arc"

Type Identifier in VBS


HMICircularArc

Usage
In the following example, the object with the name "CircularArc1" is moved 10 pixels to the
right:

'VBS21
Dim objCircularArc
Set objCircularArc = ScreenItems("CircularArc1")
objCircularArc.Left = objCircularArc.Left + 10

See also
StartAngle Property (Page 573)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

887

VBS Reference
2.3 Object types of the ScreenItem object
Top Property (Page 627)
ToolTipText Property (Page 626)
Radius Property (Page 533)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashBorderColor Property (Page 411)
EndAngle Property (Page 396)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
Layer Property (Page 446)

2.3.2.6

Pie segment

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Pie Segment"

Type Identifier in VBS


HMICircleSegment

888

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "PieSegment1" is moved 10 pixels to the
right:

'VBS22
Dim objCircleSeg
Set objCircleSeg = ScreenItems("PieSegment1")
objCircleSeg.Left = objCircleSeg.Left + 10

See also
Type Property (Page 651)
BorderColor Property (Page 341)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Top Property (Page 627)
ToolTipText Property (Page 626)
StartAngle Property (Page 573)
Radius Property (Page 533)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

889

VBS Reference
2.3 Object types of the ScreenItem object
EndAngle Property (Page 396)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 446)

2.3.2.7

Line

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Line"

Type Identifier in VBS


HMILine

Usage
In the following example, the object with the name "Line1" is moved 10 pixels to the right:

'VBS23
Dim objLine
Set objLine = ScreenItems("Line1")
objLine.Left = objLine.Left + 10

890

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

See also
PasswordLevel Property (Page 516)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
RotationAngle Property (Page 538)
ReferenceRotationTop Property (Page 535)
ReferenceRotationLeft Property (Page 535)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashBorderColor Property (Page 411)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderEndStyle Property (Page 342)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
Layer Property (Page 446)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

891

VBS Reference
2.3 Object types of the ScreenItem object

2.3.2.8

Polygon

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Polygon"

Type Identifier in VBS


HMIPolygon

Usage
In the following example, the object with the name "Polygon1" is moved 10 pixels to the right:

'VBS24
Dim objPolygon
Set objPolygon = ScreenItems("Polygon1")
objPolygon.Left = objPolygon.Left + 10

See also
ReferenceRotationTop Property (Page 535)
BackFlashColorOn Property (Page 325)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
RotationAngle Property (Page 538)

892

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ReferenceRotationLeft Property (Page 535)
PointCount Property (Page 527)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Index Property (Page 438)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
ActualPointTop Property (Page 307)
ActualPointLeft Property (Page 307)
Layer Property (Page 446)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

893

VBS Reference
2.3 Object types of the ScreenItem object

2.3.2.9

Polyline

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Polyline"

Type Identifier in VBS


HMIPolyLine

Usage
In the following example, the object with the name "Polyline1" is moved 10 pixels to the right:

'VBS25
Dim objPolyline
Set objPolyline = ScreenItems("Polyline1")
objPolyline.Left = objPolyline.Left + 10

See also
Layer Object (Page 136)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
RotationAngle Property (Page 538)
ReferenceRotationTop Property (Page 535)

894

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ReferenceRotationLeft Property (Page 535)
PointCount Property (Page 527)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Index Property (Page 438)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashBorderColor Property (Page 411)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderEndStyle Property (Page 342)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
ActualPointTop Property (Page 307)
ActualPointLeft Property (Page 307)
Layer Property (Page 446)

2.3.2.10

Rectangle

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Rectangle"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

895

VBS Reference
2.3 Object types of the ScreenItem object

Type Identifier in VBS


HMIRectangle

Usage
In the following example, the object with the name "Rectangle1" is moved 10 pixels to the right:

'VBS26
Dim objRectangle
Set objRectangle = ScreenItems("Rectangle1")
objRectangle.Left = objRectangle.Left + 10

Notes on Error Handling


The rectangle and rounded rectangle are mapped to an "HMIRectangle" type in the object
model. Since the two objects have different properties, the availability of the property (dynamic
type compilation in Runtime) should be queried via an exception measure. The exception
measure is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

896

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Examples of error handling

Sub OnClick(ByVal Item)


'VBS27
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If "HMIRectangle" = objScreenItem.Type Then
'
'=== Property "RoundCornerHeight" only available for RoundRectangle
objScreenItem.RoundCornerHeight = objScreenItem.RoundCornerHeight * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.Name & ": no RoundedRectangle" & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

See also
Properties (Page 303)
BorderFlashColorOn Property (Page 343)
Activate Method (Page 696)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

897

VBS Reference
2.3 Object types of the ScreenItem object
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 446)

2.3.2.11

Rounded rectangle

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Rounded Rectangle".

Type Identifier in VBS


HMIRoundRectangle

898

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "RoundedRectangle1" is moved 10 pixels
to the right:

'VBS28
Dim objRoundedRectangle
Set objRoundedRectangle = ScreenItems("RoundedRectangle1")
objRoundedRectangle.Left = objRoundedRectangle.Left + 10

Notes on Error Handling


The rectangle and rounded rectangle are mapped to an "HMIRectangle" type in the object
model. Since the two objects have different properties, the availability of the property (dynamic
type compilation in Runtime) should be queried via an exception measure. The exception
measure is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(ByVal Item)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

899

VBS Reference
2.3 Object types of the ScreenItem object

'VBS29
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If "HMIRectangle" = objScreenItem.Type Then
'
'=== Property "RoundCornerHeight" available only for RoundRectangle
objScreenItem.RoundCornerHeight = objScreenItem.RoundCornerHeight * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no RoundedRectangle" & vbCrLf
Err.Clear
'Delete errormessage
End If
End If
Next
On Error Goto 0
'Deactivation of errorhandling
End Sub

See also
FlashBackColor Property (Page 410)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
RoundCornerWidth Property (Page 539)
RoundCornerHeight Property (Page 539)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FillStyle Property (Page 407)

900

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 446)

2.3.2.12

Static text

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Static Text"

Type Identifier in VBS


HMITextField

Usage
In the following example, the object with the name "StaticText1" is moved 10 pixels to the right:

'VBS30
Dim objStaticText
Set objStaticText = ScreenItems("StaticText1")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

901

VBS Reference
2.3 Object types of the ScreenItem object

objStaticText.Left = objStaticText.Left + 10

See also
ObjectName Property (Page 498)
BorderFlashColorOn Property (Page 343)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Text list (Page 211)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
Orientation Property (Page 512)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
ForeFlashColorOn Property (Page 423)
ForeFlashColorOff Property (Page 422)
ForeColor Property (Page 422)
FontUnderline Property (Page 421)
FontSize Property (Page 420)
FontName Property (Page 420)
FontItalic Property (Page 419)
FontBold Property (Page 419)
FlashRateForeColor Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashForeColor Property (Page 411)
FlashBorderColor Property (Page 411)

902

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)
Layer Property (Page 446)

2.3.2.13

Connector

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Connector"

Type Identifier in VBS


HMIConnector

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

903

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "Connector1" is moved 10 pixels to the right:

'VBS31
Dim objConnector
Set objConnector = ScreenItems("Connector1")
objConnector.Left = objConnector.Left + 10

See also
ScreenItems Object (List) (Page 144)
Activate Method (Page 696)
Properties (Page 303)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
TopConnectedObjectName Property (Page 628)
TopConnectedConnectionPointIndex Property (Page 628)
Top Property (Page 627)
ToolTipText Property (Page 626)
Parent Property (Page 514)
Orientation Property (Page 512)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Property (Page 446)
Height Property (Page 430)
Enabled Property (Page 394)
BottomConnectedObjectName Property (Page 344)
BottomConnectedConnectionPointIndex Property (Page 344)

904

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.3

Smart objects

2.3.3.1

3D Bar

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "3D Bar"

Type Identifier in VBS


HMIBar

Usage
In the following example, the object with the name "3DBar1" is moved 10 pixels to the right:

'VBS32
Dim objBar
Set objBar = ScreenItems("3DBar1")
objBar.Left = objBar.Left + 10

Notes on Error Handling


Bars and 3D bars are imaged in the object model on a "HMIBar" type. Since the two objects
have different properties, the availability of the property (dynamic type compilation in Runtime)
should be queried via an exception measure. The exception measure is activated for the
corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

905

VBS Reference
2.3 Object types of the ScreenItem object

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

'VBS148
Sub OnClick(ByVal Item)
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If "HMIBar" = objScreenItem.Type Then
'
'=== Property "Layer00Value" only available for 3D bar
objScreenItem.Layer00Value = objScreenItem.Layer00Value * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.Name & ": no 3D bar" & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

See also
Type Property (Page 651)
Layer08Color Property (Page 454)
BorderStyle Property (Page 343)
Activate Method (Page 696)

906

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
ZeroPointValue Property (Page 693)
Width Property (Page 682)
Visible Property (Page 680)
Top Property (Page 627)
ToolTipText Property (Page 626)
Process Property (Page 530)
PredefinedAngles Property (Page 529)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Min Property (Page 492)
Max Property (Page 474)
LightEffect Property (Page 464)
Left Property (Page 463)
Layer10Value Property (Page 461)
Layer09Value Property (Page 461)
Layer08Value Property (Page 461)
Layer07Value Property (Page 461)
Layer06Value Property (Page 460)
Layer05Value Property (Page 460)
Layer04Value Property (Page 460)
Layer03Value Property (Page 459)
Layer02Value Property (Page 459)
Layer01Value Property (Page 459)
Layer00Value Property (Page 459)
Layer10Color Property (Page 454)
Layer09Color Property (Page 454)
Layer07Color Property (Page 453)
Layer06Color Property (Page 453)
Layer05Color Property (Page 453)
Layer04Color Property (Page 452)
Layer03Color Property (Page 452)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

907

VBS Reference
2.3 Object types of the ScreenItem object
Layer02Color Property (Page 452)
Layer01Color Property (Page 451)
Layer00Color Property (Page 451)
Layer10Checked Property (Page 451)
Layer09Checked Property (Page 450)
Layer08Checked Property (Page 450)
Layer07Checked Property (Page 450)
Layer06Checked Property (Page 449)
Layer05Checked Property (Page 449)
Layer04Checked Property (Page 449)
Layer03Checked Property (Page 448)
Layer02Checked Property (Page 448)
Layer01Checked Property (Page 448)
Layer00Checked Property (Page 447)
Layer Object (Page 136)
Height Property (Page 430)
Enabled Property (Page 394)
Direction Property (Page 391)
BorderWidth Property (Page 344)
BorderColor Property (Page 341)
BaseY Property (Page 331)
BaseX Property (Page 331)
BarWidth Property (Page 328)
BarHeight Property (Page 328)
BarDepth Property (Page 328)
Background Property (Page 325)
BackColor Property (Page 323)
Axe Property (Page 321)
AngleBeta Property (Page 313)
AngleAlpha Property (Page 313)

908

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.3.2

Application Window

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Application Window"

Type Identifier in VBS


HMIApplicationWindow

Usage
In the following example, the object with the name "ApplicationWindow1" is moved 10 pixels
to the right:

'VBS33
Dim objAppWindow
Set objAppWindow = ScreenItems("ApplicationWindow1")
objAppWindow.Left = objAppWindow.Left + 10

See also
Properties (Page 303)
Activate Method (Page 696)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
WindowBorder Property (Page 683)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
Template Property (Page 583)
Parent Property (Page 514)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

909

VBS Reference
2.3 Object types of the ScreenItem object
OnTop Property (Page 502)
ObjectName Property (Page 498)
Moveable Property (Page 493)
MaximizeButton Property (Page 475)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
Enabled Property (Page 394)
CloseButton Property (Page 359)
Caption Property (Page 351)
Application Property (Page 314)

2.3.3.3

Bar

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Bar"

Type Identifier in VBS


HMIBar

Usage
In the following example, the object with the name "Bar1" is moved 10 pixels to the right:

'VBS34
Dim objBar
Set objBar = ScreenItems("Bar1")
objBar.Left = objBar.Left + 10

910

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Notes on Error Handling


Bars and 3D bars are imaged in the object model on a "HMIBar" type. Since the two objects
have different properties, the availability of the property (dynamic type compilation in Runtime)
should be queried via an exception measure. The exception measure is activated for the
corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

'VBS147
Sub OnClick(ByVal Item)
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If "HMIBar" = objScreenItem.Type Then
'
'=== Property "LimitHigh4" only available for bar
objScreenItem.LimitHigh4 = objScreenItem.LimitHigh4 * 2
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.Name & ": no bar" & vbCrLf

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

911

VBS Reference
2.3 Object types of the ScreenItem object

'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0
'Deactivation of errorhandling
End Sub

See also
ToolTipText Property (Page 626)
Layer Object (Page 136)
ColorChangeType Property (Page 363)
Average Property (Page 321)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
ZeroPointValue Property (Page 693)
ZeroPoint Property (Page 693)
Width Property (Page 682)
WarningLow Property (Page 682)
WarningHigh Property (Page 682)
Visible Property (Page 680)
TypeWarningLow Property (Page 655)
TypeWarningHigh Property (Page 655)
TypeToleranceLow Property (Page 655)
TypeToleranceHigh Property (Page 655)
TypeLimitLow5 Property (Page 654)
TypeLimitLow4 Property (Page 654)
TypeLimitHigh5 Property (Page 654)
TypeLimitHigh4 Property (Page 653)
TypeAlarmLow Property (Page 653)
TypeAlarmHigh Property (Page 653)
Type Property (Page 651)
LTrendColor property (before WinCC V7) (Page 631)
Trend Property (Page 629)

912

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Top Property (Page 627)
ToleranceLow Property (Page 614)
ToleranceHigh Property (Page 613)
ScalingType Property (Page 545)
Scaling Property (Page 544)
ScaleTicks Property (Page 544)
ScaleColor Property (Page 544)
RightComma Property (Page 537)
Process Property (Page 530)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Min Property (Page 492)
Max Property (Page 474)
Marker Property (Page 474)
LongStrokesTextEach Property (Page 472)
LongStrokesSize Property (Page 471)
LongStrokesOnly Property (Page 471)
LongStrokesBold Property (Page 471)
LimitLow5 Property (Page 465)
LimitLow4 Property (Page 465)
LimitHigh5 Property (Page 464)
LimitHigh4 Property (Page 464)
LeftComma Property (Page 463)
Left Property (Page 463)
HysteresisRange Property (Page 437)
Hysteresis Property (Page 437)
Height Property (Page 430)
FontSize Property (Page 420)
FontName Property (Page 420)
FontBold Property (Page 419)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

913

VBS Reference
2.3 Object types of the ScreenItem object
FillStyle2 Property (Page 408)
FillStyle Property (Page 407)
FillColor Property (Page 405)
Exponent Property (Page 399)
Enabled Property (Page 394)
Direction Property (Page 391)
ColorWarningLow Property (Page 366)
ColorWarningHigh Property (Page 366)
ColorToleranceLow Property (Page 365)
ColorToleranceHigh Property (Page 365)
ColorLimitLow5 Property (Page 365)
ColorLimitLow4 Property (Page 364)
ColorLimitHigh5 Property (Page 364)
ColorLimitHigh4 Property (Page 364)
ColorAlarmLow Property (Page 363)
ColorAlarmHigh Property (Page 362)
CheckWarningLow Property (Page 358)
CheckWarningHigh Property (Page 357)
CheckToleranceLow Property (Page 357)
CheckToleranceHigh Property (Page 357)
CheckLimitLow5 Property (Page 356)
CheckLimitLow4 Property (Page 356)
CheckLimitHigh5 Property (Page 356)
CheckLimitHigh4 Property (Page 355)
CheckAlarmLow Property (Page 355)
CheckAlarmHigh Property (Page 355)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor3 Property (Page 324)

914

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
BackColor2 Property (Page 324)
BackColor Property (Page 323)
AxisSection Property (Page 322)
Alignment Property (Page 310)
AlarmLow Property (Page 310)
AlarmHigh Property (Page 309)

2.3.3.4

Picture Window

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Picture Window"

Type Identifier in VBS


HMIScreenWindow

Usage
In the following example, the object with the name "ScreenWindow1" is moved 10 pixels to
the right:

'VBS35
Dim objScrWindow
Set objScrWindow = ScreenItems("ScreenWindow1")
objScrWindow.Left = objScrWindow.Left + 10

See also
ServerPrefix Property (Page 558)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

915

VBS Reference
2.3 Object types of the ScreenItem object
ScreenItem Object (Page 141)
Zoom Property (Page 693)
WindowBorder Property (Page 683)
Width Property (Page 682)
Visible Property (Page 680)
UpdateCycle Property (Page 658)
Type Property (Page 651)
Top Property (Page 627)
TagPrefix Property (Page 582)
ScrollPositionY Property (Page 548)
ScrollPositionX Property (Page 548)
ScrollBars Property (Page 548)
ScreenName Property (Page 546)
Screens Property (Page 547)
Parent Property (Page 514)
OnTop Property (Page 502)
OffsetTop Property (Page 501)
OffsetLeft Property (Page 500)
ObjectName Property (Page 498)
Moveable Property (Page 493)
MaximizeButton Property (Page 475)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
Enabled Property (Page 394)
CloseButton Property (Page 359)
CaptionText Property (Page 353)
Caption Property (Page 351)
AdaptSize Property (Page 308)
AdaptPicture Property (Page 308)
MenuToolBarConfig Property (Page 481)

916

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.3.5

Control

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Control"
The Control object type always assumes the properties of the Control type selected. In the
case of controls provided by WinCC, the properties are indicated under the description of the
corresponding Control.
In the case of controls from external suppliers, the control properties are supplied and thus not
a part of this description. However, the control properties can be queried using the "Item"
property.

Type Identifier in VBS


Special WinCC type descriptions or version-independent ProgID

Usage
In the following example, the object with the name "Control1" is moved 10 pixels to the right:

'VBS36
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left + 10

Special feature
The controls provided by WinCC return a special ID as the type. It can be found under the
topic "Type Identification in VBS" in the individual descriptions of the WinCC Controls.

Use of Controls from External Suppliers


In the case of non-WinCC controls, the version-independent ProgID is returned as the type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

917

VBS Reference
2.3 Object types of the ScreenItem object
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "Control1" is a control embedded in the picture which already
returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.
Determine the version-dependent ProgID as follows:

'VBS37
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("Control1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

Note
In order that example above works, a multimedia control should be inserted in the picture.
Determine the UserFriendlyName as follows:

'VBS38
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("Control1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that example above works, a multimedia control should be inserted in the picture.
If a non-WinCC control is used, it is possible that the properties provided by the control have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an external control supplier can be
accessed using the additional "object" property. Address the properties of an external control
supplier as follows:

918

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Control.object.type

The properties of the ScreenItem object are used in the case of identical names, if you use
the following form:

Control.type

WinCC controls available


WinCC Alarm Control
WinCC Digital/Analog Clock
WinCC FunctionTrendControl
WinCC Gauge Control
WinCC Media Control
WinCC OnlineTableControl
WinCC OnlineTrendControl
WinCC Push Button Control
WinCC Slider Control
WinCC UserArchiveControl
HMI Symbol Library

See also
Object Property (Page 497)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Property (Page 446)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

919

VBS Reference
2.3 Object types of the ScreenItem object
Height Property (Page 430)
Enabled Property (Page 394)

2.3.3.6

I/O Field

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "I/O Field"

Type Identifier in VBS


HMIIOField

Usage
In the following example, the object with the name "IOField1" is moved 10 pixels to the right:

'VBS39
Dim objIOField
Set objIOField = ScreenItems("IOField1")
objIOField.Left = objIOField.Left + 10

See also
OperationMessage Property (Page 503)
EditAtOnce Property (Page 394)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)

920

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Top Property (Page 627)
ToolTipText Property (Page 626)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
OutputValue Property (Page 513)
OutputFormat Property (Page 513)
Orientation Property (Page 512)
OperationReport Property (Page 511)
ObjectName Property (Page 498)
LimitMin Property (Page 466)
LimitMax Property (Page 465)
Left Property (Page 463)
Layer Object (Page 136)
HiddenInput Property (Page 431)
Height Property (Page 430)
ForeFlashColorOn Property (Page 423)
ForeFlashColorOff Property (Page 422)
ForeColor Property (Page 422)
FontUnderline Property (Page 421)
FontSize Property (Page 420)
FontName Property (Page 420)
FontItalic Property (Page 419)
FontBold Property (Page 419)
FlashRateForeColor Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashForeColor Property (Page 411)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillColor Property (Page 405)
Enabled Property (Page 394)
DataFormat Property (Page 384)
CursorControl Property (Page 382)
ClearOnNew Property (Page 358)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

921

VBS Reference
2.3 Object types of the ScreenItem object
ClearOnError Property (Page 358)
BoxType Property (Page 345)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AssumeOnFull Property (Page 317)
AssumeOnExit Property (Page 316)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

2.3.3.7

Faceplate Instance

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "faceplate instance" graphic object.

Type identifier in VBS


HMIFaceplateObject

922

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "FaceplateInstance1" is moved 10 pixels
to the right:

'VBS309
Dim objFaceplateObject
Set objFaceplateObject = ScreenItems("FaceplateInstance1")
objFaceplateObject.Left = objFaceplateObject.Left + 10

2.3.3.8

Graphic Object

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Graphic Object"

Type Identifier in VBS


HMIGraphicView

Usage
In the following example, the object with the name "GraphicObject1" is moved 10 pixels to the
right:

'VBS40
Dim objGraphicView
Set objGraphicView= ScreenItems("GraphicObject1")
objGraphicView.Left = objGraphicView.Left + 10

See also
Parent Property (Page 514)
Activate Method (Page 696)
Properties (Page 303)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

923

VBS Reference
2.3 Object types of the ScreenItem object
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
PicUseTransColor Property (Page 526)
PictureName Property (Page 524)
PicTransColor Property (Page 522)
PicReferenced Property (Page 521)
PasswordLevel Property (Page 516)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)

924

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.3.9

Combobox

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Combobox" graphic object.

Type Identifier in VBS


HMIComboBox

Usage
In the following example, the object with the name "ComboBox1" is moved 10 pixels to the
right:

'VBS21
Dim objComboBox
Set objComboBox = ScreenItems("ComboBox1")
objComboBox.Left = objComboBox.Left + 10

2.3.3.10

List Box

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "List Box" graphic object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

925

VBS Reference
2.3 Object types of the ScreenItem object

Type Identifier in VBS


HMIListBox

Usage
In the following example, the object with the name "ListBox1" is moved 10 pixels to the right:

'VBS21
Dim objListBox
Set objListBox = ScreenItems("ListBox1")
objListBox.Left = objListBox.Left + 10

2.3.3.11

Multiple row text

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Multiline Text" graphic object.

Type Identifier in VBS


HMIMultiLineEdit

Usage
In the following example, the object with the name "MultiLineEdit1" is moved 10 pixels to the
right:

'VBS21
Dim objMultiLineEdit
Set objMultiLineEdit = ScreenItems("MultiLineEdit1")
objMultiLineEdit.Left = objMultiLineEdit.Left + 10

926

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.3.12

OLE object

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "OLE Element". The return
value is a STRING type.

Type Identifier in VBS


Version-independent ProgID

Usage
In the following example, the object with the name "OLEElement1" is moved 10 pixels to the
right:

'VBS41
Dim objOLEElement
Set objOLEElement = ScreenItems("OLEElement1")
objOLEElement.Left = objOLEElement.Left + 10

Special feature
In the case of OLE Elements, the version-independent ProgID is returned as the type.
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "OLEObject1" is a control embedded in the picture which
already returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.
Determine the version-dependent ProgID as follows:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

927

VBS Reference
2.3 Object types of the ScreenItem object

'VBS42
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("OLEElement1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

Note
In order that the example above works, a Word document should be embedded in the picture
as an OLE Element.
Determine the User Friendly Name as follows:

'VBS43
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("OLEElement1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that the example above works, a Word document should be embedded in the picture
as an OLE Element.

Using OLE Elements


If an OLE Element is used, it is possible that the properties provided by the OLE Element have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an OLE Element can be accessed using
the additional "Object" property. Address the properties of an OLE Element as follows:

OLEObjekt.object.type

Only use the form

OLEObjekt.type

928

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
In the case of identical names, the properties of the ScreenItem object are used.

See also
Height Property (Page 430)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Parent Property (Page 514)
Object Property (Page 497)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Property (Page 446)
Enabled Property (Page 394)

2.3.3.13

Group Display

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Group Display"

Type Identifier in VBS


HMIGroupDisplay

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

929

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "GroupDisplay1" is moved 10 pixels to the
right:

'VBS44
Dim objGroupDisplay
Set objGroupDisplay = ScreenItems("GroupDisplay1")
objGroupDisplay.Left = objGroupDisplay.Left + 10

See also
Activate Method (Page 696)
MCKQBackColorOn Property (Page 479)
FontBold Property (Page 419)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
UserValue4 Property (Page 663)
UserValue3 Property (Page 662)
UserValue2-Eigenschaft (Page 662)
UserValue1 Property (Page 662)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
SignificantMask Property (Page 565)
SameSize Property (Page 543)
Relevant Property (Page 536)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
MessageClass Property (Page 489)
MCText Property (Page 480)
MCKQTextFlash Property (Page 480)
MCKQTextColorOn Property (Page 480)
MCKQTextColorOff Property (Page 479)

930

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
MCKQBackFlash Property (Page 479)
MCKQBackColorOff Property (Page 478)
MCKOTextFlash Property (Page 478)
MCKOTextColorOn Property (Page 478)
MCKOTextColorOff Property (Page 478)
MCKOBackFlash Property (Page 477)
MCKOBackColorOn Property (Page 477)
MCKOBackColorOff Property (Page 477)
MCGUTextFlash Property (Page 476)
MCGUTextColorOn Property (Page 476)
MCGUTextColorOff Property (Page 476)
MCGUBackFlash Property (Page 476)
MCGUBackColorOn Property (Page 475)
MCGUBackColorOff-Eigenschaft (Page 475)
LockTextColor Property (Page 470)
LockText Property (Page 470)
LockStatus Property (Page 470)
LockBackColor Property (Page 469)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FontUnderline Property (Page 421)
FontSize Property (Page 420)
FontName Property (Page 420)
FontItalic Property (Page 419)
FlashRate Property (Page 413)
Enabled Property (Page 394)
CollectValue Property (Page 361)
Button4Width Property (Page 350)
Button3Width Property (Page 350)
Button2Width Property (Page 350)
Button1Width Property (Page 350)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

931

VBS Reference
2.3 Object types of the ScreenItem object

2.3.3.14

Text list

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Text List"

Type Identifier in VBS


HMISymbolicIOField

Usage
In the following example, the object with the name "TextList1" is moved 10 pixels to the right:

'VBS45
Dim objSymIO
Set objSymIO = ScreenItems("TextList1")
objSymIO.Left = objSymIO.Left + 10

See also
Type Property (Page 651)
FontUnderline Property (Page 421)
BackFlashColorOff Property (Page 325)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
UnselTextColor Property (Page 658)
UnselBGColor Property (Page 657)
Top Property (Page 627)

932

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ToolTipText Property (Page 626)
SelTextColor Property (Page 555)
SelBGColor Property (Page 550)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
OutputValue Property (Page 513)
Orientation Property (Page 512)
OperationReport Property (Page 511)
OperationMessage Property (Page 503)
ObjectName Property (Page 498)
NumberLines Property (Page 496)
ListType Property (Page 468)
Left Property (Page 463)
Layer Object (Page 136)
LanguageSwitch Property (Page 444)
ItemBorderWidth Property (Page 442)
ItemBorderStyle Property (Page 442)
ItemBorderColor Property (Page 441)
ItemBorderBackColor Property (Page 441)
Height Property (Page 430)
ForeFlashColorOn Property (Page 423)
ForeFlashColorOff Property (Page 422)
ForeColor Property (Page 422)
FontSize Property (Page 420)
FontName Property (Page 420)
FontItalic Property (Page 419)
FontBold Property (Page 419)
FlashRateForeColor Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashForeColor Property (Page 411)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillColor Property (Page 405)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

933

VBS Reference
2.3 Object types of the ScreenItem object
Enabled Property (Page 394)
EditAtOnce Property (Page 394)
CursorControl Property (Page 382)
BoxType Property (Page 345)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BitNumber Property (Page 334)
BackFlashColorOn Property (Page 325)
BackColor Property (Page 323)
AssumeOnExit Property (Page 316)
Assignments Property (Page 316)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

2.3.3.15

Status display

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Status Display"

Type Identifier in VBS


HMIGraphicIOField

934

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "StatusDisplay1" is moved 10 pixels to the
right:

'VBS46
Dim objGraphicIO
Set objGraphicIO= ScreenItems("StatusDisplay1")
objGraphicIO.Left = objGraphicIO.Left + 10

See also
Layer Object (Page 136)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Index Property (Page 438)
Height Property (Page 430)
FlashRateFlashPic Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashPicUseTransColor Property (Page 413)
FlashPicture Property (Page 412)
FlashPicTransColor Property (Page 412)
FlashPicReferenced Property (Page 412)
FlashFlashPicture Property (Page 411)
FlashBorderColor Property (Page 411)
Enabled Property (Page 394)
BorderWidth Property (Page 344)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

935

VBS Reference
2.3 Object types of the ScreenItem object
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BasePicUseTransColor Property (Page 330)
BasePicture Property (Page 329)
BasePicTransColor Property (Page 329)
BasePicReferenced Property (Page 329)

2.3.4

Windows objects

2.3.4.1

Button

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Button"

Type Identifier in VBS


HMIButton

Usage
In the following example, the object with the name "Button1" is moved 10 pixels to the right:

'VBS47
Dim cmdButton
Set cmdButton = ScreenItems("Button1")
cmdButton.Left = cmdButton.Left + 10

936

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Notes on Error Handling


Buttons and pushbuttons are mapped in the object model to an "HMIButton" type. Since the
objects have different properties, the availability of the property (dynamic type compilation in
Runtime) should be queried via an exception measure. The exception measure is activated
for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(ByVal Item)


'VBS48
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = "HMIButton" Then
'
'=== Property "Text" available only for Standard-Button
objScreenItem.Text = "Windows"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Windows-Button" & vbCrLf
Err.Clear
'Delete error message
End If

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

937

VBS Reference
2.3 Object types of the ScreenItem object

End If
Next
On Error Goto 0
End Sub

'Deactivation of errorhandling

See also
Top Property (Page 627)
FlashBorderColor Property (Page 411)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
WindowsStyle Property (Page 684)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
ToolTipText Property (Page 626)
Text list (Page 211)
PictureUp Property (Page 525)
PictureDown Property (Page 523)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
Orientation Property (Page 512)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Hotkey Property (Page 436)
Height Property (Page 430)
ForeFlashColorOn Property (Page 423)
ForeFlashColorOff Property (Page 422)
ForeColor Property (Page 422)
FontUnderline Property (Page 421)
FontSize Property (Page 420)
FontName Property (Page 420)
FontItalic Property (Page 419)

938

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
FontBold Property (Page 419)
FlashRateForeColor Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashForeColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColorTop Property (Page 342)
BorderColor Property (Page 341)
BorderColorBottom Property (Page 342)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

939

VBS Reference
2.3 Object types of the ScreenItem object

2.3.4.2

Check box

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Check Box"

Type Identifier in VBS


HMICheckBox

Usage
In the following example, the object with the name "CheckBox1" is moved 10 pixels to the right:

'VBS49
Dim chkCheckBox
Set chkCheckBox = ScreenItems("CheckBox1")
chkCheckBox.Left = chkCheckBox.Left + 10

See also
FontSize Property (Page 420)
BackColor Property (Page 323)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Text list (Page 211)

940

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Process Property (Page 530)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
Orientation Property (Page 512)
OperationMessage Property (Page 503)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Index Property (Page 438)
Height Property (Page 430)
ForeFlashColorOn Property (Page 423)
ForeFlashColorOff Property (Page 422)
ForeColor Property (Page 422)
FontUnderline Property (Page 421)
FontName Property (Page 420)
FontItalic Property (Page 419)
FontBold Property (Page 419)
FlashRateForeColor Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashForeColor Property (Page 411)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BoxCount Property (Page 345)
BoxAlignment Property (Page 345)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

941

VBS Reference
2.3 Object types of the ScreenItem object
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

2.3.4.3

Radio box

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Radio Box"

Type Identifier in VBS


HMIOptionGroup

Usage
In the following example, the object with the name "RadioBox1" is moved 10 pixels to the right:

'VBS50
Dim objOptionGroup
Set objOptionGroup = ScreenItems("RadioBox1")
objOptionGroup.Left = objOptionGroup.Left + 10

See also
ForeColor Property (Page 422)
BackFlashColorOn Property (Page 325)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)

942

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Text list (Page 211)
Process Property (Page 530)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
Orientation Property (Page 512)
OperationMessage Property (Page 503)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Index Property (Page 438)
Height Property (Page 430)
ForeFlashColorOn Property (Page 423)
ForeFlashColorOff Property (Page 422)
FontUnderline Property (Page 421)
FontSize Property (Page 420)
FontName Property (Page 420)
FontItalic Property (Page 419)
FontBold Property (Page 419)
FlashRateForeColor Property (Page 415)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashForeColor Property (Page 411)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

943

VBS Reference
2.3 Object types of the ScreenItem object
BoxCount Property (Page 345)
BoxAlignment Property (Page 345)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 311)
AlignmentLeft Property (Page 311)
AdaptBorder Property (Page 308)

2.3.4.4

Round Button

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Round Button"

Type Identifier in VBS


HMISwitch

Usage
In the following example, the object with the name "RoundButton1" is moved 10 pixels to the
right:

'VBS51
Dim objSwitch
Set objSwitch= ScreenItems("RoundButton1")

944

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

objSwitch.Left = objSwitch.Left + 10

Sub OnClick(ByVal Item)


'VBS52
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = "HMIButton" Then
'
'=== Property "Text" available only for Standard-Button
objScreenItem.Text = "Windows"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Windows-Button" & vbCrLf
Err.Clear
'Delete error message
End If
'
'=== Property "Radius" available only for RoundButton
objScreenItem.Radius = 10
If 0 <> Err.Number Then
HMIRuntime.Trace ScreenItem.ObjectName & ": no RoundButton" & vbCrLf
Err.Clear
End If
End If
Next
On Error Goto 0
'Deactivation of errorhandling
End Sub

See also
PicDownUseTransColor Property (Page 521)
BorderColorTop Property (Page 342)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Toggle Property (Page 613)
Radius Property (Page 533)
Pressed Property (Page 529)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

945

VBS Reference
2.3 Object types of the ScreenItem object
PicUpUseTransColor Property (Page 526)
PicUpTransparent Property (Page 526)
PicUpReferenced Property (Page 525)
PictureUp Property (Page 525)
PictureDown Property (Page 523)
PictureDeactivated Property (Page 523)
PicDownTransparent Property (Page 521)
PicDownReferenced Property (Page 521)
PicDeactUseTransColor Property (Page 520)
PicDeactTransparent Property (Page 520)
PicDeactReferenced-Eigenschaft (Page 520)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
Enabled Property (Page 394)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderColorBottom Property (Page 342)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)

946

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)

2.3.4.5

Slider

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Slider"

Type Identifier in VBS


HMISlider

Usage
In the following example, the object with the name "Slider1" is moved 10 pixels to the right:

'VBS53
Dim sldSlider
Set sldSlider = ScreenItems("Slider1")
sldSlider.Left = sldSlider.Left + 10

Notes on Error Handling


Sliders and WinCC slider controls are mapped in the object model to an "HMISlider" type.
Since the objects have different properties, the availability of the property (dynamic type
compilation in Runtime) should be queried via an exception measure. The exception measure
is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

947

VBS Reference
2.3 Object types of the ScreenItem object
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(Byval Item)


'VBS194
Dim ScreenItem
' activating error handling:
On Error Resume Next
For Each ScreenItem In ScreenItems
If ScreenItem.Type = "HMISlider" Then
'=== Property "BevelColorUp" only exists for a WinCC Slider Control
ScreenItem.BevelColorUp = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no Windows-Slider" + vbCrlf)
' delete error message
Err.Clear
End If
'=== Property "BorderStyle" only exists for a Windows-Slider
ScreenItem.BorderStyle = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no WinCC Slider Control" + vbCrlf)
Err.Clear
End If
End If
Next
On Error GoTo 0 ' deactivating error handling
End Sub

948

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

See also
Height Property (Page 430)
BackColorBottom Property (Page 324)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
WindowsStyle Property (Page 684)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
SmallChange Property (Page 566)
Process Property (Page 530)
PasswordLevel Property (Page 516)
Parent Property (Page 514)
OperationReport Property (Page 511)
OperationMessage Property (Page 503)
ObjectName Property (Page 498)
Min Property (Page 492)
Max Property (Page 474)
Left Property (Page 463)
Layer Object (Page 136)
FlashRateBorderColor Property (Page 414)
FlashRateBackColor Property (Page 414)
FlashBorderColor Property (Page 411)
FlashBackColor Property (Page 410)
FillStyle Property (Page 407)
FillingIndex Property (Page 406)
Filling Property (Page 406)
FillColor Property (Page 405)
ExtendedOperation Property (Page 402)
Enabled Property (Page 394)
Direction Property (Page 391)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

949

VBS Reference
2.3 Object types of the ScreenItem object
ColorTop Property (Page 365)
ColorBottom Property (Page 363)
ButtonColor Property (Page 346)
BorderWidth Property (Page 344)
BorderStyle Property (Page 343)
BorderFlashColorOn Property (Page 343)
BorderFlashColorOff Property (Page 343)
BorderColor Property (Page 341)
BorderBackColor Property (Page 341)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColorTop Property (Page 325)
BackColor Property (Page 323)

2.3.5

Tube objects

2.3.5.1

Polygon Tube

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Polygon Tube" graphic object.

Type Identifier in VBS


HMITubePolyline

950

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Usage
In the following example, the object with the name "TubePolyline1" is moved 10 pixels to the
right:

'VBS24
Dim objTubePolyline
Set objTubePolyline = ScreenItems("TubePolyline1")
objTubePolyline.Left = objTubePolyline.Left + 10

2.3.5.2

T-piece

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "T-piece" graphic object.

Type Identifier in VBS


HMITubeTeeObject

Usage
In the following example, the object with the name "TubeTeeObject1" is moved 10 pixels to
the right:

'VBS21
Dim objTubeTeeObject
Set objTubeTeeObject = ScreenItems("TubeTeeObject1")
objTubeTeeObject.Left = objTubeTeeObject.Left + 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

951

VBS Reference
2.3 Object types of the ScreenItem object

2.3.5.3

Double T-piece

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Double T-piece" graphic object.

Type Identifier in VBS


HMITubeDoubleTeeObject

Usage
In the following example, the object with the name "TubeDoubleTeeObject1" is moved 10
pixels to the right:

'VBS21
Dim objTubeDoubleTeeObject
Set objTubeDoubleTeeObject = ScreenItems("TubeDoubleTeeObject1")
objTubeDoubleTeeObject.Left = objTubeDoubleTeeObject.Left + 10

2.3.5.4

Tube Bend

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "Tube Arc" graphic object.

952

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Type Identifier in VBS


HMITubeArcObject

Usage
In the following example, the object with the name "TubeArcObject1" is moved 10 pixels to the
right:

'VBS24
Dim objTubeArcObject
Set objTubeArcObject = ScreenItems("TubeArcObject1")
objTubeArcObject.Left = objTubeArcObject.Left + 10

2.3.6

Controls

2.3.6.1

Controls

Special features with controls


In the case of non-WinCC controls, the version-independent ProgID is returned as the type.
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "Control1" is a control embedded in the picture which already
returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.
Determine the version-dependent ProgID as follows:

'VBS153
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("Control1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

953

VBS Reference
2.3 Object types of the ScreenItem object

Note
In order that example above works, a multimedia control should be inserted in the picture.
Determine the User Friendly Name as follows:

'VBS154
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("Control1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that example above works, a multimedia control should be inserted in the picture.

Restrictions of VBS for Dynamization by Controls


If Controls are to be dynamized with, the following conditions must be fulfilled:
Methods
The "ByRef" declaration may only be implemented as a "Variant" (ByRef xxx as Variant)
The "ByVal" declaration may only be implemented with tag types (ByVal xxx as Long)
Properties
The "ByRef" declaration may only be implemented as a "Variant" (ByRef xxx as Variant)
The "ByVal" declaration may only be implemented with tag types (ByVal xxx as Long)
Events
The "ByRef" declaration is not permitted.
The "ByVal" declaration may only be implemented as a "Variant" (ByVal xxx as Variant)
Arrays
If arrays are used, they must be declared with (ByRef xxx As Variant).
In order that arrays can be transferred in variants, variant tag must also be inserted as an
intermediate tag according to the following scheme:

'VBS151
Dim arrayPoints(200)
Dim vArrayCoercion

954

'Variant for array Coercion

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

' Make the VBS Array compatibile with the OLE Automation
vArrayCoercion = (arrayPoints)
objTrendControl.DataXY = vArrayCoercion
' this array will occur in the control

Use of Controls from External Suppliers


If a non-WinCC control is used, it is possible that the properties provided by the control have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an external control supplier can be
accessed using the additional "object" property. Address the properties of an external control
supplier as follows:

Control.object.type

If you use the following form, the properties of the ScreenItem object are used in the case of
identical names:

Control.type

Double parameter
When using a Control which is not an internal WinCC control, it is possible that the event
prototypes contain a parameter with the name "Item". In this case, the name of the parameter
is renamed according to "ObjectItem" in the VBS prototype submitted. If this name already
exists, the name is differentiated by numbers being appended.

WinCC controls available


HMI Symbol Library
WinCC AlarmControl
WinCC Alarm Control (before WinCC V7)
WinCC Digital/Analog Clock
WinCC FunctionTrendControl
WinCC Function Trend Control (before WinCC V7)
WinCC Gauge Control
WinCC Media Control
WinCC OnlineTableControl
WinCC Online Table Control (before WinCC V7)
WinCC OnlineTrendControl

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

955

VBS Reference
2.3 Object types of the ScreenItem object
WinCC Online Trend Control (before WinCC V7)
WinCC Push Button Control
WinCC RulerControl
WinCC Slider Control
WinCC UserArchiveControl

See also
HMI Symbol Library (Page 253)
WinCC Slider Control (Page 281)
WinCC Push Button Control (Page 275)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Gauge Control (Page 264)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Digital/Analog Clock (Page 258)
WinCC Alarm Control (before WinCC V7) (Page 288)
WinCC UserArchiveControl (Page 284)
WinCC RulerControl (Page 278)
WinCC OnlineTrendControl (Page 271)
WinCC OnlineTableControl (Page 267)
WinCC FunctionTrendControl (Page 260)
WinCC AlarmControl (Page 255)

2.3.6.2

List of controls

Column object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the properties of the columns in the WinCC
UserArchiveControl.

956

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC UserArchiveControl (Page 284)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "colobj.ColumnName", the listing name "Column" is dropped:
"colobj.Name".
ColumnAlias (Page 367)

ColumnFlagUnique
(Page 369)

ColumnPosition (Page 371)

ColumnSort (Page 374)

ColumnAlign (Page 367)

ColumnHideText (Page 369)

ColumnPrecisions
(Page 371)

ColumnSortIndex
(Page 374)

ColumnAutoPrecisions
(Page 367)

ColumnHideTitleText
(Page 370)

ColumnReadAccess
(Page 372)

ColumnStartValue
(Page 375)

ColumnCaption (Page 368)

ColumnIndex (Page 370)

ColumnReadonly (Page 372)

ColumnStringLength
(Page 375)

ColumnCount (Page 368)

ColumnLeadingZeros
(Page 370)

ColumnRepos (Page 372)

ColumnTimeFormat
(Page 375)

ColumnDateFormat
(Page 368)

ColumnLength (Page 370)

ColumnShowDate
(Page 373)

ColumnType (Page 376)

ColumnDMVarName
(Page 368)

ColumnMaxValue
(Page 371)

ColumnShowIcon
(Page 373)

ColumnVisible (Page 376)

ColumnExponentialFormat
(Page 369)

ColumnMinValue (Page 371)

ColumnShowTitleIcon
(Page 374)

ColumnWriteAccess
(Page 377)

ColumnFlagNotNull
(Page 369)

ColumnName (Page 371)

See also
GetColumn method (Page 704)
GetColumnCollection method (Page 705)

HitlistColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "HitlistColumn" listing object to configure the message blocks used in the hitlist of
WinCC AlarmControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

957

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "hitlistobj.HitlistColumnName", the listing name
"HitlistColumn" is dropped: "hitlistobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
HitlistColumnAdd (Page 432)

HitlistColumnRepos (Page 433)

HitListMaxSourceItems (Page 434)

HitlistColumnCount (Page 432)

HitlistColumnSort (Page 433)

HitListMaxSourceItemsWarn
(Page 435)

HitlistColumnIndex (Page 432)

HitlistColumnSortIndex (Page 433)

HitListRelTime (Page 435)

HitlistColumnName (Page 432)

HitlistColumnVisible (Page 434)

HitListRelTimeFactor (Page 435)

HitlistColumnRemove (Page 432)

HitListDefaultSort (Page 434)

HitListRelTimeFactorType (Page 435)

See also
GetHitlistColumn method (Page 706)
GetHistlistColumnCollection method (Page 707)

MessageBlock object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "MessageBlock" listing object to configure the message blocks in WinCC
AlarmControl.

958

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "messageobj.MessageBlockName", the listing name
"MessageBlock" is dropped: "messageobj.Name".
MessageBlockAlign
(Page 481)

MessageBlockFlashOn
(Page 484)

MessageBlockLength
(Page 486)

MessageBlockShowIcon
(Page 487)

MessageBlockAutoPrecision
s (Page 482)

MessageBlockHideText
(Page 484)

MessageBlockName
(Page 486)

MessageBlockShowTitleIcon
(Page 487)

MessageBlockCaption
(Page 482)

MessageBlockHideTitleText
(Page 484)

MessageBlockPrecisions
(Page 486)

MessageBlockTextId
(Page 488)

MessageBlockCount
(Page 482)

MessageBlockID (Page 485)

MessageBlockSelected
(Page 486)

MessageBlockTimeFormat
(Page 488)

MessageBlockDateFormat

MessageBlockIndex
(Page 485)

MessageBlockShowDate
(Page 487)

MessageBlockType
(Page 488)

MessageBlockExponentialFo MessageBlockLeadingZeros
rmat (Page 483)
(Page 485)

See also
GetMessageBlock method (Page 708)
GetMessageBlockCollection method (Page 709)

MessageColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "MessageColumn" listing object to configure the message blocks used in the message
lists of WinCC AlarmControl.

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "messagecol.MessageColumnName", the listing name
"MessageColumn" is dropped: "messagecol.Name".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

959

VBS Reference
2.3 Object types of the ScreenItem object
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
MessageColumnAdd (Page 489)

MessageColumnName (Page 490)

MessageColumnSort (Page 491)

MessageColumnCount (Page 489)

MessageColumnRemove (Page 490)

MessageColumnSortIndex (Page 491)

MessageColumnIndex (Page 490)

MessageColumnRepos (Page 490)

MessageColumnVisible (Page 491)

See also
GetMessageColumn method (Page 710)
GetMessageColumnCollection method (Page 711)

OperatorMessage object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "OperatorMessage" listing object to configure the operator messages displayed in
WinCC AlarmControl.

Use in the controls


WinCC AlarmControl (Page 255)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "opmessobj.OperatorMessageName", the listing name
"OperatorMessage" is dropped: "opmessobj.Name".
OperatorMessageID (Page 503)

OperatorMessageSource5 (Page 506)

OperatorMessageSourceType3
(Page 509)

OperatorMessageIndex (Page 503)

OperatorMessageSource6 (Page 506)

OperatorMessageSourceType4
(Page 509)

OperatorMessageName (Page 504)

OperatorMessageSource7 (Page 507)

OperatorMessageSourceType5
(Page 509)

OperatorMessageNumber (Page 504)

OperatorMessageSource8 (Page 507)

OperatorMessageSourceType6
(Page 510)

OperatorMessageSelected (Page 505)

OperatorMessageSource9 (Page 507)

OperatorMessageSourceType7
(Page 510)

OperatorMessageSource1 (Page 505)

OperatorMessageSource10 (Page 508)

OperatorMessageSourceType8
(Page 510)

OperatorMessageSource2 (Page 505)

OperatorMessageSourceType1
(Page 508)

OperatorMessageSourceType9
(Page 511)

960

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
OperatorMessageSource3 (Page 505)

OperatorMessageSourceType2
(Page 508)

OperatorMessageSourceType10
(Page 511)

OperatorMessageSource4 (Page 506)

See also
GetOperatorMessage method (Page 713)
GetOperatorMessageCollection method (Page 714)

Row object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Row" listing object to access the rows of the table-based controls. The Row object
refers to the runtime data in the tables.

Use in the controls


WinCC AlarmControl (Page 255)

WinCC OnlineTableControl (Page 267)

WinCC RulerControl (Page 278)

WinCC UserArchiveControl (Page 284)

Available methods of the object


SelectAll (Page 780)

SelectRow (Page 781)

UnselectAll (Page 795)

UnselectRow (Page 796)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rowobj.RowCellCount", the listing name "Row" is dropped:
"rowobj.CellCount".
RowCellCount (Page 539)

RowCellText (Page 539)

RowCount (Page 539)

RowNumber (Page 540)

See also
GetRow method (Page 715)
GetRowCollection method (Page 716)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

961

VBS Reference
2.3 Object types of the ScreenItem object
GetSelectedRow method (Page 722)
GetSelectedRows method (Page 723)

RulerBlock object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Block" listing object to configure the blocks of WinCC RulerControl.

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rulerblockobj.BlockName", the listing name "Block" is
dropped: "rulerblockobj.Name".
BlockAlign (Page 336)

BlockHideText (Page 337)

BlockPrecisions (Page 339)

BlockAutoPrecisions (Page 336)

BlockHideTitleText (Page 338)

BlockShowDate (Page 340)

BlockCaption (Page 336)

BlockID

BlockShowIcon (Page 340)

BlockCount (Page 336)

BlockIndex (Page 339)

BlockShowTitleIcon (Page 340)

BlockDateFormat (Page 337)

BlockLength (Page 339)

BlockTimeFormat (Page 340)

BlockExponentialFormat (Page 337)

BlockName (Page 339)

BlockUseSourceFormat (Page 341)

See also
GetRulerBlock method (Page 717)
GetRulerBlockCollection method (Page 718)

RulerColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the columns of the ruler window in WinCC
RulerControl.

962

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rulercolobj.ColumnName", the listing name "Column" is
dropped: "rulercolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ColumnAdd (Page 367)

ColumnName (Page 371)

ColumnSort (Page 374)

ColumnCount (Page 368)

ColumnRemove (Page 372)

ColumnSortIndex (Page 374)

ColumnIndex (Page 370)

ColumnRepos (Page 372)

ColumnVisible (Page 376)

See also
GetRulerColumn method (Page 719)
GetRulerColumnCollection method (Page 720)

StatisticAreaColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the columns of the statistic area window in WinCC
RulerControl.

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "statareacolobj.ColumnName", the listing name "Column" is
dropped: "statareacolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

963

VBS Reference
2.3 Object types of the ScreenItem object
ColumnAdd (Page 367)

ColumnName (Page 371)

ColumnSort (Page 374)

ColumnCount (Page 368)

ColumnRemove (Page 372)

ColumnSortIndex (Page 374)

ColumnIndex (Page 370)

ColumnRepos (Page 372)

ColumnVisible (Page 376)

See also
GetStatisticAreaColumn method (Page 725)
GetStatisticAreaColumnCollection method (Page 726)

StatisticResultColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Column" listing object to configure the columns of the statistic window in WinCC
RulerControl.

Use in the controls


WinCC RulerControl (Page 278)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "statrescolobj.ColumnName", the listing name "Column" is
dropped: "statrescolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ColumnAdd (Page 367)

ColumnName (Page 371)

ColumnSort (Page 374)

ColumnCount (Page 368)

ColumnRemove (Page 372)

ColumnSortIndex (Page 374)

ColumnIndex (Page 370)

ColumnRepos (Page 372)

ColumnVisible (Page 376)

See also
GetStatisticResultColumn method (Page 727)
GetStatisticResultColumnCollection method (Page 728)

964

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

StatusbarElement object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "StatusbarElement" listing object to configure the properties of the statusbar of the
controls.

Use in the controls


WinCC AlarmControl (Page 255)

WinCC FunctionTrendControl
(Page 260)

WinCC OnlineTableControl (Page 267)

WinCC OnlineTrendControl (Page 271)

WinCC RulerControl (Page 278)

WinCC UserArchiveControl (Page 284)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "statusbarobj.StatusbarElementName", the listing name
"StatusbarElement" is dropped: "statusbarobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
StatusbarElementAdd (Page 574)

StatusbarElementIndex (Page 575)

StatusbarElementText (Page 577)

StatusbarElementAutoSize (Page 575)

StatusbarElementName (Page 576)

StatusbarElementTooltipText
(Page 577)

StatusbarElementCount (Page 575)

StatusbarElementRemove
(Page 576)

StatusbarElementUserDefined
(Page 577)

StatusbarElementIconId (Page 575)

StatusbarElementRename
(Page 576)

StatusbarElementVisible (Page 577)

StatusbarElementId (Page 575)

StatusbarElementRepos (Page 576)

StatusbarElementWidth (Page 578)

See also
GetStatusbarElement method (Page 729)
GetStatusbarElementCollection method (Page 730)

TimeAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

965

VBS Reference
2.3 Object types of the ScreenItem object
Use the "TimeAxis" listing object to configure the properties of the time axis in columns in the
WinCC OnlineTrendControl.

Use in the controls


WinCC OnlineTrendControl (Page 271)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "timeaxisobj.TimeAxisName", the listing name "TimeAxis" is
dropped: "timeaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
TimeAxisActualize

TimeAxisIndex (Page 591)

TimeAxisRepos (Page 593)

TimeAxisAdd (Page 588)

TimeAxisInTrendColor

TimeAxisShowDate (Page 593)

TimeAxisAlign (Page 589)

TimeAxisLabel (Page 591)

TimeAxisTimeFormat (Page 593)

TimeAxisBeginTime (Page 589)

TimeAxisMeasurePoints (Page 591)

TimeAxisTimeRangeBase (Page 594)

TimeAxisColor (Page 589)

TimeAxisName (Page 592)

TimeAxisTimeRangeFactor (Page 594)

TimeAxisCount (Page 589)

TimeAxisRangeType (Page 592)

TimeAxisTrendWindow (Page 594)

TimeAxisDateFormat (Page 590)

TimeAxisRemove (Page 592)

TimeAxisVisible (Page 594)

TimeAxisEndTime (Page 590)

TimeAxisRename (Page 592)

See also
GetTimeAxis method (Page 731)
GetTimeAxisCollection method (Page 732)

TimeColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "TimeColumn" listing object to configure the properties of the time column in WinCC
OnlineTrendControl.

966

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC OnlineTableControl (Page 267)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "timecolobj.TimeColumnName", the listing name
"TimeColumn" is dropped: "timecolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
TimeColumnActualize (Page 595)

TimeColumnHideText (Page 599)

TimeColumnShowDate (Page 601)

TimeColumnAdd (Page 596)

TimeColumnHideTitleText (Page 599)

TimeColumnShowIcon (Page 601)

TimeColumnAlign (Page 596)

TimeColumnIndex (Page 599)

TimeColumnShowTitleIcon (Page 602)

TimeColumnBackColor (Page 597)

TimeColumnLength (Page 599)

TimeColumnSort (Page 602)

TimeColumnBeginTime (Page 597)

TimeColumnMeasurePoints (Page 600) TimeColumnSortIndex (Page 602)

TimeColumnCaption (Page 597)

TimeColumnName (Page 600)

TimeColumnTimeFormat (Page 602)

TimeColumnCount (Page 597)

TimeColumnRangeType (Page 600)

TimeColumnTimeRangeBase
(Page 603)

TimeColumnDateFormat (Page 598)

TimeColumnRemove (Page 600)

TimeColumnTimeRangeFactor
(Page 603)

TimeColumnEndTime (Page 598)

TimeColumnRename (Page 601)

TimeColumnUseValueColumnColors
(Page 604)

TimeColumnForeColor (Page 598)

TimeColumnRepos (Page 601)

TimeColumnVisible (Page 604)

See also
GetTimeColumn method (Page 734)
GetTimeColumnCollection method (Page 735)

ToolbarButton object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "ToolbarButton" listing object to configure the properties of the toolbar of the controls.

Use in the controls


WinCC AlarmControl (Page 255)

WinCC FunctionTrendControl
(Page 260)

WinCC OnlineTableControl (Page 267)

WinCC OnlineTrendControl (Page 271)

WinCC RulerControl (Page 278)

WinCC UserArchiveControl (Page 284)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

967

VBS Reference
2.3 Object types of the ScreenItem object

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "toolbarobj.ToolbarButtonName", the listing name
"ToolbarButton" is dropped: "toolbarobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ToolbarButtonActive (Page 615)

ToolbarButtonId (Page 620)

ToolbarButtonRename (Page 622)

ToolbarButtonAdd (Page 616)

ToolbarButtonIndex (Page 620)

ToolbarButtonRepos (Page 622)

ToolbarButtonBeginGroup (Page 616)

ToolbarButtonLocked (Page 621)

ToolbarButtonTooltipText (Page 622)

ToolbarButtonCount (Page 620)

ToolbarButtonName (Page 621)

ToolbarButtonUserDefined (Page 622)

ToolbarButtonEnabled (Page 620)

ToolbarButtonPasswordLevel
(Page 621)

ToolbarButtonVisible (Page 623)

ToolbarButtonHotKey (Page 620)

ToolbarButtonRemove (Page 621)

See also
GetToolbarButton method (Page 736)
GetToolbarButtonCollection method (Page 737)

Trend object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Trend" listing object to configure the properties of the trends. The "InsertData" and
"RemoveData" methods are used to fill the trend with data or to delete the trend. The
"GetRulerData" method is used to access the data at a particular point of the trend.

Use in the controls


WinCC FunctionTrendControl (Page 260)

WinCC OnlineTrendControl (Page 271)

Available methods of the object


GetRulerData (Page 721)

968

InsertData (Page 753)

RemoveData (Page 777)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "trendobj.Trendname", the listing name "Trend" is dropped:
"trendobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
Properties in WinCC FunctionTrendControl and WinCC OnlineTrendControl
TrendAdd (Page 629)

TrendLineWidth (Page 635)

TrendRemove (Page 639)

TrendColor (Page 631)

TrendLowerLimit (Page 635)

TrendRename (Page 639)

TrendCount (Page 632)

TrendLowerLimitColor (Page 635)

TrendRepos (Page 639)

TrendExtendedColorSet

TrendLowerLimitColoring (Page 635)

TrendTrendWindow (Page 642)

TrendFill (Page 633)

TrendName (Page 636)

TrendUncertainColor (Page 642)

TrendFillColor (Page 633)

TrendPointColor (Page 636)

TrendUncertainColoring (Page 642)

TrendIndex (Page 633)

TrendPointStyle

TrendUpperLimit (Page 642)

TrendLabel (Page 634)

TrendPointWidth (Page 637)

TrendUpperLimitColor (Page 643)

TrendLineStyle (Page 634)

TrendProvider (Page 637)

TrendUpperLimitColoring (Page 643)

TrendLineType (Page 634)

TrendProviderCLSID (Page 638)

TrendVisible (Page 644)

Properties in WinCC OnlineTrendControl


TrendAutoRangeBeginTagName
(Page 630)

TrendAutoRangeSource (Page 631)

TrendValueAlignment

TrendAutoRangeBeginValue
(Page 630)

TrendSelectTagName (Page 639)

TrendValueAxis (Page 644)

TrendAutoRangeEndTagName
(Page 630)

TrendTagName (Page 640)

TrendValueUnit

TrendAutoRangeEndValue (Page 630)

TrendTimeAxis (Page 641)

Properties in the WinCC FunctionTrendControl


TrendActualize (Page 629)

TrendSelectTagNameX (Page 639)

TrendTimeRangeBase (Page 641)

TrendBeginTime (Page 631)

TrendSelectTagNameY (Page 640)

TrendTimeRangeFactor (Page 641)

TrendEndTime (Page 632)

TrendTagNameX (Page 640)

TrendXAxis (Page 651)

TrendMeasurePoints (Page 636)

TrendTagNameY (Page 641)

TrendYAxis (Page 651)

TrendRangeType

See also
GetTrend method (Page 738)
GetTrendCollection method (Page 739)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

969

VBS Reference
2.3 Object types of the ScreenItem object

TrendWindow object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "TrendWindow" listing object to configure the properties of the trend window.

Use in the controls


WinCC FunctionTrendControl (Page 260)

WinCC OnlineTrendControl (Page 271)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "trendwndobj.TrendWindowName", the listing name
"TrendWindow" is dropped: "trendwndobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
Properties in WinCC FunctionTrendControl and WinCC OnlineTrendControl
TrendWindowAdd (Page 644)

TrendWindowGridInTrendColor
(Page 646)

TrendWindowRulerColor (Page 648)

TrendWindowCoarseGrid (Page 645)

TrendWindowHorizontalGrid
(Page 646)

TrendWindowRulerLayer

TrendWindowCoarseGridColor
(Page 645)

TrendWindowIndex (Page 647)

TrendWindowRulerStyle (Page 648)

TrendWindowCount (Page 645)

TrendWindowName (Page 647)

TrendWindowRulerWidth (Page 649)

TrendWindowFineGrid (Page 645)

TrendWindowRemove (Page 647)

TrendWindowSpacePortion (Page 649)

TrendWindowFineGridColor
(Page 646)

TrendWindowRename (Page 647)

TrendWindowVerticalGrid (Page 650)

TrendWindowForegroundTrendGrid
(Page 646)

TrendWindowRepos (Page 648)

TrendWindowVisible (Page 650)

Properties in WinCC OnlineTrendControl


TrendWindowStatisticRulerColor
(Page 649)

TrendWindowStatisticRulerStyle
(Page 649)

TrendWindowStatisticRulerWidth
(Page 650)

See also
GetTrendWindow method (Page 741)
GetTrendWindowCollection method (Page 742)

970

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

ValueAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "ValueAxis" listing object to configure the properties of the value axis in WinCC
OnlineTrendControl.

Use in the controls


WinCC OnlineTrendControl (Page 271)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "valueaxisobj.ValueAxisName", the listing name "ValueAxis"
is dropped: "valueaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ValueAxisAdd (Page 666)

ValueAxisEndValue (Page 668)

ValueAxisRemove (Page 670)

ValueAxisAlign (Page 666)

ValueAxisExponentialFormat
(Page 668)

ValueAxisRename (Page 670)

ValueAxisAutoPrecisions (Page 667)

ValueAxisIndex (Page 668)

ValueAxisRepos (Page 670)

ValueAxisAutoRange (Page 667)

ValueAxisInTrendColor

ValueAxisScalingType (Page 671)

ValueAxisBeginValue (Page 667)

ValueAxisLabel (Page 669)

ValueAxisTrendWindow (Page 671)

ValueAxisColor (Page 667)

ValueAxisName (Page 669)

ValueAxisVisible (Page 671)

ValueAxisCount (Page 668)

ValueAxisPrecisions (Page 670)

See also
GetValueAxis method (Page 743)
GetValueAxisCollection method (Page 744)

ValueColumn object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "ValueColumn" listing object to configure the properties of the value column in WinCC
OnlineTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

971

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC OnlineTableControl (Page 267)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "valcolobj.ValueColumnName", the listing name
"ValueColumn" is dropped: "valcolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ValueColumnAdd (Page 671)

ValueColumnHideTitleText (Page 674)

ValueColumnRepos (Page 676)

ValueColumnAlign (Page 672)

ValueColumnIndex (Page 674)

ValueColumnSelectTagName
(Page 677)

ValueColumnAutoPrecisions
(Page 672)

ValueColumnLength (Page 675)

ValueColumnShowIcon (Page 677)

ValueColumnBackColor (Page 673)

ValueColumnName (Page 675)

ValueColumnShowTitleIcon (Page 677)

ValueColumnCaption (Page 673)

ValueColumnPrecisions (Page 675)

ValueColumnSort (Page 678)

ValueColumnCount (Page 673)

ValueColumnProvider (Page 675)

ValueColumnSortIndex (Page 678)

ValueColumnExponentialFormat
(Page 673)

ValueColumnProviderCLSID
(Page 676)

ValueColumnTagName (Page 678)

ValueColumnForeColor (Page 674)

ValueColumnRemove (Page 676)

ValueColumnTimeColumn (Page 679)

ValueColumnHideText (Page 674)

ValueColumnRename (Page 676)

ValueColumnVisible (Page 679)

See also
GetValueColumn method (Page 745)
GetValueColumnCollection method (Page 746)

XAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Xaxis" listing object to configure the properties of the X axis in WinCC
FunctionTrendControl.

972

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Use in the controls


WinCC FunctionTrendControl (Page 260)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "xaxisobj.XAxisName", the listing name "XAxis" is dropped:
"xaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
XAxisAdd (Page 686)

XAxisEndValue (Page 688)

XAxisRemove (Page 690)

XAxisAlign

XAxisExponentialFormat (Page 688)

XAxisRename (Page 692)

XAxisAutoPrecisions (Page 687)

XAxisIndex (Page 692)

XAxisRepos (Page 690)

XAxisAutoRange (Page 687)

XAxisInTrendColor

XAxisScalingType (Page 690)

XAxisBeginValue (Page 687)

XAxisLabel (Page 689)

XAxisTrendWindow (Page 691)

XAxisColor (Page 688)

XAxisName (Page 689)

XAxisVisible (Page 691)

XAxisCount (Page 692)

XAxisPrecisions (Page 690)

See also
GetXAxis method (Page 747)
GetXAxisCollection method (Page 749)

YAxis object (list)


Description
The listing of controls is a data container that can save a number of objects of the same type
(users can change the number).
Use the "Yaxis" listing object to configure the properties of the Y axis in WinCC
FunctionTrendControl.

Use in the controls


WinCC FunctionTrendControl (Page 260)

Available properties of the object


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "yaxisobj.YAxisName", the listing name "YAxis" is dropped:
"yaxisobj.Name".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

973

VBS Reference
2.3 Object types of the ScreenItem object
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
YAxisAdd (Page 686)

YAxisEndValue (Page 688)

YAxisRemove (Page 690)

YAxisAlign (Page 686)

YAxisExponentialFormat (Page 688)

YAxisRename (Page 693)

YAxisAutoPrecisions (Page 687)

YAxisIndex (Page 692)

YAxisRepos (Page 690)

YAxisAutoRange (Page 687)

YAxisInTrendColor (Page 689)

YAxisScalingType (Page 690)

YAxisBeginValue (Page 687)

YAxisLabel (Page 689)

YAxisTrendWindow (Page 691)

YAxisColor (Page 688)

YAxisName (Page 689)

YAxisVisible (Page 691)

YAxisCount (Page 692)

YAxisPrecisions (Page 690)

See also
GetYAxis method (Page 750)
GetYAxisCollection method (Page 751)

2.3.6.3

HMI Symbol Library

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "HMI Symbol Library"

Type Identifier in VBS


HMISymbolLibrary

Usage
In the following example, the object with the name "Control1" is moved 20 pixels to the right:

'VBS64
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +20

974

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Properties
This object type has the following properties:

See also
Left Property (Page 463)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
Stretch Property (Page 580)
Picture Property (Page 522)
Parent Property (Page 514)
ObjectName Property (Page 498)
Object Property (Page 497)
Layer Object (Page 136)
Height Property (Page 430)
ForeColor Property (Page 422)
Flip Property (Page 416)
Enabled Property (Page 394)
Cursor Property (Page 381)
BlinkColor Property (Page 335)
BackStyle Property (Page 326)
BackColor Property (Page 323)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

975

VBS Reference
2.3 Object types of the ScreenItem object

2.3.6.4

WinCC AlarmControl

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC AlarmControl" as
of WinCC V7.0.

Type Identifier in VBS


HMIAlarmControl

Available list objects


HitlistColumn (Page 236)

Row (Page 240)

MessageBlock (Page 237)

StatusbarElement (Page 244)

MessageColumn (Page 238)

ToolbarButton (Page 246)

OperatorColumn (Page 239)

Available Methods in VBS


Activate

GetOperatorMessageCollecti MoveToLastLine
on

ActivateDynamic

GetRow (Page 715)

MoveToLastPage

ShowHitList

AttachDB

GetRowCollection
(Page 716)

MoveToNextLine

ShowInfoText

CopyRows

GetSelectedRow (Page 722)

MoveToNextPage

ShowLockDialog

DeactivateDynamic

GetSelectedRows
(Page 723)

MoveToPreviousLine

ShowLockList

DetachDB

GetStatusbarElement

MoveToPreviousPage

Export

GetStatusbarElementCollecti Print
on

ShowMessageList

GetHitlistColumn

GetToolbarButton

QuitHorn

ShowPropertyDialog

GetHitlistColumnCollection

GetToolbarButtonCollection

QuitSelected

ShowSelectionDialog

GetMessageBlock

HideAlarm

QuitVisible

ShowShortTermArchiveList

GetMessageBlockCollection

LockAlarm

ShowComment

ShowSortDialog

976

ShowHideList

ShowLongTermArchiveList

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ShowDisplayOptionsDialog

ShowTimebaseDialog

GetMessageColumnCollectio MoveToFirstLine
n

GetMessageColumn

LoopInAlarm

ShowEmergencyQuitDialog

UnhideAlarm

GetOperatorMessage

ShowHelp

UnlockAlarm

MoveToFirstPage

Available Properties in VBS


If you access the properties with a listing object, you do not have to enter the name of the
listing. For example, when using "messagecol.MessageColumnName", the listing name
"MessageColumn" is dropped: "messagecol.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
Activate

HitListRelTime

OperatorMessageSource10

AllServer

HitListRelTimeFactor

OperatorMessageSourceTyp StatusbarElementText
e1

ApplyProjectSettings

HitListRelTimeFactorType

OperatorMessageSourceTyp StatusbarElementTooltipText
e2

AutoCompleteColumns

HorizontalGridLines

OperatorMessageSourceTyp StatusbarElementUserDefin
e3
ed

AutoCompleteRows

IconSpace

OperatorMessageSourceTyp StatusbarElementVisible
e4

AutoScroll

LineColor (Page 466)

OperatorMessageSourceTyp StatusbarElementWidth
e5

AutoSelectionColors

LineWidth (Page 467)

OperatorMessageSourceTyp StatusbarFontColor
e6

AutoSelectionRectColor

LongTermArchiveConsistenc OperatorMessageSourceTyp StatusbarShowTooltips


y
e7

BackColor

MessageBlockAlign

OperatorMessageSourceTyp StatusbarText
e8

BorderColor

MessageBlockAutoPrecision
s

OperatorMessageSourceTyp StatusbarUseBackColor
e9

BorderWidth

MessageBlockCaption

OperatorMessageSourceTyp StatusbarVisible
e10

Caption

MessageBlockCount

PageMode

TableColor

CellCut

MessageBlockDateFormat

PageModeMessageNumber

TableColor2

CellSpaceBottom

MessageBlockExponentialFo PrintJobName
rmat

TableForeColor

CellSpaceLeft

MessageBlockFlashOn

RowCellCount (Page 539)

TableForeColor2

CellSpaceRight

MessageBlockHideText

RowCellText (Page 539)

TimeBase

CellSpaceTop

MessageBlockHideTitleText

RowCount (Page 539)

TitleColor

Closeable

MessageBlockIndex

RowNumber (Page 540)

TitleCut

ColumnResize

MessageBlockLeadingZeros

RowScrollbar

TitleDarkShadowColor

ColumnTitleAlign

MessageBlockLength

RowTitleAlign

TitleForeColor

ColumnTitles

MessageBlockPrecisions

RowTitles

TitleGridLineColor

DefaultMsgFilterSQL

MessageBlockSelected

RTPersistence

TitleLightShadowColor

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

StatusbarElementRepos

977

VBS Reference
2.3 Object types of the ScreenItem object
DefaultSort

MessageBlockShowDate

RTPersistencePasswordLev
el

TitleSort

DefaultSort2

MessageBlockShowIcon

RTPersistenceType

TitleStyle

DefaultSort2Column

MessageBlockShowTitleIcon SelectedCellColor

ToolbarAlignment

DisplayOptions

MessageBlockTextId

SelectedCellForeColor

ToolbarBackColor

DoubleClickAction

MessageBlockType

SelectedRowColor

ToolbarButtonActive

ExportDirectoryChangeable

MessageColumnAdd

SelectedRowForeColor

ToolbarButtonAdd

ExportDirectoryname

MessageColumnCount

SelectedTitleColor

ToolbarButtonBeginGroup

ExportFileExtension

MessageColumnIndex

SelectedTitleForeColor

ToolbarButtonClick

ExportFilename

MessageColumnName

SelectionColoring

ToolbarButtonCount

ExportFilenameChangeable

MessageColumnRemove

SelectionRect

ToolbarButtonEnabled

ExportFormatGuid

MessageColumnRepos

SelectionRectColor

ToolbarButtonHotKey

ExportFormatName

MessageColumnSort

SelectionRectWidth

ToolbarButtonId

ExportParameters

MessageColumnSortIndex

SelectionType

ToolbarButtonIndex

ExportSelection

MessageColumnVisible

ServerNames

ToolbarButtonLocked

ExportShowDialog

MessageListType

ShowSortButton

ToolbarButtonName

ExportXML

Moveable

ShowSortIcon

ToolbarButtonPasswordLeve
l

Font

MsgFilterSQL

ShowSortIndex

ToolbarButtonRemove

GridLineColor

OperatorMessageID

ShowTitle

ToolbarButtonRename

GridLineWidth

OperatorMessageIndex

Sizeable

ToolbarButtonRepos

HitlistColumnAdd

OperatorMessageName

SkinName

ToolbarButtonTooltipText

HitlistColumnCount

OperatorMessageNumber

SortSequence

ToolbarButtonUserDefined

HitlistColumnIndex

OperatorMessageSelected

StatusbarBackColor

ToolbarButtonVisible

HitlistColumnName

OperatorMessageSource1

StatusbarElementAdd

ToolbarShowTooltips

HitlistColumnRemove

OperatorMessageSource2

StatusbarElementAutoSize

ToolbarUseBackColor

HitlistColumnRepos

OperatorMessageSource3

StatusbarElementCount

ToolbarUseHotKeys

HitlistColumnSort

OperatorMessageSource4

StatusbarElementIconId

ToolbarVisible

HitlistColumnSortIndex

OperatorMessageSource5

StatusbarElementId

UseMessageColor

HitlistColumnVisible

OperatorMessageSource6

StatusbarElementIndex

UseSelectedTitleColor

HitListDefaultSort

OperatorMessageSource7

StatusbarElementName

UseTableColor2

HitListMaxSourceItems

OperatorMessageSource8

StatusbarElementRemove

VerticalGridLines

HitListMaxSourceItemsWarn

OperatorMessageSource9

StatusbarElementRename

Example
A selection of messages is defined in an existing WinCC AlarmControl. The column properties
are configured in the script.
Requirements
A "WinCC AlarmControl" with the name "Control1" has already been inserted in a process
picture in Graphics Designer. The picture "C_015_Native_Alarms_Sel.pdl" from the demo
project was used for this example.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.

978

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
You have already configured messages in your project. Or you are using the demo project
from which we have taken the messages used for the example.
Messages have already been triggered in Runtime. The buttons "incoming" and "outgoing"
were clicked in the demo project.

'VBS366
Sub OnClick(ByVal Item)
Dim objControl
Dim objMessColumn
Dim objMessBlock
Set objControl = ScreenItems("Control1")
objControl.ApplyProjectSettings = False
Set objMessBlock = objControl.GetMessageBlock("Date")
objMessBlock.DateFormat = "dd.MM.yy"
Set objMessColumn = objControl.GetMessageColumn("Time")
objMessColumn.Visible = False
objControl.MsgFilterSQL = "MSGNR >= 5 AND Priority = 0"
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)

2.3.6.5

WinCC Digital/Analog Clock

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Digital/Analog
Clock"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

979

VBS Reference
2.3 Object types of the ScreenItem object

Type Identifier in VBS


HMIClock

Usage
In the following example, the object with the name "Control1" is moved 11 pixels to the right:

'VBS55
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +11

See also
Parent Property (Page 514)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
Ticks Property (Page 587)
TicksColor Property (Page 587)
SquareExtent Property (Page 572)
SecondNeedleWidth Property (Page 549)
SecondNeedleHeight Property (Page 549)
Picture Property (Page 522)
ObjectName Property (Page 498)
Object Property (Page 497)
MinuteNeedleWidth Property (Page 493)
MinuteNeedleHeight Property (Page 492)
LocaleID Property (Page 469)
Left Property (Page 463)
Layer Object (Page 136)
HourNeedleWidth Property (Page 437)

980

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
HourNeedleHeight Property (Page 436)
Height Property (Page 430)
Handtype Property (Page 430)
HandFillColor Property (Page 429)
ForeColor Property (Page 422)
Font property (before WinCC V7) (Page 418)
FocusRect Property (Page 417)
Enabled Property (Page 394)
BackStyle Property (Page 326)
BackColor Property (Page 323)
Analog Property (Page 313)

2.3.6.6

WinCC FunctionTrendControl

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC
FunctionTrendControl" as of WinCC V7.0.

Type Identifier in VBS


HMIFunctionTrendControl

Available list objects


StatusbarElement (Page 244)

Trend (Page 247)

XAxis (Page 251)

ToolbarButton (Page 246)

TrendWindow (Page 249)

YAxis (Page 252)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

981

VBS Reference
2.3 Object types of the ScreenItem object

Methods available in VBS


Activate

GetToolbarButtonCollectio
n

MoveAxis

ShowTrendSelection

ActivateDynamic GetTrend

NextTrend

StartStopUpdate

AttachDB

GetTrendCollection

OneToOneView

ZoomArea

DeactivateDyna
mic

GetTrendWindow

PreviousTrend

ZoomInOut

DetachDB

GetTrendWindowCollection Print

ZoomInOutX

Export

GetXAxis

ShowHelp

ZoomInOutY

GetStatusbarEle
ment

GetXAxisCollection

ShowPropertyDialog

ZoomMove

GetStatusbarEle
mentCollection

GetYAxis

ShowTagSelection

GetToolbarButto
n

GetYAxisCollection

ShowTimeSelection

Properties available in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "xaxisobj.XAxisName", the listing name "XAxis" is dropped:
"xaxisobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
BackColor

StatusbarElementTooltipText TrendLineWidth

TrendWindowVerticalGrid

BorderColor

StatusbarElementUserDefin
ed

TrendLowerLimit

TrendWindowVisible

BorderWidth

StatusbarElementVisible

TrendLowerLimitColor

TrendXAxis

Caption

StatusbarElementWidth

TrendLowerLimitColoring

TrendYAxis

Closeable

StatusbarFontColor

TrendMeasurePoints

UseTrendNameAsLabel

ConnectTrendWindows

StatusbarShowTooltips

TrendName

XAxisAdd

ExportDirectoryChangeable

StatusbarText

TrendPointColor

XAxisAlign

ExportDirectoryname

StatusbarUseBackColor

TrendPointStyle

XAxisAutoPrecisions

ExportFileExtension

StatusbarVisible

TrendPointWidth

XAxisAutoRange

ExportFilename

TimeBase

TrendProvider

XAxisBeginValue

ExportFilenameChangeable

ToolbarAlignment

TrendProviderCLSID

XAxisColor

ExportFormatGuid

ToolbarBackColor

TrendRangeType

XAxisCount

ExportFormatName

ToolbarButtonActive

TrendRemove

XAxisEndValue

ExportSelection

ToolbarButtonAdd

TrendRename

XAxisExponentialFormat

ExportShowDialog

ToolbarButtonBeginGroup

TrendRepos

XAxisIndex

ExportParameters

ToolbarButtonClick

TrendSelectTagNameX

XAxisInTrendColor

982

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ExportXML

ToolbarButtonCount

TrendSelectTagNameY

XAxisLabel

Font

ToolbarButtonEnabled

TrendTagNameX

XAxisName

GraphDirection

ToolbarButtonHotKey

TrendTagNameY

XAxisPrecisions

LineColor

ToolbarButtonId

TrendTimeRangeBase

XAxisRemove

LineWidth

ToolbarButtonIndex

TrendTimeRangeFactor

XAxisRename

LoadDataImmediately

ToolbarButtonLocked

TrendTrendWindow

XAxisRepos

Moveable

ToolbarButtonName

TrendUncertainColor

XAxisScalingType

Online

ToolbarButtonPasswordLeve TrendUncertainColoring
l

XAxisTrendWindow

PrintJobName

ToolbarButtonRemove

TrendUpperLimit

XAxisVisible

RTPersistence

ToolbarButtonRename

TrendUpperLimitColor

XAxisAdd

RTPersistencePasswordLev
el

ToolbarButtonRepos

TrendUpperLimitColoring

XAxisAlign

RTPersistenceType

ToolbarButtonTooltipText

TrendVisible

XAxisAutoPrecisions

ShowRuler

ToolbarButtonUserDefined

TrendWindowAdd

XAxisAutoRange

ShowRulerInAxis

ToolbarButtonVisible

TrendWindowCoarseGrid

XAxisBeginValue

ShowScrollbars

ToolbarShowTooltips

TrendWindowCount

XAxisColor

ShowTitle

ToolbarUseBackColor

TrendWindowCoarseGridCol YAxisCount
or

Sizeable

ToolbarUseHotKeys

TrendWindowFineGrid

XAxisEndValue

ShowTrendIcon

ToolbarVisible

TrendWindowFineGridColor

XAxisExponentialFormat

SkinName

TrendActualize

TrendWindowForegroundTre YAxisIndex
ndGrid

StatusbarBackColor

TrendAdd

TrendWindowGridInTrendCo XAxisInTrendColor
lor

StatusbarElementAdd

TrendBeginTime

TrendWindowHorizontalGrid

XAxisLabel

StatusbarElementAutoSize

TrendColor

TrendWindowIndex

XAxisName

StatusbarElementCount

TrendCount

TrendWindowName

XAxisPrecisions

StatusbarElementIconId

TrendEndTime

TrendWindowRemove

XAxisRemove

StatusbarElementId

TrendExtendedColorSet

TrendWindowRename

YAxisRename

StatusbarElementIndex

TrendFill

TrendWindowRepos

XAxisRepos

StatusbarElementName

TrendFillColor

TrendWindowRulerColor

XAxisScalingType

StatusbarElementRemove

TrendIndex

TrendWindowRulerLayer

XAxisTrendWindow

StatusbarElementRename

TrendLabel

TrendWindowRulerStyle

XAxisVisible

StatusbarElementRepos

TrendLineStyle

TrendWindowRulerWidth

StatusbarElementText

TrendLineType

TrendWindowSpacePortion

Examples
A trend is displayed in a WinCC FunctionTrendControl that is linked with a user archive.
Different properties are configured for the trend in the script. The "StartID" of the user archive
and the number of measurement points is changed regarding data connection.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

983

VBS Reference
2.3 Object types of the ScreenItem object
Requirements
A "WinCC FunctionTrendControl" with the name "Control1" is inserted in a process picture
in Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured a user archive in your project. Or you are using the demo
project from which we have taken the user archive for the example.

'VBS363
Sub OnClick(ByVal Item)
Dim objFXControl
Dim objTrendWindow
Dim objTrend
Dim objXAxis
Dim objYAxis
Dim startID
Dim FXServerDataX(3)
Dim FXServerDataY(3)
' create reference to FXControl
Set objFXControl = ScreenItems("Control1")
' create reference to new window, x and y axis
Set objTrendWindow = objFXControl.GetTrendWindowCollection.AddItem("myWindow")
Set objXAxis = objFXControl.GetXAxisCollection.AddItem("myXAxis")
Set objYAxis = objFXControl.GetYAxisCollection.AddItem("myYAxis")
' assign x and y axis to the window
objXAxis.TrendWindow = objTrendWindow.Name
objYAxis.TrendWindow = objTrendWindow.Name
' add new trend
Set objTrend = objFXControl.GetTrendCollection.AddItem("myTrend1")
' configure trend data connection (UserArchive)
objTrend.Provider = 3
startID = CLng(4)
FXServerDataX(0) = "Setpoint"
FXServerDataX(1) = "ParabelX"
FXServerDataX(3) = startID
FXServerDataY(0) = "Setpoint"
FXServerDataY(1) = "ParabelY"
FXServerDataY(3) = startID
objTrend.MeasurePoints = 50
objTrend.SetTagName "Setpoint\ParabelX", "Setpoint\ParabelY", FXServerDataX, FXServerDataY
' assign trend properties
objTrend.Color = RGB(255,0,0)
objTrend.PointStyle = 1
objTrend.TrendWindow = objTrendWindow.Name
objTrend.XAxis = objXAxis.Name
objTrend.YAxis = objYAxis.Name
End Sub

984

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)
ServerDataX (Page 556)
ServerDataY (Page 556)

2.3.6.7

WinCC Gauge Control

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Gauge Control"

Type Identifier in VBS


HMIGauge

Usage
In the following example, the object with the name "Control1" is moved 14 pixels to the right:

'VBS58
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +14

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

985

VBS Reference
2.3 Object types of the ScreenItem object

See also
WarningColor Property (Page 681)
Object Property (Page 497)
BackColor Property (Page 323)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)
Width Property (Page 682)
Warning Property (Page 681)
Visible Property (Page 680)
ValueMin Property (Page 679)
ValueMax Property (Page 679)
ValueColumnAlignment Property (Page 672)
UnitText Property (Page 657)
UnitOffset Property (Page 657)
UnitFont Property (Page 656)
UnitColor Property (Page 656)
Type Property (Page 651)
Top Property (Page 627)
TicWidth Property (Page 586)
TicTextOffset Property (Page 586)
TicTextColor Property (Page 586)
TicOffset Property (Page 585)
TicFont Property (Page 585)
TicColor Property (Page 585)
ShowWarning Property (Page 565)
ShowPeak Property (Page 560)
ShowNormal Property (Page 559)
ShowDecimalPoint Property (Page 559)
ShowDanger Property (Page 559)
Rectangular Property (Page 535)
Parent Property (Page 514)
ObjectName Property (Page 498)

986

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
NormalColor Property (Page 496)
NeedleColor Property (Page 496)
LocaleID Property (Page 469)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FrameScale Property (Page 424)
FramePicture Property (Page 424)
FrameColor Property (Page 423)
Enabled Property (Page 394)
Delta Property (Page 389)
DangerColor Property (Page 383)
CenterScale Property (Page 354)
CenterColor Property (Page 354)
CaptionOffset Property (Page 352)
CaptionFont Property (Page 352)
Caption Property (Page 351)
CaptionColor Property (Page 352)
BorderWidth Property (Page 344)
BevelWidth Property (Page 334)
BevelOuter Property (Page 334)
BevelInner Property (Page 333)
BackStyle Property (Page 326)
BackgroundPicture Property (Page 326)
AngleMin Property (Page 314)
AngleMax Property (Page 314)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

987

VBS Reference
2.3 Object types of the ScreenItem object

2.3.6.8

WinCC Media Control

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the "WinCC Media Control" graphic object as
of WinCC V7.0.
Object Type of ScreenItem Object. Represents the "WinCC Media Control" graphic object as
of WinCC V7.0.

Type Identifier in VBS


HMIMediaControl

Usage
In the following example, the object with the name "Control1" is moved 16 pixels to the right:

'VBS60
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left 16

2.3.6.9

WinCC OnlineTableControl

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP

988

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Object Type of ScreenItem Object. Represents the graphic object "WinCC
OnlineTableControl" as of WinCC V7.0.

Type Identifier in VBS


HMIOnlineTableControl

Available list objects


Row (Page 240)

ToolbarButton (Page 246)

StatusbarElement (Page 244)

ValueColumn (Page 250)

TimeColumn (Page 245)

Available Methods in VBS


Activate

GetRow (Page 715)

GetToolbarButtonCollection

Print

ActivateDynamic

GetRowCollection
(Page 716)

GetValueColumn

SelectedStatisticArea

AttachDB

GetSelectedRow (Page 722)

GetValueColumnCollection

ShowColumnSelection

CalculateStatistic

GetSelectedRows
(Page 723)

MoveToFirst

ShowHelp

CopyRows

GetStatusbarElement

MoveToLast

ShowPropertyDialog

DeactivateDynamic

GetStatusbarElementCollecti MoveToNext
on

ShowTagSelection

DetachDB

GetTimeColumn

MoveToPrevious

ShowTimeSelection

Edit

GetTimeColumnCollection

NextColumn

StartStopUpdate

Export

GetToolbarButton

PreviousColumn

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "timecolobj.TimeColumnName", the listing name
"TimeColumn" is dropped: "timecolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
AutoCompleteColumns

RTPersistence

TimeColumnAdd

ToolbarButtonId

AutoCompleteRows

RTPersistencePasswordLev
el

TimeColumnAlign

ToolbarButtonIndex

AutoSelectionColors

RTPersistenceType

TimeColumnBackColor

ToolbarButtonLocked

AutoSelectionRectColor

SelectedCellColor

TimeColumnBeginTime

ToolbarButtonName

BackColor

SelectedCellForeColor

TimeColumnCaption

ToolbarButtonPasswordLeve
l

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

989

VBS Reference
2.3 Object types of the ScreenItem object
BorderColor

SelectedRowColor

TimeColumnCount

ToolbarButtonRemove

BorderWidth

SelectedRowForeColor

TimeColumnDateFormat

ToolbarButtonRename

Caption

SelectedTitleColor

TimeColumnEndTime

ToolbarButtonRepos

CellCut

SelectedTitleForeColor

TimeColumnForeColor

ToolbarButtonTooltipText

CellSpaceBottom

SelectionColoring

TimeColumnHideText

ToolbarButtonUserDefined

CellSpaceLeft

SelectionRect

TimeColumnHideTitleText

ToolbarButtonVisible

CellSpaceRight

SelectionRectColor

TimeColumnIndex

ToolbarShowTooltips

CellSpaceTop

SelectionRectWidth

TimeColumnLength

ToolbarUseBackColor

Closeable

SelectionType

TimeColumnMeasurePoints

ToolbarUseHotKeys

ColumnResize

ShowSortButton

TimeColumnName

ToolbarVisible

ColumnScrollbar

ShowSortIcon

TimeColumnRangeType

UseColumnBackColor

ColumnTitleAlign

ShowSortIndex

TimeColumnRemove

UseColumnForeColor

ColumnTitles

ShowTitle

TimeColumnRename

UseSelectedTitleColor

EnableEdit

Sizeable

TimeColumnRepos

UseTableColor2

ExportDirectoryChangeable

SkinName

TimeColumnShowDate

ValueColumnAdd

ExportDirectoryname

SortSequence

TimeColumnShowIcon

ValueColumnAlign

ExportFileExtension

StatusbarBackColor

TimeColumnShowTitleIcon

ValueColumnAutoPrecisions

ExportFilename

StatusbarElementAdd

TimeColumnSort

ValueColumnBackColor

ExportFilenameChangeable

StatusbarElementAutoSize

TimeColumnSortIndex

ValueColumnCaption

ExportFormatGuid

StatusbarElementCount

TimeColumnTimeFormat

ValueColumnCount

ExportFormatName

StatusbarElementIconId

TimeColumnTimeRangeBas
e

ValueColumnExponentialFor
mat

ExportParameters

StatusbarElementId

TimeColumnTimeRangeFact ValueColumnForeColor
or

ExportSelection

StatusbarElementIndex

TimeColumnUseValueColum ValueColumnHideText
nColors

ExportShowDialog

StatusbarElementName

TimeColumnVisible

ValueColumnHideTitleText

ExportXML

StatusbarElementRemove

TimeStepBase

ValueColumnIndex

Font

StatusbarElementRename

TimeStepFactor

ValueColumnLength

GridLineColor

StatusbarElementRepos

TitleColor

ValueColumnName

GridLineWidth

StatusbarElementText

TitleCut

HorizontalGridLines

StatusbarElementTooltipText TitleDarkShadowColor

ValueColumnProvider

IconSpace

StatusbarElementUserDefin
ed

TitleForeColor

ValueColumnProviderCLSID

LineColor

StatusbarElementVisible

TitleGridLineColor

ValueColumnRemove

LineWidth

StatusbarElementWidth

TitleLightShadowColor

ValueColumnRename

LoadDataImmediately

StatusbarFontColor

TitleSort

ValueColumnRepos

Moveable

StatusbarShowTooltips

TitleStyle

ValueColumnSelectTagNam
e

Online

StatusbarText

ToolbarAlignment

ValueColumnShowIcon

PrintJobName

StatusbarUseBackColor

ToolbarBackColor

ValueColumnShowTitleIcon

RowCellCount (Page 539)

StatusbarVisible

ToolbarButtonActive

ValueColumnSort

RowCellText (Page 539)

TableColor

ToolbarButtonAdd

ValueColumnSortIndex

RowCount (Page 539)

TableColor2

ToolbarButtonBeginGroup

ValueColumnState

990

ValueColumnPrecisions

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
RowNumber (Page 540)

TableForeColor

ToolbarButtonClick

ValueColumnTagName

RowScrollbar

TableForeColor2

ToolbarButtonCount

ValueColumnTimeColumn

RowTitleAlign

TimeBase

ToolbarButtonEnabled

ValueColumnVisible

RowTitles

TimeColumnActualize

ToolbarButtonHotKey

VerticalGridLines

Example
An additional column is added in an existing WinCC OnlineTableControl that is linked with an
archive tag. Different properties are configured for the control and the column in the script.
Requirement
A "WinCC OnlineTableControl" with the name "Control1" has already been inserted in a
process picture in Graphics Designer. The control consists of a time column and three value
columns. The picture "B_025_V7_Arch_TableControl.PDL" from the demo project was used
for this example.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured archives and archive tags in your project. Or you are using
the demo project from which we have taken the archive for the example.

VBS362
Sub OnClick(ByVal Item)
Dim objControl
Dim objTimeColumn
Dim objValueColumn
Set objControl = ScreenItems("Control1")
' Control wide specification
objControl.ColumnResize = False
objControl.TimeBase = 1
objControl.TimeColumnTimeFormat = "HH:mm:ss tt"
objControl.TimeColumnLength = 20
' properties for Time column
Set objTimeColumn = objControl.GetTimeColumn("Time column 1")
objTimeColumn.DateFormat = "dd/MM/yy"
' properties for a new 4th value column with connection to archive tag "Trend_4"
Set objValueColumn = objControl.GetValueColumnCollection.AddItem("Trend 4")
objValueColumn.Caption = "Trend 4"
objValueColumn.Length = 10
objValueColumn.Align = 1
objValueColumn.Provider = 1
objValueColumn.TagName = "G_Archive\Trend_4"
objValueColumn.TimeColumn = "Time column 1"
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

991

VBS Reference
2.3 Object types of the ScreenItem object

See also
Controls (Page 232)

2.3.6.10

WinCC OnlineTrendControl

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC
OnlineTrendControl" as of WinCC V7.0.

Type Identifier in VBS


HMIOnlineTrendControl

Available list objects


StatusbarElement (Page 244)

ToolbarButton (Page 246)

TrendWindow (Page 249)

TimeAxis (Page 244)

Trend (Page 247)

ValueAxis (Page 250)

Available Methods in VBS


MoveToFirst

ShowPropertyDialog

ActivateDynamic GetToolbarButton
method
(Page 736)

Activate

MoveToLast

ShowTagSelection

AttachDB
method

GetToolbarButtonCollectio
n (Page 737)

MoveToNext

ShowTimeSelection

CalculateStatisti
c

GetTrend

MoveToPrevious

ShowTrendSelection

DeactivateDyna
mic

GetTrendCollection

NextTrend

StartStopUpdate

DetachDB

GetTrendWindow

OneToOneView

ZoomArea

Export

GetTrendWindowCollection PreviousTrend

ZoomInOut

GetStatusbarEle
ment

GetValueAxis

ZoomInOutTime

992

GetTimeAxisCollection

Print

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
GetStatusbarEle
mentCollection

GetValueAxisCollection

ShowHelp

ZoomInOutValues

GetTimeAxis

MoveAxis

ShowPercentageAxis

ZoomMove

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "trendobj.Trendname", the listing name "Trend" is dropped:
"trendobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
BackColor

StatusbarElementRepos

ToolbarButtonRemove

TrendValueUnit

BorderColor

StatusbarElementText

ToolbarButtonRename

TrendVisible

BorderWidth

StatusbarElementTooltipText ToolbarButtonRepos

TrendWindowAdd

Caption

StatusbarElementUserDefin
ed

ToolbarButtonTooltipText

TrendWindowCoarseGrid

Closeable

StatusbarElementVisible

ToolbarButtonUserDefined

TrendWindowCoarseGridCol
or

ConnectTrendWindows

StatusbarElementWidth

ToolbarButtonVisible

TrendWindowCount

ExportDirectoryChangeable

StatusbarFontColor

ToolbarShowTooltips

TrendWindowFineGrid

ExportDirectoryname

StatusbarShowTooltips

ToolbarUseBackColor

TrendWindowFineGridColor

ExportFileExtension

StatusbarText

ToolbarUseHotKeys

TrendWindowForegroundTre
ndGrid

ExportFilename

StatusbarUseBackColor

ToolbarVisible

TrendWindowGridInTrendCo
lor

ExportFilenameChangeable

StatusbarVisible

TrendAdd

TrendWindowHorizontalGrid

ExportFormatGuid

TimeAxisActualize

TrendAutoRangeBeginTagN
ame

TrendWindowIndex

ExportFormatName

TimeAxisAdd

TrendAutoRangeBeginValue TrendWindowName

ExportParameters

TimeAxisAlign

TrendAutoRangeEndTagNa
me

TrendWindowRemove

ExportSelection

TimeAxisBeginTime

TrendAutoRangeEndValue

TrendWindowRename

ExportShowDialog

TimeAxisColor

TrendAutoRangeSource

TrendWindowRepos

ExportXML

TimeAxisCount

TrendColor

TrendWindowRulerColor

Font

TimeAxisDateFormat

TrendCount

TrendWindowRulerLayer

GraphDirection

TimeAxisEndTime

TrendExtendedColorSet

TrendWindowRulerStyle

LineColor

TimeAxisIndex

TrendFill

TrendWindowRulerWidth

LineWidth

TimeAxisInTrendColor

TrendFillColor

TrendWindowSpacePortion

LoadDataImmediately

TimeAxisLabel

TrendIndex

TrendWindowStatisticRulerC
olor

Moveable

TimeAxisMeasurePoints

TrendLabel

TrendWindowStatisticRulerS
tyle

Online

TimeAxisName

TrendLineStyle

TrendWindowStatisticRuler
Width

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

993

VBS Reference
2.3 Object types of the ScreenItem object
PercentageAxis

TimeAxisRangeType

TrendLineType

TrendWindowVerticalGrid

PercentageAxisAlign

TimeAxisRemove

TrendLineWidth

TrendWindowVisible

PercentageAxisColor

TimeAxisRename

TrendLowerLimit

UseTrendNameAsLabel

PrintJobName

TimeAxisRepos

TrendLowerLimitColor

ValueAxisAdd

RTPersistence

TimeAxisShowDate

TrendLowerLimitColoring

ValueAxisAlign

RTPersistencePasswordLev
el

TimeAxisTimeFormat

TrendName

ValueAxisAutoPrecisions

RTPersistenceType

TimeAxisTimeRangeBase

TrendPointColor

ValueAxisAutoRange

ShowRuler

TimeAxisTimeRangeFactor

TrendPointStyle

ValueAxisBeginValue

ShowRulerInAxis

TimeAxisTrendWindow

TrendPointWidth

ValueAxisColor

ShowScrollbars

TimeAxisVisible

TrendProvider

ValueAxisCount

ShowStatisticRuler

TimeBase

TrendProviderCLSID

ValueAxisEndValue

ShowTitle

ToolbarAlignment

TrendRemove

ValueAxisExponentialFormat

ShowTrendIcon

ToolbarBackColor

TrendRename

ValueAxisIndex

Sizeable

ToolbarButtonActive

TrendRepos

ValueAxisInTrendColor

SkinName

ToolbarButtonAdd

TrendSelectTagName

ValueAxisLabel

StatusbarBackColor

ToolbarButtonBeginGroup

TrendTagName

ValueAxisName

StatusbarElementAdd

ToolbarButtonClick

TrendTimeAxis

ValueAxisPrecisions

StatusbarElementAutoSize

ToolbarButtonCount

TrendTrendWindow

ValueAxisRemove

StatusbarElementCount

ToolbarButtonEnabled

TrendUncertainColor

ValueAxisRename

StatusbarElementIconId

ToolbarButtonHotKey

TrendUncertainColoring

ValueAxisRepos

StatusbarElementId

ToolbarButtonId

TrendUpperLimit

ValueAxisScalingType

StatusbarElementIndex

ToolbarButtonIndex

TrendUpperLimitColor

ValueAxisTrendWindow

StatusbarElementName

ToolbarButtonLocked

TrendUpperLimitColoring

ValueAxisVisible

StatusbarElementRemove

ToolbarButtonName

TrendValueAlignment

StatusbarElementRename

ToolbarButtonPasswordLeve TrendValueAxis
l

Example
Three trends are displayed in a WinCC OnlineTrendControl that are linked with archive tags.
Different properties are configured for the trends in the script.
Requirements
A "WinCC OnlineTrendControl" with the name "Control1" is inserted in a process picture
in Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured archives and archive tags in your project. Or you are using
the demo project from which we have taken the archives for the example.

'VBS361
Sub OnClick(ByVal Item)

994

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Dim objTrendControl
Dim objTrendWindow
Dim objTimeAxis
Dim objValueAxis
Dim objTrend
'create reference to TrendControl
Set objTrendControl = ScreenItems("Control1")
'create reference to new window, time and value axis
Set objTrendWindow = objTrendControl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = objTrendControl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValueAxis = objTrendControl.GetValueAxisCollection.AddItem("myValueAxis")
'assign time and value axis to the window
objTimeAxis.TrendWindow = objTrendWindow.Name
objValueAxis.TrendWindow = objTrendWindow.Name
' assign properties to trendwindow
objTrendWindow.HorizontalGrid = False
' add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend1")
objTrend.Provider = 1
objTrend.TagName = "G_Archive\Trend_1"
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
objTrend.Color = RGB(255,0,0)
objTrend.PointStyle = 0
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend2")
objTrend.Provider = 1
objTrend.TagName = "G_Archive\Trend_2"
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
objTrend.Color = RGB(0,255,0)
objTrend.LineWidth = 3
'add new trend and assign properties
Set objTrend = objTrendControl.GetTrendCollection.AddItem("myTrend3")
objTrend.Provider = 1
objTrend.TagName = "G_Archive\Trend_3"
objTrend.TrendWindow = objTrendWindow.Name
objTrend.TimeAxis = objTimeAxis.Name
objTrend.ValueAxis = objValueAxis.Name
objTrend.Color = RGB(0,0,255)
objTrend.LineType = 2
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

995

VBS Reference
2.3 Object types of the ScreenItem object

See also
Controls (Page 232)

2.3.6.11

WinCC Push Button Control

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Push Button Control"

Type Identifier in VBS


HMIButton

Usage
In the following example, the object with the name "Control1" is moved 17 pixels to the right:

'VBS61
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +17

Note
The events KeyDown, KeyUp and KeyPress cannot be addressed by VBS. If it is required to
make controls dynamic with the help of VBS, no parameter must be declared with ByRef.

Notes on Error Handling


Buttons and pushbuttons are mapped in the object model to an "HMIButton" type. Since the
objects have different properties, the availability of the property (dynamic type compilation in

996

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Runtime) should be queried via an exception measure. The exception measure is activated
for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

'VBS62
Dim objScreenItem
On Error Resume Next
'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = "HMIButton" Then
'
'=== Property "Text" available only for Standard-Button
objScreenItem.Text = "Windows"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Windows-Button" & vbCrLf
Err.Clear
'Delete error message
End If
'
'=== Property "Caption" available only for PushButton
objScreenItem.Caption = "Push"
If 0 <> Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & ": no Control" & vbCrLf

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

997

VBS Reference
2.3 Object types of the ScreenItem object

Err.Clear
End If
End If
Next
On Error Goto 0

'Deactivation of errorhandling

See also
Properties (Page 303)
FontName Property (Page 420)
Activate Method (Page 696)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Transparent Property (Page 629)
Top Property (Page 627)
PictureUnselected Property (Page 525)
PictureSelected Property (Page 524)
Parent Property (Page 514)
Outline Property (Page 513)
ObjectName Property (Page 498)
Object Property (Page 497)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
FrameWidth Property (Page 425)
FrameColorUp Property (Page 424)
FrameColorDown Property (Page 423)
ForeColor Property (Page 422)
FontUnderline Property (Page 421)
FontStrikeThru Property (Page 421)
FontSize Property (Page 420)
FontItalic Property (Page 419)
Font property (before WinCC V7) (Page 418)

998

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
FontBold Property (Page 419)
FocusRect Property (Page 417)
Enabled Property (Page 394)
Caption Property (Page 351)
BackColor Property (Page 323)
AutoSize Property (Page 321)

2.3.6.12

WinCC RulerControl

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC RulerControl" as
of WinCC V7.0.

Type Identifier in VBS


HMIRulerControl

Available list objects


Row (Page 240)

StatisticResultColumn (Page 243)

RulerBlock (Page 241)

StatusbarElement (Page 244)

RulerColumn (Page 241)

ToolbarButton (Page 246)

StatisticAreaColumn (Page 242)

Available Methods in VBS


Activate

GetRulerBlock

GetStatisticAreaColumn

GetToolbarButton

ActivateDynamic

GetRulerBlockCollection

GetStatisticAreaColumnColl
ection

GetToolbarButtonCollection
ShowHelp

DeactivateDynamic

GetRulerColumn

GetStatisticResultColumn

Export

GetRulerColumnCollection

GetStatisticResultColumnCol ShowPropertyDialog
lection

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

999

VBS Reference
2.3 Object types of the ScreenItem object
GetRow (Page 715)

GetSelectedRow (Page 722)

GetStatusbarElement

GetRowCollection
(Page 716)

GetSelectedRows
(Page 723)

GetStatusbarElementCollecti
on

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "rulercolobj.ColumnName", the listing name "Column" is
dropped: "rulercolobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
AutoCompleteColumns

ColumnScrollbar

SelectedRowForeColor

TableColor2

AutoCompleteRows

ColumnSort

SelectedTitleColor

TableForeColor

AutoPositon

ColumnSortIndex

SelectedTitleForeColor

TableForeColor2

AutoSelectionColors

ColumnTitleAlign

SelectionColoring

TitleColor

AutoSelectionRectColor

ColumnTitles

SelectionRect

TitleCut

AutoShow

ColumnVisible

SelectionRectColor

TitleDarkShadowColor

BackColor

ExportDirectoryChangeable

SelectionRectWidth

TitleForeColor

BlockAlign

ExportDirectoryname

SelectionType

TitleGridLineColor

BlockAutoPrecisions

ExportFileExtension

ShareSpaceWithSourceCont TitleLightShadowColor
rol

BlockCaption

ExportFilename

ShowSortButton

TitleSort

BlockCount

ExportFilenameChangeable

ShowSortIcon

TitleStyle

BlockDateFormat

ExportFormatGuid

ShowSortIndex

ToolbarAlignment

BlockExponentialFormat

ExportFormatName

ShowTitle

ToolbarBackColor

BlockHideText

ExportParameters

Sizeable

ToolbarButtonActive

BlockHideTitleText

ExportSelection

SkinName

ToolbarButtonAdd

BlockID

ExportShowDialog

SortSequence

ToolbarButtonBeginGroup

BlockIndex

ExportXML

SourceControl

ToolbarButtonClick

BlockLength

Font

SourceControlType

ToolbarButtonCount

BlockName

GridLineColor

StatusbarBackColor

ToolbarButtonEnabled

BlockPrecisions

GridLineWidth

StatusbarElementAdd

ToolbarButtonHotKey

BlockShowDate

HorizontalGridLines

StatusbarElementAutoSize

ToolbarButtonId

BlockShowIcon

IconSpace

StatusbarElementCount

ToolbarButtonIndex

BlockShowTitleIcon

LineColor

StatusbarElementIconId

ToolbarButtonLocked

BlockTimeFormat

LineWidth

StatusbarElementId

ToolbarButtonName

BlockUseSourceFormat

Moveable

StatusbarElementIndex

ToolbarButtonPasswordLeve
l

BorderColor

PrintJobName

StatusbarElementName

ToolbarButtonRemove

BorderWidth

RowCellCount (Page 539)

StatusbarElementRemove

ToolbarButtonRename

Caption

RowCellText (Page 539)

StatusbarElementRename

ToolbarButtonRepos

CellCut

RowCount (Page 539)

StatusbarElementRepos

ToolbarButtonTooltipText

CellSpaceBottom

RowNumber (Page 540)

StatusbarElementText

ToolbarButtonUserDefined

1000

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
CellSpaceLeft

RowScrollbar

StatusbarElementTooltipText ToolbarButtonVisible

CellSpaceRight

RowTitleAlign

StatusbarElementUserDefin
ed

ToolbarShowTooltips

CellSpaceTop

RowTitles

StatusbarElementVisible

ToolbarUseBackColor

Closeable

RTPersistence

StatusbarElementWidth

ToolbarUseHotKeys

ColumnAdd

RTPersistencePasswordLev
el

StatusbarFontColor

ToolbarVisible

ColumnCount

RTPersistenceType

StatusbarShowTooltips

UseSelectedTitleColor

ColumnIndex

RulerType

StatusbarText

UseSourceBackColors

ColumnName

SelectedCellColor

StatusbarUseBackColor

UseSourceForeColors

ColumnRemove

SelectedCellForeColor

StatusbarVisible

UseTableColor2

ColumnRepos

SelectedRowColor

TableColor

VerticalGridLines

ColumnResize

Example
A WinCC Ruler Control is inserted in a picture with an existing WinCC OnlineTableControl.
The RulerControl contains a statistics window that displays the "Minimum", "Maximum" and
"Average" columns. The static values are then displayed for the selected rows of the
OnlineTableControl.
Requirements
A "WinCC OnlineTableControl" with the name "Control1" has already been inserted in a
process picture in Graphics Designer. The control is linked with archive tags or process
tags. The picture "B_025_V7_Arch_TableControl.PDL" from the demo project was used for
this example.
You have added an additional "WinCC RulerControl" with the name "Control2" in the picture.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have selected some rows in OnlineTableControl.

'VBS364
Sub OnClick(ByVal Item)
Dim objRulerControl
Dim objTableControl
Dim objstatColumn
Dim rows
Set objRulerControl = ScreenItems("Control2")
' Use Statistic-window
objRulerControl.RulerType = 2
objRulerControl.SourceControl = "Control1"
' In Statistic-window only columns "Name", "MinValue", MaxValue" and "Average" are shown
Set objstatColumn = objRulerControl.GetStatisticResultColumnCollection
objstatColumn.RemoveItem(4)
objstatColumn.RemoveItem(5)
objstatColumn.RemoveItem(6)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1001

VBS Reference
2.3 Object types of the ScreenItem object

' Get the selected rows of tablecontrol and calculate statistic


Set objTrendControl = ScreenItems("Control1")
Set rows = objTableControl.SelectAll
objTableControl.CalculateStatistic
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)

2.3.6.13

WinCC Slider Control

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Slider Control"

Type Identifier in VBS


HMISlider

Usage
In the following example, the object with the name "Control1" is moved 19 pixels to the right:

'VBS63
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +19

1002

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

Notes on Error Handling


Sliders and WinCC slider controls are mapped in the object model to an "HMISlider" type.
Since the objects have different properties, the availability of the property (dynamic type
compilation in Runtime) should be queried via an exception measure. The exception measure
is activated for the corresponding procedure by the following instruction:

On Error Resume Next

The instruction causes the VBScript engine to initiate the follow-on command in the case of a
Runtime error.
The error code can subsequently be checked using the Err object. In order to deactivate the
handling of Runtime errors in scripts, use the following command:

On Error Goto 0

Handling errors always relates to the procedure layer. If a script in a procedure causes an
error, VBScript checks whether an error handling measure is implemented in this layer. If not,
control is transferred one layer up (to the calling procedure). If there is no error handling
measure here either, the control is transferred yet another layer up. This continues until either
the top module level is reached or the code for Runtime error handling is located. If the
activation of the Runtime error handling fails, the control is transferred to the top level on the
internal VBScript Runtime error handing. This opens an error dialog and stops the script.
The "On Error Resume Next" command can be installed on all layers (i.e. also in procedures).
When the error handling measure is use, it can basically be determined whether the user is
actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a faulty access
to the object.

Examples of error handling

Sub OnClick(Byval Item)


'VBS193
Dim ScreenItem
' activating error handling:
On Error Resume Next
For Each ScreenItem In ScreenItems
If ScreenItem.Type = "HMISlider" Then
'=== Property "BevelColorUp" only exists for a WinCC Slider Control
ScreenItem.BevelColorUp = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no Windows-Slider" + vbCrlf)
' delete error message
Err.Clear

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1003

VBS Reference
2.3 Object types of the ScreenItem object

End If
'=== Property "BorderStyle" only exists for a Windows-Slider
ScreenItem.BorderStyle = 1
If (Err.Number <> 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + ": no WinCC Slider Control" + vbCrlf)
Err.Clear
End If
End If
Next
On Error GoTo 0 ' deactivating error handling
End Sub

See also
PictureThumb Property (Page 524)
BarFillColor Property (Page 328)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
WithLabels Property (Page 685)
WithAxes Property (Page 685)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
TickStyle Property (Page 587)
ThumbBackColor Property (Page 584)
ShowThumb Property (Page 563)
ShowPosition Property (Page 560)
ShowBar Property (Page 558)
RangeMin Property (Page 534)
RangeMax Property (Page 534)
Position Property (Page 527)
PictureBack Property (Page 522)
Parent Property (Page 514)
OuterBevelWidth Property (Page 513)
OuterBevelStyle Property (Page 512)

1004

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
ObjectName Property (Page 498)
Object Property (Page 497)
LocaleID Property (Page 469)
Left Property (Page 463)
Layer Object (Page 136)
LabelColor Property (Page 443)
InnerBevelWidth Property (Page 440)
InnerBevelStyle Property (Page 439)
InnerBevelOffset Property (Page 439)
Height Property (Page 430)
ForeColor Property (Page 422)
FontPosition Property (Page 420)
Font property (before WinCC V7) (Page 418)
FocusWidth Property (Page 417)
FocusColor Property (Page 417)
Enabled Property (Page 394)
ContinousChange Property (Page 380)
Caption Property (Page 351)
BevelColorUp Property (Page 333)
BevelColorDown Property (Page 333)
BarBackColor Property (Page 327)
BackStyle Property (Page 326)
BackColor Property (Page 323)

2.3.6.14

WinCC UserArchiveControl

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC
UserArchiveControl" as of WinCC V7.0.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1005

VBS Reference
2.3 Object types of the ScreenItem object

Type Identifier in VBS


HMIUserArchiveControl

Available list objects


Column (Page 235)

StatusbarElement (Page 244)

Row (Page 240)

ToolbarButton (Page 246)

Available Methods in VBS


Activate

GetRow (Page 715)

MoveToFirst

ServerImport

ActivateDynamic

GetRowCollection
(Page 716)

MoveToLast

ShowHelp

CopyRows

GetSelectedRow (Page 722)

MoveToNext

ShowPropertyDialog

CutRows

GetSelectedRows
(Page 723)

MoveToPrevious

ShowSelectArchive

DeactivateDynamic

GetStatusbarElement

PasteRows

ShowSelection

CutRows

GetStatusbarElementCollecti Print
on

ShowSelectTimeBase

Export

GetToolbarButton

ReadTags

ShowSort

GetColumn

GetToolbarButtonCollection

ServerExport

WriteTags

GetColumnCollection

Available Properties in VBS


If you access the properties with the listing object, you do not have to enter the name of the
listing. For example, when using "colobj.ColumnName", the listing name "Column" is dropped:
"colobj.Name".
Note that properties are available for WinCC controls that can have the effect of methods.
These properties are characterized by the respective names, e.g. "Add", "Remove" or
"Rename".
ArchiveName

ColumnShowIcon

RowTitles

StatusbarUseBackColor

ArchiveType
AutoCompleteColumns

ColumnShowTitleIcon

RTPersistence

StatusbarVisible

ColumnSort

RTPersistencePasswordLev
el

TableColor

AutoCompleteRows

ColumnSortIndex

RTPersistenceType

TableColor2

AutoSelectionColors

ColumnStartValue

SelectArchiveName

TableForeColor

AutoSelectionRectColor

ColumnStringLength

SelectedCellColor

TableForeColor2

BackColor

ColumnTimeFormat

SelectedCellForeColor

TimeBase

BorderColor

ColumnTitleAlign

SelectedRowColor

TitleColor

BorderWidth

ColumnTitles

SelectedRowForeColor

TitleCut

Caption

ColumnType

SelectedTitleColor

TitleDarkShadowColor

1006

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
CellCut

ColumnVisible

SelectedTitleForeColor

TitleForeColor

CellSpaceBottom

ColumnWriteAccess

SelectionColoring

TitleGridLineColor

CellSpaceLeft

EnableDelete

SelectionRect

TitleLightShadowColor

CellSpaceRight

EnableEdit

SelectionRectColor

TitleSort

CellSpaceTop

EnableInsert

SelectionRectWidth

TitleStyle

Closeable

ExportDirectoryChangeable

SelectionType

ToolbarAlignment

ColumnAlias

ExportDirectoryname

ShowSortButton

ToolbarBackColor

ColumnAlign

ExportFileExtension

ShowSortIcon

ToolbarButtonActive

ColumnAutoPrecisions

ExportFilename

ShowSortIndex

ToolbarButtonAdd

ColumnCaption

ExportFilenameChangeable

ShowTitle

ToolbarButtonBeginGroup

ColumnCount

ExportFormatGuid

Sizeable

ToolbarButtonClick

ColumnDateFormat

ExportFormatName

SkinName

ToolbarButtonCount

ColumnDMVarName

ExportParameters

SortSequence

ToolbarButtonEnabled

ColumnExponentialFormat

ExportSelection

StatusbarBackColor

ToolbarButtonHotKey

ColumnFlagNotNull

ExportShowDialog

StatusbarElementAdd

ToolbarButtonId

ColumnFlagUnique

ExportXML

StatusbarElementAutoSize

ToolbarButtonIndex

ColumnHideText

FilterSQL

StatusbarElementCount

ToolbarButtonLocked

ColumnHideTitleText

Font

StatusbarElementIconId

ToolbarButtonName

ColumnIndex

GridLineColor

StatusbarElementId

ToolbarButtonPasswordLeve
l

ColumnLeadingZeros

GridLineWidth

StatusbarElementIndex

ToolbarButtonRemove

ColumnLength

HorizontalGridLines

StatusbarElementName

ToolbarButtonRename

ColumnMaxValue

IconSpace

StatusbarElementRemove

ToolbarButtonRepos

ColumnMinValue

LineColor

StatusbarElementRename

ToolbarButtonTooltipText

ColumnName

LineWidth

StatusbarElementRepos

ToolbarButtonUserDefined

ColumnPosition (Page 371)

Moveable

StatusbarElementText

ToolbarButtonVisible

ColumnPrecisions

PrintJobName

StatusbarElementTooltipText ToolbarShowTooltips

ColumnReadAccess

RowCellCount (Page 539)

StatusbarElementUserDefin
ed

ToolbarUseBackColor

ColumnReadonly

RowCellText (Page 539)

StatusbarElementVisible

ToolbarUseHotKeys

ColumnRepos

RowCount (Page 539)

StatusbarElementWidth

ToolbarVisible

ColumnResize

RowNumber (Page 540)

StatusbarFontColor

UseSelectedTitleColor

ColumnScrollbar

RowScrollbar

StatusbarShowTooltips

UseTableColor2

ColumnShowDate

RowTitleAlign

StatusbarText

VerticalGridLines

Example
A user archive is displayed in a WinCC UserArchiveControl.
The following actions are initiated via script:
Selecting data
Exporting data
Printing a table

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1007

VBS Reference
2.3 Object types of the ScreenItem object
Requirements
A "WinCC UserArchiveControl" with the name "Control1" is inserted in a process picture in
Graphics Designer.
A button is inserted in the Graphics Designer. You have configured the event "mouse click"
with a VBS action and the following script for the button.
You have already configured a user archive in your project. Or you are using the demo
project from which you can use a user archive.

VBS365
Sub OnClick(ByVal Item)
Dim objUAControl
Dim objColumn
Dim coll
Dim field
' create reference to UserArchivControl
Set objUAControl = ScreenItems("Control1")
' Select user archive and general column properties
objUAControl.SelectArchiveName = True
objUAControl.ColumnResize = False
objUAControl.ColumnTitleAlign = 1
' properties for ID column
Set objColumn = objUAControl.GetColumn("ID")
objColumn.Length = 2
objColumn.Align = 0
' Select data
objUAControl.FilterSQL = "ID >=3"
'export the content as a CSV-file in the "ua" directory of the project folder
objUAControl.ServerExport
' print the control
objUAControl.PrintJobName = "UserArchiveControl - Table"
objUAControl.Print
End Sub

Note
More examples for use of properties and methods are available in the descriptions of the Get
methods of the controls and under "Examples for VBScript/Examples in WinCC/Dynamizing
controls".

See also
Controls (Page 232)

1008

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.6.15

Controls before WinCC V7

WinCC Alarm Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Alarm Control"

Type Identifier in VBS


HMIMessageView

Usage
In the following example, the object with the name "Control1" is moved 10 pixels to the right:

'VBS54
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left + 10

See also
ProjectPath Property (Page 531)
BackColor Property (Page 323)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
WindowType Property (Page 685)
Width Property (Page 682)
Visible Property (Page 680)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1009

VBS Reference
2.3 Object types of the ScreenItem object
Type Property (Page 651)
Top Property (Page 627)
ToolbarButtons Property (Page 623)
Titleline Property (Page 612)
TitleCut property (before WinCC V7) (Page 611)
StatusbarPanes Property (Page 578)
ServerNames property (before WinCC V7) (Page 557)
SelectionType property (before WinCC V7) (Page 554)
SelectionRectWidth property (before WinCC V7) (Page 553)
SelectionRectColor property (before WinCC V7) (Page 553)
SelectionMode Property (Page 552)
PersistentRTPermission Property (Page 519)
PersistentRTCSPermission Property (Page 519)
Parent Property (Page 514)
ObjectName Property (Page 498)
Object Property (Page 497)
MsgFilterSQL property (before WinCC V7) (Page 494)
MsgCtrlFlags Property (Page 494)
LineTitle Property (Page 467)
LineHeight Property (Page 466)
LineFont Property (Page 466)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
HeaderSort Property (Page 430)
GridLineVert Property (Page 429)
GridLineHorz Property (Page 427)
Font property (before WinCC V7) (Page 418)
Enabled Property (Page 394)
ColWidth Property (Page 377)
ColTitle Property (Page 366)
ColMove Property (Page 362)
CellCut property (before WinCC V7) (Page 353)
Caption Property (Page 351)
ButtonCommand Property (Page 346)

1010

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
AutoScroll property (before WinCC V7) (Page 319)
AllServer property (before WinCC V7) (Page 312)
Activate property (before WinCC V7) (Page 304)
LocaleSpecificSettings Property (Page 469)
SortOrder Property (Page 567)
TableFocusOnButtonCommand Property (Page 581)
CursorMode Property (Page 383)
CursorModePrefetch Property (Page 383)
LongTimeArchiveConsistency property (before WinCC V7) (Page 472)

WinCC Function Trend Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Function Trend
Control"

Type Identifier in VBS


HMIFunctionTrendView

Usage
In the following example, the object with the name "Control1" is moved 13 pixels to the right:

'VBS57
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +13

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1011

VBS Reference
2.3 Object types of the ScreenItem object

See also
Top Property (Page 627)
ScalingTypeY Property (Page 546)
Layer Object (Page 136)
DesiredCurveSourceUAArchive Property (Page 390)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 682)
Visible Property (Page 680)
UpperLimitValue Property (Page 659)
UpperLimit Property (Page 658)
UpperLimitColor Property (Page 659)
Type Property (Page 651)
ToolbarHotKeys Property (Page 624)
ToolbarButtons Property (Page 623)
ToolbarAlignment property (before WinCC V7) (Page 614)
Titleline Property (Page 612)
TimeZone Property (Page 610)
TimeAxisX Property (Page 595)
TagProviderClsid Property (Page 583)
SourceUAColumnY Property (Page 572)
SourceUAColumnX Property (Page 572)
SourceUAArchiveStartID Property (Page 571)
SourceUAArchive Property (Page 571)
SourceTimeRange Property (Page 571)
SourceTagProviderDataY Property (Page 570)
SourceTagProviderDataX Property (Page 570)
SourceTagNameY Property (Page 570)
SourceTagNameX Property (Page 569)
SourceNumberOfValues Property (Page 569)
SourceNumberOfUAValues Property (Page 569)
SourceEndTime Property (Page 568)

1012

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
SourceBeginTime Property (Page 567)
ShowValuesExponentialY Property (Page 565)
ShowValuesExponentialX Property (Page 564)
ShowRulerImmediately Property (Page 561)
ScalingTypeX Property (Page 545)
RulerPrecisionY Property (Page 543)
RulerPrecisionX Property (Page 542)
Replacement Property (Page 536)
ReplacementColor Property (Page 537)
RelayCurves Property (Page 536)
ProviderType Property (Page 532)
PrecisionY Property (Page 528)
PrecisionX Property (Page 528)
PersistentRTPermission Property (Page 519)
PersistentRT Property (Page 518)
PersistentRTCSPermission Property (Page 519)
PersistentRTCS Property (Page 518)
Parent Property (Page 514)
Online property (before WinCC V7) (Page 502)
ObjectName Property (Page 498)
Object Property (Page 497)
NumItems Property (Page 497)
Name Property (Page 495)
LowerLimitValue Property (Page 474)
LowerLimit Property (Page 472)
LowerLimitColor Property (Page 473)
LoadDataImmediately property (before WinCC V7) (Page 468)
Left Property (Page 463)
LabelY Property (Page 444)
LabelX Property (Page 444)
ItemVisible Property (Page 443)
InsertData Property (Page 440)
Index Property (Page 438)
Height Property (Page 430)
GridlinesY Property (Page 428)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1013

VBS Reference
2.3 Object types of the ScreenItem object
GridlinesX Property (Page 428)
GridlinesValueY Property (Page 428)
GridlinesValueX Property (Page 427)
GraphDirection property (before WinCC V7) (Page 426)
FreezeProviderConnections Property (Page 425)
Font property (before WinCC V7) (Page 418)
FineGridY Property (Page 410)
FineGridX Property (Page 410)
FineGridValueY Property (Page 410)
FineGridValueX Property (Page 409)
EndY Property (Page 398)
EndX Property (Page 397)
Enabled Property (Page 394)
DesiredCurveVisible Property (Page 391)
DesiredCurveSourceUAColumnY Property (Page 391)
DesiredCurveSourceUAColumnX Property (Page 391)
DesiredCurveSourceUAArchiveStartID Property (Page 390)
DesiredCurveSourceNumberOfUAValues Property (Page 390)
DesiredCurveCurveForm Property (Page 389)
DesiredCurveColor Property (Page 389)
DeleteData Property (Page 388)
DataY Property (Page 386)
DataXY Property (Page 386)
DataX Property (Page 385)
DataIndex Property (Page 384)
CurveForm Property (Page 382)
CommonY Property (Page 378)
CommonX Property (Page 378)
Color Property (Page 362)
CoarseGridY Property (Page 360)
CoarseGridX Property (Page 360)
CoarseGridValueY Property (Page 361)
CoarseGridValueX Property (Page 361)
Closeable property (before WinCC V7) (Page 358)
Caption Property (Page 351)

1014

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
BeginY Property (Page 332)
BeginX Property (Page 332)
BackColor Property (Page 323)
AutorangeY Property (Page 318)
AutorangeX Property (Page 318)
AllowPersistence Property (Page 312)
LocaleSpecificSettings Property (Page 469)
PrintBackgroundColor Property (Page 530)
PrintJob Property (Page 530)
RulerFont Property (Page 542)

WinCC Online Table Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Online Table
Control"

Type Identifier in VBS


HMITableView

Usage
In the following example, the object with the name "Control1" is moved 15 pixels to the right:

'VBS59
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +15

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1015

VBS Reference
2.3 Object types of the ScreenItem object

See also
TimeOverlap Property (Page 606)
ItemVisible Property (Page 443)
PrintBackgroundColor Property (Page 530)
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 682)
Visible Property (Page 680)
Variable Property (Page 680)
ValueColumnAlignment Property (Page 672)
UpperLimitValue Property (Page 659)
UpperLimit Property (Page 658)
UpperLimitColor Property (Page 659)
Type Property (Page 651)
Top Property (Page 627)
ToolbarHotKeys Property (Page 624)
Toolbar Property (Page 614)
ToolbarButtons Property (Page 623)
ToolbarAlignment property (before WinCC V7) (Page 614)
Titleline Property (Page 612)
TimeZone Property (Page 610)
TimeRangeFactor Property (Page 607)
TimeRange Property (Page 607)
TimeRangeBase Property (Page 607)
TimeOverlapColor Property (Page 606)
TimeJump Property (Page 605)
TimeJumpColor Property (Page 605)
TimeFormat Property (Page 604)
TimeColumnAlignment Property (Page 596)
Statusbar Property (Page 574)
PrintJob Property (Page 530)
Precisions Property (Page 528)

1016

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
PersistentRTPermission Property (Page 519)
PersistentRT Property (Page 518)
PersistentRTCSPermission Property (Page 519)
PersistentRTCS Property (Page 518)
Parent Property (Page 514)
Online property (before WinCC V7) (Page 502)
ObjectName Property (Page 498)
Object Property (Page 497)
NumItems Property (Page 497)
LowerLimitValue Property (Page 474)
LowerLimit Property (Page 472)
LowerLimitColor Property (Page 473)
LoadDataImmediately property (before WinCC V7) (Page 468)
Left Property (Page 463)
Layer Object (Page 136)
Index Property (Page 438)
Height Property (Page 430)
Font property (before WinCC V7) (Page 418)
EndTime Property (Page 397)
Enabled Property (Page 394)
Edit Property (Page 393)
Editable Property (Page 394)
CommonTime Property (Page 378)
Command Property (Page 377)
Color Property (Page 362)
Closeable property (before WinCC V7) (Page 358)
Caption Property (Page 351)
BeginTime Property (Page 331)
BackColor Property (Page 323)
Archive Property (Page 315)
AllowPersistence Property (Page 312)
Actualize Property (Page 306)
Activate property (before WinCC V7) (Page 304)
LocaleSpecificSettings Property (Page 469)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1017

VBS Reference
2.3 Object types of the ScreenItem object

WinCC Online Trend Control (before WinCC V7)


Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "WinCC Online Trend
Control"

Type Identifier in VBS


HMITrendView

Usage
In the following example, the object with the name "Control1" is moved 16 pixels to the right:

'VBS60
Dim objControl
Set objControl = ScreenItems("Control1")
objControl.Left = objControl.Left +16

See also
Properties (Page 303)
TimeAxis Property (Page 588)
LowerLimitColor Property (Page 473)
Caption Property (Page 351)
Activate Method (Page 696)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Controls (Page 232)
Width Property (Page 682)
Visible Property (Page 680)
UpperLimitValue Property (Page 659)

1018

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
UpperLimit Property (Page 658)
UpperLimitColor Property (Page 659)
Type Property (Page 651)
Top Property (Page 627)
ToolbarHotKeys Property (Page 624)
Toolbar Property (Page 614)
ToolbarButtons Property (Page 623)
ToolbarAlignment property (before WinCC V7) (Page 614)
Titleline Property (Page 612)
TimeZone Property (Page 610)
TimeRangeFactor Property (Page 607)
TimeRange Property (Page 607)
TimeRangeBase Property (Page 607)
TimeOverlap Property (Page 606)
TimeOverlapColor Property (Page 606)
TimeJump Property (Page 605)
TimeJumpColor Property (Page 605)
TimeAxisFormat Property (Page 590)
TagName Property (Page 582)
Statusbar Property (Page 574)
ShowRulerImmediately Property (Page 561)
ServerData Property (Page 555)
RulerPrecisions Property (Page 542)
Replacement Property (Page 536)
ReplacementColor Property (Page 537)
RelayCurves Property (Page 536)
ProviderClsid Property (Page 531)
PrintJob Property (Page 530)
Precisions Property (Page 528)
PersistentRTPermission Property (Page 519)
PersistentRT Property (Page 518)
PersistentRTCSPermission Property (Page 519)
PersistentRTCS Property (Page 518)
Parent Property (Page 514)
Online property (before WinCC V7) (Page 502)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1019

VBS Reference
2.3 Object types of the ScreenItem object
ObjectName Property (Page 498)
Object Property (Page 497)
NumItems Property (Page 497)
MeasurePoints Property (Page 481)
LowerLimitValue Property (Page 474)
LowerLimit Property (Page 472)
LoadDataImmediately property (before WinCC V7) (Page 468)
Left Property (Page 463)
Layer Object (Page 136)
Label Property (Page 443)
ItemVisible Property (Page 443)
Index Property (Page 438)
Height Property (Page 430)
GridLineValue Property (Page 429)
GridLines Property (Page 427)
GraphDirection property (before WinCC V7) (Page 426)
Font property (before WinCC V7) (Page 418)
FineGridValue Property (Page 409)
FineGrid Property (Page 409)
EndValue Property (Page 397)
EndTime Property (Page 397)
Enabled Property (Page 394)
CurveForm Property (Page 382)
CommonY Property (Page 378)
CommonX Property (Page 378)
Command Property (Page 377)
Color Property (Page 362)
CoarseGridValue Property (Page 360)
CoarseGrid Property (Page 359)
Closeable property (before WinCC V7) (Page 358)
BeginValue Property (Page 332)
BeginTime Property (Page 331)
BackColor Property (Page 323)
Autorange Property (Page 318)
AllowPersistence Property (Page 312)

1020

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object
Actualize Property (Page 306)
Activate property (before WinCC V7) (Page 304)
AdjustRuler Property (Page 309)
LineWidth property (before WinCC V7) (Page 467)
ScalingType Property (Page 545)
UseRangeSubstitutes Property (Page 661)
XAxisColor property (before WinCC V7) (Page 686)
HideTagNames Property (Page 431)
LocaleSpecificSettings Property (Page 469)
PrintBackgroundColor Property (Page 530)
ItemProviderClsid Property (Page 442)
OneY Property (Page 501)
AllowXAxisColor - Property (Page 312)
AnchorRuler Property (Page 313)
SavedTrend Property (Page 544)
SelectedTrend Property (Page 552)
ShowSpanNames Property (Page 563)
DefaultPrecision Property (Page 387)
DefaultRulerPrecision Property (Page 387)
LowerLimitTagName Property (Page 473)
UpperLimitTagName Property (Page 659)
UseOnlineTags Property (Page 661)

2.3.7

Customized Object

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Customized Object".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1021

VBS Reference
2.3 Object types of the ScreenItem object

Type Identifier in VBS


HMIScreenModule

Usage
You access customized properties in a customized object via the attribute name in VBS.
Intellisense is only applicable to the customized object as a whole.
You will locate the attribute name under Properties of the properties placed outside (right-click
Property) and can be modified there.
In the following example, the object with the name "CustomizedObject1" is moved 10 pixels
to the right:

'VBS65
Dim objCustomObject
Set objCustomObject = ScreenItems("CustomizedObject1")
objCustomObject.Left = objCustomObject.Left + 10

See also
Activate Method (Page 696)
Properties (Page 303)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Parent Property (Page 514)
ObjectName Property (Page 498)
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
Enabled Property (Page 394)

1022

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.3 Object types of the ScreenItem object

2.3.8

Group

Description
6FUHHQV
6FUHHQ
6FUHHQ,WHPV
6FUHHQ,WHP
Object Type of ScreenItem Object. Represents the graphic object "Group"

Type Identifier in VBS


HMIGroup

Usage
In the following example, the object with the name "Group1" is moved 10 pixels to the right:

'VBS66
Dim objGroup
Set objGroup = ScreenItems("Group1")
objGroup.Left = objGroup.Left + 10

See also
Properties (Page 303)
Activate Method (Page 696)
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)
Width Property (Page 682)
Visible Property (Page 680)
Type Property (Page 651)
Top Property (Page 627)
ToolTipText Property (Page 626)
Parent Property (Page 514)
ObjectName Property (Page 498)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1023

VBS Reference
2.3 Object types of the ScreenItem object
Left Property (Page 463)
Layer Object (Page 136)
Height Property (Page 430)
Enabled Property (Page 394)

1024

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4

Properties

2.4.1

Properties

Overview
The properties of the individual objects can be used to modify specific graphic objects and
tags in Runtime , e.g. activating an operating element per mouse click or triggering a color
change by modifying a tag value.
Properties on graphic objects can be addressed via the following syntax:

'VBS191
Dim obj
Set obj = ScreenItems("object1")
obj.property = Value

In the following example, the object with the name "Control1" is moved 10 pixels to the right:

'VBS192
Dim obj
Set obj = ScreenItems("control1")
obj.Left = obj.Left + 10

2.4.2

2.4.2.1

Aa - Ad

AccessPath Property
Description
Displays the storage path (with hierarchy information) of a screen object (picture). The property
corresponds to the full access code on the Screens Collections.
STRING (read only)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1025

VBS Reference
2.4 Properties

Example:
In the following example, the path of the picture "ScreenWindow1" is issued:

'VBS67
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
MsgBox objScreen.AccessPath

See also
ScreenItem Object (Page 141)
Screens Object (List) (Page 149)

Activate property (before WinCC V7)


Description
The data to be displayed is only requested from the archive server when this attribute is set.
In order to reduce the picture opening times, this attribute should not be set and the value only
dynamically changed when necessary.
Write/Read access
To differentiate between the "Activate" property form the "Activate" method, the property is
accessed via "Object".

Example:

Dim ctrl
Set ctrl = ScreenItems("Control")
ctrl.Object.activate = true

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

1026

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Activate property
Activate
The data to be displayed in the message window are only requested from the message server
if you set this attribute. Instead of setting this attribute, it is advisable to change the value
dynamically in order to reduce picture activation times.
The attribute can be assigned dynamic properties by means of the name Activate . The data
type is BOOLEAN.

ActiveProject Property
Description
Returns an object of type "Project".

See also
Path Property (Page 516)
Name Property (Page 495)
Ellipse segment (Page 162)
HMIRuntime Object (Page 134)

ActiveScreen Property
Description
Supplies a reference to the picture which contains the object with the current focus.

Usage
"ActiveScreen" is used in Runtime to address the properties of the picture which contains the
currently focussed object.

Example:
The following example assigns the name of the current picture to the tag "strScrName" and
outputs it in a message:

'VBS68
Dim strScrName
strScrName = HMIRuntime.ActiveScreen.Objectname
MsgBox strScrName

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1027

VBS Reference
2.4 Properties

See also
Screen Object (Page 146)
HMIRuntime Object (Page 134)

ActiveScreenItem Property
Description
Supplies a reference to the object currently in focus.

Usage
"ActiveScreenItem" is used in Runtime in order to address the properties of the object currently
in focus.

Example:
The following example displays the name of the object in the "ScreenWindow1" picture which
has the focus:

'VBS69
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
MsgBox objScreen.ActiveScreenItem.ObjectName

See also
ScreenItem Object (Page 141)
HMIRuntime Object (Page 134)

Actualize Property
Description
The "Index" property references a column pair or a trend. "Actualize" defines whether a static
or dynamic representation should be used for this column pair/trend.
0: Static display
-1: Dynamic display

1028

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

ActualPointLeft Property
Description
Defines or returns the x-coordinate of the current corner point in relation to the original picture
(top left). Each corner point is identified by an index which is derived from the number
("PointCount") of corner point available.
A change of the value can affect the properties "Width" (object width) and "Left" (x-coordinate
of the object position).

See also
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

ActualPointTop Property
Description
Defines or returns the y-coordinate of the current corner point in relation to the original picture
(top left). Each corner point is identified by an index which is derived from the number
("PointCount") of corner point available.
A change of the value can affect the properties "Height" (object height) and "Top" (y-coordinate
of the position).

See also
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1029

VBS Reference
2.4 Properties

AdaptBorder Property
Description
TRUE, when the border should be dynamically adjusted to the size of the text. BOOLEAN writeread access.
For text list and I/O field: Read only access.

See also
Button (Page 215)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
I/O Field (Page 199)
ScreenItem Object (Page 141)

AdaptPicture Property
Description
Defines whether the picture displayed in a picture window should be adapted to the size of the
picture window in Runtime or not. Read only access.
TRUE, when the picture adapts to the picture window size.
FALSE, when the picture does not adapt to the picture window size.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

AdaptSize Property
Description
Defines whether the picture window should adapt to the size of the picture displayed in it during
Runtime or not. Read only access.
TRUE, when the picture window adapts to the picture size.
FALSE, when the picture window does not adapt to the picture size.

1030

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

AdjustRuler Property
Description
Specifies if the ruler window should be adjusted to the trend window upon each appearance.
TRUE, if you move the ruler window and make it appear and disappear again, it will be
displayed in its original position and its original size.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

2.4.2.2

Al - Ap

AlarmID property
Description
Returns the AlarmID of the Alarm object. The AlarmID is unique, and is assigned by the system.
AlarmID (readonly)

See also
Alarms object (list) (Page 126)

AlarmHigh Property
Description
Defines the top limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmHigh" property.
The "CheckAlarmHigh" property determines whether the monitoring for this limit value is
activated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1031

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

AlarmLogs Property
Description
Returns an object of type "AlarmLogs".
AlarmLogs (read-only)

See also
HMIRuntime Object (Page 134)

AlarmLow Property
Description
Defines the bottom limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmLow" property.
The "CheckAlarmLow" property determines whether the monitoring for this limit value is
activated.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Alignment Property
Description
Defines or returns the representation of the scale (left/right or top/bottom) according to the
position of the bar graph object. The "Scaling" property must be set to TRUE for the scale to
be displayed.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1032

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

AlignmentLeft Property
Description
Defines or returns the horizontal alignment of the text. Value range from 0 to 2.
0 = left
1 = centered
2 = right

See also
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

AlignmentTop Property
Description
Defines or returns the vertical alignment of the text. Value range from 0 to 2.
0 = top
1 = centered
2 = bottom

See also
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1033

VBS Reference
2.4 Properties

AllowPersistence Property
Description
TRUE, when settings regarding persistence are possible. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

AllowXAxisColor - Property
Description
TRUE if the defined color of the common X-axis is displayed in runtime. BOOLEAN write-read
access.

AllServer property (before WinCC V7)


Description
Defines that the data to be displayed in the message window is required by all servers
participating in a distributed system on which Alarm Logging is activated. Write/Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

AllServer property
All servers - AllServer
Selects all servers whose packages were loaded and on which "Alarm Logging Runtime" is
activated in the startup list.
Value

Explanation

TRUE

All servers are activated.

FALSE

Activates only the servers entered in "Server selection".

1034

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name AllServer. The data
type is BOOLEAN.

Analog Property
Description
TRUE, when the clock is to be displayed as an analog clock. BOOLEAN write-read access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

AnchorRuler Property
Description
TRUE if the ruler window is firmly linked to the curve window. BOOLEAN write-read access.

AngleAlpha Property
Description
Defines or returns depth angle a for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

AngleBeta Property
Description
Defines or returns depth angle b for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1035

VBS Reference
2.4 Properties

AngleMax Property
Description
Defines or returns the angle on the scale at which the scale graduation ends. LONG write-read
access.
The start and end of the scale graduation are described by the attributes "AngleMin" and
"AngleMax" in angular degrees. AngleMin < AngleMax applies.
Angle 0 degrees is at the right side of the horizontal diameter of the graduated scale disk.
Positive angle values are counted in a counterclockwise direction.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

AngleMin Property
Description
Defines or returns the angle on the scale at which the scale graduation begins. LONG writeread access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

Application Property
Description
Returns the Graphics Designer application when the application property is used without an
object identifier. If the application property is used with object identifier, it returns an application
object which displays the application with which the defined object was created. Read only
access.

See also
Application Window (Page 188)
ScreenItem Object (Page 141)

1036

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ApplyProjectSettings property
Apply project settings - ApplyProjectSettings
Activates the project settings derived from "Alarm Logging".
Value

Explanation

TRUE

The "Apply project settings" check box is selected. The message blocks configured in "Alarm Logging"
and their properties are activated in AlarmControl. The message blocks are displayed with these
properties in the message window.

FALSE

The "Apply project settings" check box is deactivated. You can add or remove message blocks, or edit
their properties.

The attribute can be assigned dynamic properties by means of the name


ApplyProjectSettings. The data type is BOOLEAN.

2.4.2.3

Ar - Ax

Archive Property
Description
The "Index" property references a pair of columns. "Archive" defines process archive values
linked to the column pair. The name of the process value archive is specified in the following
form: Server name::Archive name

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

ArchiveName property
Name - ArchiveName
Specifies the user archive or view to be displayed. Open the "Package Browser" dialog for
configuring an archive or a view by clicking the button.
The attribute can be assigned dynamic properties by means of the name ArchiveName. The
data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1037

VBS Reference
2.4 Properties

ArchiveType property
Type - ArchiveType
Specifies whether the selected user archive is an archive or a view. The field cannot be edited.
The attribute can be assigned dynamic properties by means of the name ArchiveType. The
data type is LONG.

AspectRatio property
AspectRatio
Specifies if the aspect ratio is kept in movies.
The attribute can be assigned dynamic properties by means of the name AspectRatio. The
data type is BOOLEAN.

Assignments Property
Description
A list which contains the assignments between the output values and the actual output texts
to be output.
The assignments depend on the set list type. The list type is defined with the ListType property.
Read only access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

AssumeOnExit Property
Description
TRUE, if the entered text is assumed upon exiting the entry field (e.g., with the key or mouse
click). BOOLEAN write-read access.

See also
I/O Field (Page 199)
Text list (Page 211)
ScreenItem Object (Page 141)

1038

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

AssumeOnFull Property
Description
TRUE, when the content of the input field is full (specified number of characters have been
entered) and should be exited automatically and the input accepted. BOOLEAN write-read
access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

AutoCompleteColumns property
Show empty columns - AutoCompleteColumns
Adds empty columns if the Control width is greater than the width of columns configured.
Value

Explanation

TRUE

Enables the display of empty columns.

FALSE

Disables the display of empty columns.

The attribute can be assigned dynamic properties by means of the name


AutoCompleteColumns. The data type is BOOLEAN.

AutoCompleteRows property
Show empty rows - AutoCompleteRows
Enables the insertion of empty rows if the Control length is greater than the number of rows
configured.
Value

Explanation

TRUE

Enables the display of empty rows.

FALSE

Disables the display of empty rows.

The attribute can be assigned dynamic properties by means of the name


AutoCompleteRows. The data type is BOOLEAN.

AutoPosition property
Automatic positioning - AutoPosition
Defines whether to position the RulerControl exactly below the source control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1039

VBS Reference
2.4 Properties
The following settings are available:
Value

Explanation

TRUE

The RulerControl is positioned exactly below the source control.

FALSE

The RulerControl is displayed in accordance with your configuration of the control position.

The attribute can be assigned dynamic properties by means of the name AutoPosition. The
data type is BOOLEAN.

Autorange Property
Description
TRUE, when the value range of the Y-axis is determined automatically or defined by using the
"BeginValue" and "EndValue"attributes. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

AutorangeX Property
Description
TRUE, when the value range of the X-axis is determined automatically. FALSE, when it is
determined by means of the "BeginX" and "EndX" attributes. BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

AutorangeY Property
Description
TRUE, when the value range of the Y-axis is determined automatically. FALSE, when it is
determined by means of the "BeginY" and "EndY" attributes. BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1040

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

AutoScroll property (before WinCC V7)


Description
Defines the behavior of the message window when a new message is received. BOOLEAN
write-read access.
TRUE : A newly received message is appended to the list displayed in the message window
and is automatically selected. The visible range of the message window is moved, if necessary.
FALSE : A newly received message is not selected. The visible range of the message window
is not changed.
The targeted selection of messages is only possible when "AutoScroll" is not active.
The "AutoScroll" property is deactivated when the attribute "MsgCtrlFlag" = "-1" is set. This
means that the most recent message is displayed at the top of the list in the message window.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

AutoScroll Property
Auto scrolling - AutoScroll
Defines the behavior of the message window after a new message events.
You can only select message lines if "Auto scrolling" is disabled.
Value

Explanation

TRUE

If "AutoScroll" is activated, a new activated message is appended to the list displayed in the
message window and selected automatically. The visible area of the message window is
shifted as required.

FALSE

New message events are not selected if "Autoscroll" is disabled. The visible area of the
message window is not changed.

The attribute can be assigned dynamic properties by means of the name AutoScroll. The data
type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1041

VBS Reference
2.4 Properties

AutoSelectionColors property
Automatic selection coloring - AutoSelectionColor
Enables the display of default system colors as selection color for cells and rows.
Value

Explanation

TRUE

The system colors are in use.

FALSE

The custom colors are used.

The attribute can be assigned dynamic properties by means of the name


AutoSelectionColors. The data type is BOOLEAN.

AutoSelectionRectColor property
Automatic color assignment - AutoSelectionRectColor
Defines a system color for the selection border.
Value

Explanation

TRUE

The system color is in use.

FALSE

The custom color is used.

The attribute can be assigned dynamic properties by means of the name


AutoSelectionRectColors. The data type is BOOLEAN.

AutoShow property
Show/hide automatically - AutoShow
Enables/disables automatic activation of the RulerControl on the display if you selected the
button functions for the ruler, statistics range and for statistics in the source control.
The RulerControl is hidden again if you are no longer using the ruler, statistics range and
statistics functions.
Value

Explanation

TRUE

The RulerControl is displayed automatically.

FALSE

The RulerControl is not displayed automatically.

The attribute can be assigned dynamic properties by means of the name AutoShow. The data
type is BOOLEAN.

1042

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

AutoSize Property
Description
Defines or returns the size adaptation of the object. The following values can be set:
0: No size adaptation.
1: The picture ("PictureSelected", "PictureUnselected" properties) is adapted to the button.
2: The button is adapted to the picture ("PictureSelected", "PictureUnselected" properties).

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

Autostart property
Autostart
Specifies if movies are started automatically.
The attribute can be assigned dynamic properties by means of the name Autostart. The data
type is BOOLEAN.

Average Property
Average
TRUE, if the mean value is calculated based on the last 10 values. A value change is
conditional for calculation of a new mean value. The mean value is reset when you change a
picture. If only one value is available when you change the picture, the following mean value
is calculated: (5+0+0+0+0+0+0+0+0+0)/10=0,5.
BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Axe Property
Description
Defines or returns the position of the 3D bar in the coordinate system. Value range from 0 to
2.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1043

VBS Reference
2.4 Properties
0: The 3D-bar is displayed on the X-axis.
1: The 3D-bar is displayed on the Y-axis.
2: The 3D-bar is displayed on the Z-axis.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

AxisSection Property
Description
Defines or returns the distance between two long axis sections. The information on the distance
is given in scale units and is dependent on the minimum and maximum values configured.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.3

2.4.3.1

Ba

BackBorderWidth Property
Description
Defines or returns the width of the 3D border in pixels. The value for the width is dependent
on the size of the object.

See also
ScreenItem Object (Page 141)
Button (Page 215)
Round Button (Page 223)
Slider (Page 226)
Group Display (Page 208)

1044

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

BackColor property
Background - BackColor
Specifies the background color of the control. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name BackColor. The data
type is LONG.

BackColor property
Background Color (BackColor)
Specifies the icon background color in the "Color selection" dialog. The background color is
displayed in "opaque" style.
The attribute can be assigned dynamic properties by means of the name BackColor. The data
type is LONG.

BackColor Property
Function
Defines or returns the background color for the object.
For objects with a fill pattern, the background color is not displayed if "transparent" is defined
as the fill style.
Special features of the WinCC slider control
The background color only takes effect when the object is at least partially filled.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Enter the appropriate decimal value
for each of the three RGB values.
Example:
RGB(200, 150, 100)

Example:
The following example defines the background of the "ScreenWindow1" picture to red:

'VBS70
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.BackColor = RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1045

VBS Reference
2.4 Properties

See also
FillStyle Property (Page 407)
FillColor Property (Page 405)
ScreenItem Object (Page 141)

BackColor2 Property
Description
Defines or returns the bar color for the display of the current value. LONG write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

BackColor3 Property
Description
Defines or returns the color of the bar background. LONG write-read access.

See also
ScreenItem Object (Page 141)
Bar (Page 189)

BackColorBottom Property
Description
Defines or returns the color for the bottom/right part of the slider. LONG write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

1046

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

BackColorTop Property
Description
Defines or returns the color for the top/left part of the slider. LONG write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

BackFlashColorOff Property
Description
Defines or returns the color of the object background for the flash status "Off". LONG writeread access.

See also
ScreenItem Object (Page 141)

BackFlashColorOn Property
Description
Defines or returns the color of the object background for the flash status "On". LONG writeread access.

See also
ScreenItem Object (Page 141)

Background Property
Description
TRUE, when the background of the 3D-bar graph object should be visible. BOOLEAN writeread access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1047

VBS Reference
2.4 Properties

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BackgroundPicture Property
Description
Returns the picture name of the background picture for the graduated scale disk. Read only
access

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BackPictureAlignment property
Description
Defines or returns the mode of representation of the background image in the process picture.
LONG write-read access.

BackPictureName property
Description
Defines the path and file name of the background image in the process picture or returns it.
LONG write-read access.

BackStyle Property
Description
WinCC Digital/Analog Clock
Defines the type of background of the analog clock:
0: The rectangular background of the clock is filled by the specified background color.
1: The round numbered face of the clock is filled by the specified background color. This
enables a round analog clock to be displayed.

1048

2: Numbered face and rectangular background are transparent.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
WinCC Gauge Control
Defines the type of background of the gauge:
0: The rectangular or square background of the gauge has a border color is filled with the
specified color. The circular graduated scale disk is filled by the specified background color.
1: The rectangular or square background of the gauge is transparent. The circular
graduated scale disk is filled by the specified background color. This enables a circular
gauge to be displayed.
2: The rectangular or square background and graduated scale disk are transparent.
WinCC Slider Control
Defines whether the object background should be transparent.
0: The object background is not transparent
1: The object background is transparent
HMI Symbol Library
Defines the icon background transparency. Write/Read access.
0: The background is transparent and, thus, invisible.
1: The background is visible, the color of the background is defined by the "Background
Color" attribute.

See also
HMI Symbol Library (Page 253)
WinCC Slider Control (Page 281)
WinCC Gauge Control (Page 264)
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

BarBackColor Property
Description
Defines the background color in the area of the slider. The area stretches form "RangeMin" to
"RangeMax".

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1049

VBS Reference
2.4 Properties

BarDepth Property
Description
Defines or returns the depth of the bar in pixels.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BarFillColor Property
Description
Defines the fill color in the area of the slider. The area stretches from "RangeMin" to the position
of the slider.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

BarHeight Property
Description
Defines or returns the height of the bar in pixels.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BarWidth Property
Description
Defines or returns the width of the bar in pixels.

1050

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BasePicReferenced Property
Description
TRUE, when the picture assigned in the object status display should be saved. Otherwise,
only the associated object reference is saved. Read only access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

BasePicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "BasePicUseTransColor" property is
"True".

See also
Status display (Page 213)
ScreenItem Object (Page 141)

BasePicture Property
Description
Returns the basic picture for the object status display. Read-only access.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.
In this context, the "BasePicReferenced" property defines whether the basic picture should be
saved together with the object status display or referenced.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1051

VBS Reference
2.4 Properties

BasePicUseTransColor Property
Description
TRUE, when the configured color ("BasePicTransColor" property) of the bitmap objects should
be set to "transparent". BOOLEAN write-read access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

BaseScreenName Property
Function
Defines or returns the current basic picture.
STRING (write-read access)
A picture change is executed using the

HMIRuntime.BaseScreenName = (<Serverprfix>::)<Neues Grundbild>

command.
When reading out the "BaseScreenName" property, only the picture name without server prefix
is returned.
Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

Example:
The following example executes a picture change to "bild1.pdl":

HMIRuntime.BaseScreenName = "bild1"

See also
ScreenItem Object (Page 141)
HMIRuntime Object (Page 134)

1052

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

BaseY Property
Description
Defines or returns the vertical distance of the bottom bar edge to the top edge of the objet field.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

BaseX Property
Description
Defines or returns the horizontal distance of the right bar edge to the left edge of the object
field in pixels.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

2.4.3.2

Be - Bl

BeginTime Property
Description
WinCC Online Trend Control
The "Index" property references a pair of columns. "BeginTime" defines the start time for
displaying this column pair. Write/Read access.
WinCC Online Trend Control
The "Index" property references a trend. "BeginTime" defines the start time for displaying this
trend. Whether the information is evaluated is dependent on the TimeRange" and "CommonX"
properties.
Use the "yyyy-mm-dd hh:mm:ss" format when creating a dynamic time range.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1053

VBS Reference
2.4 Properties

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

BeginValue Property
Description
The "Index" property references a trend. "BeginValue" defines the lower limit of the value range
to be displayed for the trend. Whether the information is evaluated is dependent on the
"Autorange" and "CommonY" properties.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

BeginX Property
Description
Defines or returns the lower limit of the X-axis of a trend referenced with the "Index" property.
Whether the information is evaluated is dependent on the "AutorangeX" and "CommonX"
properties.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

BeginY Property
Description
Defines or returns the lower limit of the Y-axis of a trend referenced with the "Index" property.
Whether the information is evaluated is dependent on the "AutorangeY" and "CommonY"
properties.

See also
ScreenItem Object (Page 141)
WinCC Function Trend Control (before WinCC V7) (Page 290)

1054

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

BevelColorDown Property
Description
Defines the color of the following border sections in the case of 3D representation of the
borders:
with depressed bevel ("BevelStyle" = 1): top and left bevel section
with raised bevel ("BevelStyle" = 2): bottom and right bevel section

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

BevelColorUp Property
Description
Defines the color of the following border sections in the case of 3D representation of the
borders:
with depressed bevel ("BevelStyle" = 1): bottom and right bevel section
with raised bevel ("BevelStyle" = 2): top and left bevel section

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

BevelInner Property
Description
Defines or returns the appearance of the inner part of the object bevel. Write/Read access.
0: inner part not available
1: "depressed" appearance
2: "raised" appearance
3: uniform gray border
4 or higher: uniformly colored order, border color = background color

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1055

VBS Reference
2.4 Properties

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BevelOuter Property
Description
Defines or returns the appearance of the outer part of the object bevel. Write/Read access.
0: inner part not available
1: "depressed" appearance
2: "raised" appearance
3: uniform gray border
4 or higher: uniformly colored order, border color = background color

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BevelWidth Property
Description
Defines or returns the border width for the inner part of the border (inner bevel) and for the
outer border part (outer bevel) in pixels. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

BitNumber Property
Description
Defines or returns the bit whose status must change in order to trigger a change of value. The
tag used must be of the type BYTE, WORD or DWORD.

1056

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Text list (Page 211)
ScreenItem Object (Page 141)

BlinkColor Property
Description
Defines the color of the icon in the flash picture. LONG write-read access.

See also
HMI Symbol Library (Page 253)
ScreenItem Object (Page 141)

BlinkMode property
Flash mode (BlinkMode)
Specifies the flash mode of the icon in runtime.
The following settings are available:
Value

Description

Comments

No flashing

The icon does not flash.

Hidden

The icon flashes in the background color.

Shadow

The icon flashes with shading in the foreground color.

Solid

The icon flashes in the foreground color.

The attribute can be assigned dynamic properties by means of the name BlinkMode. The data
type is LONG.

BlinkSpeed property
Flash rate (BlinkSpeed)
Specifies the length of the icon flash interval in Runtime.
The following settings are available:
Value

Description

Comments

250

Fast

Flash interval of 250 ms.

500

Medium

Flash interval of 500 ms.

1000

Slow

Flash interval of 1000 ms.

The attribute can be assigned dynamic properties by means of the name BlinkSpeed. You can
also use other values. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1057

VBS Reference
2.4 Properties

BlockAlign property
Block alignment - BlockAlign
Defines the mode of aligning the caption of blocks in column headers.
The following settings are available:
Value

Description

Explanation

left

The block caption is left justified.

centered

The block caption is aligned to center.

right

The block caption is right justified.

The attribute can be assigned dynamic properties by means of the name BlockAlign. The data
type is LONG.

BlockAutoPrecisions property
Decimal places automatic - BlockAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" field is disabled.

FALSE

The value in the "Decimal places" field is enabled.

The attribute can be assigned dynamic properties by means of the name


BlockAutoPrecisions. The data type is BOOLEAN.

BlockCaption property
Caption - BlockCaption
Defines the caption of the column header in the control for the selected message block.
The caption is active in all Runtime languages.
The attribute can be assigned dynamic properties by means of the name BlockCaption. The
data type is STRING.

BlockCount property
BlockCount
Specifies the number of blocks to be made available as columns for the control.
The attribute can be assigned dynamic properties by means of the name BlockCount. The
data type is LONG.

1058

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

BlockDateFormat property
Date format - BlockDateFormat
Defines the date format for visualization.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name BlockDateFormat.
The data type is STRING.

BlockExponentialFormat property
Exponential notation - BlockExponentialFormat
Specifies exponential notation for the display of values of a selected block.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


BlockExponentialFormat. The data type is BOOLEAN.

BlockHideText property
Content as text - BlockHideText
Enables the textual display of the content of a selected block.
Value

Explanation

TRUE

The content is not displayed in text format. The option is disabled.

FALSE

The content is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name BlockHideText. The
data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1059

VBS Reference
2.4 Properties

BlockHideTitleText property
Title as text - BlockHideTitleText
Enables the display of the header of a selected block in text format.
Value

Explanation

TRUE

The header is not displayed in text format. The option is disabled.

FALSE

The header is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name BlockHideTitleText.
The data type is BOOLEAN.

BlockId property
BlockId
Default assignment of the ID number and of the block in WinCC RulerControl:

1060

Value

Description

No block

Name

Index

Designation

Display

Tag name Y

Tag name X

Y value

X value/time stamp

Y value (LL)

10

Time stamp (LL)

11

Y value (UL)

12

Time stamp (UL)

13

Minimum

14

Minimum - Time stamp

15

Maximum

16

Maximum - Time stamp

17

Average

18

Standard deviation

19

Integral

20

Weighted mean value

21

Duration

22

Number of values

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name BlockID. The data
type is LONG.

BlockIndex property
BlockIndex
References a block. Using this attribute you can assign the values of other attributes to a
specific block.
Values between 0 and "BlockCount" minus 1 are valid for "BlockIndex". Attribute "BlockCount"
defines the number of available blocks.
The attribute can be assigned dynamic properties by means of the name BlockIndex. The data
type is LONG.

BlockLength property
Length in characters - BlockLength
Specifies the column width for a selected block.
The attribute can be assigned dynamic properties by means of the name BlockLength. The
data type is LONG.

BlockName property
Object name - BlockName
Displays the name of the block selected. You cannot edit this name.
The attribute can be assigned dynamic properties by means of the name BlockName. The
data type is STRING.

BlockPrecisions property
Decimal places - BlockPrecisions
Specifies the number of decimal places of the values in the selected column. You can only
enter the value if the "Automatic" option is disabled.
The attribute can be assigned dynamic properties by means of the name BlockPrecisions. The
data type is SHORT.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1061

VBS Reference
2.4 Properties

BlockShowDate property
Display date - BlockShowDate
Specifies if the "Time" block is displayed with time and date in a field.
Value

Explanation

TRUE

The date and time are displayed. The date format is defined in the "Date format" field.

FALSE

The time is displayed.

The attribute can be assigned dynamic properties by means of the name BlockShowDate. The
data type is BOOLEAN.

BlockShowIcon property
Content as icon - BlockShowIcon
Enables the display of the content of a selected block as icon. This function is only available
in WinCC Alarm Control.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name BlockShowIcon. The
data type is BOOLEAN.

BlockShowTitleIcon property
Title as icon - BlockShowTitleIcon
Enables the display of the header of a selected block as icon. This function is only available
in WinCC Alarm Control.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name BlockShowTitleIcon.
The data type is BOOLEAN.

BlockTimeFormat property
Time format - BlockTimeFormat
Defines the time format to be used for visualization.
The following time formats are available:

1062

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name BlockTimeFormat.
The data type is STRING.

BlockUseSourceFormat property
Use source format - BlockUseSourceFormat
Specifies that the format is inherited from the interconnected control. Here the size of the
control, the zoom factor and the value range are taken into consideration to display the optimal
number of decimal places.
Value

Explanation

TRUE

The formats are derived from the interconnected control.

FALSE

The formats configured in Ruler Control are used, for example, the display of a precisely specified number of
decimal places.

The attribute can be assigned dynamic properties by means of the name


BlockUseSouceFormat. The data type is BOOLEAN.

2.4.3.3

Bo - Bu

BorderBackColor Property
Description
Defines or returns the background color of the line for the object. LONG write-read access.
The background color is only visible with the property setting "BorderWidth" > 0.

See also
ScreenItem Object (Page 141)

BorderColor Property
Description
Defines or returns the line color for the object. LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1063

VBS Reference
2.4 Properties

See also
ScreenItem Object (Page 141)

BorderColor property
Border color - BorderColor
Specifies the border color. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name BorderColor. The
data type is LONG.

BorderColorBottom Property
Description
Defines or returns the border color for the bottom/right part of the object. LONG write-read
access.

See also
ScreenItem Object (Page 141)
Button (Page 215)
Round Button (Page 223)

BorderColorTop Property
Description
Defines or returns the border color for the top/left part of the object. LONG write-read access.

See also
Button (Page 215)
Round Button (Page 223)
ScreenItem Object (Page 141)

BorderEndStyle Property
Description
Defines or returns the line end style of the object. LONG write-read access.

1064

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Polyline (Page 173)
Line (Page 169)
ScreenItem Object (Page 141)

BorderFlashColorOff Property
Description
Defines or returns the color of the object lines for the flashing status "Off". LONG write-read
access.

See also
ScreenItem Object (Page 141)

BorderFlashColorOn Property
Description
Defines or returns the color of the object lines for the flashing status "On". LONG write-read
access.

See also
ScreenItem Object (Page 141)

BorderStyle Property
Description
Defines or returns the line style for the object. Value range from 0 to 4.
0 = solid line
1 = dashed line
2 = dotted line
3 = dash-dotted line
4 = dash-dot-dot line

See also
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1065

VBS Reference
2.4 Properties

BorderWidth Property
Description
Defines or returns the line weight (in pixels) for the object.
WinCC Gauge Control:
Defines or returns the width of the middle border part in pixels.
The object border is composed of three parts. The middle part of the object border is described
by the "BorderWidth" property.
The color of the middle border part is in the background color.

See also
ScreenItem Object (Page 141)

BorderWidth property
Border width - BorderWidth
Specifies the line weight of the border in pixels.
The attribute can be assigned dynamic properties by means of the name BorderWidth. The
data type is LONG.

BottomConnectedConnectionPointIndex Property
Description
Specifies or sets the index number of the bottom connecting point.
LONG write-read access.

See also
Connector (Page 182)
ScreenItem Object (Page 141)

BottomConnectedObjectName Property
Description
Specifies or sets the object name of the object which is docked on at the bottom connecting
point.
LONG write-read access.

1066

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Connector (Page 182)
ScreenItem Object (Page 141)

BoxAlignment Property
Description
TRUE, when the fields are arranged aligned to the right. BOOLEAN write-read access.

See also
Radio box (Page 221)
Check box (Page 219)
ScreenItem Object (Page 141)

BoxCount Property
Description
Defines or returns the number of fields. Value range from 0 to 31.

See also
Radio box (Page 221)
Check box (Page 219)
ScreenItem Object (Page 141)

BoxType Property
Description
Defines or returns the field type. Value range from 0 to 2:
0: Edition
1: Input
2: I/O field

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1067

VBS Reference
2.4 Properties

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

ButtonColor Property
Description
Defines or returns the color of the slider. LONG write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ButtonCommand Property
Description
Upon changing a value of "ButtonCommand", a message is issued to the WinCC Alarm Control
in order to adapt the display in the message window.
Value (hex); value (dec); Retrieved Function:
0x00000001; 1; Message list
0x00000002; 2; Short-term archive list
0x00000004; 4; Long-term archive list
0x00200000; 2097152; Lock list
0x00000008; 8; Acknowledge central signaling device
0x00000010; 16; Single Acknowledgment
0x00000020; 32; Group Acknowledge
0x00000040; 64; Autoscroll
0x00000080; 128; Selection Dialog
0x00000100; 256; Lock Dialog
0x00000200; 512; Print Message Log
0x00000800; 2048; Emergency Acknowledgment
0x00001000; 4096; First Message
0x00002000; 8192; Last Message
0x00004000; 16384; Next Message

1068

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
0x00008000; 32768; Previous Message
0x00010000; 65536; Infotext Dialog
0x00020000; 131072; Comments Dialog
0x00040000; 262144; Loop in Alarm
0x00100000; 1048576; Print current view
0x00400000; 4194304; Lock/unlock message
0x00800000; 8388608; Sorting Dialog
0x01000000; 16777216; Time base dialog
0x02000000; 33554432; Hit list
0x04000000; 67108864; List of messages to be hidden
0x08000000; 134217728; Show/hide message
0x10000000; 268435456; Display option dialog

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Button1MessageClasses property
Message Types for Button 1 (Button1MessageClasses)
Define one or more message events for displaying the first button in the group display. This is
done by entering the numbers of the bits in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
One event can be displayed simultaneously in more than one button.
The "Message Types for Button 1" attribute can be assigned dynamic properties with the name
"Button1MessageClasses".

Button2MessageClasses property
Message Types for Button 2 (Button2MessageClasses)
For displaying both buttons, define one or more message events in the group display. This is
done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1069

VBS Reference
2.4 Properties
The "Message Types for Button 2" attribute can be assigned dynamic properties with the name
"Button2MessageClasses".

Button3MessageClasses property
Message Types for Button 3 (Button3MessageClasses)
For displaying the third button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 3" attribute can be assigned dynamic properties with the name
"Button3MessageClasses".

Button4MessageClasses property
Message Types for Button 4 (Button4MessageClasses)
For displaying the fourth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 4" attribute can be assigned dynamic properties with the name
"Button4MessageClasses".

Button5MessageClasses property
Message Types for Button 5 (Button5MessageClasses)
For displaying the fifth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, separate the numbers with a comma. The
sequence of the assignment defines the priority. If there are more than one selected event for
one button, the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 5" attribute can be assigned dynamic properties with the name
"Button5MessageClasses".

1070

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Button6MessageClasses property
Message Types for Button 6 (Button6MessageClasses)
For displaying the sixth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there are more than one selected event for one button,
the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 6" attribute can be assigned dynamic properties with the name
"Button6MessageClasses".

Button7MessageClasses property
Message Types for Button 7 (Button7MessageClasses)
For displaying the seventh button, define one or more message events in the group display.
This is done by entering the number of the bit in the collect value. The display of the message
events is configured in the "Message Types" property group.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there are more than one selected event for one button,
the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 7" attribute can be assigned dynamic properties with the name
"Button7MessageClasses".

Button8MessageClasses property
Message Types for Button 8 (Button8MessageClasses)
For displaying the eighth button, define one or more message events in the group display. This
is done by entering the number of the bit in the collect value. The display of the message events
is configured in the "Message Types" property group.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there are more than one selected event for one button,
the event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.
The "Message Types for Button 8" attribute can be assigned dynamic properties with the name
"Button8MessageClasses".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1071

VBS Reference
2.4 Properties

Button1Width Property
Description
Defines or returns the width of the Button 1 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Button2Width Property
Description
Defines or returns the width of the Button 2 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Button3Width Property
Description
Defines or returns the width of the Button 3 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

See also
ScreenItem Object (Page 141)
Group Display (Page 208)

Button4Width Property
Description
Defines or returns the width of the Button 4 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the same width.

1072

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

2.4.4

2.4.4.1

Ca - Cl

Caption Property
Description
Application and picture windows
TRUE, when the application or picture window has a title bar in Runtime. Read only access.
The Caption property must be set to TRUE when the application or picture window should
have Maximize and Close buttons.
Controls before WinCC V7
Defines or returns the text to be displayed on the label on the button or in the title bar (Online
Trend Control and Online Table Control). Write/Read access.

See also
Controls (Page 232)
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

Caption property
Text - Caption
Defines the text of the window caption.
The attribute can be assigned dynamic properties by means of the name Caption. The data
type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1073

VBS Reference
2.4 Properties

CaptionColor Property
Description
Defines or returns the color of the element labeling. LONG write-read access.

See also
ScreenItem Object (Page 141)
WinCC Gauge Control (Page 264)

CaptionFont Property
Description
Returns the values for font, font style and font size as well as the "Underline" and
"Strikethrough" effects for the element labeling. Read only access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

CaptionOffset Property
Description
Defines or returns the distance of the element labeling in relation to the top edge of the object.
The element labeling can only be positioned along the vertical diameter of the graduated scale
disk. The value of the attribute is related to the height of the object and is measured from the
top edge of the object to the base of the text. Write/Read access.
The value range is 0 to 1:
0: The base of the text is at the top limit of the object. The text is no longer visible because it
is outside the object.
1: The base of the text is at the bottom limit of the object.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

1074

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

CaptionText Property
Description
Defines or returns the window title which is displayed in Runtime.
The Caption property must be set to TRUE.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

CellCut property (before WinCC V7)


Description
TRUE, when the content of the cells in a message line should be cut if the column width is too
small. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

CellCut property
Shorten contents - CellCut
Shortens cell contents if the cell width is insufficient.
Value

Explanation

TRUE

Enables shortening of cell contents.

FALSE

Disables shortening of cell contents.

The attribute can be assigned dynamic properties by means of the name CellCut. The data
type is BOOLEAN.

CellSpaceBottom property
CellSpaceBottom
Defines the bottom margin of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceBottom.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1075

VBS Reference
2.4 Properties

CellSpaceLeft property
CellSpaceLeft
Defines the left indent of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceLeft . The
data type is LONG.

CellSpaceRight property
CellSpaceRight
Defines the right indent of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceRight . The
data type is LONG.

CellSpaceTop property
CellSpaceTop
Defines the top margin of the table cells.
The attribute can be assigned dynamic properties by means of the name CellSpaceTop . The
data type is LONG.

CenterColor Property
Description
Defines or returns the color of the circular center of the scale (cover of the pointer axis). LONG
write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

CenterScale Property
Description
Defines or returns the diameter of the circular center of the scale (cover of the pointer axis) in
relation to the smaller value of the geometric width and height attributes. Write/Read access.
The value range is 0.03 to 1:

1076

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
1: The diameter corresponds to the smaller value of the "Width" or "Height" geometric values.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

CheckAlarmHigh Property
Description
TRUE, when the "AlarmHigh" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "AlarmHigh", "ColorAlarmHigh" and "TypeAlarmHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckAlarmLow Property
Description
TRUE, when the "AlarmLow" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "AlarmLow", "ColorAlarmLow" and "TypeAlarmLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitHigh4 Property
Description
TRUE, when the "Reserve 4" upper limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitHigh4", "ColorLimitHigh4" and "TypeLimitHigh4" properties.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1077

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitHigh5 Property
Description
TRUE, when the "Reserve 5" upper limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitHigh5", "ColorLimitHigh5" and "TypeLimitHigh5" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitLow4 Property
Description
TRUE, when the "Reserve 4" lower limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitLow4", "ColorLimitLow4" and "TypeLimitLow4" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckLimitLow5 Property
Description
TRUE, when the "Reserve 5" lower limit value should be monitored. BOOLEAN write/read
access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "LimitLow5", "ColorLimitLow5" and "TypeLimitLow5" properties.

1078

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckToleranceHigh Property
Description
TRUE, when the "ToleranceHigh" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "ToleranceHigh", "ColorToleranceHigh" and "TypeToleranceHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckToleranceLow Property
Description
TRUE, when the "ToleranceLow" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "ToleranceLow", "ColorToleranceLow" and "TypeToleranceLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

CheckWarningHigh Property
Description
TRUE, when the "WarningHigh" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "WarningHigh", "ColorWarningHigh" and "TypeWarningHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1079

VBS Reference
2.4 Properties

CheckWarningLow Property
Description
TRUE, when the "WarningLow" limit value is to be monitored. BOOLEAN write/read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
by means of the "WarningLow", "ColorWarningLow" and "TypeWarningLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ClearOnError Property
Description
TRUE, when the field entry is automatically deleted in the case of invalid input. BOOLEAN
write-read access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

ClearOnNew Property
Description
TRUE, when the field entry is deleted as soon as the I/O field has the focus. BOOLEAN writeread access.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

Closeable property (before WinCC V7)


Description
TRUE, when the window can be closed in Runtime. BOOLEAN write-read access.

1080

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

Closeable property
Closeable
Defines whether the control can be closed in Runtime.
Value

Explanation

TRUE

The control can be closed in Runtime.

FALSE

The control cannot be closed in Runtime.

The attribute can be assigned dynamic properties by means of the name Closeable. The data
type is BOOLEAN.

CloseButton Property
Description
TRUE, when the window is provided with a "Close" button. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

2.4.4.2

Co

CoarseGrid Property
Description
TRUE when the value axis is scaled by long tick marks. The distance between two long tick
marks can be changed using the "CoarseGridValue" property. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1081

VBS Reference
2.4 Properties

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

CoarseGridX Property
Description
TRUE, when the X-axis graduation is scaled by long tick marks. The distance between two
long tick marks can be changed using the "CoarseGridValueX" property. BOOLEAN write-read
access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CoarseGridY Property
Description
TRUE, when the Y-axis graduation is scaled by long tick marks. The distance between two
long tick marks can be changed using the "CoarseGridValueY" property. BOOLEAN write-read
access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CoarseGridValue Property
Description
Defines the distance between two long tick marks in the scale. Whether the information is
evaluated is dependent on the value of the "CoarseGrid" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

1082

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

CoarseGridValueX Property
Description
Defines or returns the distance between two long tick marks on the graduation scale of the Xaxis. Whether the information is evaluated is dependent on the value of the "CoarseGridX"
property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CoarseGridValueY Property
Description
Defines or returns the distance between two long tick marks on the graduation scale of the Yaxis. Whether the information is evaluated is dependent on the value of the "CoarseGridY"
property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CollectValue Property
Description
Contains the respective status of the active message class in Runtime as the start value. LONG
write/read access.
The value can be determined from the group display of hierarchically subordinate pictures by
making it dynamic using a tag.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1083

VBS Reference
2.4 Properties

ColMove Property
Description
TRUE, when the arrangement of columns can be changed. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Color Property
Description
The "Index" property references a column pair or a trend. "Color" defines the color of the font
in the column or the trend. LONG write-read access. The color is defined as an RGB value.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ColorAlarmHigh Property
Description
Defines or returns the bar color for the "AlarmHigh" limit value. LONG write/read access.
The "CheckAlarmHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1084

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ColorAlarmLow Property
Description
Defines or returns the bar color for the "AlarmLow" limit value. LONG write/read access.
The "CheckAlarmLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorBottom Property
Description
Defines or returns the color for the bottom/right stop of the slider object. LONG write-read
access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ColorChangeType Property
Description
TRUE, if the change of color should occur segment by segment in the case of a color change
(e.g. on reaching a limit value). If set to FALSE, it defines the change of color for the entire
bar. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1085

VBS Reference
2.4 Properties

ColorLimitHigh4 Property
Description
Defines or returns the color for the "Reserve 4" upper limit value. LONG write/read access.
The "CheckLimitHigh4" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorLimitHigh5 Property
Description
Defines or returns the color for the "Reserve 5" upper limit value. LONG write/read access.
The "CheckLimitHigh5" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorLimitLow4 Property
Description
Defines or returns the color for the "Reserve 4" lower limit value. LONG write/read access.
The "CheckLimitLow4" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1086

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ColorLimitLow5 Property
Description
Defines or returns the color for the "Reserve 5" lower limit value. LONG write/read access.
The "CheckLimitLow5" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorToleranceHigh Property
Description
Defines or returns the color for the "ToleranceHigh" upper limit value. LONG write/read access.
The "CheckToleranceHigh" property must have been set to TRUE if the bar color should
change on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorToleranceLow Property
Description
Defines or returns the color for the "ToleranceLow" lower limit value. LONG write/read access.
The "CheckToleranceLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorTop Property
Description
Defines or returns the color for the top/left stop of the slider object. LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1087

VBS Reference
2.4 Properties

See also
Slider (Page 226)
ScreenItem Object (Page 141)

ColorWarningHigh Property
Description
Defines or returns the color for the "WarningHigh" upper limit value. LONG write/read access.
The "CheckWarningHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColorWarningLow Property
Description
Defines or returns the color for the "WarningLow" lower limit value. LONG write/read access.
The "CheckWarningLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ColTitle Property
Description
TRUE, when the columns in the message window should have a title bar. BOOLEAN writeread access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

1088

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ColumnAdd property
Apply - ColumnAdd
Copies the selected column from the list of existing columns to the list of selected columns.
The attribute can be assigned dynamic properties by means of the name ColumnAdd. The
data type is STRING.

ColumnAlias property
ColumnAlias
Defines the alias specified in the user archive for the column name.
The attribute can be assigned dynamic properties by means of the name ColumnAlias. The
data type is STRING.

ColumnAlign property
Alignment - ColumnAlign
Specifies the mode of alignment of a selected column.
The following settings are available:
Value

Description

Explanation

left

The selected column is aligned left.

centered

The selected column is aligned to center.

right

The selected column is aligned right.

The attribute can be assigned dynamic properties by means of the name ColumnAlign. The
data type is LONG.

ColumnAutoPrecisions property
Decimal places automatic - ColumnAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" field is disabled.

FALSE

The value in the "Decimal places" field is enabled.

The attribute can be assigned dynamic properties by means of the name


ColumnAutoPrecisions. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1089

VBS Reference
2.4 Properties

ColumnCaption property
Caption - ColumnCaption
Sets the caption for a selected column.
The attribute can be assigned dynamic properties by means of the name ColumnCaption. The
data type is STRING.

ColumnCount property
ColumnCount
Defines the number of columns configured.
The attribute can be assigned dynamic properties by means of the name ColumnCount. The
data type is LONG.

ColumnDateFormat property
Date format - ColumnDateFormat
Defines the date format for visualization.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name ColumnDateFormat.
The data type is STRING.

ColumnDMVarName property
ColumnDMVarName
Defines the name of the tag you assigned to the column in the user archive.
The attribute can be assigned dynamic properties by means of the name
ColumnDMVarName. The data type is STRING.

1090

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ColumnExponentialFormat property
Exponential notation - ColumnExponentialFormat
Sets exponential notation for the display of values of a selected column.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


ColumnExponentialFormat. The data type is BOOLEAN.

ColumnFlagNotNull property
ColumnFlagNotNull
Specifies whether the user archive field assigned to the column must have a value.
Value

Explanation

Yes

The column must have a value.

No

The column can have a value.

The attribute cannot be dynamized.

ColumnFlagUnique property
ColumnFlagUnique
Specifies whether the user archive field assigned to the column must have a unique value.
Values in this column must not be redundant.
Value

Explanation

TRUE

The column must have a unique value.

FALSE

The column must not have a unique value.

The attribute cannot be dynamized.

ColumnHideText property
Content as text - ColumnHideText
Defines textual display of the contents of a selected column.
Value

Explanation

TRUE

The content is not displayed in text format. The option is disabled.

FALSE

The content is displayed in text format. The option is enabled.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1091

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ColumnHideText.
The data type is BOOLEAN.

ColumnHideTitleText property
Text header - ColumnHideTitleText
Sets textual display of the header of a selected column.
Value

Explanation

TRUE

The header is not displayed in text format. The option is disabled.

FALSE

The header is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name


ColumnHideTitleText. The data type is BOOLEAN.

ColumnIndex property
ColumnIndex
References a control column. Using this attribute you can assign the values of other properties
to a specific column.
Values between 0 and "ColumnCount" minus 1 are valid for "ColumnIndex"; the attribute
"ColumnCount" defines the number of available columns.
The "ColumnIndex" attribute can be assigned dynamic properties by means of attribute
ColumnIndex. The data type is LONG.

ColumnLeadingZeros property
With leading zeros - ColumnLeadingZeros
Enables the display of values with leading zeros for the column selected. Use "Number of
digits" or "ColumnLeadingZeros" to specify the number of leading zeros. The maximum
number is "11". No leading zeros are displayed with the value "0". The "With leading zeros"
option is deactivated.
The attribute can be assigned dynamic properties by means of the name
ColumnLeadingZeros. The data type is LONG.

ColumnLength property
Length in Characters - ColumnLength
Specifies the width of a selected column.

1092

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ColumnLength. The
data type is LONG.

ColumnMaxValue property
ColumnMaxValue
Defines the maximum column value specified in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnMaxValue.
The data type is STRING.

ColumnMinValue property
ColumnMinValue
Defines the minimum column value specified in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnMinValue.
The data type is STRING.

ColumnName property
ColumnName
Defines the name of the column which is referenced by means of "ColumnIndex" attribute.
The attribute can be assigned dynamic properties by means of the name ColumnName. The
data type is STRING.

ColumnPosition property
ColumnPosition
Displays the field position defined in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnPosition. The
data type is LONG.

ColumnPrecisions property
Decimal places - ColumnPrecisions
Specifies the number of decimal places of the values in the selected column. You can only
enter the value if the "Automatic" option is disabled.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1093

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ColumnPrecisions.
The data type is SHORT.

ColumnReadAccess property
ColumnReadAccess
Defines authorizations for read access to the column as specified in the user archive. The
number corresponds with the number assigned to the authorization in the "User Administrator"
editor.
The attribute cannot be dynamized.

ColumnReadonly property
Write protected - ColumnReadonly
Sets the write protection of a selected column.
Value

Explanation

TRUE

This column is write protected.

FALSE

This column is not write protected. You can edit the column values in Runtime by activating the "Change"
option in the General" tab.

The attribute can be assigned dynamic properties by means of the name ColumnReadonly.
The data type is BOOLEAN.

ColumnRemove property
Remove - ColumnRemove
Cuts selected columns from the list of selected columns and pastes these to the list of available
columns.
The attribute can be assigned dynamic properties by means of the name ColumnRemove. The
data type is STRING.

ColumnRepos property
Up/Down - ColumnRepos
Changes the order of columns. "Up" and "Down" move the column selected up or down in the
list. This moves the column towards the front or towards the back.
The attribute can be assigned dynamic properties by means of the name ColumnRepos. The
data type is LONG.

1094

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ColumnResize property
Width can be resized - ColumnResize
Enables changes to the width of columns.
Value

Explanation

TRUE

You can change the width of the columns.

FALSE

You cannot change the width of the columns.

The attribute can be assigned dynamic properties by means of the name ColumnResize. The
data type is BOOLEAN.

ColumnSrollbar properties
Column scroll bars - ColumnScrollbar
Enables the display of column scroll bars.
The following settings are available:
Value

Description

Explanation

no

Column scroll bars are not displayed.

as required

Column scroll bars are displayed if vertical space requirements of the


control are greater than the actually available display area.

always

Column scroll bars are always displayed.

The attribute can be assigned dynamic properties by means of the name ColumnScrollbar.
The data type is LONG.

ColumnShowDate property
Display date - ColumnShowDate
Specifies if the "Time" block is displayed with time and date in a field.
Value

Explanation

TRUE

The date and time are displayed. The date format is defined in the "Date format" field.

FALSE

The time is displayed.

The attribute can be assigned dynamic properties by means of the name ColumnShowDate.
The data type is BOOLEAN.

ColumnShowIcon property
Content as icon - ColumnShowIcon

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1095

VBS Reference
2.4 Properties
Enables the display the contents of a selected column by means of icon. This function is only
available in WinCC Alarm Control.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name ColumnShowIcon.
The data type is BOOLEAN.

ColumnShowTitleIcon property
Header as icon - ColumnShowTitleIcon
Specifies the display of the header of a selected column by means of icon. This function is
only available in WinCC Alarm Control.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


ColumnShowTitleIcon. The data type is BOOLEAN.

ColumnSort property
ColumnSort
Defines the sorting order of the user archive column referenced in the "ColumnIndex" attribute.
The following settings are available:
Value

Description

Explanation

No

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name ColumnSort . The
data type is LONG.

ColumnSortIndex property
ColumnSortIndex
Defines the sorting order of the column referenced in "ColumnIndex". The sorting criterion is
removed from "ColumnSort" if you set a "0" value..

1096

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ColumnSortIndex.
The data type is LONG.

ColumnStartValue property
ColumnStartValue
Defines the column start value specified in the user archive.
The attribute can be assigned dynamic properties by means of the name ColumnStartValue.
The data type is STRING.

ColumnStringLength property
ColumnStringLength
Displays the string length of the column as defined in the user archive.
The attribute can be assigned dynamic properties by means of the name
ColumnStringLength. The data type is LONG.

ColumnTimeFormat property
Time format - ColumnTimeFormat
Defines the time format to be used for visualization.
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name


ColumnTimeFormat. The data type is STRING.

ColumnTitleAlign property
Column title alignment - ColumnTitleAlign
Specifies the type of column title alignment.
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1097

VBS Reference
2.4 Properties
Value

Description

Explanation

left

The column titles are left justified.

centered

The column titles are centered.

right

The column titles are right justified.

Same as table
content

The column titles are justified to fit the corresponding column content.

The attribute can be assigned dynamic properties by means of the name ColumnTitleAlign.
The data type is LONG.

ColumnTitles property
Show column title - ColumnTitles
Enables the display of the column header.
Value

Explanation

TRUE

The column header is displayed.

FALSE

The column header is not displayed.

The attribute can be assigned dynamic properties by means of the name ColumnTitles. The
data type is BOOLEAN.

ColumnType property
Type - ColumnType
Displays the data type set in the user archive for a selected column.
The attribute can be assigned dynamic properties by means of the name ColumnType. The
data type is LONG.

ColumnVisible property
ColumnVisible
Enables the display of a column referenced by means of "ColumnIndex" attribute.
Value

Explanation

TRUE

The column is displayed.

FALSE

The column is not displayed.

The attribute can be assigned dynamic properties by means of the name ColumnVisible . The
data type is BOOLEAN.

1098

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ColumnWriteAccess property
ColumnWriteAccess
Defines authorizations for write access to the column as specified in the user archive. The
number corresponds with the number assigned to the authorization in the "User Administrator"
editor.
The attribute cannot be dynamized.

ColWidth Property
Description
TRUE, when it should be possible to change the widths of the columns in the message window.
The width of the columns can only be changed, however, when the "AutoScroll" property is
not active. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

Command Property
Description
TRUE, when updating of the values displayed in the control should be forced.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

Comment property
Description
Reads or sets the Alarm object comment.

See also
Alarms object (list) (Page 126)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1099

VBS Reference
2.4 Properties

CommonTime Property
Description
TRUE, when a common time column is to be used in the table window. BOOLEAN write-read
access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

CommonX Property
Description
TRUE, when the trends in the trend window should be displayed with a common X-axis.
BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CommonY Property
Description
TRUE, when the trends in the trend window should be displayed with a common Y-axis.
BOOLEAN write-read access.

See also
ScreenItem Object (Page 141)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

ComputerName property
Description
Returns the name of the computer on which the alarm object was triggered.

1100

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
ComputerName (readonly)

See also
Alarms object (list) (Page 126)

Context property
Description
Reads or sets the alarm object server prefix.

See also
Alarms object (list) (Page 126)

ConnectTrendWindows property
Connect trend windows - ConnectTrendWindows
Enables the connection of trend windows configured. You must have configured several trend
windows.
The connected trend windows have the following properties:
They can have a common X axis.
They have a scroll bar.
They have a ruler.
The zoom functions for a trend window affect the connected trend windows.
Value

Description

TRUE

All trend windows configured are connected.

FALSE

The trend windows are displayed separately.

The attribute can be assigned dynamic properties by means of the name


ConnectTrendWindows. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1101

VBS Reference
2.4 Properties

ContinousChange Property
Description
Defines the type of transfer of the value defined by the slider ("Position" property) in Runtime:
FALSE : The value of the "Position" property is transferred when the mouse button is
released.
TRUE : The value of the "Position" property is transferred immediately following a change
of the slider position.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

Count Property
Description
Supplies the number of elements in a list.
INTEGER (read-only access).

Example:
The example shows how the number of objects in a DataSet list is output.

'VBS165
HMIRuntime.Trace "Count: " & HMIRuntime.DataSet.Count & vbNewLine

The following example adds two tags to the TagSet list and outputs the count properties as
Trace.

'VBS177
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "Count: " & group.Count & vbNewLine

1102

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
CreateTagSet Method (Page 701)
TagSet Object (List) (Page 156)
ScreenItems Object (List) (Page 144)
Screens Object (List) (Page 149)
Layers Object (Listing) (Page 137)
DataSet Object (List) (Page 132)
ProcessValues Object (List) (Page 140)

2.4.4.3

Cu

CurrentContext Property
Description
In the case of a picture window, the server from which the picture comes and contains the
script is read out.
The "CurrentContext" property can return different results: If, for example, a picture window
displaying a server picture is set in a local basic picture, distinction is made between two cases:
The "CurrentContext" property is used in an action of the picture window picture: The result
is the return of the symbolic computer name of the server (Package property) extended by
two colons, e.g."WinCCProject_MyComputer:: .
The "CurrentContext" property is used in an action of the basic picture: The result is returned
in the form of an empty character string.

See also
HMIRuntime Object (Page 134)

Cursor Property
Description
Controls the appearance of the cursor in Runtime when positioned over an icon.
0: The cursor appears as an arrow and does not change when positioned over the icon.
1: The cursor appears as a 3D arrow accompanied by a green lightening symbol. In
Runtime, this indicates that the object concerned can be operated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1103

VBS Reference
2.4 Properties

See also
ScreenItem Object (Page 141)
HMI Symbol Library (Page 253)

Cursor property
Mouse pointer (Cursor)
Specifies whether or not to display the mouse pointer on the icon at runtime.
Value

Explanation

TRUE

The mouse pointer is shown at runtime if positioned on the icon.

FALSE

The mouse pointer is hidden at runtime if positioned on the icon.

The attribute can be assigned dynamic properties by means of the name Cursor. The data
type is BOOLEAN.

CursorControl Property
Description
TRUE, when Alpha Cursor mode is activated, the cursor skips to the next field in the TAB
sequence after exiting the field. BOOLEAN write-read access.
To do this, the "CursorMode" property must be set to TRUE.

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

CurveForm Property
Description
WinCC Function Trend Control
Defines how the measuring points of a trend referenced by the "Index" property should be
connected. Write/Read access.
WinCC Online Trend Control
The "Index" property references a trend. "CurveForm" defines how the measuring points
should be connected.

1104

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
0x00000012 Representation of the measuring points.
0x00000014 Measuring points are connected linearly.
0x00000011 Measuring points are connected via a step curve.
0x00000021 The area under the linearly connected trend is filled.
0x00000022: The area under the step curve is filled.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

CursorMode Property
Description
When the "CursorMode" is set to "yes", you can show all messages from the short-term archive
page by page in the long-term archive list. Use the "CursorModePrefetch" property to
determine the number of messages shown per page.
The "Autoscroll" option must be unchecked in order to be able to switch between pages. Write/
Read access.

CursorModePrefetch Property
Description
Sets the number of message that you want to display page by page in the long-term archive
list out of all messages in the short-term archive.
The "CursorMode" object property must be set to "yes".
Write/Read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1105

VBS Reference
2.4 Properties

2.4.5

2.4.5.1

Da

DangerColor Property
Description
Defines or returns the color of the danger zone on the scale. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

Danger Property
Description
Defines or returns the beginning of the "danger zone". The zone stretches from the "danger"
value to the end of the scale. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

DataFormat Property
Description
Returns the data type of the I/O field object. Read only access.
Value range from 0 to 3.
0: Binary
1: Decimal
2: String
3: Hexadecimal

1106

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

DataIndex Property
Description
Returns the current index of the data of the current trend.
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DataLogs Property
Description
Returns an object of type "DataLogs".
DataLogs (read-only)

See also
DataLogs Object (Page 130)
HMIRuntime Object (Page 134)

DataSet Property
Description
Returns an object of type "DataSet".
DataSet (read-only)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1107

VBS Reference
2.4 Properties

See also
DataSet Object (List) (Page 132)
HMIRuntime Object (Page 134)

DataX Property
Description
Inserts a single data record and must be set before calling "InsertData".
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DataXY Property
Description
Inserts several data records as an array with pairs of values and must be set before calling
"InsertData".
The data in the array is assumed when "DataX" is of the VT_EMPTY type. Otherwise, the
"InsertData" attribute used the single value pair resulting from DataX and DataY.
Note
The property is only supported for the controls prior to WinCC V7.

See also
Example: Calling Methods of an ActiveX Control (Page 819)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1108

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

DataY Property
Description
Inserts a single data record and must be set before calling "InsertData".
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.5.2

De - Do

DefaultMsgFilterSQL property
DefaultMsgFilterSQL
Defines an SQL statement for a fixed selection of messages.
The SQL statements of "DefaultMsgFilterSQL" and "MsgFilterSQL" are linked logically by
"AND" operation if you define additional custom selections by means of "MsgFilterSQL"
attribute.
The attribute can be assigned dynamic properties by means of the name
DefaultMsgFilterSQL. The data type is STRING.

DefaultPrecision Property
Description
This attribute defines the number of default decimal places, with which the scale value is
specified. Write/Read access.

DefaultRulerPrecision Property
Description
This attribute defines the number of decimal places as standard value with which a measured
value should be displayed when it is determined using the "Display value at this position"
function. Write/Read access.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1109

VBS Reference
2.4 Properties

DefaultSort property
Default sorting order - DefaultSort
Defines the default sorting order in table columns.
The following settings are available:
Value

Description

Explanation

Ascending

The list is updated starting with the bottom line.

Descending

The list is updated starting with the top line.

The attribute can be assigned dynamic properties by means of the name DefaultSort. The data
type is LONG.

DefaultSort2 property
DefaultSort2
Use this function to define the sorting method in table columns if not using the default "Date/
time/number" sorting order. Instead, you defined a message block in the "DefaultSort2Column"
object property to sort the columns based on the "message block/date/time/number" order.
The following settings are available:
Value

Description

Explanation

Ascending

The list is updated starting with the bottom line.

Descending

The list is updated starting with the top line.

The attribute can be assigned dynamic properties by means of the name DefaultSort2. The
data type is LONG.

DefaultSort2Column property
DefaultSort2Column
Use this function to define the sorting method in table columns if not using the default "Date/
time/number" sorting order.
Define a message block by its object name.
The table columns are now sorted based on the "message block/date/time/number" order.
The attribute can be assigned dynamic properties by means of the name
DefaultSort2Column. The data type is STRING.

1110

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

DeleteData Property
Description
Deletes data in the data buffer of the current trend.
TRUE : All trend data is deleted.
FALSE : The value pair at the "DataIndex" position are deleted.
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Delta Property
Description
Defines or returns the value difference between two main scale graduation marks. Write/Read
access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

DesiredCurveColor Property
Description
Defines the color of a setpoint trend which belongs to a trend referenced by the "Index"
property. The color is defined as an RGB value. Whether the information is evaluated is
dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1111

VBS Reference
2.4 Properties

DesiredCurveCurveForm Property
Description
Defines the form of representation of a setpoint trend which belongs to a trend referenced by
the "Index" property. Whether the information is evaluated is dependent on the value of the
"DesiredCurveVisible" property.
0x00000011 Measuring points are connected by a solid line via a step curve
0x00000012 Representation of the measuring points
0x00000014 Measuring points are connected linearly with a solid line
0x00000021 The area under the linearly connected trend is filled.
0x00000022: The area under the stepped curve is filled.
0x00000031: Measuring points are connected by a dashed line via a step curve
0x00000032: Measuring points are connected linearly with a dashed line

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceNumberOfUAValues Property
Description
Defines the number of value pairs of a setpoint trend which belongs to a trend referenced by
the "Index" property. Whether the information is evaluated is dependent on the value of the
"DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAArchive Property
Description
Defines the name of the user archive from which the value of a setpoint trend, which belongs
to a trend referenced by "Index", is read. Whether the information is evaluated is dependent
on the value of the "DesiredCurveVisible" property.

1112

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAArchiveStartID Property
Description
Defines the starting point for the value of a setpoint trend, which belongs to a trend referenced
by "Index", from which the values should be read from the archive. Whether the information is
evaluated is dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAColumnX Property
Description
Defines the column in the user archive from which the X-values of a setpoint trend, which
belongs to a trend referenced by "Index", should be read. Whether the information is evaluated
is dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

DesiredCurveSourceUAColumnY Property
Description
Defines the column in the user archive from which the Y-values of a setpoint trend, which
belongs to a trend referenced by "Index", should be read. Whether the information is evaluated
is dependent on the value of the "DesiredCurveVisible" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1113

VBS Reference
2.4 Properties

DesiredCurveVisible Property
Description
TRUE, a setpoint trend which belongs to a trend referenced by "Index" should be displayed.
BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Direction Property
Description
Defines or returns the bar direction or the position of the slider object. BOOLEAN write-read
access. Value range from 0 to 3.
0 = top
1 = bottom
2 = left
3 = right

See also
Slider (Page 226)
Bar (Page 189)
3D Bar (Page 184)
ScreenItem Object (Page 141)

DisplayName property
Display name (DisplayName)
Specifies the user-defined name of the process picture. The attribute is of type "Multilingual
String". You can specify names for all languages installed in WinCC.
The "Display name" attribute can be dynamized with the "DisplayName" name.

1114

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

DisplayOptions property
Show messages - DisplayOptions
Select the messages to be displayed.
The following selection options are available:
Value

Designation

All messages

Only displayed messages

Only hidden messages

The attribute can be assigned dynamic properties by means of the name DisplayOptions. The
data type is LONG.

DisplayOptions property (before WinCC V7)


Description
Specifies if a button is assigned to a graphic, text, or both.
0
1
2
3

Picture or text: If a picture exists, the button is assigned with the picture, otherwise it is
assigned with text.
Graphic and text
Text only
Graphic only

DoubleClickAction property
Action on double-click - DoubleClickAction
Sepcifies the action to be executed in Runtime by double-clicking on a message line.
The following settings are available:
Value

Description

Explanation

none

No action.

Loop-in-alarm

Calls the "Loop-in-alarm" function.

Open comments dialog

Calls the "Comments dialog" button function.

Open Infotext dialog

Calls the "Infotext dialog" button function.

Column-dependent

The action is determined by the column in which you


double-clicked.

The attribute can be assigned dynamic properties by means of the name DoubleClickAction.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1115

VBS Reference
2.4 Properties

2.4.6

2.4.6.1

Edit Property

Description
Activates Editing mode for a cell as long as the "Editable" property has been set to TRUE for
the corresponding column.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

2.4.6.2

Editable Property

Description
The "Index" property references a pair of columns. "Editable" defines whether the column pair
should be editable. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

2.4.6.3

EditAtOnce Property

Description
TRUE, if accessing the field with the <TAB> key permits input immediately and without further
action. BOOLEAN write-read access.

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

1116

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.6.4

Enabled Property

Function
Enables or disables possible operation of an object or issues the corresponding value. TRUE :
Enable operation, FALSE: Operation is disabled.
BOOLEAN write-read access.

Example:
The following example disables all objects in the picture "NewPDL1":

'VBS71
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Enabled=False
'Lock object
Next

'Read names of objects

See also
Screen Object (Page 146)
ScreenItem Object (Page 141)

2.4.6.5

EnableDelete property

Delete - EnableDelete
Enables deletion of data from the user archive in Runtime.
Value

Explanation

TRUE

You can delete data from the user archive in Runtime.

FALSE

You cannot delete data from the user archive in Runtime.

The attribute can be assigned dynamic properties by means of the name EnableDelete. The
data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1117

VBS Reference
2.4 Properties

2.4.6.6

EnableEdit property

Modify - EnableEdit
Enables editing of the data displayed during runtime.
Value

Explanation

TRUE

Enables editing of data during runtime.

FALSE

Disables editing of data during runtime.

The attribute can be assigned dynamic properties by means of the name EnableEdit. The data
type is BOOLEAN.

2.4.6.7

EnableInsert property

Add - EnableInsert
Enables insertion of data in the user archive in Runtime.
Value

Explanation

TRUE

You can add data to the user archive in Runtime.

FALSE

You cannot add data to the user archive in Runtime.

The attribute can be assigned dynamic properties by means of the name EnableInsert. The
data type is BOOLEAN.

2.4.6.8

EnablePopupMenu property

EnablePopupMenu
Specifies if the pop-up menu is enabled in the control.
The attribute can be assigned dynamic properties by means of the name EnablePopupMenu.
The data type is BOOLEAN.

2.4.6.9

EndAngle Property

Description
Defines or returns the end of the object. The information is in counterclockwise direction in
degrees, beginning at the 12:00 clock position.

1118

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Pie segment (Page 167)
Circular arc (Page 166)
Ellipse segment (Page 162)
Ellipse arc (Page 161)
ScreenItem Object (Page 141)

2.4.6.10

EndTime Property

Description
Online Table Control
The "Index" attribute references a pair of columns. "EndTime" defines the end time for
displaying this column pair. Whether the information is evaluated is dependent on the
TimeRange" and "CommonTime" properties. Write/Read access.
Online Trend Control
The "Index" attribute references a trend. "EndTime" defines the end time for displaying this
trend. Whether the information is evaluated is dependent on the "Autorange", "TimeRange"
and "CommonX" properties.
Use the "yyyy-mm-dd hh:mm:ss" format when creating a dynamic time range.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

2.4.6.11

EndValue Property

Description
The "Index" property references a trend. "EndValue" defines the upper limit of the value range
to be displayed for the trend. Whether the information is evaluated is dependent on the
"Autorange" and "CommonY" properties.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1119

VBS Reference
2.4 Properties

2.4.6.12

EndX Property

Description
Defines the upper limit of the X-axis of a trend referenced with "Index". Whether the information
is evaluated is dependent on the "AutorangeX" and "CommonX" properties.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.6.13

EndY Property

Description
Defines the upper limit of the Y-axis of a trend referenced with "Index". Whether the information
is evaluated is dependent on the "AutorangeY" and "CommonY" properties.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.6.14

ErrorDescription Property

Function
Error description of the "LastError" property. The error description is provided in English only.
STRING (read only)
The following error messages are defined:
Output

Description

""

OK

"Operation Failed"

Execution error

"Variable not found"

Tag error

"Server down"

Server not available.

"An error occured for one or several tags"

Multi Tag Error (Error in one or several tags)

In order that ErrorDescription returns a value, a read process must be executed beforehand.
If an error occurs during read or write of several tags using the TagSet object, the error is set
to "Multi Tag Error". In order to determine at which tag the error occurred and what type of
error it was, the ErrorDescription property of each tag must be analyzed.

1120

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Example:
The following example displays the error description for "Tag1":

'VBS72
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objtag.Read
MsgBox objTag.ErrorDescription

The following example adds two tags to the TagSet list and outputs the ErrorDescription
property as Trace.

'VBS179
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "ErrorDescription: " & group.ErrorDescription & vbNewLine

The ErrorDescription property of a tag contained in the list may be accessed as follows:

HMIRuntime.Trace "ErrorDescription: " & group("Motor1").ErrorDescription & vbNewLine

See also
LastError Property (Page 445)
QualityCode Property (Page 532)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

2.4.6.15

Exponent Property

Description
TRUE, when the display of numbers should be with exponents (e.g."1.00e+000"). BOOLEAN
write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1121

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.6.16

ExportDirectoryChangeable property

Directory can be changed - ExportDirectoryChangeable


Enables changing of the directory for data export in Runtime.
Value

Explanation

TRUE

The data export directory can be changed in Runtime.

FALSE

The data export directory cannot be changed in Runtime.

The attribute can be assigned dynamic properties by means of the name


ExportDirectoryChangeable. The data type is BOOLEAN.

2.4.6.17

ExportDirectoryname property

Directory - ExportDirectoryname
Defines the directory to which the exported Runtime data is written.
You can select or create the directory using the selection button.
The attribute can be assigned dynamic properties by means of the name
ExportDirectoryname. The data type is STRING.

2.4.6.18

ExportFileExtension property

ExportFileExtension
Defines the extension of the export file.
Only the file name extension "csv" is currently supported.
The attribute can be assigned dynamic properties by means of the name
ExportFileExtension. The data type is STRING.

2.4.6.19

ExportFilename property

File name - ExportFilename


Defines the name of the file which is to receive the exported Runtime data.

1122

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ExportFilename. The
data type is STRING.

2.4.6.20

ExportFilenameChangeable property

File can be renamed - ExportFilenameChangeable


Enables renaming of the export file in Runtime.
Value

Explanation

TRUE

The export file can be renamed in Runtime.

FALSE

The export file cannot be renamed in Runtime.

The attribute can be assigned dynamic properties by means of the name


ExportFilenameChangeable. The data type is BOOLEAN.

2.4.6.21

ExportFormatGuid property

ExportFormatGuid
Default assignment of the ID number and export provider.
The attribute can be assigned dynamic properties by means of the name ExportFormatGuid.
The data type is STRING.

2.4.6.22

ExportFormatName property

Format - ExportFormatName
Defines the export file format.
Only the "csv" file format is currently available for the export.
The attribute can be assigned dynamic properties by means of the name ExportFormatName.
The data type is STRING.

See also
How to export Runtime data

2.4.6.23

ExportParameters property

ExportParameters
Specifies the parameters of the selected format by means of the properties dialog.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1123

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ExportParameters.
The data type is VARIANT.

2.4.6.24

ExportSelection property

Scope of data export - ExportSelection


Specifies the control's Runtime data to be exported.
The following settings are available:
Value

Description

Explanation

all

All Runtime data of the control is exported.

Selection

Selected Runtime data of the control is exported.

The attribute can be assigned dynamic properties by means of the name ExportSelection. The
data type is LONG.

2.4.6.25

ExportShowDialog property

Show dialog - ExportShowDialog


Enables the display of the export dialog during runtime.
Value

Explanation

TRUE

The dialog is displayed during runtime.

FALSE

The dialog is not displayed during runtime.

The attribute can be assigned dynamic properties by means of the name ExportShowDialog.
The data type is BOOLEAN.

2.4.6.26

ExportXML property

ExportXML
Only used internally.
The attribute can be assigned dynamic properties by means of the name ExportXML.

1124

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.6.27

ExtendedOperation Property

Description
TRUE, when the slider regulator is set at the respective end value (minimum/maximum value).
This is done by clicking the mouse in an area outside the current regulator setting. BOOLEAN
write-read access.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

2.4.6.28

ExtendedZoomingEnable Property

Description
Activates/deactivates the ExtendedZooming properties of a picture.
Using ExtendedZooming, the view of a process picture in Runtime may be enlarged or reduced
by using the mouse wheel.
BOOLEAN write-read access.

Example:
Activates ExtendedZooming for picture NewPDL1.

'VBS155
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
objScreen.ExtendedZoomingEnable = 1

See also
Screen Object (Page 146)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1125

VBS Reference
2.4 Properties

2.4.7

2.4.7.1

Fe - Fl

FeatureFullscreen property
FeatureFullscreen
Specifies if the "Full screen" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeatureFullscreen.
The data type is BOOLEAN.

FeaturePause property
FeaturePause
Specifies if the "Pause" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeaturePause. The
data type is BOOLEAN.

FeaturePlay property
FeaturePlay
Specifies if the "Play" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeaturePlay. The
data type is BOOLEAN.

FeatureStepBackward property
FeatureStepBackward
Specifies if the "Step backward" function is available in the control.
The attribute can be assigned dynamic properties by means of the name
FeatureStepBackward. The data type is BOOLEAN.

FeatureStepForward property
FeatureStepForward
Specifies if the "Step forward" function is available in the control.

1126

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
FeatureStepForward. The data type is BOOLEAN.

FeatureStop property
FeatureStop
Specifies if the "Stop" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeatureStop. The
data type is BOOLEAN.

FeatureVolume property
FeatureVolume
Specifies if the "Volume" function is available in the control.
The attribute can be assigned dynamic properties by means of the name FeatureVolume. The
data type is BOOLEAN.

FileName property
FileName
Specifies the file whose content you want to display or play.
The attribute can be assigned dynamic properties by means of the name FileName. The data
type is STRING.

FillColor Property
Description
Defines or returns the fill pattern color for the object.
LONG (write-read access)
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Enter the appropriate decimal value
for each of the three RGB values.
Example:
RGB(200, 150, 100)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1127

VBS Reference
2.4 Properties

Example:
The following example defines the fill color for "ScreenWindow1" to blue:

'VBS73
Dim objScreen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.FillStyle = 131075
objScreen.FillColor = RGB(0, 0, 255)

See also
FillStyle Property (Page 407)
BackColor Property (Page 323)
ScreenItem Object (Page 141)

Filling Property
Description
TRUE, when the object can be filled by closed border lines (e.g. representing the fill level of a
tank). BOOLEAN write-read access.
The fill level of the object is set by means of the "FillingIndex" property.

See also
ScreenItem Object (Page 141)

FillingDirection properties
Filling direction (FillingDirection)
The "Filling direction" attribute specifies the filling direction for an object enclosed in a frame
line.
Bottom to top

The object is filled from bottom to top.

Top to bottom

The object is filled from top to bottom.

Left to right

The object is filled from left to right.

Right to left

The object is filled from right to left.

The attribute can be assigned dynamic properties by means of the name FillingDirection. The
data type is LONG.

1128

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

FillingIndex Property
Description
Defines the %age value (related to the height of the object) to which the object with closed
border line is to be filled.
The fill level is represented by the current background color. The unfilled background is
transparent.

See also
ScreenItem Object (Page 141)

FillStyle Property
Description
Defines or returns the fill pattern for the object.
LONG (write-read access)
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

65536
0

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1048576

196611

196627

1048577

196612

196628

1048578

196613

196629

1048579

196614

196630

1048832

196615

196631

1048833

196616

196632

1048834

196617

196633

1048835

196618

196634

131072

196619

196635

1129

VBS Reference
2.4 Properties
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

131073

196620

196636

131074

196621

196637

131075

196622

196638

131076

196623

196639

196608

196624

196640

196609

196625

196641

196610

196626

196642

Example
The following example sets the fill pattern for "ScreenWindow1" to transparent:

'VBS190
Dim obj
Set obj = ScreenItems("Rectangle1")
obj.FillStyle = 65536

See also
FillColor Property (Page 405)
BackColor Property (Page 323)
Screen Object (Page 146)

FillStyle2 Property
Description
Defines or returns the fill style of the bar.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1130

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

FillStyleAlignment property
Description
Defines the alignment of the fill pattern for the process picture.
Normal

The fill pattern refers to the process picture. In runtime, no scaling is


performed when opening the picture.
Stretched (window) The fill pattern refers to the window in the Graphics Designer. In runtime,
scaling is performed when opening the picture.

FilterSQL property
FilterSQL
Defines an SQL statement for a selection of data in the user archive.
The attribute can be assigned dynamic properties by means of the name FilterSQL. The data
type is STRING.

FineGrid Property
Description
TRUE, when the value axis is scaled by short tick marks. The distance between two short tick
marks can be changed using the "FineGridValue" property. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

FineGridValue Property
Description
Defines the distance between two short tick marks in the scale. Whether the information is
evaluated is dependent on the value of the "FineGrid" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1131

VBS Reference
2.4 Properties

FineGridValueX Property
Description
Defines the distance between two short tick marks on the X-axes scaling. Whether the
information is evaluated is dependent on the value of the "FineGridX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FineGridValueY Property
Description
Defines the distance between two short tick marks on the Y-axes scaling. Whether the
information is evaluated is dependent on the value of the "FineGridX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FineGridX Property
Description
TRUE, when the X-axis graduation is scaled by short tick marks. The distance between two
short tick marks can be changed using the "FineGridValueX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FineGridY Property
Description
TRUE, when the Y-axis graduation is scaled by short tick marks. The distance between two
short tick marks can be changed using the "FineGridValueY" property.

1132

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

FlashBackColor Property
Description
TRUE, when flashing of the background is activated. BOOLEAN write-read access

See also
ScreenItem Object (Page 141)

FlashBorderColor Property
Description
TRUE, when flashing of the object lines is activated. BOOLEAN write-read access.

See also
ScreenItem Object (Page 141)

FlashFlashPicture Property
Description
TRUE, when flashing of the flash picture is activated. BOOLEAN write-read access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashForeColor Property
Description
TRUE, when flashing of the text is activated. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1133

VBS Reference
2.4 Properties

See also
I/O Field (Page 199)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
ScreenItem Object (Page 141)

FlashPicReferenced Property
Description
TRUE, when the assigned flash picture should be saved. Otherwise, only the associated object
reference is saved. Read only access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashPicTransColor Property
Description
Defines which color of the bitmap object (.bmp, .dib) assigned to the flash picture should be
set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "FlashPicUseTransColor" property is
"True".

See also
ScreenItem Object (Page 141)
Status display (Page 213)

FlashPicture Property
Description
Returns the flash picture. Read-only access.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

1134

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
In this context, the "FlashPicReferenced" property defines whether the flash picture should be
saved together with the object status display or referenced.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashPicUseTransColor Property
Description
TRUE, when the configured color ("FlashPicTransColor" property) of the bitmap objects
assigned to the flash picture should be set to "transparent". BOOLEAN write-read access.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashRate Property
Description
Defines or returns the flashing frequency for the object. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1135

VBS Reference
2.4 Properties

FlashRateBackColor Property
Description
Defines or returns the flash frequency for the object background. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
ScreenItem Object (Page 141)

FlashRateBorderColor Property
Description
Defines or returns the flash frequency for the lines of the object. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
ScreenItem Object (Page 141)

1136

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

FlashRateFlashPic Property
Description
Defines or returns the flash frequency for the status display. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

See also
Status display (Page 213)
ScreenItem Object (Page 141)

FlashRateForeColor Property
Description
Defines or returns the flash frequency for the object label. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.5 Hz)

Medium (approx. 2 Hz)

Fast (approx. 8 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1137

VBS Reference
2.4 Properties

See also
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

Flip property
Flip (Flip)
Specifies flipping of the icon at runtime.
The following settings are available:
Value

Description

Comments

None

The icon is not flipped.

Horizontal

The object is flipped along the horizontal center axis.

Vertical

The object is flipped along the vertical center axis.

Both

The object is flipped along the horizontal and vertical center axes.

The attribute can be assigned dynamic properties by means of the name Flip. The data type
is LONG.

Flip Property
Description
Mirrors the icon on the vertical and/or horizontal middle axis of the icon.
Zero - 0: The icon is mot mirrored.
Horizontal - 1: The icon is mirrored on the vertical center axis.
Vertical - 2: The icon is mirrored on the horizontal, center axis.
Both - 3: The icon is mirrored both on the horizontal and vertical center axes.

See also
HMI Symbol Library (Page 253)
ScreenItem Object (Page 141)

1138

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.7.2

Fo - Fr

FocusColor Property
Description
If the focus is positioned on the control in Runtime, the labeling and position text are identified
by a border. FocusColor defines the color of the border.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

FocusRect Property
Description
TRUE, when the button should be provided with a selection border, in Runtime, as soon as it
receives the focus. BOOLEAN write-read access.

See also
WinCC Push Button Control (Page 275)
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

FocusWidth Property
Description
If the focus is positioned on the control in Runtime, the labeling and position text are identified
by a border. FocusWidth defines the width of the border, value range of 1-10 pixels. LONG
write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1139

VBS Reference
2.4 Properties

Font Property
Name - Font
Sets the font.
The attribute cannot be dynamized.

Font property (before WinCC V7)


Description
Defines or returns the font. Write/Read access.
The font object has the following sub-properties
Size (Font Size)
Bold (yes/no)
Name (font name)
Italic (yes/no)
Underline (underline yes/no)
StrikeThrough (yes/no)
If two font properties are directly assigned, only the default property "Name" is assumed.

Example:

'VBS74
Dim objControl1
Dim objControl2
Set objControl1 = ScreenItems("Control1")
Set objControl2 = ScreenItems("Control2")
objControl2.Font = objControl1.Font ' take over only the type of font

See also
WinCC Slider Control (Page 281)
WinCC Push Button Control (Page 275)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Digital/Analog Clock (Page 258)

1140

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

FontBold Property
Description
TRUE, when the text in the object should be assigned the "bold" attribute. BOOLEAN writeread access.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
Bar (Page 189)
ScreenItem Object (Page 141)

FontItalic Property
Description
TRUE, when the text in the object should be assigned the "italic" attribute. BOOLEAN writeread access.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1141

VBS Reference
2.4 Properties

FontName Property
Description
Defines or returns the font name of the text in the object.
All the fonts installed in Windows are available for selection.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
Bar (Page 189)
ScreenItem Object (Page 141)

FontPosition Property
Description
Returns the font name for the display of the slider position in the bottom part of the object. All
the fonts installed in Windows are available for selection. Read only access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

FontSize Property
Description
Defines or returns the font size of the text in the object in points.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)

1142

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
Bar (Page 189)
ScreenItem Object (Page 141)

FontStrikeThru Property
Description
TRUE, when the text in the object should be assigned the "strikethrough" attribute. BOOLEAN
write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FontUnderline Property
Description
TRUE, when the text in the object should be assigned the "underline" attribute. BOOLEAN
write-read access.

See also
WinCC Push Button Control (Page 275)
Group Display (Page 208)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1143

VBS Reference
2.4 Properties

ForeColor Property
Description
Defines or returns the color of the font for the text in the object. LONG write-read access.

See also
WinCC Slider Control (Page 281)
WinCC Push Button Control (Page 275)
WinCC Digital/Analog Clock (Page 258)
HMI Symbol Library (Page 253)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

ForeColor property
Foreground color (ForeColor)
Specifies the foreground color of the icon in the "Color selection" dialog. The icon is displayed
in the foreground color if the "Shadow" and "Solid" foreground mode is set.
The attribute can be assigned dynamic properties by means of the name ForeColor. The data
type is LONG.

ForeFlashColorOff Property
Description
Defines or returns the color of the text for flash status "Off". LONG write-read access.

See also
Text list (Page 211)
Static text (Page 180)
Radio box (Page 221)
Check box (Page 219)

1144

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

ForeFlashColorOn Property
Description
Defines or returns the color of the text for flash status "On". LONG write-read access.

See also
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

FrameColor Property
Description
Defines or returns the color of the rectangular or square area located on the graduated scale
disk. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

FrameColorDown Property
Description
Defines or returns the color for the right, bottom part of the 3D frame of the button (button
pressed). LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1145

VBS Reference
2.4 Properties

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FrameColorUp Property
Description
Defines or returns the color for the left, top part of the 3D frame of the button (button not
pressed). LONG write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FramePicture Property
Description
Returns the picture name of the background picture for the graduated scale disk. Read only
access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

FrameScale Property
Description
Defines or returns the diameter of the graduated scale disk in relation to smallest value of the
width and height geometric attributes. Write/Read access.
The value range is (scale distance - scale width) to 1.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

1146

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

FrameWidth Property
Description
Defines or returns the border width of the button in pixels. Write/Read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

FreezeProviderConnections Property
Description
Enables modification of the data connection properties ("ProviderType", "Source"...), without
the change being effective immediately. On changing "SourceTagNameX", for example,
impermissible combinations can created with "SourceTagNameY".
Therefore, FreezeProviderConnections" must be set to TRUE before modifying a data
connection attribute. After modifying all the data connection, "FreezeProviderConnection" is
set to FALSE and the changes take effect.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.8

2.4.8.1

GlobalColorScheme property

Description
Defines whether the colors defined for the current design in the global color scheme will be
used for this object.
TRUE if the object is displayed with the colors from the global color scheme defined for this
object type.
FALSE if the object is displayed with the colors as per the settings in the object.
BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1147

VBS Reference
2.4 Properties

2.4.8.2

GlobalShadow property

Description
Defines whether the object will be displayed with the shadowing defined in the active design.
TRUE if the object is displayed with the global shadow defined for this object type.
FALSE if no shadow is displayed.
BOOLEAN write-read access.

2.4.8.3

GraphDirection property (before WinCC V7)

Description
Defines which edge of the trend window should display the current values. Write/Read access.
0: Positive values run to the right and upwards.
-1: Positive values run to the left and upwards.
-2: Positive values run to the right and upwards.
-3: Positive values run to the right and downwards.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.8.4

GraphDirection Property

Write direction - GraphDirection


Defines the direction of the update of axis values.
Value

Description

Explanation

From the right

The updated values are displayed starting at the right side of the trend.

From the left

The updated values are displayed starting at the left side of the trend.

From the top

The updated values are displayed starting at the top of the trend.

From the bottom

The updated values are displayed starting at the bottom of the trend.

True type fonts must be used within the trend window if "From the top" or "From the bottom"
is selected for write direction. Only this setting ensures legibility of the labeling of the vertical
axis.
The attribute can be assigned dynamic properties by means of the name GraphDirection. The
data type is LONG.

1148

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.8.5

GridLineColor property

Color of the row divider / content - GridLineColor


Defines the color of row/column dividers in table contents. The button opens the "Color
selection" dialog.
The attribute can be assigned dynamic properties by means of the name GridLineColor. The
data type is LONG.

2.4.8.6

GridLineHorz Property

Description
TRUE, when the message window columns are separated by horizontal dividing lines.
BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

2.4.8.7

GridLines Property

Description
TRUE, when the trend window is displayed with grid lines parallel to the X-axis. The distance
between two grid lines can be changed using the "GridLineValue" property. BOOLEAN writeread access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

2.4.8.8

GridlinesValueX Property

Description
Defines or returns the distance between two grid lines on the X-axis. Whether the information
is evaluated is dependent on the value of the "GridLinesX" property.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1149

VBS Reference
2.4 Properties

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.8.9

GridlinesValueY Property

Description
Defines or returns the distance between two grid lines on the Y-axis. Whether the information
is evaluated is dependent on the value of the "GridLinesY" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.8.10

GridlinesX Property

Description
TRUE, when the trend window is displayed with grid lines parallel to the X-axis. The distance
between two grid lines can be changed using the "GridLineValueX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.8.11

GridlinesY Property

Description
TRUE, when the trend window is displayed with grid lines parallel to the Y-axis. The distance
between two grid lines can be changed using the "GridLineValueX" property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1150

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.8.12

GridLineValue Property

Description
Defines the distance between two grid lines. Whether the information is evaluated is
dependent on the value of the "GridLines" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

2.4.8.13

GridLineVert Property

Description
TRUE, when the message window columns are separated by vertical dividing lines. BOOLEAN
write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

2.4.8.14

GridLineWidth property

Width of dividers - GridLineWidth


Defines the line weight of the row/column dividers in pixels.
The attribute can be assigned dynamic properties by means of the name GridLineWidth. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1151

VBS Reference
2.4 Properties

2.4.9

2.4.9.1

Ha - Hi

HandFillColor Property
Description
Defines or returns the fill color of all the hands in the analog clock. In order that the hands are
displayed with the fill color defined, the "Handtype" property must be set to "0" (covering).
LONG write-read access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

Handtype Property
Description
Defines the representation of the hands:
0: The hands are filled in the hand color defined and the edges in the foreground color.
1: The hands fill color is transparent and the edges displayed in the foreground color.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

HeaderSort Property
Description
Specifies if sorting of messages by message block column header is possible.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

1152

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Height Property
Description
Defines or returns the height of the object in pixels.
LONG (write-read access)

Example:
The following example halves the height of all objects in the "NewPDL1" picture whose names
begin with "Circle":

'VBS75
Dim objScreen
Dim objCircle
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'Searching all circles
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
If "Circle" = Left(strName, 6) Then
'
'to halve the height of the circles
Set objCircle = objScreen.ScreenItems(strName)
objCircle.Height = objCircle.Height / 2
End If
Next

See also
Width Property (Page 682)
Object types of the ScreenItem object (Page 158)
ScreenItem Object (Page 141)

HiddenInput Property
Description
TRUE, when the input value should not be displayed when being entered. Each character
entered is substituted by a *. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1153

VBS Reference
2.4 Properties

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

HideTagNames Property
Description
TRUE if the archive and tag name in the trend should be hidden via the right mouse button,
in the status line and in the table to display the coordinates. BOOLEAN write-read access.

HitlistColumnAdd property
HitlistColumnAdd
Transfers the selected message block from the list of available message blocks to the list of
selected message blocks.
The attribute can be assigned dynamic properties by means of the name HitlistColumnAdd .
The data type is STRING.

HitlistColumnCount property
HitlistColumnCount
Specifies the number of message blocks displayed in the hitlist in Runtime.
The attribute can be assigned dynamic properties by means of the name
HitlistColumnCount . The data type is LONG.

HitlistColumnIndex property
HitlistColumnIndex
References a message block selected for the hitlist. Using this attribute you can assign the
values of other attributes to a specific message block of the hitlist.
Values between 0 and "HitlistColumnCount" minus 1 are valid for "HitlistColumnIndex".
Attribute "HitlistColumnCount" defines the number of message blocks selected for the hitlist.
The "HitlistColumnIndex" attribute can be assigned dynamic properties by means of attribute
HitlistColumnRepos. The data type is LONG.

1154

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

HitlistColumnName property
HitlistColumnName
Displays the name of the message block of the hitlist which is referenced with attribute
"HitlistColumnIndex". You cannot edit this name.
The attribute can be assigned dynamic properties by means of the name
HitlistColumnName . The data type is STRING.

HitlistColumnRemove property
HitlistColumnRemove
Cuts the marked message block from the list of selected message blocks and pastes it to the
list of available message blocks.
The attribute can be assigned dynamic properties by means of the name
HitlistColumnRemove. The data type is STRING.

HitlistColumnRepos
Up/Down - MessageColumnRepos/HitlistColumnRepos
Resorts the message blocks. The "Up" and "Down" commands move the selected message
block accordingly in the list. This moves the message block in Runtime Control towards the
front or towards the back.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnRepos .
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnRepos.
The data type is LONG.

HitlistColumnSort property
HitlistColumnSort
Defines the sorting order of the message block referenced in "HitlistColumnIndex" for the hitlist.
The following settings are available:
Value

Description

Explanation

none

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1155

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name HitlistColumnSort .
The data type is LONG.

HitlistColumnSortIndex property
HitlistColumnSortIndex
Defines the sorting order of the message block referenced in "HitlistColumnIndex" in the hitlist.
The sorting criterion is removed from "HitlistColumnSort" if you set a "0" value..
The attribute can be assigned dynamic properties by means of the name
HitlistColumnSortIndex. The data type is LONG.

HitlistColumnVisible
Selected message blocks - MessageColumnVisible/HitlistColumnVisible
Selected message blocks of message list or hitlist that are displayed in Runtime. Defines
whether the message block referenced in "MessageColumnIndex" or "HitlistColumnIndex" is
displayed.
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnVisible.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnVisible.
The data type is BOOLEAN.

HitlistDefaultSort property
HitlistDefaultSort
Defines the default sorting order in the table columns of the hitlist.
The following settings are available:
Value

Description

Explanation

Ascending

The list is sorted in ascending order based on frequency.

Descending

The list is sorted in descending order based on frequency.

The attribute can be assigned dynamic properties by means of the name HitlistDefaultSort.
The data type is LONG.

1156

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

HitListMaxSourceItems property
Maximum number of data records - HitListMaxSourceItems
Defines the maximum number of data records for statistics.
The attribute can be assigned dynamic properties by means of the name
HitListMaxSourceItems . The data type is LONG.

HitListMaxSourceItemsWarn property
Warning when maximum is reached - HitListMaxSourceItemsWarn
Enables the output of a warning notice after the valid number of data records was reached.
Value

Explanation

TRUE

A warning is output after the valid maximum number of data records was reached.

FALSE

A warning is not output after the valid maximum number of data records was reached.

The attribute can be assigned dynamic properties by means of the name


HitListMaxSourceItemsWarn. The data type is BOOLEAN.

HitListRelTime property
Time range for statistics - HitListRelTime
Sets a time range for the statistics.
Value

Explanation

TRUE

The time range set for statistics is used if this range was not defined in the selection.

FALSE

The time range is not used.

The attribute can be assigned dynamic properties by means of the name HitListRelTime. The
data type is BOOLEAN.

HitListRelTimeFactor property
Time range - HitListRelTimeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
HitListRelTimeFactor. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1157

VBS Reference
2.4 Properties

HitListRelTimeFactorType property
Time range - HitListRelTimeFactorType
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

Minute

Hour

Day

Week

Month

The attribute can be assigned dynamic properties by means of the name


HitListMaxRelTimeFactorType. The data type is LONG.

2.4.9.2

Ho - Hy

HorizontalGridLines property
Horizontal - HorizontalGridLines
Defines whether horizontal separating lines will be displayed.
Value

Explanation

TRUE

Enables the display of horizontal dividers.

FALSE

Disables the display of horizontal dividers.

The attribute can be assigned dynamic properties by means of the name


HorizontalGridLines. The data type is BOOLEAN.

Hotkey Property
Description
Returns the function key related to the mouse operation in respect of a button object.
Read only access.

See also
Button (Page 215)
ScreenItem Object (Page 141)

1158

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

HourNeedleHeight Property
Description
Defines or returns the length of the hour hand for the analog clock. The specification of the
length is entered as a percentage value in relation to half the length of the short side of the
rectangular background. Write/Read access.
Example:
The shorter side of the rectangular background is 100 pixels long.
The hour hand length is 50.
This results in a length of the hour hand of (100 pixels / 2) * 0.5 = 25 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

HourNeedleWidth Property
Description
Defines or returns the width of the hour hand for the analog clock. The width is specified as a
percentage value related to double the length of the hour hand. Write/Read access.
Example:
The length of the hour hand is 25 pixels.
The hour hand width is 10.
This results in a width of the hour hand of 25 pixels * 2 * 0.1 = 5 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

Hysteresis Property
Description
TRUE, when the display should appear with hysteresis. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1159

VBS Reference
2.4 Properties

HysteresisRange Property
Description
Defines the hysteresis in % of the displayed value or returns it.
The Hysteresis property must be set to TRUE for the hysteresis to be calculated.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.10

2.4.10.1

IconSpace property

IconSpace
Defines the spacing between the icons and text in the table cells. The value is active if and
icon and text are displayed.
The attribute can be assigned dynamic properties by means of the name IconSpace. The data
type is LONG.

2.4.10.2

IndependentWindow property

Description
Defines whether the display of the picture window in Runtime depends on the process picture
in which the picture window was configured.
TRUE if the size and position of the picture window are independent of the process picture
and only defined by the "Window mode" attribute.
FALSE if the size and position of the picture window change with the shift or scaling of the
process picture.

2.4.10.3

Index Property

Description
Check box, radio box
Defines or returns the number (0 to 31) of the field whose text is to be defined.

1160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Combo box, list box
Defines or returns the number (0 to 31) of the line whose text is to be defined.
Polygon, polyline, tube polygon
Defines or returns the number of the corner point whose position coordinates are to be modified
or displayed.
WinCC online trend control, WinCC online table control, WinCC function trend control
The "Index" property is evaluated by other properties in order to be able to assign the settings
to a specific trend or column pair. The valid values for the index move within the range from 0
to (NumItems - 1). The "NumItems" properties contains the number of the trends/column pairs
to be displayed. The index must always be set before you change the properties of a trend /
column in runtime.
Status display
Defines the status (0 to 255) or returns it. A basic picture and flash picture can be defined for
each status value.

See also
Status display (Page 213)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
Polyline (Page 173)
Polygon (Page 171)
Radio box (Page 221)
Check box (Page 219)
ScreenItem Object (Page 141)

2.4.10.4

InnerBevelOffset Property

Description
Defines the distance between the inner and outer bevels.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1161

VBS Reference
2.4 Properties

2.4.10.5

InnerBevelStyle Property

Description
Defines the 3D effect for the inner bevel of the object.
0: No border.
1: The border is displayed depressed.
2: The border is displayed raised.
3: The border is displayed in one color without a 3D effect. The border color is defined by
the "BevelColorDown" property.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

2.4.10.6

InnerBevelWidth Property

Description
Defines the width of the inner bevel in pixels.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

2.4.10.7

InputValue property

Description
Defines the value to be entered by the user in the I/O field. The value is not displayed in the I/
O field when the property is set.
If you want the value to be displayed in the I/O field after confirmation with the <Return> key,
configure a direct connection between the properties "input value" and "output value". The
direct connection is only practical when no tag is connected to the output value, but the user
can nevertheless query the specified value, for example, through a script.
LONG write-read access.

See also
Example: Calling Methods of an ActiveX Control (Page 819)

1162

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.10.8

InsertData Property

Description
Inserts data for the current trend.
TRUE : "DataIndex" is ignored and the data is appended to that in the data buffer.
FALSE : The data is inserted at the "DataIndex" position in the data buffer.
The trend window is redrawn following each operation involving "Insert Data".
Note
The property is only supported for the controls prior to WinCC V7.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.10.9

Instance property

Description
Returns an instance of the alarm object.

See also
Alarms object (list) (Page 126)

2.4.10.10 ItemBorderBackColor Property


Description
Defines or returns the background color for dividing lines in the selection list of the text list
object. LONG write-read access. The background color is only visible with the property setting
ItemBorderStyle > 0.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1163

VBS Reference
2.4 Properties

2.4.10.11 ItemBorderColor Property


Description
Defines or returns the color for deviding lines in the selection list of the text list object. LONG
write-read access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

2.4.10.12 ItemBorderStyle Property


Description
Defines or returns the color for the dividing line style in the selection list of the text list object.
Value range from 0 to 4.
0 = solid line
1 = dashed line
2 = dotted line
3 = dash-dotted line
4 = dash-dot-dot line

See also
Text list (Page 211)
ScreenItem Object (Page 141)

2.4.10.13 ItemBorderWidth Property


Description
Defines or returns the dividing line weight in pixels in the selection list of the text list object.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

1164

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.10.14 ItemProviderClsid Property


Description
"ItemProviderCIsid" shows, if the trend referenced using Index in Trend Control is connected
with an archive tag or an online tag.
Notice: If you assign a value to the "ProviderCIsid" property , you will overwrite the trendspecific property "ItemProviderCIsid".
{416A09D2-8B5A-11D2-8B81-006097A45D48}: The trend is connected to an archive tag.
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: The trend is connected to an online tag.
If the trends are being supplied with archive and online tags, the property "ProviderCIsid"
returns the value "{00000000-0000-0000-0000-000000000000}".

2.4.10.15 ItemVisible Property


Description
TRUE, when a trend or a column pair reference by the "Index" property is visible. BOOLEAN
write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.11

2.4.11.1

Lab - Las

Label Property
Description
The "Index" property references a trend. Label is used to define the name of the time axis or
value axis in accordance with the value of the "TimeAxis" property.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1165

VBS Reference
2.4 Properties

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

LabelColor Property
Description
Defines the color of the scale label.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

LabelX Property
Description
Defines or returns the label on the X-axis for a trend referenced by "Index" according to the
value of "TimeAxisX". Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LabelY Property
Description
Defines or returns the label on the Y-axis for a trend referenced by "Index" according to the
value of "TimeAxisY". Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1166

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

LanguageSwitch Property
Description
Returns the value which defines where the language dependent assigned texts are stored.
Read only access.
TRUE, when the texts in the Text Library are managed. Translation to other language occurs
in the Text Library.
FALSE, when the texts are managed directly in the object. Translation to other language can
be carried out using Text Distributor.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

Language Property
Description
Defines the current Runtime language or reads it.
You specify the Runtime language in VBS by using a country code, e.g., 1031 for German Default, 1033 for English - USA etc. A summary of all country codes may be found in the Basics
of VBScript under the subject header "Regional Scheme ID (LCID) Diagram".
INTEGER (write-read access)

Example:
The following example sets the data language to German:

'VBS76
HMIRuntime.Language = 1031

See also
HMIRuntime Object (Page 134)

LastError Property
Description
Returns an error code regarding the success of the last operation, e.g. information on a tag
write or read process. The "QualityCode" property can provide information on the quality of

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1167

VBS Reference
2.4 Properties
the returned value. A description of the error can be called in using the "ErrorDescription"
property.
LONG (read only)
The following error codes are defined:
Code in hexadecimal notation

Description

0x00000000

OK

0x80040001

Execution error

0x80040002

Tag error

0x80040003

Server not available.

0x80040004

Multi Tag Error (Error in one or several tags)

In order that LastError returns a value, a read must be executed beforehand.


If an error occurs during read or write of several tags using the TagSet object, the error is set
to "Multi Tag Error". In order to determine at which tag the error occurred and what type of
error it was, the LastError property of each tag must be analyzed.

Example:
The following example displays the error code for "Tag1":

'VBS77
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
MsgBox objTag.LastError

The following example adds two tags to the TagSet list and outputs the LastError property as
Trace.

'VBS178
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "LastError: " & group.LastError & vbNewLine

The LastError property of a tag contained in the list may be accessed as follows:

HMIRuntime.Trace "LastError: " & group("Motor1").LastError & vbNewLine

1168

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
TagSet Object (List) (Page 156)
QualityCode Property (Page 532)
ErrorDescription Property (Page 398)
Tag Object (Page 152)

2.4.11.2

Layer

Layer Property
Description
Returns the layer of the picture in which the object is located. There is a total of 32 layers
available, whereby Layer "0" is the bottom layer and Layer "31" the top layer.
The configured objects are initially in the background of a layer.
LONG (read only)
Note
The layer property specifies the layer in which the object is located. The layer "0" is output
as "Layer0".
When accessed, the layers are counted up from 1 in VBS. Therefore, the layer "1" must be
addressed with "layers(2)".

Example:
The following example displays the name and layer of all the objects in the picture "NewPDL1":

'VBS78
Dim objScreen
Dim objScrItem
Dim lngAnswer
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(strName & " is in layer " & objScrItem.Layer,vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1169

VBS Reference
2.4 Properties

See also
ScreenItem Object (Page 141)

Layer00Checked Property
Description
TRUE, when limit 0 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer00Value and Layer00Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer01Checked Property
Description
TRUE, when limit 1 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer01Value and Layer01Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer02Checked Property
Description
TRUE, when limit 2 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer02Value and Layer02Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

1170

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Layer03Checked Property
Description
TRUE, when limit 3 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer03Value and Layer03Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer04Checked Property
Description
TRUE, when limit 4 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer04Value and Layer04Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer05Checked Property
Description
TRUE, when limit 5 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer05Value and Layer05Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1171

VBS Reference
2.4 Properties

Layer06Checked Property
Description
TRUE, when limit 6 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer06Value and Layer06Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer07Checked Property
Description
TRUE, when limit 7 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer07Value and Layer07Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer08Checked Property
Description
TRUE, when limit 8 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer08Value and Layer08Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

1172

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Layer09Checked Property
Description
TRUE, when limit 9 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer09Value and Layer09Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer10Checked Property
Description
TRUE, when limit 10 should be monitored. BOOLEAN write/read access.
Limit value and representation are defined with the Layer10Value and Layer10Color
properties.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer00Color Property
Description
Defines or returns the color for limit 0. LONG write/read access.
When monitoring of the limit value is activated (Layer00Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1173

VBS Reference
2.4 Properties

Layer01Color Property
Description
Defines or returns the color for limit 1. LONG write/read access.
When monitoring of the limit value is activated (Layer01Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer02Color Property
Description
Defines or returns the color for limit 2. LONG write/read access.
When monitoring of the limit value is activated (Layer02Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer03Color Property
Description
Defines or returns the color for limit 3. LONG write/read access.
When monitoring of the limit value is activated (Layer03Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

1174

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Layer04Color Property
Description
Defines or returns the color for limit 4. LONG write/read access.
When monitoring of the limit value is activated (Layer04Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer05Color Property
Description
Defines or returns the color for limit 5. LONG write/read access.
When monitoring of the limit value is activated (Layer05Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer06Color Property
Description
Defines or returns the color for limit 6. LONG write/read access.
When monitoring of the limit value is activated (Layer06Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1175

VBS Reference
2.4 Properties

Layer07Color Property
Description
Defines or returns the color for limit 7. LONG write/read access.
When monitoring of the limit value is activated (Layer07Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer08Color Property
Description
Defines or returns the color for limit 8. LONG write/read access.
When monitoring of the limit value is activated (Layer08Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer09Color Property
Description
Defines or returns the color for limit 9. LONG write/read access.
When monitoring of the limit value is activated (Layer09Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

1176

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Layer10Color Property
Description
Defines or returns the color for limit 10. LONG write/read access.
When monitoring of the limit value is activated (Layer10Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer00FillColor property
Bar fill color 0 (Layer00FillColor)
The "Layer00FillColor" attribute defines the color with which the bar is filled in relation to "Limit
0".
The "Layer00FillColor" attribute can be made dynamic with the name "Layer00FillColor".

Layer01FillColor property
Layer01FillColor
The "Layer01FillColor" attribute defines the color with which the bar is filled in relation to "Limit
1".
The "Layer01FillColor" attribute can be made dynamic with the name "Layer01FillColor".

Layer02FillColor property
Layer02FillColor
The "Layer02FillColor" attribute defines the color with which the bar is filled in relation to "Limit
2".
The "Layer02FillColor" attribute can be made dynamic with the name "Layer02FillColor".

Layer03FillColor property
Layer03FillColor
The "Layer03FillColor" attribute defines the color with which the bar is filled in relation to "Limit
3".
The "Layer03FillColor" attribute can be made dynamic with the name "Layer03FillColor".

Layer04FillColor property
Layer04FillColor

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1177

VBS Reference
2.4 Properties
The "Layer04FillColor" attribute defines the color with which the bar is filled in relation to "Limit
4".
The "Layer04FillColor" attribute can be made dynamic with the name "Layer04FillColor".

Layer05FillColor property
Layer05FillColor
The "Layer05FillColor" attribute defines the color with which the bar is filled in relation to "Limit
5".
The "Layer05FillColor" attribute can be made dynamic with the name "Layer05FillColor".

Layer06FillColor property
Layer06FillColor
The "Layer06FillColor" attribute defines the color with which the bar is filled in relation to "Limit
6".
The "Layer06FillColor" attribute can be made dynamic with the name "Layer06FillColor".

Layer07FillColor property
Layer07FillColor
The "Layer07FillColor" attribute defines the color with which the bar is filled in relation to "Limit
7".
The "Layer07FillColor" attribute can be made dynamic with the name "Layer07FillColor".

Layer08FillColor property
Layer08FillColor
The "Layer08FillColor" attribute defines the color with which the bar is filled in relation to "Limit
8".
The "Layer08FillColor" attribute can be made dynamic with the name "Layer08FillColor".

Layer09FillColor property
Layer09FillColor
The "Layer09FillColor" attribute defines the color with which the bar is filled in relation to "Limit
9".
The "Layer09FillColor" attribute can be made dynamic with the name "Layer09FillColor".

Layer10FillColor property
Layer10FillColor

1178

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The "Layer10FillColor" attribute defines the color with which the bar is filled in relation to "Limit
10".
The "Layer10FillColor" attribute can be made dynamic with the name "Layer10FillColor".

Layer00FillStyle property
Layer00FillStyle
The "Layer00FillStyle" attribute defines the style of the bar in relation to "Limit 0". For the fill
pattern to become visible, "bar fill color 0" must differ from "bar color 0".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer00FillStyle" attribute can be made dynamic with the name "Layer00FillStyle".

Layer01FillStyle property
Layer01FillStyle
The "Layer01FillStyle" attribute defines the style of the bar in relation to "Limit 1". For the fill
pattern to become visible, "bar fill color 1" must differ from "bar color 1".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer01FillStyle" attribute can be made dynamic with the name "Layer01FillStyle".

Layer02FillStyle property
Layer02FillStyle
The "Layer02FillStyle" attribute defines the style of the bar in relation to "Limit 2". For the fill
pattern to become visible, "bar fill color 2" must differ from "bar color 2".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer02FillStyle" attribute can be made dynamic with the name "Layer02FillStyle".

Layer03FillStyle property
Layer03FillStyle
The "Layer03FillStyle" attribute defines the style of the bar in relation to "Limit 3". For the fill
pattern to become visible, "bar fill color 3" must differ from "bar color 3".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer03FillStyle" attribute can be made dynamic with the name "Layer03FillStyle".

Layer04FillStyle property
Layer04FillStyle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1179

VBS Reference
2.4 Properties
The "Layer04FillStyle" attribute defines the style of the bar in relation to "Limit 4". For the fill
pattern to become visible, "bar fill color 4" must differ from "bar color 4".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer04FillStyle" attribute can be made dynamic with the name "Layer04FillStyle".

Layer05FillStyle property
Layer05FillStyle
The "Layer05FillStyle" attribute defines the style of the bar in relation to "Limit 5". For the fill
pattern to become visible, "bar fill color 5" must differ from "bar color 5".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer05FillStyle" attribute can be made dynamic with the name "Layer05FillStyle".

Layer06FillStyle property
Layer06FillStyle
The "Layer06FillStyle" attribute defines the style of the bar in relation to "Limit 6". For the fill
pattern to become visible, "bar fill color 6" must differ from "bar color 6".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer06FillStyle" attribute can be made dynamic with the name "Layer06FillStyle".

Layer07FillStyle property
Layer07FillStyle
The "Layer07FillStyle" attribute defines the style of the bar in relation to "Limit 7". For the fill
pattern to become visible, "bar fill color 7" must differ from "bar color 7".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer07FillStyle" attribute can be made dynamic with the name "Layer07FillStyle".

Layer08FillStyle property
Layer08FillStyle
The "Layer08FillStyle" attribute defines the style of the bar in relation to "Limit 8". For the fill
pattern to become visible, "bar fill color 8" must differ from "bar color 8".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer08FillStyle" attribute can be made dynamic with the name "Layer08FillStyle".

1180

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Layer09FillStyle property
Layer09FillStyle
The "Layer09FillStyle" attribute defines the style of the bar in relation to "Limit 9". For the fill
pattern to become visible, "bar fill color 9" must differ from "bar color 9".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer09FillStyle" attribute can be made dynamic with the name "Layer09FillStyle".

Layer10FillStyle property
Layer10FillStyle
The "Layer10FillStyle" attribute defines the style of the bar in relation to "Limit 10". For the fill
pattern to become visible, "bar fill color 10" must differ from "bar color 10".
There is a choice of 50 fill styles. The 0 "Solid" fill style fills the object with the set background
color. The 1 "Transparent" fill style means neither a background nor a fill pattern is displayed.
The "Layer10FillStyle" attribute can be made dynamic with the name "Layer10FillStyle".

Layer00Value Property
Description
Determines the value for "Limit 0" or returns it.
Monitoring only takes effect when the Layer00Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer01Value Property
Description
Determines the value for "Limit 1" or returns it.
Monitoring only takes effect when the Layer01Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1181

VBS Reference
2.4 Properties

Layer02Value Property
Description
Determines the value for "Limit 2" or returns it.
Monitoring only takes effect when the Layer02Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer03Value Property
Description
Determines the value for "Limit 3" or returns it.
Monitoring only takes effect when the Layer03Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer04Value Property
Description
Determines the value for "Limit 4" or returns it.
Monitoring only takes effect when the Layer04Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer05Value Property
Description
Determines the value for "Limit 5" or returns it.
Monitoring only takes effect when the Layer05Checked property value is set to TRUE.

1182

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer06Value Property
Description
Determines the value for "Limit 6" or returns it.
Monitoring only takes effect when the Layer06Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer07Value Property
Description
Determines the value for "Limit 7" or returns it.
Monitoring only takes effect when the Layer07Checked property value is set to TRUE.

See also
ScreenItem Object (Page 141)
3D Bar (Page 184)

Layer08Value Property
Description
Determines the value for "Limit 8" or returns it.
Monitoring only takes effect when the Layer08Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1183

VBS Reference
2.4 Properties

Layer09Value Property
Description
Determines the value for "Limit 9" or returns it.
Monitoring only takes effect when the Layer09Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

Layer10Value Property
Description
Determines the value for "Limit 10" or returns it.
Monitoring only takes effect when the Layer10Checked property value is set to TRUE.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

LayerDeclutteringEnable Property
Description
Returns the LayerDecluttering properties of a picture.
LayerDecluttering enables fading in and out of layers depending on the set minimum and
maximum zoom.
BOOLEAN Read-only access.

Example:
The example outputs the LayerDecluttering Property NewPDL1 as a trace.

'VBS156
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

1184

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Screen Object (Page 146)

Layers Property
Description
Returns an object of type "Layers".
Layers (read-only)

See also
Layers Object (Listing) (Page 137)
HMIRuntime Object (Page 134)

2.4.11.3

Le - Li

Left Property
Description
Defines or returns the X-coordinate of an object (measured from the top left edge of the picture)
in pixels. The X-coordinate relates to the top left corner of the rectangle enclosing the object.
LONG (write-read access)

Example:
The following example shifts all objects in the picture "NewPDL1" 5 pixels to the left:

'VBS79
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Left = objScrItem.Left - 5
Next

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1185

VBS Reference
2.4 Properties

See also
Top Property (Page 627)
ScreenItem Object (Page 141)

LeftComma Property
Description
Defines or returns the number of digits to the left of the decimal point (0 to 20).

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LightEffect Property
Description
TRUE, when the light effect should be activated. BOOLEAN write-read access.

See also
3D Bar (Page 184)
ScreenItem Object (Page 141)

LimitHigh4 Property
Description
Determines the upper limit value for "Reserve 4" or returns it.
The CheckLimitHigh4 property must be set to TRUE in order that the "Reserve 4" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitHigh4 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

1186

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

LimitHigh5 Property
Description
Determines the upper limit value for "Reserve 5" or returns it.
The CheckLimitHigh5 property must be set to TRUE in order that the "Reserve 5" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitHigh5 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LimitLow4 Property
Description
Determines the lower limit value for "Reserve 4" or returns it.
The CheckLimitLow4 property must be set to TRUE in order that the "Reserve 4" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow4 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LimitLow5 Property
Description
Determines the lower limit value for "Reserve 5" or returns it.
The CheckLimitLow5 property must be set to TRUE in order that the "Reserve 5" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow5 property.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1187

VBS Reference
2.4 Properties

LimitMax Property
Description
Determines the upper limit value as an absolute value depending on the data format or returns
it.
If the displayed value exceeds the upper limit value, it is displayed by a sequence of *** (not
displayable).

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

LimitMin Property
Description
Determines the lower limit value as an absolute value depending on the data format or returns it.
If the displayed value exceeds the upper limit value, it is displayed by a sequence of *** (not
displayable).

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

LineColor property
Color of window dividers - LineColor
Specifies the color of the window dividers. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name LineColor. The data
type is LONG.

LineFont Property
Description
TRUE, when the font size should be automatically adapted to the line height. BOOLEAN writeread access.

1188

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

LineHeight Property
Description
TRUE, when the line height can be modified. BOOLEAN write-read access.
The "LineHeight" property is only deactivated if both properties "LineHeight" and "LineFont"
are set to "FALSE".

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

LineJoinStyle property
Description
Defines the way that corners are displayed in a tube polygon.
Angle
Round

The tubes are joined at corner points without rounding


The tubes are rounded at the outside corner points.

LineTitle Property
Description
TRUE, when the message window a column with consecutive number contains queued
messages. BOOLEAN write-read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1189

VBS Reference
2.4 Properties

LineWidth property (before WinCC V7)


Description
Specifies the line width of the trend referenced by "Index". Value range from 0 to 10.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

LineWidth property
Line weight of window dividers - LineWidth
Defines the line weight of the window dividers in pixels.
The attribute can be assigned dynamic properties by means of the name LineWidth. The data
type is LONG.

ListType Property
Description
Returns the data type displayed in the case of a text list object. Read only access.
Value range from 0 to 2.
0 = decimal
1 = binary
2 = bit

See also
Text list (Page 211)
ScreenItem Object (Page 141)

1190

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.11.4

Lo

LoadDataImmediately property
Load archive data - LoadDataImmediately
Defines whether the tag values for the time range to be displayed are loaded from the archives
when the picture is called.
Value

Explanation

TRUE

Loads archived values on picture calls.

FALSE

Loads only current values on picture calls.

The attribute can be assigned dynamic properties by means of the name


LoadDataImmediately. The data type is BOOLEAN.

LoadDataImmediately property (before WinCC V7)


Description
TRUE, when the tag values for the time range to be displayed are loaded from the archives
on opening a picture. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LocaleID Property
Description
Defines the language to be displayed in the control, e.g. 1031 for German. Write/Read access.
The list of language codes is available in the WinCC documentation (Index > Language Code).

See also
WinCC Slider Control (Page 281)
WinCC Gauge Control (Page 264)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1191

VBS Reference
2.4 Properties
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

LocaleSpecificSettings Property
Description
TRUE if a font can be assigned and formatted for each Runtime language. BOOLEAN writeread access.

LockBackColor Property
Description
Defines or returns the background color of the button for a locked measuring point. LONG
write/read access.
The LockStatus property must be set to TRUE for the background color to be displayed.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

LockStatus Property
Description
TRUE, when a locked measuring point should be displayed. BOOLEAN write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

LockText Property
Description
Defines the label of a button for a locked measuring point.
The LockStatus property must be set to TRUE for the label to be displayed.

1192

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

LockTextColor Property
Description
Defines or returns the color of the button label for a locked measuring point. LONG write/read
access.
The LockStatus property must be set to TRUE for the background color to be displayed.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Logging Property
Description
Returns an object of type "Logging".
Logging (read-only)

See also
HMIRuntime Object (Page 134)
Logging Object (Page 138)

LongStrokesBold Property
Description
TRUE, when the long sections of a scale should be displayed in bold face. BOOLEAN writeread access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1193

VBS Reference
2.4 Properties

LongStrokesOnly Property
Description
TRUE, when only the long sections of a scale should be displayed . BOOLEAN write-read
access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LongStrokesSize Property
Description
Defines or returns the length of the axis section in pixels.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LongStrokesTextEach Property
Description
Returns the value which defines which sections of the scale displayed should be labeled (1 =
every section, 2 = every second section, etc.). Read only access

See also
Bar (Page 189)
ScreenItem Object (Page 141)

LongTimeArchiveConsistency Property
LongTimeArchiveConsistency
If "LongTimeArchiveConsistency" is set to "No", 1000 messages are displayed in the long-term
archive list on the single-user system, server or client for each server, or for each redundant
server pair.
If the "LongTimeArchiveConsistency" is set to "yes", the most recent 1000 messages are
displayed on the client of all servers or redundant server pair in the long-term archive list.

1194

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
LongTimeArchiveConsistency . The data type is BOOLEAN.

LongTimeArchiveConsistency property (before WinCC V7)


Description
If "LongTimeArchiveConsistency" is set to "No", 1000 messages are displayed in the long-term
archive list in the single-user system, server or client for each server or for each redundant
server pair.
If the "LongTimeArchiveConsistency" is set to "yes", the most recent 1000 messages are
displayed on the client of all servers or redundant server pair in the long-term archive list.
Write/Read access.

LowerLimit Property
Description
WinCC Online Trend Control/WinCC Function Trend Control
TRUE, when the "LowerLimitColor" specification is to be used in order to identify the tag values
(from a trend referenced via "Index") which lie below the value defined in "LowerLimitValue".
BOOLEAN write-read access.
WinCC Online Trend Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LowerLimitColor Property
Description
WinCC Online Trend Control/WinCC Function Trend Control
Defines the color to be used in order to identify the tag values (from trend referenced via
"Index") which lie below the value defined in "LowerLimitValue". Whether the information is
evaluated is dependent on the value of the "LowerLimit" property. The color is defined as an
RGB value. LONG write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1195

VBS Reference
2.4 Properties
Online Table Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

LowerLimitTagName Property
Description
This defines the lower limit of the trend range, which is automatically taken from the variable
properties configured in PCS 7. Write/Read access.

LowerLimitValue Property
Description
WinCC Online Trend Control/WinCC Function Trend Control
Tag values (from a trend referenced via "Index") which lie below the value defined by
"LowerLimitValue" are identified by the color specified in "LowerLimitColor". Whether the
information is evaluated is dependent on the value of the "LowerLimit" attribute.
Online Table Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

1196

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.12

2.4.12.1

Ma - Mc

Marker Property
Description
TRUE, when the limit values should be displayed as scale values. BOOLEAN write-read
access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Max Property
Description
Defines or returns the absolute value in the case of a full value display. This value is displayed
if the scale display is active.

See also
Bar (Page 189)
Slider (Page 226)
3D Bar (Page 184)
ScreenItem Object (Page 141)

MaximizeButton Property
Description
TRUE, when the object can be maximized in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1197

VBS Reference
2.4 Properties

MCGUBackColorOff-Eigenschaft
Description
Defines or returns the background color for flash status "Off" in the case of the "Departed
Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUBackColorOn Property
Description
Defines or returns the background color for flash status "On" in the case of the "Departed
Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUBackFlash Property
Description
TRUE, when the background should flash when a message departs unacknowledged.
BOOLEAN write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUTextColorOff Property
Description
Defines or returns the color of the text for flash status "Off" in the case of the "Departed
Unacknowledged" status. LONG write-read access.

1198

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUTextColorOn Property
Description
Defines or returns the background color of the text for flash status "Off" in the case of the
"Departed Unacknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCGUTextFlash Property
Description
TRUE, when the font should flash when a message departs unacknowledged. BOOLEAN writeread access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOBackColorOff Property
Description
Defines or returns the background color for flash status "Off" in the case of the "Arrived" status.
LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1199

VBS Reference
2.4 Properties

MCKOBackColorOn Property
Description
Defines or returns the background color for flash status "On" in the case of the "Arrived" status.
LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOBackFlash Property
Description
TRUE, when the background should flash when a message arrives. BOOLEAN write-read
access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOTextColorOff Property
Description
Defines or returns the color of the text for flash status "Off" in the case of the "Arrived" status.
LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOTextColorOn Property
Description
Defines or returns the background color of the text for flash status "On" in the case of the
"Arrived" status. LONG write-read access.

1200

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKOTextFlash Property
Description
TRUE, when the font should flash when a message arrives. BOOLEAN write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQBackColorOff Property
Description
Defines or returns the background color for flash status "Off" in the case of the "Departed
Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQBackColorOn Property
Description
Defines or returns the background color for flash status "On" in the case of the "Departed
Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1201

VBS Reference
2.4 Properties

MCKQBackFlash Property
Description
TRUE, when the background should flash when a message departs acknowledged. BOOLEAN
write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQTextColorOff Property
Description
Defines or returns the color of the text for flash status "Off" in the case of the "Departed
Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQTextColorOn Property
Description
Defines or returns the background color of the text for flash status "On" in the case of the
"Departed Acknowledged" status. LONG write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCKQTextFlash Property
Description
TRUE, when the font should flash when a message departs acknowledged. BOOLEAN writeread access.

1202

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MCText Property
Description
Defines or returns the label for the respective message class.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

2.4.12.2

Me

MeasurePoints Property
Description
The "Index" property references a trend. "MeasurePoints" defines the number of measuring
points to be displayed. The information is only evaluated when the "TimeAxis" property is set
to the value "-1".

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

MenuToolBarConfig Property
Description
Loads the given configuration file with configured menu and toolbars or returns the name of
the configuration file. STRING (write-read access)

See also
Picture Window (Page 194)
HMIRuntime Object (Page 134)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1203

VBS Reference
2.4 Properties

MessageBlockAlign property
Alignment - MessageBlockAlign
Aligns the contents of a selected message block in the table.
To change the alignment, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The following settings are available:
Value

Description

Explanation

Left

Aligns the contents of a selected message block to the left.

Centered

Aligns the contents of a selected message block to the center.

Right

Aligns the contents of a selected message block to the right.

The attribute can be assigned dynamic properties by means of the name MessageBlockAlign.
The data type is LONG.

MessageBlockAutoPrecisions property
Automatic decimal places - MessageBlockAutoPrecisions
Enables automatic setting of the number of decimal places.
Value

Explanation

TRUE

The number of decimal places is set automatically. The value in the "Decimal places" field is disabled.

FALSE

The value in the "Decimal places" field is enabled.

The attribute can be assigned dynamic properties by means of the name


MessageBlockAutoPrecisions. The data type is BOOLEAN.

MessageBlockCaption property
Label - MessageBlockCaption
Defines the label of the column title in the message window for the selected message block.
The label specified is active in all Runtime languages.
To change the label, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockCaption. The data type is STRING.

1204

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

MessageBlockCount property
MessageBlockCount
Defines the number of message blocks which are available for the message list and the hitlist.
The attribute can be assigned dynamic properties by means of the name
MessageBlockCount . The data type is LONG.

MessageBlockDateFormat property
Date format - MessageBlockDateFormat
Defines the date format for displaying messages.
To change the date format, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name


MessageBlockDateFormat. The data type is STRING.

MessageBlockExponentialFormat property
Exponential notation - MessageBlockExponentialFormat
Specifies the exponential notation for visualization of the values of a selected message block.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


MessageBlockExponentialFormat. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1205

VBS Reference
2.4 Properties

MessageBlockFlashMode property
Flash mode - MessageBlockFlashMode
Specifies how the content of the selected message block flashes in Runtime when a message
appears. The "Flashing on" option must be selected.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
Valu
e

Description

Explanation

Standard

The text color switches between the standard color and the flash color when flashing

Switch
background
color/text color

The color of the background and the text color switch during flashing. You configure the message
colors for the type of message in the alarm logging editor.

Switch message
color/table color

The message colors and the configured table colors switch during flashing. You configure the
message colors for the type of message in the alarm logging editor. Set the table colors in the
"Layout" tab in the AlarmControl.

The attribute can be assigned dynamic properties by means of the name


MessageBlockFlashMode. The data type is LONG.

MessageBlockFlashOn property
Flashing on - MessageBlockFlashOn
Enables flashing of the selected message block in Runtime after a message was activated.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
Value

Explanation

TRUE

Flashing message block content.

FALSE

No flashing message block content.

The attribute can be assigned dynamic properties by means of the name


MessageBlockFlashOn. The data type is BOOLEAN.

1206

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

MessageBlockHideText property
Content as text - MessageBlockHideText
Enables the textual display of the content of a selected message block.
Value

Explanation

TRUE

The content is not displayed in text format. The option is disabled.

FALSE

The content is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name


MessageBlockHideText. The data type is BOOLEAN.

MessageBlockHideTitleText property
Title as text - MessageBlockHideTitleText
Enables the display of the header of a selected message block in text format.
Value

Explanation

TRUE

The header is not displayed in text format. The option is disabled.

FALSE

The header is displayed in text format. The option is enabled.

The attribute can be assigned dynamic properties by means of the name


MessageBlockHideTitleText. The data type is BOOLEAN.

MessageBlockId property
MessageBlockId
Default assignment of the ID number and message block in WinCC AlarmControl.
The attribute can be assigned dynamic properties by means of the name MessageBlockID.
The data type is LONG.

MessageBlockInvertUseMessageColor property
MessageBlockInvertUseMessageColor
Specifies for the message block whether or not the message colors are displayed, contrary to
the central setting for the AlarmControl . For example, the "UseMessageColor" property is set
to "FALSE" for the AlarmControl. You have set the "MessageBlockInvertUseMessageColor"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1207

VBS Reference
2.4 Properties
property to "TRUE" for a message block. This causes the message colors to be displayed for
this message block in Runtime.
Value

Explanation

TRUE

Contrary to the central setting in "UseMessageColor", the message colors are displayed or not displayed
for the message block.

FALSE

Just like the central setting in "UseMessageColor", the message colors are displayed or not displayed
for the message block.

The attribute can be assigned dynamic properties by means of the name


MessageBlockInvertUseMessageColor. The data type is BOOLEAN.

MessageBlockIndex property
MessageBlockIndex
References an existing message block. Using this attribute, you can assign a specific message
block values for other attributes.
Values between 0 and "MessageBlockCount" minus 1 are valid for "MessageBlockIndex".
Attribute "MessageBlockCount" defines the number of available message blocks.
The attribute can be assigned dynamic properties by means of the name
MessageBlockIndex. The data type is LONG.

MessageBlockLeadingZeros property
Number of digits - MessageBlockLeadingZeros
Defines the number of leading zeros for the message block content. The maximum number is
"11". A "0" value deactivates the "With leading zeros" option.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockLeadingZeros. The data type is LONG.

MessageBlockLength property
Length in characters - MessageBlockLength
Defines the length of the message block selected based on the number of characters.
To change the length, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockLength. The data type is LONG.

1208

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

MessageBlockName property
Object name - MessageBlockName
Displays the object name of the message block selected. You cannot edit this name.
The data type is STRING.

MessageBlockPrecisions property
Decimal places - MessageBlockPrecisions
Specifies the decimal precision of the values of a selected message block. You can only enter
the value if the "Automatic" option is disabled.
The attribute can be assigned dynamic properties by means of the name
MessageBlockPrecisions. The data type is SHORT.

MessageBlockSelected property
Available message blocks - MessageBlockSelected
The available message blocks are blocks that can be used in Runtime for the message list or
hitlist.
Select the "Message blocks" tab to activate existing message blocks as required in the Control.
Select the "Hitlist" and "Message list" tabs to configure the hitlist and message list based on
the available blocks.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockSelected. The data type is BOOLEAN.

MessageBlockShowDate property
Show date - MessageBlockShowDate
Enables the display of a date in the "Time" message block in addition to the time.
Value

Explanation

TRUE

Date and time are displayed.

FALSE

The time is displayed.

The attribute can be assigned dynamic properties by means of the name


MessageBlockShowDate. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1209

VBS Reference
2.4 Properties

MessageBlockShowIcon property
Content as icon - MessageBlockShowIcon
Enables the display of the content of a selected message block as icon.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name


MessageBlockShowIcon. The data type is BOOLEAN.

MessageBlockShowTitleIcon property
Title as icon - MessageBlockShowTitleIcon
Enables the display of the title of a selected message block as icon.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


MessageBlockShowTitleIcon. The data type is BOOLEAN.

MessageBlockTextId property
Text ID - MessageBlockTextId
Specifies the caption of the selected message block using a Text ID which was derived from
the text library. The caption is adapted automatically if a user changes the Runtime language.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".
The attribute can be assigned dynamic properties by means of the name
MessageBlockTextId. The data type is LONG.

MessageBlockTimeFormat property
MessageBlockTimeFormat
Defines which time format or duration format is used for displaying the messages.
To change the setting, the option "Apply project settings" must be deactivated or
"ApplyProjectSettings" must be set to "FALSE".

1210

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss

Hours:Minutes:Seconds, e.g. 15:35:44

HH:mm:ss.ms

Hours:Minutes:Seconds.Milliseconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The following time duration formats are available:


Value

Explanation

Automatic

The time duration format is determined automatically.

d H:mm:ss

Day Hours:Minutes:Seconds, e.g. 1 2:03:55.

H:mm:ss.

Hours:Minutes:Seconds, e.g. 26:03:55.

m:ss

Minutes:Seconds, Example: 1563:55.

Seconds, e.g. 93835.

The attribute can be made dynamic by means of the name MessageBlockTimeFormat. The
data type is STRING.

MessageBlockType property
MessageBlockType
Displays the association of the message block.
The following settings are available:
Value

Description

Explanation

System block

The message block belongs to the system block category.

Text block

The message block belongs to the user text block category.

Process value block

The message block belongs to the process value block category.

Hitlist block

The message block belongs to the message blocks of the hitlist.

The attribute can be assigned dynamic properties by means of the name


MessageBlockType . The data type is LONG.

MessageClass Property
Description
Defines the respective message type (Alarm High, Alarm Low, Warning High, Warning Low, ...)
for which the "Display Text", "Arrived-", "Arrived Acknowledged -" and "Departed
Unacknowledged -" settings have been configured.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1211

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

MessageColumnAdd property
MessageColumnAdd
Adds the selected message block from the list of existing message blocks to the list of selected
message blocks.
The attribute can be assigned dynamic properties by means of the name
MessageColumnAdd . The data type is STRING.

MessageColumnCount property
MessageColumnCount
Specifies the number of message blocks to be displayed in the message list in Runtime.
The attribute can be assigned dynamic properties by means of the name
MessageColumnCount . The data type is LONG.

MessageColumnIndex property
MessageColumnIndex
References a message block selected for the message list. Using this attribute you can assign
the values of other attributes to a specific message block of the message list.
Values between 0 and "MessageColumnCount" minus 1 are valid for "MessageColumnIndex".
Attribute "MessageColumnCount" defines the number of message blocks selected for the
message list.
The "MessageColumnIndex" attribute can be assigned dynamic properties by means of
attribute MessageColumnRepos. The data type is LONG.

MessageColumnName property
MessageColumnName
Displays the name of the message block of the message list which is referenced with attribute
"MessageColumnIndex". You cannot edit this name.
The attribute can be assigned dynamic properties with the name MessageColumnName. The
data type is STRING.

1212

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

MessageColumnRemove property
MessageColumnRemove
Cuts the marked message block from the list of selected message blocks and pastes it to the
list of available message blocks.
The attribute can be assigned dynamic properties by means of the name
MessageColumnRemove . The data type is STRING.

MessageColumnRepos property
Up/Down - MessageColumnRepos/HitlistColumnRepos
Resorts the message blocks. The "Up" and "Down" commands move the selected message
block accordingly in the list. This moves the message block in Runtime Control towards the
front or towards the back.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnRepos .
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnRepos.
The data type is LONG.

MessageColumnSort property
MessageColumnSort
Defines the sorting order of the message block referenced in "MessageColumnIndex" .
The following settings are available:
Value

Description

Explanation

no

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name


MessageColumnSort . The data type is LONG.

MessageColumnSortIndex property
MessageColumnSortIndex
Defines the sorting order of the message block referenced in "MessageColumnIndex". The
sorting criterion is removed from "MessageColumnSort" if you set a "0" value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1213

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
MessageColumnSortIndex. The data type is LONG.

MessageColumnVisible property
Selected message blocks - MessageColumnVisible/HitlistColumnVisible
Selected message blocks of message list or hitlist that are displayed in Runtime. Defines
whether the message block referenced in "MessageColumnIndex" or "HitlistColumnIndex" is
displayed.
The attribute for the message list can be assigned dynamic properties by means of the name
MessageColumnVisible.
The attribute for the hitlist can be assigned dynamic properties by means of the name
HitlistColumnVisible.
The data type is BOOLEAN.

MessageListType property
Active list on picture call - MessageListType
Selection field for defining the active list for picture calls.
Value

Description

Explanation

Message list

The currently active messages are displayed after a picture was


called.

Short-term archive list

A short-term archive list displays the logged messages after the


picture was called. The display is updated immediately on activation
of new messages.

Long-term archive list

A long-term archive list displays the logged messages after a picture


was called.

Lock list

Only the currently locked messages are displayed after a picture


was called.

Hitlist

The configured statistics data is displayed after a picture was called.

List of messages to be
hidden

The messages to be hidden are displayed at the call of a picture.

The attribute can be assigned dynamic properties by means of the name MessageListType.
The data type is LONG.

1214

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.12.3

Mi - Ms

Min Property
Description
Defines or returns the absolute value in the case of the smallest value display. This value is
displayed if the scale display is active.

See also
Slider (Page 226)
Bar (Page 189)
3D Bar (Page 184)
ScreenItem Object (Page 141)

MinuteNeedleHeight Property
Description
Defines or returns the length of the minute hand for the analog clock. The specification of the
length is entered as a percentage value in relation to half the length of the short side of the
rectangular background. Write/Read access.
Example:
The shorter side of the rectangular background is 100 pixels long.
The minute hand length is 80.
This results in a length of the minute hand of (100 pixels / 2) * 0.8 = 40 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

MinuteNeedleWidth Property
Description
Defines or returns the width of the minute hand for the analog clock. The width is specified as
a percentage value related to double the length of the minute hand.
Example:
The length of the minute hand is 40 pixels.
The minute hand width is 8.
This results in a width of the minute hand of 40 pixels * 2 * 0.08 = 6 pixels.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1215

VBS Reference
2.4 Properties

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

Moveable Property
Description
TRUE, when the object can be moved in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

Moveable Property
Movable
Defines whether the control can be moved in Runtime.
Value

Explanation

TRUE

The control can be moved in Runtime.

FALSE

The control cannot be moved in Runtime.

The attribute can be assigned dynamic properties by means of the name Moveable. The data
type is BOOLEAN.

MsgCtrlFlags Property
Description
Defines the sorting sequence in Alarm Control. Write/Read access.
0: The entries are sorted by the value in the time column and in ascending order, i.e. the
oldest messages are displayed at the top of the message window.
1: The entries are sorted by the value in the time column in descending order, i.e. the oldest
messages are displayed at the bottom of the message window. In the case of this value,
the "AutoScroll" property is automatically deactivated, otherwise the current message could
be moved out of the display area of the message window.

1216

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

MsgFilterSQL property (before WinCC V7)


Description
Defines an SQL Statement to the selected messages displayed in the message window. Write/
Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

MsgFilterSQL property
MsgFilterSQL
Defines one or several SQL statements for the custom selection of messages. Multiple userdefined selections are logically linked by "OR" operation. The SQL statements of
"DefaultMsgFilterSQL" and "MsgFilterSQL" are linked logically by "AND" operation if you
define a default selection by means of "DefaultMsgFilterSQL".
The attribute can be assigned dynamic properties by means of the name MsgFilterSQL. The
data type is STRING.

2.4.13

2.4.13.1

Name Property

Description of layer and tag object


Returns the object name. STRING (read only)
In the case of tags, the name of the tag without server and tag prefix
In the case of layers, the layer name
Tags
The tag "Name" property is used to address the tag via the tag list. The name of a tag can
contain a server prefix. In WinCC, tag names are structured according to the following scheme:
<Serverprefix>::<Variablenprefix><Name der Variable>

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1217

VBS Reference
2.4 Properties
If the tag name alone is specified, the server prefix and tag prefix are removed from the context
of the picture.
If the tag is specified with a server prefix in the tag name, the tags and server prefix of the
context are ignored and the server prefix included is used.

WinCC Function Trend Control Description


The "Index" property references a trend. "Name" defines the name of the trend.

Description Project Object


Returns the name of the current Runtime project. STRING (read only)
Example:
The following example returns the name of the current Runtime project as Trace:

'VBS160
HMIRuntime.Trace "Name: " & HMIRuntime.ActiveProject.Name & vbNewLine

Description of DataItem Object


Returns the name of the DataItem object.

See also
ActiveProject Property (Page 305)
WinCC Function Trend Control (before WinCC V7) (Page 290)
Tag Object (Page 152)
Ellipse segment (Page 162)
Layer Object (Page 136)
DataItem Object (Page 129)

2.4.13.2

NeedleColor Property

Description
Defines or returns the color of the pointer. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

1218

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.13.3

NormalColor Property

Description
Defines the color of the normal area of the scale. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

2.4.13.4

NumberLines Property

Description
Text list
Defines or return the number of lines the text list object should contain. If the amount of
configured text is larger than this value, the selection list receives a vertical scroll bar.
Combobox and list box
Defines or returns for the Combobox and List Box objects the number of entries the object
should contain. You can define a maximum of 100,000 lines.
At the same time, the value of the "Number of rows" attribute specifies the upper limit value
for the "Index" attribute in the "Font" property group. Changing the value can have the following
effects:
Increasing the number: New lines are added at the bottom. The standard labeling of the
new filed can be changed using the "Text" attribute in the "Font" property group.
Reducing the number: All lines are removed for which the value of the "Index" attribute is
higher than the new number.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

2.4.13.5

NumItems Property

Description
Returns the number of trends or column pairs (visible and invisible) in the window which have
been configured. Write/Read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1219

VBS Reference
2.4 Properties

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.14

2.4.14.1

Ob - On

Object Property
Description
If a non-WinCC control is used, it is possible that the properties provided by the control have
the same names as the general ScreenItem properties. In such cases, the ScreenItem
properties have priority. The "hidden" properties of an external control supplier can be
accessed using the additional "object" property.

Example:
Address the properties of an external control supplier as follows:
Control.object.type
If the following form alone is used
Control.type
the properties of the ScreenItem object are used in the case of identical names.

See also
Controls (Page 232)
ScreenItem Object (Page 141)

ObjectName Property
Description
Returns the object name.
In the case of graphic objects, the object name
In the case of pictures, the picture name

1220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
STRING (read only)

Example:
The following example issues the names of all the objects contained in the picture "NewPDL1":

'VBS80
Dim objScreen
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
lngAnswer = MsgBox("Name of object " & lngIndex & ": " & strName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

Pictures
Establish the picture name directly from the "ObjectName" property:

'VBS81
MsgBox "Screenname: " & HMIRuntime.ActiveScreen.ObjectName

See also
Screen Object (Page 146)
ScreenItem Object (Page 141)

ObjectSizeDeclutteringEnable Property
Description
Returns the ObjectSizeDecluttering properties of a picture.
Upon activated ObjectSizeDecluttering, only objects within a set size range are displayed.
You specify the upper and lower limits for the display range in Graphics Designer under "Tools>
Settings > Show/Hide".
BOOLEAN Read-only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1221

VBS Reference
2.4 Properties

Example:
The example outputs the Decluttering Properties of the picture NewPDL1 as a trace.

'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Min: " & objScreen.ObjectSizeDeclutteringMin & vbNewLine
HMIRuntime.Trace "Max: " & objScreen.ObjectSizeDeclutteringMax & vbNewLine
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

ObjectSizeDeclutteringMax Property
Description
Using the ObjectSizeDeclutteringMax property, the upper size range of a picture may be read.
Objects which are larger than the stated pixel size are no longer displayed when
ObjectSizeDecluttering is activated.
LONG read-only access.

Example:
The example outputs the Decluttering Properties of the picture NewPDL1 as a trace.

'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Min: " & objScreen.ObjectSizeDeclutteringMin & vbNewLine
HMIRuntime.Trace "Max: " & objScreen.ObjectSizeDeclutteringMax & vbNewLine
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

ObjectSizeDeclutteringMin Property
Description
Using the ObjectSizeDeclutteringMin property, the lower size range of a picture may be read.

1222

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Objects which are smaller than the stated pixel size are no longer displayed when
ObjectSizeDecluttering is activated.
LONG read-only access.

Example:
The example outputs the Decluttering Properties of the picture NewPDL1 as a trace.

'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
HMIRuntime.Trace "Min: " & objScreen.ObjectSizeDeclutteringMin & vbNewLine
HMIRuntime.Trace "Max: " & objScreen.ObjectSizeDeclutteringMax & vbNewLine
HMIRuntime.Trace "Enable: " & objScreen.LayerDeclutteringEnable & vbNewLine

See also
Screen Object (Page 146)

OffsetLeft Property
Description
Defines or returns the distance of the picture from the left edge of the picture window.
The picture is displayed as a cutout of the picture window. The picture scroll bars are located
at the left and upper edge of the picture. If you wish to display the picture in the picture window
by using the horizontal and vertical positioning of the picture scroll bars, use the properties
"ScrollPositionX" and "ScrollPositionY" for such positioning.

See also
ScrollPositionY Property (Page 548)
ScrollPositionX Property (Page 548)
Picture Window (Page 194)
ScreenItem Object (Page 141)

OffsetTop Property
Description
Defines or returns the distance of the picture from the top edge of the picture window.
The picture is displayed as a cutout of the picture window. The picture scroll bars are located
at the left and upper edge of the picture. If you wish to display the picture in the picture window

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1223

VBS Reference
2.4 Properties
by using the horizontal and vertical positioning of the picture scroll bars, use the properties
"ScrollPositionX" and "ScrollPositionY" for such positioning.

See also
ScrollPositionY Property (Page 548)
ScrollPositionX Property (Page 548)
Picture Window (Page 194)
ScreenItem Object (Page 141)

OneY Property
Description
TRUE if only the Y-axis of the trend is displayed in the foreground instead of all Y-axes of the
displayed trends. BOOLEAN write-read access.

Online property (before WinCC V7)


Description
Serves to start or stop updating.
0: The updated display is stopped. The values are buffered and updated when the button
is clicked again.
-1: The updated display is resumed.

See also
ScreenItem Object (Page 141)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

Online property
Starting refresh - Online
Enables a refresh of displayed values when calling a picture in Runtime.
Value

Description

TRUE

Enables the refresh of values on picture calls.

FALSE

Disables the refresh of values on picture calls.

1224

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name Online. The data
type is BOOLEAN.

OnTop Property
Description
TRUE, when the object should remain in the foreground in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

2.4.14.2

Op

OperationMessage Property
Description
TRUE, if a message should be output upon successful operation. BOOLEAN Schreib-LeseZugriff.
The operation is sent to the message system, and is archived. Using the message system, a
message may be output in a message line, for example.
Special features of I/O field, text list and slider
The reason for the operation may only be entered if the "OperationReport" property has been
set to TRUE.

See also
Slider (Page 226)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
I/O Field (Page 199)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1225

VBS Reference
2.4 Properties

OperatorMessageID property
OperatorMessageID
Default assignment of the ID number and trigger event in WinCC OnlineTableControl:
Value

Description

Explanation

EditValue

Trigger event "Change archive value"

InsertValue

Trigger event "Generate archive value"

The attribute can be assigned dynamic properties by means of the name


OperatorMessageID. The data type is LONG.

OperatorMessageIndex property
OperatorMessageIndex
References the event of an archive value change for an operator message. Using this attribute
you can assign the values of other attributes to a specific operator message.
The following values are available:
Value

Explanation

Trigger event "Change archive value"

Trigger event "Generate archive value"

The attribute can be assigned dynamic properties by means of the name


OperatorMessageIndex. The data type is LONG.

OperatorMessageName property
Object name - OperatorMessageName
Displays the name that is referenced with the attribute "OperatorMessageIndex" for message
events for operator messages. You cannot edit this name.
The following names are available for message events:
Value

Explanation

Lock

Message event "Lock"

Unlock

Message event "Enable"

Hide

Message event "Hide"

Unhide

Message event "Unhide"

Quit

Message event "Ackn."

The attribute can be assigned dynamic properties by means of the name


OperatorMessageName . The data type is STRING.

1226

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
How to configure operator messages

OperatorMessageNumber property
Message number - OperatorMessageNumber
Define a message number for the selected operator message event if you do not want to use
the operator message of WinCC.
The attribute can be assigned dynamic properties by means of the name
OperatorMessageNumber. The data type is LONG.

OperatorMessageSelected property
Operator messages for - OperatorMessageSelected
Activate the message events which trigger operator messages in the list.
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSelected. The data type is BOOLEAN.

OperatorMessageSource1 property
Source - OperatorMessageSource1
Define the message block of an operated message to be added to "Process value block 1" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 1" of the operator message. Select "1" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource1. The data type is STRING.

OperatorMessageSource2 property
Source - OperatorMessageSource2
Define the message block of an operated message to be added to "Process value block 2" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 2" of the operator message. Select "2" at process value as the message lock of
the operated message "User text block 1".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1227

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource2. The data type is STRING.

OperatorMessageSource3 property
Source - OperatorMessageSource3
Define the message block of an operated message to be added to "Process value block 3" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 3" of the operator message. Select "3" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource3. The data type is STRING.

OperatorMessageSource4 property
Source - OperatorMessageSource4
Define the message block of an operated message to be added to "Process value block 4" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 4" of the operator message. Select "4" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource4. The data type is STRING.

OperatorMessageSource5 property
Source - OperatorMessageSource5
Define the message block of an operated message to be added to "Process value block 5" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 5" of the operator message. Select "5" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource5. The data type is STRING.

1228

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

OperatorMessageSource6 property
Source - OperatorMessageSource6
Define the message block of an operated message to be added to "Process value block 6" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 6" of the operator message. Select "6" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource6. The data type is STRING.

OperatorMessageSource7 property
Source - OperatorMessageSource7
Define the message block of an operated message to be added to "Process value block 7" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 7" of the operator message. Select "7" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource7. The data type is STRING.

OperatorMessageSource8 property
Source - OperatorMessageSource8
Define the message block of an operated message to be added to "Process value block 8" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 8" of the operator message. Select "8" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource8. The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1229

VBS Reference
2.4 Properties

OperatorMessageSource9 property
Source - OperatorMessageSource9
Define the message block of an operated message to be added to "Process value block 9" of
the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 9" of the operator message. Select "9" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource9. The data type is STRING.

OperatorMessageSource10 property
Source - OperatorMessageSource10
Define the message block of an operated message to be added to "Process value block 10"
of the operator message configured in Source.
An operator message is to be generated to indicate that a message was locked. The contents
of "User text block 1" of the locked message, e.g. "Motor faulty", is to be displayed in "Process
value block 10" of the operator message. Select "10" at process value as the message lock of
the operated message "User text block 1".
The attribute can be assigned dynamic properties by means of the name
OperatorMessageSource10. The data type is STRING.

OperatorMessageSourceType1 property
Transfer as - OperatorMessageSourceType1
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType1. The data type is LONG.

1230

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

OperatorMessageSourceType2 property
Transfer as - OperatorMessageSourceType2
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType2. The data type is LONG.

OperatorMessageSourceType3 property
Transfer as - OperatorMessageSourceType3
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType3. The data type is LONG.

OperatorMessageSourceType4 property
Transfer as - OperatorMessageSourceType4
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType4. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1231

VBS Reference
2.4 Properties

OperatorMessageSourceType5 property
Transfer as - OperatorMessageSourceType5
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType5. The data type is LONG.

OperatorMessageSourceType6 property
Transfer as - OperatorMessageSourceType6
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType6. The data type is LONG.

OperatorMessageSourceType7 property
Transfer as - OperatorMessageSourceType7
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType7. The data type is LONG.

1232

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

OperatorMessageSourceType8 property
Transfer as - OperatorMessageSourceType8
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType8. The data type is LONG.

OperatorMessageSourceType9 property
Transfer as - OperatorMessageSourceType9
Defines the format for transferring the source.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source as text.

Value

Transfer the source as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType9. The data type is LONG.

OperatorMessageSourceType10 property
Transfer as - OperatorMessageSourceType10
Specifies the format of the source content for the transfer.
The following formats are available:
Value

Description

Explanation

Text

Transfer the source content in text format.

Value

Transfer the source content as value.

The attribute can be assigned dynamic properties by means of the name


OperatorMessageSourceType10. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1233

VBS Reference
2.4 Properties

OperationReport Property
Description
TRUE, if the reason for an operation should be recorded. BOOLEAN write/read access.
When the object is used or operated in Runtime, a dialog opens in which the operator can
input the reason for the operation in the form of text. The operation is sent to the message
system, and is archived.

See also
Slider (Page 226)
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

2.4.14.3

Or - Ou

Orientation Property
Description
TRUE, when the text in the object should be displayed horizontally. BOOLEAN write-read
access.

Description of the "Connector" object type


Modifies the orientation of the connector. BOOLEAN write-read access.

See also
Connector (Page 182)
Static text (Page 180)
Text list (Page 211)
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
I/O Field (Page 199)
ScreenItem Object (Page 141)

1234

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

OuterBevelStyle Property
Description
Defines the 3D effect for the outer bevel of the object.
0: No border.
1: The border is displayed depressed.
2: The border is displayed raised.
3: The border is displayed in one color without a 3D effect. The border color is defined by
the "BevelColorUp" property.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

OuterBevelWidth Property
Description
Defines the width of the outer bevel in pixels.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

Outline Property
Description
TRUE, when the button should be given a black border in addition to the 3D border. BOOLEAN
write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1235

VBS Reference
2.4 Properties

OutputFormat Property
Description
Returns the value for the representation of the output value and sets it. The representation
depends on the data format.

See also
I/O Field (Page 199)
ScreenItem Object (Page 141)

OutputValue Property
Description
Determines the default setting for the value to be displayed or returns it.
This value is used in Runtime when the associated tag cannot be connected or updated when
a picture is started.

See also
Text list (Page 211)
I/O Field (Page 199)
ScreenItem Object (Page 141)

2.4.15

2.4.15.1

Pa - Pe

PageMode property
Enable paging - PageMode
Enables paging is in the long-term archive list. Allows you to display all messages of the shortterm archive in the long-term archive list. Use the "Messages per page" or
"PageModeMessageNumber" property to determine the number of messages displayed per
page.
The page up/down buttons of the toolbar can be used if paging is enabled.

1236

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Explanation

TRUE

Paging is enabled for the long-term archive list.

FALSE

Paging is disabled for the long-term archive list.

The attribute can be assigned dynamic properties by means of the name PageMode. The data
type is BOOLEAN.

PageModeMessageNumber property
Messages per page - PageModeMessageNumber
Defines the number of messages shown per page when paging the long-term archive list.
The attribute can be assigned dynamic properties by means of the name
PageModeMessageNumber. The data type is LONG.

Parent Property
Description
Returns a reference to the superordinate object.
Objects within the VBS object model are accessed by hierarchy. You may descend in the
picture hierarchy using Screen and Screenitems. You may ascend in the picture hierarchy by
using the Parent property.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1237

VBS Reference
2.4 Properties

Usage
The Parent property can be used as often as required within an object hierarchy. The following
section provides a systematic description of how to access all the elements in a hierarchy:

The Command
MsgBox MyCircle.Parent.Objectname
returns the name of "Picture2" located one layer higher in the object hierarchy than the original
ScreenItem object "Circle1".
For example, if you wish to use "Parent" three times, ascend in the object hierarchy by three
layers:
MsgBox MyCircle.Parent.Parent.Parent.Objectname
returns the name of Picture1.
Reasoning:
Original reference is to ScreenItem "Circle1"
"Circle1" is within "Picture2" (Layer 1)

1238

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
"Picture2" is within Picture Window2 "BF2" (Layer 2)
"BF2" is within "Picture 1"(Layer 3)

Example
In the following examples, the object name of the parent object is displayed:

'VBS120
Dim objCircle
Set objCircle = HMIRuntime.Screens("ScreenWindow1").ScreenItems("Circle1")
MsgBox objCircle.Parent.ObjectName

'VBS82
Dim objScrItem
Set objScrItem = HMIRuntime.Screens(1).ScreenItems(1)
MsgBox "Name of BaseScreen: " & objScrItem.Parent.ObjectName

See also
Picture Window (Page 194)
Screen Object (Page 146)
Objects and Lists (Page 123)

PasswordLevel Property
Description
Defines the authorization for operation (e.g. no input or no triggering actions) of the object.

See also
ScreenItem Object (Page 141)

Path Property
Description
Returns the path of the current project (without file name). For a WinCC client without its own
path, the path is returned in UNC format, otherwise the local path is returned.
STRING (read access only)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1239

VBS Reference
2.4 Properties

Example:
The following example returns the project path as Trace:

'VBS161
HMIRuntime.Trace "Path: " & HMIRuntime.ActiveProject.Path & vbNewLine

See also
Project Object (Page 140)

PercentageAxis property
PercentageAxis
Enables the additional display of an axis with percentage scaling in a trend window for value
axes.
Value

Explanation

TRUE

The display of an axis with percentage scaling is enabled.

FALSE

The display of an axis with percentage scaling is disabled.

The attribute can be assigned dynamic properties by means of the name PercentageAxis. The
data type is BOOLEAN.

PercentageAxisAlign property
PercentageAxisAlign
Enables axis alignment with percentage scaling in the trend window.
The following settings are available:
Value

Description

Explanation

left

The axis with percentage scaling is aligned left.

right

The axis with percentage scaling is aligned right.

The attribute can be assigned dynamic properties by means of the name


PercentageAxisAlign. The data type is LONG.

1240

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

PercentageAxisColor property
PercentageAxisColor
Specifies the color of an axis with percentage scaling. The button opens the "Color selection"
dialog to select the color.
The attribute can be assigned dynamic properties by means of the name
PercentageAxisColor. The data type is LONG.

PersistentRT Property
Description
TRUE, when modified window settings should be retained following a change of picture.
Whether the information is evaluated is dependent on the value of the "AllowPersistance"
property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

PersistentRTCS Property
Description
TRUE, when modified settings should be retained following a change of picture and applied
in the configuration system. Whether the information is evaluated is dependent on the value
of the "AllowPersistance" property. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1241

VBS Reference
2.4 Properties

PersistentRTCSPermission Property
Description
Defines the operator permission which is necessary in order to modify settings related to
persistence. The value to be entered must correspond to the number of the requested
authorization level in the user administrator. Whether or not the information is to be analyzed
depends on the value of the "AllowPersistence" property (does not apply to WinCC Alarm
Control).

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

PersistentRTPermission Property
Description
Defines the operator permission which is necessary in order to modify settings related to the
persistency in Runtime. The value to be entered must correspond to the number of the
requested authorization level in the user administrator. Whether or not the information is to be
analyzed depends on the value of the "AllowPersistence" property (does not apply to WinCC
Alarm Control).

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1242

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.15.2

Pi

PicDeactReferenced-Eigenschaft
Description
TRUE, when the picture assigned for the "Disable" status should be saved in the RoundButton
object. Otherwise, only the associated object reference is saved. Read only access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDeactTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "Disabled"
status should be set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicDeactUseTransColor" property is
"True".

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDeactUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDeactTransparent" property for the
"Disable" status should be used. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1243

VBS Reference
2.4 Properties

PicDownReferenced Property
Description
TRUE, when the picture assigned for the "On" status is to be saved. Otherwise, only the
associated object reference is saved. Read only access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDownTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "On" status
should be set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicDownUseTransColor" property is
"True".

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicDownUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDownTransparent" property for the "On"
status should be used. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicReferenced Property
Description
TRUE, when the assigned picture is references the object and is not saved in it. Read only
access.

1244

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

PictAlignment property
Description
Defines or returns the picture alignment of the picture on the button or round button.
LONG write-read access.

PicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicUseTransColor" property is "True".

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

Picture Property
Description
Returns the picture name of the background picture for the rectangular background for both
the analog and digital clocks. Read only access

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

PictureBack Property
Description
Returns the picture name of the picture for the object background. Read only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1245

VBS Reference
2.4 Properties

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

PictureDeactivated Property
Description
Defines the picture to be displayed in the "Disable" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PictureDirectory property
Directory for pictures (PictureDirectory)
Specifies the name of the subdirectory that is created in the "GraCS" directory of the WinCC
project. If pictures are stored in the subdirectory, they are available for the extended status
display. If no subdirectory is specified or the subdirectory does not contain any pictures, the
pictures in the "GraCS" directory are taken into consideration.
The "Directory for pictures" attribute can be dynamized with the name "PictureDirectory".

PictureDown Property
Description
Defines the picture to be displayed in the "On" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Button (Page 215)
Round Button (Page 223)
ScreenItem Object (Page 141)

1246

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

PictureName Property
Description
Defines the picture to be displayed in the graphic object in Runtime or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

PictureSelected Property
Description
Returns the picture name of the picture displayed in the "On" status. "AutoSize" controls the
adaptation of the size of picture and buttons. Read only access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

PictureSizeMode property
PictureSizeMode
Specifies the size adjustment between picture and control.
Value

Designation

Explanation

Fit size to content

The control is adapted to the picture size.

Fit content to size

The picture is adapted or scaled to the control.

The attribute can be assigned dynamic properties by means of the name PictureSizeMode.
The data type is LONG.

PictureThumb Property
Description
Returns the picture name of the background picture for the slider. Read only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1247

VBS Reference
2.4 Properties

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

PictureUnselected Property
Description
Returns the picture name of the picture displayed in the "Off" status. "AutoSize" controls the
adaptation of the size of picture and buttons. Read only access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

PictureUp Property
Description
Defines the picture to be displayed in the "Off" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

See also
Round Button (Page 223)
Button (Page 215)
ScreenItem Object (Page 141)

PicUpReferenced Property
Description
TRUE, when the picture assigned for the "Off" status should be saved in the object. Otherwise,
only the associated object reference is saved. Read only access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

1248

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

PicUpTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "Off" status
should be set to "transparent". LONG Write/Read Access.
The color is only set to "Transparent" if the value of the "PicUpUseTransColor" property is
"True".

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicUpUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicUpTransparent" property for "Off" status
should be used. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

PicUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDeactTransparent" property for the
"Disable" status should be used. BOOLEAN write-read access.

See also
Graphic Object (Page 202)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1249

VBS Reference
2.4 Properties

2.4.15.3

Pl - Pr

PlayEndless property
PlayEndless
Specifies if movies are played endlessly in the control.
The attribute can be assigned dynamic properties by means of the name PlayEndless. The
data type is BOOLEAN.

PointCount Property
Description
Defines or returns the number of corner points. Each corner point has position coordinates
and is identified via an index.

See also
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

Position Property
Description
Defines the presetting for the position of the slider.
This value is used as the start value in Runtime.
To operate the process value linked to this attribute, it is necessary that the process value is
also linked to the "Position" event. You will find the event "Position" in the "Event" tab, in the
topic tree under SliderCtrl\Property Topics\Control Properties\Value.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

1250

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Precisions Property
Description
WinCC Online Trend Control
The "Index" property references a pair of columns. "Precision" defines the number of decimal
places which should be shown in this value column. A maximum of 16 decimal places can be
displayed.
WinCC Online Trend Control
Defines the number of decimal places with which the scale value is specified.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

PrecisionX Property
Description
Defines or returns the number of decimal places with which the scale value for the X-axis
should be specified. Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

PrecisionY Property
Description
Defines or returns the number of decimal places with which the scale value for the Y-axis
should be specified. Write/Read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1251

VBS Reference
2.4 Properties

PredefinedAngles Property
Description
Defines or returns the depth of the display of the 3DBarGraph object. Value range from 0 to 3.
0 = cavalier
1 = isometric
2 = axionometric
3 = freely defined

See also
ScreenItem Object (Page 141)
3D Bar (Page 184)

PreferredTarget property
Preferred picture target (PreferredTarget)
The "Preferred picture target" attribute specifies where the picture change is carried out by the
Favorites browser.
Yes

The picture change is carried out in this picture screen. In the case of nested picture screens the picture change
is carried out at the innermost picture screen with the "Yes" setting.

No

The picture change is carried out in the main screen.

The "Preferred picture target" attribute can be made dynamic with the name "PreferredTarget".

Pressed Property
Description
TRUE, when the Button or RoundButton object is pressed. BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

1252

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

PrintBackgroundColor Property
Description
TRUE, if the defined background color is also printed while printing the controls. BOOLEAN
write-read access.

PrintJob Property
Description
Defines or reads out which print layout should be used for the printed output.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

PrintJobName property
Current print job view - PrintJobName
Defines the print job triggered by the print function of the "Print" toolbar button. The
recommended print job is set for the control by default.
Open the "Select Print Job" dialog using the selection button.
The attribute can be assigned dynamic properties by means of the name PrintJobName. The
data type is STRING.

Process Property
Description
Defines or returns presetting for the value to be displayed.
This value is used in Runtime when the associated tag cannot be connected or updated when
a picture is started.

See also
Slider (Page 226)
Radio box (Page 221)
Check box (Page 219)
Bar (Page 189)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1253

VBS Reference
2.4 Properties
3D Bar (Page 184)
ScreenItem Object (Page 141)

ProcessValue property
Description
Returns an object of type "ProcessValue".

See also
Alarms object (list) (Page 126)

ProjectPath Property
Description
Contains the path and name of the associated project.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ProviderClsid Property
Description
The "Index" property references a trend. "ProviderClsid" defines whether an archive tag or an
internal or external tag should be displayed in this trend.
{416A09D2-8B5A-11D2-8B81-006097A45D48}: The trend is connected to an archive tag.
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: The trend is connected to an internal or
external tag.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

1254

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ProviderType Property
Description
Defines the type of values to be displayed in a trend referenced by "Index". In the case of
modification of "ProviderType", impermissible combinations with other attributes for data
connection could be created. Therefore, before modifying "ProviderType", the immediate
acceptance of the changes must be prevented using "FreezeProviderConnections".
0: Values are supplied via the API interface.
-1: Display of online or archive tags
-2: Displaying values from a user archive

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

2.4.16

2.4.16.1

QualityCode Property

Description
Defines a standard for the quality of a tag value after being read. The quality code is provided
as a 16-bit value for automatic evaluation. After a tag has been written, the value is invalid.
SHORT (read only)
Note
A summary of possible Quality Codes is provided in the WinCC Information System under
the heading "Communication" > "Diagnostics" or "Communication" > "Quality Codes".

Example:
The following example indicates the quality of the read value when no errors have occurred
during the reading process:

'VBS83
Dim objTag
Dim lngLastErr
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1255

VBS Reference
2.4 Properties

lngLastErr = objTag.LastError
If 0 = lngLastErr Then
MsgBox objTag.QualityCode
End If

See also
LastError Property (Page 445)
ErrorDescription Property (Page 398)
Tag Object (Page 152)

2.4.17

2.4.17.1

Ra - Ri

Radius Property
Description
Defines or returns the radius in pixels.

See also
Pie segment (Page 167)
Circular arc (Page 166)
Circle (Page 164)
Round Button (Page 223)
ScreenItem Object (Page 141)

RadiusHeight Property
Description
Defines or returns the vertical radius in pixels (0 to 5000).

See also
Ellipse segment (Page 162)
Ellipse arc (Page 161)

1256

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Ellipse (Page 159)
ScreenItem Object (Page 141)

RadiusWidth Property
Description
Defines or returns the horizontal radius in pixels (0 to 5000).

See also
Ellipse segment (Page 162)
Ellipse arc (Page 161)
Ellipse (Page 159)
ScreenItem Object (Page 141)

RangeMax Property
Description
Defines the maximum absolute value for the value display.
If the "WithLabels" property has the value -1 (yes), this value is displayed on the scale.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

RangeMin Property
Description
Defines the minimum absolute value for the value display.
If the "WithLabels" property has the value -1 (yes), this value is displayed on the scale.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1257

VBS Reference
2.4 Properties

Rectangular Property
Description
Defines or returns the side ratio of the rectangular background of the gauge. BOOLEAN writeread access.
FALSE : The size of the gauge can be adjusted to any side ratio by dragging the marking points
with the mouse.
TRUE : The size of the gauge can only be adjusted by dragging the marking points with the
mouse. The side ratio of the background always remains 1:1.

See also
ScreenItem Object (Page 141)
WinCC Gauge Control (Page 264)

ReferenceRotationLeft Property
Description
Defines or returns the X-coordinate of the reference point about which the object should be
rotated in Runtime.
The value of the x coordinate is relative to the object width. Enter the value in percent starting
from the left edge of the rectangle enclosing the object.

See also
Line (Page 169)
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

ReferenceRotationTop Property
Description
Defines or returns the Y-coordinate of the reference point about which the object should be
rotated in Runtime.
The value of the Y-coordinate is relative to the object height. Enter the value in percent starting
from the top edge of the rectangle enclosing the object.

1258

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
ScreenItem Object (Page 141)
Line (Page 169)
Polyline (Page 173)
Polygon (Page 171)

RelayCurves Property
Description
TRUE, when the trends should be displayed staggered. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Relevant Property
Description
TRUE, when the object will be taken into account when forming the group display. BOOLEAN
write-read access.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

Replacement Property
Description
The "Index" property references a trend. Values, whose start value is unknown on activating
Runtime or for which a substitute value is used, have an unstable status. "Replacement"
defines whether such values should be identified by the color defined in "ReplacementColor".
BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1259

VBS Reference
2.4 Properties

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ReplacementColor Property
Description
The "Index" property references a trend. Values, whose start value is unknown on activating
Runtime or for which a substitute value is used, have an unstable status. "ReplacementColor"
defines the color used to identify this value. The color is defined as an RGB value. Whether
the information is evaluated is dependent on the value of the "Replacement" property.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

RightComma Property
Description
Defines or returns the number of decimal places (0 to 20).

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.17.2

Ro - Ru

Rotation property
Rotation (Rotation)
Specifies anticlockwise rotation around the icon center.
The following settings are available:

1260

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Comments

The icon is not rotated.

90

The icon is rotated by 90 degrees.

180

The icon is rotated by 180 degrees.

270

The icon is rotated by 270 degrees.

The attribute can be assigned dynamic properties by means of the name Rotation. The data
type is LONG.

RotationAngle Property
Description
Standard objects
Defines or returns the rotation angle in degrees.
In Runtime, the object (starting from the configured starting position) is displayed rotated
clockwise around the reference point by the specified value. The changed orientation of the
object is only visible in Runtime.
The coordinates of the reference point are defined with the "Rotation Reference X" and
"Rotation Reference Y" attributes.
T-piece
Defines or returns the orientation of a T-piece in degrees.
The attribute can assume one of four values. If you enter another value, it is automatically
converted to modulus 360 and rounded up or down to the closest permissible value.
The orientation is produced by rotating the T-piece clockwise around the center point by the
specified number of degrees.
0
90
180
270

The standard position of the T-piece is the shape of the letter "T"
The "leg" of the "T" points towards the left
The "leg" of the "T" points upwards
The "leg" of the "T" points to the right

See also
Line (Page 169)
Polyline (Page 173)
Polygon (Page 171)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1261

VBS Reference
2.4 Properties

RoundCornerHeight Property
Description
Defines or returns the corner radius.
Enter the value as a percentage of half the height of the object.

See also
Rounded rectangle (Page 177)
ScreenItem Object (Page 141)

RoundCornerWidth Property
Description
Defines or returns the corner radius.
Enter the value as a percentage of half the width of the object.

See also
ScreenItem Object (Page 141)

RowCellCount property
RowCellCount
Specifies the number of cells of the Row object of a Table Control. The number of cells
corresponds to the number of columns.

RowCellText property
RowCellText
Returns the contents of a cell as a string. The cell is determined from the column number of
the Row object. Numbering runs from "1" to "CellCount".

RowCount property
RowCount
Specifies the number of rows of the Row object of a Table Control.

1262

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

RowNumber property
RowNumber
Specifies the row number of the Row object of a Table Control.

RowScrollbar property
Row scroll bars - RowScrollbar
Enables the display of row scroll bars.
The following settings are available:
Value

Description

Explanation

No

No row scroll bars.

as required

Row scroll bars are displayed if horizontal space requirements of the control are greater
than the actually available display area.

always

Row scroll bars are always displayed.

The attribute can be assigned dynamic properties by means of the name RowScrollbar. The
data type is LONG.

RowTitleAlign property
Row label alignment - RowTitleAlign
Specifies the type of row label alignment.
The following settings are available:
Value

Description

Explanation

left

The row headers are aligned left.

centered

The row headers are aligned to center.

right

The row headers are aligned right.

The attribute can be assigned dynamic properties by means of the name RowTitleAlign. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1263

VBS Reference
2.4 Properties

RowTitles property
Show row labels - RowTitles
Enables the display of row labels.
Value

Explanation

TRUE

The row labels are displayed.

FALSE

The row labels are not displayed.

The attribute can be assigned dynamic properties by means of the name RowTitles. The data
type is BOOLEAN.

RTPersistence property
Online configuration at the next picture change - RTPersistence
Enables retention of the online configurations of the control after a picture change.
The following settings are available:
Value

Description

Explanation

Discard

The current online configurations are discarded at the next picture change.

Retain

The current online configurations are retained at the next picture change.

Reset

All online configurations made are lost. The picture is set to the contents
found in the configuration system.

The attribute can be assigned dynamic properties by means of the name RTPersistence. The
data type is LONG.

RTPersistencePasswordLevel property
Operator authorization for online configuration - RTPersistencePasswordLevel
Displays the authorization for online configuration. You can edit the authorization using the
selection button. Authorizations are configured in the "User Administrator" editor.
The attribute can be assigned dynamic properties by means of the name
RTPersistencePasswordLevel . The data type is LONG.

RTPersistenceType property
Online configuration - RTPersistenceType
Defines how to retain online configurations of WinCC.
The following settings are available:

1264

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Description

Explanation

Do not retain

Online configurations are not retained. These are lost at


the next picture change.

Retain during runtime

Online configurations are retained during runtime. These


are lost on exiting.

Retain permanently

Online configurations are retained permanently. These


are also available after restart.

The attribute cannot be dynamized.

RulerFont Property
Description
This attribute defines the font of the table of the tag values, which is displayed by the key
function "Display value at this position" / "Ruler". Write/Read access.

RulerPrecisions Property
Description
Defines the number of decimal places to which a measured value should be displayed when
it is determined using the "Display value at this position" function.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

RulerPrecisionX Property
Description
Defines the number of decimal places used by the "Display value at this position" to display
the X-coordinate of a measured value. Whether the information is evaluated is dependent on
the value of the "TimeAxisX" attribute.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1265

VBS Reference
2.4 Properties

RulerPrecisionY Property
Description
Defines the number of decimal places used by the "Display value at this position" to display
the Y-coordinate of a measured value.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

RulerType property
Window - RulerType
Specifies window to be displayed during runtime. Depending on the window type, only certain
blocks can be used as columns of the WinCC RulerControl.
The following window types can be selected:
Value

Description

Explanation

"Ruler" window

The ruler window shows the coordinate values of the trends on a


ruler or values of a selected row in the table.

"Statistics area" window

The statistics area window shows the values of the low and high
limit of trends between two rulers, or displays the selected range
in the table.

"Statistics" window

The statistics window shows the statistic evaluation of trends


between two rulers, or it displays the selected values in the table.

The attribute can be assigned dynamic properties by means of the name RulerType. The data
type is LONG.

2.4.18

2.4.18.1

Sa - Sc

SameSize Property
Description
TRUE, when all four buttons of a Group Display object have the same size. BOOLEAN writeread access.

1266

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

SavedTrend Property
Description
Displays the name of the last saved trend that was exported in WinCC Online Trend Control
using the Save Report button. Read only access.

ScaleColor Property
Description
Defines or returns the color of the scale. LONG write-read access.
The "Scaling" property must be set to TRUE for the color to be displayed.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ScaleTicks Property
Description
Defines the number of segments into which the bar will be subdivided by large tick marks of
the scale:
0-100: Object can be divided into a maximum of 100 segments
= 0: The optimum number of segments is set automatically.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

Scaling Property
Description
TRUE, when a scale should also be used to represent a value. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1267

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ScalingType Property
Description of Bar Scaling
Defines or returns the type of bar scaling. Value range from 0 to 6.
0 = linear
1 = logarithmic
2 = negative logarithmic
3 = automatic (linear)
4 = tangent
5 = square
6 = cubic
The "Scaling" property must be set to TRUE for the color to be displayed.

Description of Online Trend Control


Specifies or returns the type of scaling for a trend referenced by "Index". Value range from 0
to 2.
0 = linear
1 = logarithmic
2 = negative logarithmic

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
Bar (Page 189)
ScreenItem Object (Page 141)

ScalingTypeX Property
Description
Defines the type of scaling of the X-axis of a trend referenced with "Index". Whether the
information is evaluated is dependent on the value of the "TimeAxisX" attribute.
0: Linear
-1: Logarithmically. This setting prevents the display of negative values.

1268

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
-2: Logarithmically negated. This setting prevents the display of positive values.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ScalingTypeY Property
Description
Defines the type of scaling of the Y-axis of a trend referenced with "Index".
0: Linear
-1: Logarithmically. This setting prevents the display of negative values.
-2: Logarithmically negated. This setting prevents the display of positive values.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ScreenName Property
Description
Defines the picture to be displayed in the picture window in Runtime or returns the picture
name.
Note
Always enter picture names without the extension "PDL" for reasons of compatibility with
future versions.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1269

VBS Reference
2.4 Properties

Screens Property
Description
Returns an object of type "Screens".
Screens (read only)

Example:
The following example accesses the picture "NewPDL1":

'VBS84
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")

See also
Screens Object (List) (Page 149)
Screen Object (Page 146)
HMIRuntime Object (Page 134)

ScreenItems Property
Description
Returns an object of type "ScreenItems".
ScreenItems (read only)

Example:
The following example issues the number of all the objects contained in the picture "NewPDL1":

'VBS85
Dim objScreen
Set objScreen = HMIRuntime.Screens("NewPDL1")
Msgbox objScreen.ScreenItems.Count

See also
ScreenItems Object (List) (Page 144)
HMIRuntime Object (Page 134)

1270

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ScrollBars Property
Description
TRUE, when the object is equipped with a scroll bar in Runtime. Read only access.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

ScrollPositionX Property
Description
Specifies the horizontal positioning of the scroll bar in a picture window with slider, or returns
its value.
The picture is displayed in the picture window by positioning the horizontal and vertical scroll
bars. If you wish to display the picture as a cutout where the scroll bars are located at the left
and upper edge of the picture, use the properties "OffsetLeft" and "OffsetTop" as the origin of
this cutout.

See also
ScreenItem Object (Page 141)
OffsetTop Property (Page 501)
OffsetLeft Property (Page 500)
Picture Window (Page 194)

ScrollPositionY Property
Description
Specifies the vertical positioning of the scroll bar in a picture window with slider, or returns its
value.
The picture is displayed in the picture window by positioning the horizontal and vertical scroll
bars. If you wish to display the picture as a cutout where the scroll bars are located at the left
and upper edge of the picture, use the properties "OffsetLeft" and "OffsetTop" as the origin of
this cutout.

See also
OffsetTop Property (Page 501)
OffsetLeft Property (Page 500)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1271

VBS Reference
2.4 Properties
Picture Window (Page 194)
ScreenItem Object (Page 141)

2.4.18.2

Se

SecondNeedleHeight Property
Description
Defines or returns the length of the second hand for the analog clock. The specification of the
length is entered as a percentage value in relation to half the length of the short side of the
rectangular background. Write/Read access.
Example:
The shorter side of the rectangular background is 100 pixels long.
The second hand length is 80.
This results in a length of the second hand of (100 pixels / 2) * 0.8 = 40 pixels.

See also
ScreenItem Object (Page 141)
WinCC Digital/Analog Clock (Page 258)

SecondNeedleWidth Property
Description
Defines or returns the width of the second hand for the analog clock. The width is specified as
a percentage value related to double the length of the second hand. Write/Read access.
Example:
The length of the second hand is 40 pixels.
The second hand width is 2.
This results in a width of the second hand of 40 pixels * 2 * 0.02 = 2 pixels.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

1272

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

SelBGColor Property
Description
Defines or returns the background color of the selected entry in a text list object. LONG writeread access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

SelectArchiveName property
SelectArchiveName
Opens the dialog for selecting the user archive.
Programmers can set this attribute to allow users to select a user archive by means of a button,
for example.
The attribute can be assigned dynamic properties by means of the name
SelectArchiveName. The data type is BOOLEAN.

SelectedCellColor property
Background color of selected cell - SelectedCellColor
Specifies the background color of a selected cell. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name SelectedCellColor.
The data type is LONG.

SelectedCellForeColor property
Font color of the selected cell - SelectedCellForeColor
Specifies the font color of the selected cell. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name
SelectedCellForeColor. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1273

VBS Reference
2.4 Properties

SelectedRowColor property
Background color of the selected row - SelectedRowColor
Specifies the background color of the selected line. The button opens the "Color selection"
dialog.
The attribute can be assigned dynamic properties by means of the name SelectedRowColor.
The data type is LONG.

SelectedRowForeColor property
Font color of the selected row - SelectedRowForeColor
Specifies the font color of the selected row. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name
SelectedRowForeColor. The data type is LONG.

SelectedTitleColor property
Background selection color - SelectedTitleColor
Specifies the background color of a selected table header. The button opens the "Color
selection" dialog.
The setting is only active in Runtime if the "Selection color" or "UseSelectedTitleColor" option
is activated.
The attribute can be assigned dynamic properties by means of the name SelectedTitleColor.
The data type is LONG.

SelectedTitleForeColor property
Font selection color - SelectedTitleForeColor
Specifies the font color of the table header selected. The button opens the "Color selection"
dialog.
The setting is only active in Runtime if the "Selection color" or "UseSelectedTitleColor" option
is activated.
The attribute can be assigned dynamic properties by means of the name
SelectedTitleForeColor. The data type is LONG.

1274

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

SelectedTrend Property
Description
This property brings a trend to the foreground via its name. Write/Read access.

SelectionColoring property
Selection colors for - SelectionColoring
Enables the use of selection colors for cells or rows.
The following settings are available:
Value

Description

Explanation

None

No selection colors for cells and rows.

Cell

Selection color for cell.

Row

Selection color for row.

Cell and row

Selection colors for cell and row.

The attribute can be assigned dynamic properties by means of the name SelectionColoring.
The data type is LONG.

SelectionMode Property
Description
Defines whether and how a message line can be selected.
0 - NoSelection: Prevents the selection of a message. Acknowledgement affects the oldest
pending message.
1 - Cell: Enables the selection of fields in the message line. Acknowledgement affects the
selected message.
2 - Line: Enables the selection of a message line. Acknowledgement affects the selected
message.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1275

VBS Reference
2.4 Properties

SelectionRect property
Selection border- SelectionRect
Enables the use of a selection border for selected cells or rows.
The following settings are available:
Value

Description

Explanation

None

No selection border is drawn for selected cells or rows.

Cell

A selection border is drawn for the selected cell.

Row

A selection border is drawn for the selected row.

The attribute can be assigned dynamic properties by means of the name SelectionRect. The
data type is LONG.

SelectionRectColor property (before WinCC V7)


Description
Specifies the color of the rectangle in the message window if SelectionType equals "1".

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

SelectionRectColor property
Color of the selection border - SelectionRectColor
Specifies the color of the selection border. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name SelectionRectColor.
The data type is LONG.

SelectionRectWidth property (before WinCC V7)


Description
Specifies the line weight of the rectangle in the message window if SelectionType equals "1".

1276

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

SelectionRectWidth property
Line weight of the selection border - SelectionRectWidth
Defines the line weight of the selection border in pixels.
The attribute can be assigned dynamic properties by means of the name SelectionRectWidth.
The data type is LONG.

SelectionType property (before WinCC V7)


Description
Specifies if the selected message in the message window should be optically emphasized by
color change or rectangle.
0 - Color Change: selected message is optically emphasized by color change
1 - Rectangle: selected message is optically emphasized by a rectangle

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

SelectionType property
Selectable rows - SelectionType
Defines the number of lines you can select. The following settings are available:
Value

Description

Explanation

None

No row selection.

Single selection

One row can be selected.

Multiple selection

Multiple rows can be selected.

The attribute can be assigned dynamic properties by means of the name SelectionType. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1277

VBS Reference
2.4 Properties

SelIndex property
Description
Defines and returns the index of which the associated text is highlighted in the combobox or
list box.
The maximum value is the number of lines (NumberLines) of the object.

SelText property
Description
Shows the text defined with the "Selected field" (SelIndex) attribute which is highlighted in the
combobox or list box.

SelTextColor Property
Description
Defines or returns the color of the text of the selected entry in the text list object. LONG writeread access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

ServerData Property
Description
The attribute can only be modified using the "Properties of WinCC Online Trend Control" dialog.
Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

1278

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ServerDataX
ServerDataX
Accesses the configured data connection for the X axis with WinCC FunctionTrendControl.
The attribute can be assigned dynamic properties by means of the name ServerDataX. The
data type is LONG.

Example: Editing the start ID


You may use the ServerDataX attribute to edit the start ID of the X axis.
Prerequisite is that you have an existing trend and trend view, configured X and Y axes, as
well as a data connection to the user archive.
In the following example you employ the GetTrend method to set a reference to the object in
step one, and then to the trend used in step two. Determine the data connection settings in
the third step. Set the start ID to 4 in step 4. The number (3) represents the listing type "user
archive" for data transfer. Change the modified data connection settings in step five:
Sub OnCklick(ByVal Item)
1. Step:
Dim fx_ctrl
Set fx_ctrl

ScreenItems.Item("Control1")

2. Step:
Dim fx_trend
Set fx_trend = fx_ctrl.Getrend("myTrend1")
3. Step:
Dim vServerDataX, vServerDataY
vServerDataX = fx_trend.ServerDataX
vServerDataY = fx_trend.ServerDataY
4. Step:
Dim startId
startId = CLng(4)
vServerDataX(3) = startId
vServerDataY(3) = startId
5. Step:
fx_trend.ServerDataX = ServerDataX
fx_trend.ServerDataY = ServerDataY
End Sub

ServerDataY
ServerDataY
Accesses the configured data connection for the Y axis with WinCC FunctionTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1279

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ServerDataY. The
data type is LONG.

Example: Editing the start ID


You may use the ServerDataY attribute to edit the start ID of the Y axis.
Prerequisite is that you have an existing trend and trend view, configured X and Y axes, as
well as a data connection to the user archive.
In the following example you employ the GetTrend method to set a reference to the object and
then to the trend used. Determine the data connection settings in the third step. Set the start
ID to 4 in step 4. The number (3) represents the listing type "user archive" for data transfer.
Change the modified data connection settings in step five:
Sub OnCklick(ByVal Item)
1. Step:
Dim fx_ctrlSet fx_ctrl

ScreenItems.Item("Control1")

2. Step:
Dim fx_trendSet fx_trend = fx_ctrl.Getrend("myTrend1")
3. Step:
Dim vServerDataX, vServerDataYvServerDataX =
fx_trend.ServerDataXvServerDataY = fx_trend.ServerDataY
4. Step:
Dim startIdstartId = CLng(4)vServerDataX(3) =
startIdvServerDataY(3) = startId
5. Step:
fx_trend.ServerDataX = ServerDataXfx_trend.ServerDataY =
ServerDataY
End Sub

ServerNames property
Server selection - ServerNames
Defines from which servers within a distributed system the message window obtains the
display data.
The attribute can be assigned dynamic properties by means of the name ServerNames. The
data type is STRING.

ServerNames property (before WinCC V7)


Description
Defines the server in a distributed system to which the data in the message window should
relate. Servers are specified as follows: NameServer1;NameServer2;NameServer3. Write/
Read access.

1280

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ServerPrefix Property
Description
Defines the server containing the picture to be displayed in the picture window in Runtime or
returns the server name.
Enter the server name followed by two colons: "<Servername>::". No check is made as to
whether the server actually exists.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

2.4.18.3

Sh - Sk

ShareSpaceWithSourceControl property
ShareSpaceWithSourceControl
Defines whether the size of the source control in the picture window is adapted so that the
WinCC RulerControl is also displayed in a small picture window.
Value

Explanation

TRUE

The source control in the picture window is adapted.

FALSE

The source control in the picture window is not adapted.

The attribute can be assigned dynamic properties by means of the name


ShareSpaceWithSourceControl. The data type is BOOLEAN.

ShowBar Property
Description
TRUE, when the bar should be displayed. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1281

VBS Reference
2.4 Properties

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

ShowDanger Property
Description
Controls the display of the "danger zone" on the instrument scale. BOOLEAN write-read
access.
TRUE : The area is identified by the color defined in "DangerColor".
FALSE : The color identification of the area is switched off.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowDecimalPoint Property
Description
TRUE, when the labeling of the scale section should be with decimal numbers (decimal point
and one decimal place).
FALSE, when the labeling of the scale section should be with whole numbers.
BOOLEAN write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowNormal Property
Description
Controls the display of the "normal zone" on the instrument scale. BOOLEAN write-read
access.
TRUE : The area is identified by the color defined for normal color.
FALSE : The color identification of the area is switched off.

1282

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowPeak Property
Description
Defines the display of a slave pointer to display the maximum value. BOOLEAN write-read
access.
TRUE : The slave pointer is displayed.
FALSE : The slave pointer is hidden.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ShowPosition Property
Description
TRUE, when the slider position is to be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

ShowRuler property
Show ruler - ShowRuler
Enables the display of a ruler for scanning the coordinate points on picture calls.
Value

Explanation

TRUE

Enables the display of a ruler for scanning the coordinate points.

FALSE

Disables the display of a ruler for scanning the coordinate points.

The attribute can be assigned dynamic properties by means of the name ShowRuler. The data
type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1283

VBS Reference
2.4 Properties

ShowRulerImmediately Property
Description
TRUE, when the ruler for determining the coordinate values should be displayed when opening
a picture. BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ShowRulerInAxis property
ShowRulerInAxis
Enables the display of rulers in the time axis.
Value

Explanation

TRUE

Enables the display of rulers in the time axes.

FALSE

Disables the display of rulers in the time axes.

The attribute can be assigned dynamic properties by means of the name ShowRulerInAxis.
The data type is BOOLEAN.

ShowScrollbars property
Scroll bars - ShowScrollbars
Enables the display of scroll bars.
The following settings are available:
Value

Description

Explanation

No

The display of scroll bars is disabled.

as required

Scroll bars are displayed if space requirements of the control are greater than the actual
display area.

always

The scroll bars are always displayed.

The attribute can be assigned dynamic properties by means of the name ShowScrollbars. The
data type is LONG.

1284

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ShowSlider property
ShowSlider
Specifies if a time slider is displayed in the control.
The attribute can be assigned dynamic properties by means of the name ShowSlider. The data
type is BOOLEAN.

ShowSortButton property
Use sorting button - ShowSortButton
Enables the display of a sorting button above the vertical scroll bar. Click this sorting button
to sort the selected column based on the configured sorting criteria. The sorting button is not
displayed if the table does not contain a vertical scroll bar.
Value

Explanation

TRUE

Enables sorting of a selected column by means of sorting button.

FALSE

The sorting button is not displayed.

The attribute can be assigned dynamic properties by means of the name ShowSortButton .
The data type is BOOLEAN.

ShowSortIcon property
Show sorting icon - ShowSortIcon
Enables the display of the sorting icon.
Value

Explanation

TRUE

Enables the display of the sorting icon.

FALSE

Disables the display of the sorting icon.

The attribute can be assigned dynamic properties by means of the name ShowSortIcon. The
data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1285

VBS Reference
2.4 Properties

ShowSortIndex property
Show sorting index - ShowSortIndex
Enables the display of a sorting icon.
Value

Explanation

TRUE

Enables the display of a sorting index.

FALSE

Disables the display of a sorting index.

The attribute can be assigned dynamic properties by means of the name ShowSortIndex. The
data type is BOOLEAN.

ShowSpanNames Property
Description
TRUE, if a section name is also to be displayed in the Value column of Trend Control apart
from the measured value and the status display "i" and "u". BOOLEAN write-read access.

ShowStatisticRuler property
ShowStatisticRuler
Enables the display of rulers in the statistics field on picture calls.
Value

Explanation

TRUE

Enables the display of rulers in the statistics field.

FALSE

Disables the display of rulers in the statistics field.

The attribute can be assigned dynamic properties by means of the name ShowStatisticRuler.
The data type is BOOLEAN.

ShowThumb Property
Description
TRUE, when the slider is to be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

1286

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ShowTitle property
Window title - ShowTitle
Defines representation the Control window header.
Value

Designation

Explanation

No

No window title.

Normal

The window title consists of a WinCC icon and text. The text is entered in the "Text" field.

Narrow

The window title consists only of text. The text is entered in the "Text" field.

The attribute can be assigned dynamic properties by means of the name ShowTitle. The data
type is LONG.

ShowToolbar property
ShowToolbar
Specifies if a toolbar is displayed in the control.
The attribute can be assigned dynamic properties by means of the name ShowToolbar. The
data type is BOOLEAN.

ShowTrendIcon property
ShowTrendIcon
Enables the display of an icon below the value axes. The icon indicates the trend currently
displayed in the foreground.
The attribute can be assigned dynamic properties by means of the name ShowTrendIcon. The
data type is BOOLEAN.

ShowValuesExponentialX Property
Description
TRUE, when the X-coordinate of a measured value determined via the "Display value at this
position" function is displayed in exponential notation by a trend referenced via "Index".
Whether the information is evaluated is dependent on the value of the "TimeAxisX" property.
BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1287

VBS Reference
2.4 Properties

ShowValuesExponentialY Property
Description
TRUE, when the Y-coordinate of a measured value determined via the "Display value at this
position" function is displayed in exponential notation by a trend referenced via "Index".
BOOLEAN write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ShowWarning Property
Description
Controls the display of the "warning zone" on the instrument scale. BOOLEAN write-read
access.
TRUE : The area is identified by the color defined by the warning color attribute.
FALSE : The color identification of the area is switched off.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

SignificantMask Property
Description
Is required in Runtime to display the active message class with the highest priority.
The value of the SignificantMask property represents an internal system output value does not
require any specific configuration by the user. Updating is initiated in Runtime by clicking on
the object.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

1288

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Sizeable property
Sizeable
Enables resizing of the control during runtime.
Value

Explanation

TRUE

The control can be resized during runtime.

FALSE

The control cannot be resized during runtime.

The attribute can be assigned dynamic properties by means of the name Sizeable. The data
type is BOOLEAN.

SkinName property
Style - SkinName
The control style can be defined in this selection field.
The following settings are available:
Value
0
1

Designation

Explanation

Project setting

The style corresponds to the project settings in WinCC Explorer.

Simple

"Classic" WinCC style

Standard

New WinCC V7 style

Basic Process Control

The style is reserved for internal use with Basic Process Control.

The attribute can be assigned dynamic properties by means of the name SkinName. The data
type is STRING.

2.4.18.4

Sm - Sq

SmallChange Property
Description
Defines how many steps the controller can be moved with one mouse click or returns the value.

See also
Slider (Page 226)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1289

VBS Reference
2.4 Properties

SmartTag property
Description
Returns an object of type "SmartTag".

See also
SmartTags Object (Page 151)

SortOrder Property
Description
Defines the sort sequence of the message blocks in the message window.

SortSequence property
Sorting order by mouse click - SortSequence
Specifies how to change the sorting order by mouse click.
The following sorting orders are available:
Value

Description

Explanation

Up/down/none

You can toggle between ascending, descending and no sorting by means of mouse click.

Up/down

You can toggle between ascending and descending sorting order by means of mouse click.

The attribute can be assigned dynamic properties by means of the name SortSequence. The
data type is LONG.

SourceBeginTime Property
Description
In the case of online tags and archive tags ("ProviderType" = -1), it defines the starting time
of the time range of a trend referenced via "Index" and to be displayed in the trend window. In
the case of modification of "SourceBeginTime", impermissible combinations with other
attributes for data connection could be created. Therefore, before modifying
"SourceBeginTime", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

1290

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

SourceControl property
Source - SourceControl
Defines the control to be interconnected with WinCC RulerControl.
The attribute can be assigned dynamic properties by means of the name SourceControl. The
data type is STRING.

SouceControlType property
Type - SourceControlType
Defines the type of control that is interconnected with the WinCC RulerControl in the "Source"
field.
Value

Designation

Explanation

None

The RulerControl is not connected to any source.

OnlineTrend
Control

The RulerControl is connected with an OnlineTrendControl.

OnlineTable
Control

The RulerControl is connected with an OnlineTableControl.

FunctionTrend
Control

The RulerControl is connected with a FunctionTrendControl.

The attribute can be assigned dynamic properties by means of the name SourceControlType.
The data type is LONG.

SourceEndTime Property
Description
In the case of online tags and archive tags ("ProviderType" = -1), it defines the stopping time
of the time range of a trend referenced via "Index" and to be displayed in the trend window. In
the case of modification of "SourceEndTime", impermissible combinations with other attributes
for data connection could be created. Therefore, before modifying "SourceEndTime", the
immediate acceptance of the changes must be prevented using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1291

VBS Reference
2.4 Properties

SourceNumberOfUAValues Property
Description
For values from the user archives ("ProviderType" = -2) it defines the number of values which
should be loaded from the user archive for a trend referenced via "Index". In the case of
modification of "SourceNumberOfUAValues", impermissible combinations with other attributes
for data connection could be created. Therefore, before modifying
"SourceNumberOfUAValues", the immediate acceptance of the changes must be prevented
using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceNumberOfValues Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1), "SourceNumberOfValues" defines the number of values which should
be displayed in the trend window. Whether the information is evaluated is dependent on the
value of the "SourceTimeRange" property.
In the case of modification of "SourceNumberOfValues", impermissible combinations with
other attributes for data connection could be created. Therefore, before modifying
"SourceNumberOfValues", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagNameX Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1) "SourceTagNameX" defines the tag which should be displayed along
the X-axis. In the case of modification of "SourceTagNameX", impermissible combinations with
other attributes for data connection could be created. Therefore, before modifying
"SourceTagNameX", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

1292

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagNameY Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1) "SourceTagNameY" defines the tag which should be displayed along
the X-axis. In the case of modification of "SourceTagNameY", impermissible combinations with
other attributes for data connection could be created. Therefore, before modifying
"SourceTagNameY", the immediate acceptance of the changes must be prevented using
"FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagProviderDataX Property
Description
The attribute can only be modified using the "Properties of WinCC Function Trend Control"
dialog.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceTagProviderDataY Property
Description
The attribute can only be modified using the "Properties of WinCC Function Trend Control"
dialog.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1293

VBS Reference
2.4 Properties

SourceTimeRange Property
Description
The "Index" property references a trend. In the case of online tags and archive tags
("ProviderType" = -1) "SourceTimeRange" defines how the time range to be displayed in the
trend window is defined. In the case of modification of "SourceTimeRange", impermissible
combinations with other attributes for data connection could be created. Therefore, before
modifying "SourceTimeRange", the immediate acceptance of the changes must be prevented
using "FreezeProviderConnections".
0: The time range to be displayed is defined by the starting time (SourceBeginTime) and the
number of value pairs (SourceNumberOfValues).
-1: The time range to be displayed is defined by the starting time (SourceBeginTime) and
stopping time (SourceEndTime).

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAArchive Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAArchive" defines the user archive from which the values
should be loaded. In the case of modification of "SourceUAArchive", impermissible
combinations with other attributes for data connection could be created. Therefore, before
modifying "SourceUAArchive" the immediate acceptance of the changes must be prevented
using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAArchiveStartID Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAArchiveStartID" defines the data record from which the
values should be loaded from the user archive. In the case of modification of
"SourceUAArchiveStartID", impermissible combinations with other attributes for data
connection could be created. Therefore, before modifying "SourceUAArchiveStartID", the
immediate acceptance of the changes must be prevented using "FreezeProviderConnections".

1294

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAColumnX Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAColumnX" defines the column in the user archive from which
the values for the X-axis should be loaded. In the case of modification of "SourceUAColumnX",
impermissible combinations with other attributes for data connection could be created.
Therefore, before modifying "SourceUAColumnX", the immediate acceptance of the changes
must be prevented using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SourceUAColumnY Property
Description
The "Index" property references a trend. In the case of values from the user archives
("ProviderType" = -2), "SourceUAColumnY" defines the column in the user archive from which
the values for the Y-axis should be loaded. In the case of modification of "SourceUAColumnY",
impermissible combinations with other attributes for data connection could be created.
Therefore, before modifying "SourceUAColumnY", the immediate acceptance of the changes
must be prevented using "FreezeProviderConnections".

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

SquareExtent Property
Description
TRUE, when the size of the clock should be adjustable to any side ratio by dragging the marking
points with the mouse. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1295

VBS Reference
2.4 Properties

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

2.4.18.5

St - Sy

StartAngle Property
Description
Defines or returns the start of the object. The information is in counterclockwise direction in
degrees, beginning at the 12:00 clock position.

See also
Pie segment (Page 167)
Circular arc (Page 166)
Ellipse segment (Page 162)
Ellipse arc (Page 161)
ScreenItem Object (Page 141)

State property
Description
Returns the status of a message.
The following table shows the possible states of a message:
State

Alarm Log Status

Came In

Went Out

Came in and comment

Gone and comment

See also
Alarms object (list) (Page 126)

1296

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Statusbar Property
Description
TRUE, when the status line is to be displayed. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

StatusbarBackColor property
Background color - StatusbarBackColor
Defines the background color of the status bar. The button opens the "Color selection" dialog
to select the color.
For the setting to become active, the "Display" or "StatusbarUseBackColor" option must be
activated.
The attribute can be assigned dynamic properties by means of the name
StatusbarBackColor. The data type is LONG.

StatusbarElementAdd property
New - StatusbarElementAdd
Defines a new, user-defined status bar element. The name set by WinCC can be edited in the
"Object name" field.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementAdd . The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1297

VBS Reference
2.4 Properties

StatusbarElementAutoSize property
Automatic - StatusbarElementAutoSize
Enables autosizing of the width of a status bar element selected.
Value

Explanation

TRUE

The width of the selected element is set automatically.

FALSE

The width of the selected element is not set automatically.

The attribute can be assigned dynamic properties by means of the name


StatusbarElementAutoSize. The data type is BOOLEAN.

StatusbarElementCount property
StatusbarElementCount
Defines the number of configurable status bar elements.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementCount. The data type is LONG.

StatusbarElementIconId property
StatusbarElementIconId
Default assignment of the ID number and icon of a status bar element.
The attribute for custom status bar elements can be made assigned dynamic properties by
measn of the name StatusbarElementIconId. The data type is LONG.

StatusbarElementID property
Object ID - StatusbarElementID
Unique ID of the status bar element selected. WinCC assigns this read only ID number.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementID. The data type is LONG.

StatusbarElementIndex property
StatusbarElementIndex
References a status bar element. Using this attribute you can assign the values of other
attributes to a specific status bar element.

1298

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Values between 0 and "StatusbarElementCount" minus 1 are valid for
"StatusbarElementIndex". Attribute "StatusbarElementCount" defines the number of
configurable status bar elements.
The "StatusbarElementIndex" attribute can be assigned dynamic properties by means of
attribute StatusbarElementIndex. The data type is LONG.

StatusbarElementName property
Object name - StatusbarElementName
Displays the object name of the status bar element selected. You can rename the objects of
custom status bar elements.
The "StatusbarElementName" attribute can be assigned dynamic properties by means of
attribute StatusbarElementRename. The data type is STRING.

StatusbarElementRemove property
Remove - StatusbarElementRemove
Removes the selected status bar element. You can only remove user-defined status bar
element from the list.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementRemove. The data type is STRING.

StatusbarElementRename property
StatusbarElementRename
Renames a custom status bar element which is referenced by means of
"StatusbarElementIndex" attribute.
The attribute for custom elements can be assigned dynamic properties by means of the name
StatusbarElementRename. "StatusbarElementRename" also sets a dynamic attribute
"StatusbarElementName". The data type is STRING.

StatusbarElementRepos property
Up/Down - StatusbarElementRepos
Changes the sorting order of button functions. "Up" and "Down" moves the selected status bar
element up or down in the list. This moves the status bar element of the Control towards the
front or towards the back in Runtime.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementRepos . The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1299

VBS Reference
2.4 Properties

StatusbarElementText property
StatusbarElementText
Defines the text to be displayed for the status bar element. You can edit the
"StatusbarElementText" attribute for custom elements.
The attribute for custom elements can be assigned dynamic properties by means of the name
StatusbarElementText. The data type is STRING.

StatusbarElementTooltipText property
StatusbarElementTooltipText
Defines the tooltip text for the custom status bar element.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementTooltipText. The data type is STRING.

StatusbarElementVisible property
Status bar elements - StatusbarElementVisible
Activate the elements in the list of status bar elements for their display in Runtime.
Click a list entry to adapt the properties, or to change its position in the status bar of the Control
by means of the "Up" and "Down" buttons.
Value

Explanation

TRUE

The status bar element is displayed.

FALSE

The status bar element is not displayed.

The attribute can be assigned dynamic properties by means of the name


StatusbarElementVisible. The data type is BOOLEAN.

StatusbarElementUserDefined property
StatusbarElementUserDefined
Indicates whether the project engineer has added the status bar element as a new custom
element.
Value

Explanation

TRUE

The status bar element is user-defined.

FALSE

The status bar element is defined by the system.

1300

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
StatusbarElementUserDefined. The data type is BOOLEAN.

StatusbarElementWidth property
Width in pixels - StatusbarElementWidth
Shows the width of the status bar element selected in pixels. You can define the width if the
"Automatic" option is not activated.
The attribute can be assigned dynamic properties by means of the name
StatusbarElementWidth. The data type is LONG.

StatusbarFontColor property
Font color - StatusbarFontColor
Defines the color of the text in the status bar.
The attribute can be assigned dynamic properties by means of the name StatusbarFontColor.
The data type is LONG.

StatusbarPanes Property
Description
Defines the elements to be displayed in the status bar. Write/Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

StatusbarShowTooltips property
Tooltips - StatusbarShowTooltips
Enables the display of tooltips for the status bar elements in Runtime.
Value

Explanation

TRUE

Enables the display of tooltips.

FALSE

Disables the display of tooltips.

The attribute can be assigned dynamic properties by means of the name


StatusbarShowTooltips. The data type is BOOLEAN.
Attribute "StatusbarElementTooltipText" defines the tooltip text.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1301

VBS Reference
2.4 Properties

StatusbarText property
StatusbarText
Default text in the status bar.
The attribute can be assigned dynamic properties by means of the name StatusbarText. The
data type is STRING.

StatusbarUseBackColor property
Display background color - StatusbarUseBackColor
Sets a background color for the status bar.
Value

Explanation

TRUE

Enables the display of the background color of the status bar.

FALSE

Disables the display of a background color for the status bar.

The attribute can be assigned dynamic properties by means of the name


StatusbarUseBackColor. The data type is BOOLEAN.

StatusbarVisible property
Show status bar - StatusbarVisible
Enables the display of the status bar of a control.
Value

Explanation

TRUE

Enables the display of a status bar.

FALSE

Disables the display of a status bar.

The attribute can be assigned dynamic properties by means of the name StatusbarVisible .
The data type is BOOLEAN.

StepSeconds property
StepSeconds
Specifies the interval for step forward or step backward in movies.
The attribute can be assigned dynamic properties by means of the name StepSeconds. The
data type is LONG.

1302

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Stretch Property
Description
Defines whether the side ratio is retained or adjustable on changing the icon size. BOOLEAN
write-read access.
FALSE : The side ratio is retained on changing the icon size.
TRUE : The side ratio of the icon can be adjusted parallel to changing the icon size.

See also
HMI Symbol Library (Page 253)
ScreenItem Object (Page 141)

SymbolAppearance property
Foreground mode (SymbolAppearance)
Specifies the appearance of the icon.
The following settings are available:
Value

Description

Comments

Original

The appearance of the icon corresponds to the multi-color representation in the


selection of the "Icons" tab.

Shadow

"Black" lines are maintained as contour lines. Elements of the symbols in other
colors are displayed as brightness grades of the current foreground color.

Solid

"Black" lines are maintained as contour lines. All icon elements of other colors are
assigned the color value of the current foreground color.

Outline

Lines of the color "Black" are maintained as contour lines. All the elements of the
symbol in other colors are assigned the color value of the current background color.

The attribute can be assigned dynamic properties by means of the name SymbolAppearance.
The data type is LONG.

2.4.19

2.4.19.1

Ta -Tic

TableColor property
Row background color 1 - TableColor
Defines the background color of the rows. The button opens the "Color selection" dialog.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1303

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name TableColor. The data
type is LONG.

TableColor2 property
Row background color 2 - TableColor2
Specifies the background color of "Row color 2". The button opens the "Color selection" dialog.
The setting is only active in Runtime if the "Row color 2" or "UseTableColor2" option is
activated. The background colors of "Row color 2" and "Row color 1" are used alternately in
this case.
The attribute can be assigned dynamic properties by means of the name TableColor2. The
data type is LONG.

TableFocusOnButtonCommand Property
Description
Defines whether the focus is set to the table of the control when a button in a script is clicked.

TableForeColor property
Row font color 1 - TableForeColor
Specifies the font color of the rows. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name TableForeColor. The
data type is LONG.

TableForeColor2 property
Row font color 2 - TableForeColor2
Specifies the font color of "Row color 2". The button opens the "Color selection" dialog.
The setting is only active in Runtime if the "Row color 2" or "UseTableColor2" option is
activated. The font colors of "Row color 2" and "Row color 1" are used alternately in this case.
The attribute can be assigned dynamic properties by means of the name TableForeColor2.
The data type is LONG.

1304

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TagName Property
Description
The "Index" property references a trend. "TagName" defines the tag linked to this trend. It is
specified in the form "Archivname\Variablenname" to display tags in a process value archive
or "TasgName" to display an internal or external tag which is not stored in an archive.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

TagPrefix Property
Description
Defines or returns the tag prefix which is prefixed to all tags contained in the picture window
object. In this way, a picture that is embedded in a picture window retains access to its own
tags while another accesses other tags.
Modification of the TagPrefix takes effect when a picture is reloaded. When a picture is
changed, this occurs automatically, otherwise the picture name must be reassigned.
The tag prefix can be freely defined, but must match the name of the structure tags.
Note
The TagPrefix property is not available for the controls.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

Tags Property
Description
Returns an object of type "Tags".
Tags (read only)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1305

VBS Reference
2.4 Properties

Example:
The following example accesses the tag "Tag1":

'VBS86
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")

See also
Tags Object (List) (Page 155)
HMIRuntime Object (Page 134)

TagProviderClsid Property
Description
The "Index" property references a trend. "TagProviderClsid" defines whether this trend should
display an online tag or archived value. The data is only evaluated for online tags and archive
tags ("ProviderType" = -1).
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: Online tag.
{416A09D2-8B5A-11D2-8B81-006097A45D48}: Values are read from a process value archive
or a user archive.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

Template Property
Description
Returns the template for displaying the window content of the "Application Window" object.
Read only access.
The following templates are possible depending on the property value:
Window Contents = Global Script
"GSC diagnostics"
The application window is supplied by applications of the Global Script. The results of the
diagnosis system are displayed.
"GSC Runtime"
The application window is supplied by applications of the Global Script. The analysis results
regarding characteristics in Runtime are displayed.

1306

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Window Contents = Print Jobs
"All Jobs":
The application window is supplied by the logging system. The available reports are displayed
as a list.
"All Jobs - Context Menu":
The application window is supplied by the logging system. The available reports are displayed
as a list. The shortcut menu enables the selection of print options, display of a print preview
as well as a printout of the log.
"Job Detail View":
The application window is supplied by the logging system. The available reports are displayed
in a selection menu. Detailed information is displayed for the selected report.
"Selected Jobs - Context Menu":
The application window is supplied by the logging system. The available reports are displayed
as a list. This list only contains reports which you have activated the option "Mark for print job
list" in the "Print Job Properties" dialog. The shortcut menu enables the selection of print
options, display of a print preview as well as a printout of the log.

See also
ScreenItem Object (Page 141)
Application Window (Page 188)

Text Property
Description
Defines or returns the labeling for an object.

See also
Radio box (Page 221)
Check box (Page 219)
Button (Page 215)
Static text (Page 180)
ScreenItem Object (Page 141)

ThumbBackColor Property
Description
Defines the color of the slider.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1307

VBS Reference
2.4 Properties

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

TicColor Property
Description
Defines the color of the scale tick marks. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicFont Property
Description
Controls the display of the scale division labeling. Read only access.
The following properties can be set:
- Font
- Font Style
- Font Size
- "Strikethrough" effect
- "Underline" effect

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicOffset Property
Description
Defines the diameter of the imaginary circle on which the scale graduation is set. The value is
related to the smaller value of the geometric properties Width and Height.
The ends of the main tick marks of the scale graduation point outwards onto this circle.
Value range from 0 to 1.

1308

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
0: The scale division is in the middle of the graduated scale disk.
1: The diameter of the imaginary circle for the scale tick marks is the smaller value of the
geometric properties Width and Height.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicTextColor Property
Description
Defines the color of the labeling of the scale tick marks.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicTextOffset Property
Description
Defines the diameter of the imaginary circle on which the labeling of the scale tick marks is
set. The value is related to the smaller value of the geometric properties Width and Height.
Value range from 0 to 1.
0: The label is in the middle of the graduated scale disk.
1: The diameter of the imaginary circle for the label is the smaller value of the geometric
properties Width and Height. As a result, part of the label can lie outside the object limits and
is, thus, invisible.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

TicWidth Property
Description
Defines the length of the long tick marks for the scaling. The value is related to the half the
smaller value of the geometric properties Width and Height.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1309

VBS Reference
2.4 Properties
The length of the tick marks for fine scaling is 0.5*scale width.
Value range from 0 to end of scale.
0: No scale graduation is available. The division of the scale into ranges is not visible.
Scaling distance: The scaling division ranges from the middle point of the graduated scale disk
to the value defined by the scaling distance.

See also
ScreenItem Object (Page 141)
WinCC Gauge Control (Page 264)

Ticks Property
Description
TRUE, when the numbered face is displayed. BOOLEAN write-read access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

TicksColor Property
Description
Defines or returns the color of the hour markings on the face of the analog clock. LONG writeread access.

See also
WinCC Digital/Analog Clock (Page 258)
ScreenItem Object (Page 141)

TickStyle Property
Description
This attribute defines the appearance of the scale. Value Range: 0 to 3.
As a result of the automatic scaling, it is possible that, occasionally, two scale tick marks lie
directly beside each other (apparently wide tick mark). This effect can be corrected by minimally
lengthening or shortening the slider object.

1310

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
It is also possible to completely suppress display of the scaling ("WithAxes").

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

2.4.19.2

TimeAxis - TimeBase

TimeAxis Property
Description
Defines whether a common time axis should be used for all trends in the trend window.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

TimeAxisActualize property
Refresh - TimeAxisActualize
Enables refreshing of the time axis selected.
Value

Explanation

TRUE

Enables updates of the trend window which is assigned to the time axis.

FALSE

Disables updates of the trend window which is assigned to the time axis. This setting can
be useful when comparing a logged trend with a current trend.

The attribute can be assigned dynamic properties by means of the name TimeAxisActualize.
The data type is BOOLEAN.

TimeAxisAdd property
New - TimeAxisAdd
Creates a new time axis.
The attribute can be assigned dynamic properties by means of the name TimeAxisAdd. The
data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1311

VBS Reference
2.4 Properties

TimeAxisAlign property
Alignment - TimeAxisAlign
Specifies the mode of alignment of a selected time axis.
The following settings are available:
Value

Description

Explanation

Bottom

The time axis selected is displayed below the trend.

Top

The time axis selected is displayed above the trend.

The attribute can be assigned dynamic properties by means of the name TimeAxisAlign. The
data type is LONG.

TimeAxisBeginTime property
Start time - TimeAxisBeginTime
Defines the start of the time range for a selected time axis.
The attribute can be assigned dynamic properties by means of the name
TimeAxisBeginTime. The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

TimeAxisColor property
Time axis color - TimeAxisColor
Specifies the color of the time axis. The button opens the "Color selection" dialog to select the
color.
The setting is only active if the "Use trend color" option is not activated or if
"TimeAxisInTrendColor" is "FALSE".
The attribute can be assigned dynamic properties by means of the name TimeAxisColor. The
data type is LONG.

TimeAxisCount property
TimeAxisCount
Defines the number of time axes configured.
The attribute can be assigned dynamic properties by means of the name TimeAxisCount. The
data type is LONG.

1312

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeAxisDateFormat property
Date format - TimeAxisDateFormat
Defines the date format for visualizing a selected time axis.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name


TimeAxisDateFormat. The data type is STRING.

TimeAxisEndTime property
End time - TimeAxisEndTime
Defines the end of the time range of a selected time axis.
The attribute can be assigned dynamic properties by means of the name TimeAxisEndTime.
The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

TimeAxisFormat Property
Description
Defines the format of the information along the time axis.
0: The information is provided in hh:mm
-1: The information is provided in hh:mm:ss
-2: The information is provided in hh:mm:ss.ms
-3: The information is provided in hh:mm (full hours)
-4: The information is provided in hh:mm:ss (full minutes)
-5: The information is provided in hh:mm:ss.ms (full seconds)

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1313

VBS Reference
2.4 Properties

TimeAxisIndex property
TimeAxisIndex
References a configured time axis. Using this attribute you can assign the values of other
attributes to a specific time axis.
Values between 0 and "TimeAxisCount" minus 1 are valid for "TimeAxisIndex". Attribute
"TimeAxisCount" defines the number of trends configured.
The "TimeAxisIndex" attribute can be assigned dynamic properties by means of attribute
TimeAxisRepos. The data type is LONG.

TimeAxisInTrendColor property
Use trend color - TrendAxisInTrendColor
Sets a trend color for displaying the time axis selected. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The trend color is used to display the time axis selected. The setting in the "Color" or
"TimeAxisColor" field is disabled.

FALSE

The time axis selected is displayed in the color set in the "Color" or "TimeAxisColor" field.

The attribute can be assigned dynamic properties by means of the name


TimeAxisInTrendColor. The data type is BOOLEAN.

TimeAxisLabel property
Label - TimeAxisLabel
Defines the label text for a time axis.
The attribute can be assigned dynamic properties by means of the name TimeAxisLabel. The
data type is STRING.

TimeAxisMeasurePoints property
Number of measurement points - TimeAxisMeasurePoints
Defines the number of measurement points to be displayed at the time axis selected.
The attribute can be assigned dynamic properties by means of the name
TimeAxisMeasurePoints. The data type is LONG.

1314

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeAxisName property
Object name - TimeAxisName
Specifies the name of a selected time axis.
The "TimeAxisName" attribute can be assigned dynamic properties by means of attribute
TimeAxisRename. The data type is STRING.

TimeAxisRangeType property
Time range setting - TimeAxisRangeType
Specifies the time range for the time axis selected.
Value

Description

Explanation

Time range

Defines the start time and the time range for the time axis.

Start to end time

Defines the start and end time for the time axis.

Number of measurement
points

Defines the start time and the number of measurement points


for the time axis.

The attribute can be assigned dynamic properties by means of the name


TimeAxisRangeType. The data type is LONG.

TimeAxisRemove property
Remove - TimeAxisRemove
Removes the selected time axis from the list.
The attribute can be assigned dynamic properties by means of the name TimeAxisRemove.
The data type is STRING.

TimeAxisRename property
TimeAxisRename
Renames a time axis which is referenced by means of "TimeAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name TimeAxisRename.
"TimeAxisRename" also sets a dynamic attribute "TimeAxisName". The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1315

VBS Reference
2.4 Properties

TimeAxisRepos property
Up/Down - TimeAxisRepos
Changes the order of the time axes. "Up" and "Down" move the selected time axis up or down
in the list.
The list order determines the time axis position in the trend window. The time axis is moved
away from the trend if the listing is the same and the time axis is further up in the list.
The attribute can be assigned dynamic properties by means of the name TimeAxisRepos. The
data type is LONG.

TimeAxisShowDate property
Show date - TimeAxisShowDate
Enables the display of the date and time at the time axis selected.
Value

Explanation

TRUE

Date and time are displayed. The date format is defined in the "Date format" field.

FALSE

The date is not displayed. Only the time is displayed.

The attribute can be assigned dynamic properties by means of the name TimeAxisShowDate.
The data type is BOOLEAN.

TimeAxisTimeFormat property
Time format - TimeAxisTimeFormat
Defines the time format for visualizing a selected time axis.
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

hh:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name


TimeAxisTimeFormat. The data type is STRING.

1316

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeAxisTimeRangeBase property
Time range - TimeAxisTimeRangeBase
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

500

500 ms

1000

1 second

60000

1 minute

3600000

1 hour

86400000

1 day

The attribute can be assigned dynamic properties by means of the name


TimeAxisTimeRangeBase. The data type is LONG.

TimeAxisTimeRangeFactor property
Time range - TimeAxisTimeRangeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
TimeAxisTimeRangeFactor. The data type is SHORT.

TimeAxisTrendWindow property
Trend window - TimeAxisTrendWindow
Specifies the trend window for displaying the time axis selected. Define the available trend
windows in the "Trend window" or "TrendWindowAdd" tab.
The attribute can be assigned dynamic properties by means of the name
TimeAxisTrendWindow. The data type is STRING.

TImeAxisVisible property
Time axis - TimeAxisVisible
The list shows all time axes you created. Click a time axis entry in the list to adapt the properties
and to assign the time axis to a trend window.
Activate the time axes to be displayed in the trend window in the list.
Defines whether the selected time axis is displayed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1317

VBS Reference
2.4 Properties
Value

Explanation

TRUE

The time axis is displayed.

FALSE

The time axis is not displayed.

The attribute can be assigned dynamic properties by means of the name TimeAxisVisible. The
data type is BOOLEAN.

TimeAxisX Property
Description
TRUE, when a common axis should be used for all trends in the trend window. BOOLEAN
write-read access.

See also
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

TimeBase property
Time base - TimeBase
This selection field is used to define the time base for the time stamp in the control.
Value

Designation

Local time zone

Coordinated Universal Time (UTC)

Project setting

The attribute can be assigned dynamic properties by means of the name TimeBase. The data
type is LONG.

1318

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.19.3

TimeColumn

TimeColumnActualize property
TimeColumnActualize
Enables the update of values in the selected column.
Value

Explanation

TRUE

The time column is updated.

FALSE

The time column is not updated. This setting can be useful when comparing tables.

The attribute can be assigned dynamic properties by means of the name


TimeColumnActualize. The data type is BOOLEAN.

TimeColumnAdd property
New - TimeColumnAdd
Creates a new time column.
The attribute can be assigned dynamic properties by means of the name TimeColumnAdd.
The data type is STRING.

TimeColumnAlign property
Alignment - TimeColumnAlign
Defines the mode of alignment of the time column selected.
The following settings are available:
Value

Description

Explanation

left

The time column selected is displayed on the left.

Centered

The time column selected is aligned to center.

right

The time column selected is displayed on the right.

The attribute can be assigned dynamic properties by means of the name TimeColumnAlign.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1319

VBS Reference
2.4 Properties

TimeColumnAlignment Property
Description
The "Index" property references a pair of columns. "TimeColumnAlignment" defines the
alignment of the time column for this column pair.
0: Time values are entered aligned left.
1: Time values are entered centered.
2: Time values are entered aligned right.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeColumnBackColor property
Background color - TimeColumnBackColor
Specifies the background color of the time column selected. Use the button to open the "Color
selection" dialog.
The setting is useful if:
The "Use value column colors" option is not activated or
"TimeColumnUseValueColumnColors" is "FALSE".
The "Background color" option is activated or "UseColumnBackColor" is "TRUE in the "Use
column color" field of the "General" tab".
The attribute can be assigned dynamic properties by means of the name
TimeColumnBackColor. The data type is LONG.

TimeColumnBeginTime property
Start time - TimeColumnBeginTime
Defines the start of the time range for a selected time column.
The attribute can be assigned dynamic properties by means of the name
TimeColumnBeginTime. The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

1320

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeColumnCaption property
Caption - TimeColumnCaption
Defines the caption of the time column.
The attribute can be assigned dynamic properties by means of the name
TimeColumnCaption. The data type is STRING.

TimeColumnCount property
TimeColumnCount
Defines the number of time columns configured.
The attribute can be assigned dynamic properties by means of the name TimeColumnCount.
The data type is LONG.

TimeColumnDateFormat property
Date format - TimeColumnDateFormat
Defines the date format for visualizing a selected time column.
The following date formats are available:
Value

Explanation

Automatic

The date format is set automatically.

dd.MM.yy

Day.Month.Year, e.g. 24.12.07.

dd.MM.yyyy

Day.Month.Year, e.g. 24.12.2007.

dd/MM/yy

Day/Month/Year, e.g. 24/12/07.

dd/MM/yyyy

Day/Month/Year, e.g. 24/12/2007.

The attribute can be assigned dynamic properties by means of the name


TimeColumnDateFormat. The data type is STRING.

TimeColumnEndTime property
End time - TimeColumnEndTime
Defines the end of the time range of a selected time column.
The attribute can be assigned dynamic properties by means of the name
TimeColumnEndTime. The data type is Date.
Use the "yyyy-mm-dd hh:mm:ss" format when setting a dynamic time range.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1321

VBS Reference
2.4 Properties

TimeColumnForeColor property
Font color - TimeColumnForeColor
Specifies the font color of the time column selected. Use the button to open the "Color selection"
dialog.
The setting is useful if:
The "Use value column colors" option is not activated or
"TimeColumnUseValueColumnColors" is "FALSE".
The "Font color" option is activated or "UseColumnForeColor" is "TRUE" in the "Use column
color" field of the "General" tab.
The attribute can be assigned dynamic properties by means of the name
TimeColumnForeColor. The data type is LONG.

TimeColumnHideText property
TimeColumnHideText
Sets text format for displaying the content of a time column.
Value

Explanation

TRUE

The content is not displayed in text format.

FALSE

The content is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


TimeColumnHideText. The data type is BOOLEAN.

TimeColumnHideTitleText property
TimeColumnHideTitleText
Sets text format for displaying the time column header.
Value

Explanation

TRUE

The header is not displayed in text format.

FALSE

The header is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


TimeColumnHideTitleText. The data type is BOOLEAN.

1322

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeColumnIndex property
TimeColumnIndex
References a configured time column. Using this attribute you can assign the values of other
attributes to a specific time column.
Values between 0 and "TimeColumnCount" minus 1 are valid for "TimeColumnIndex". Attribute
"TimeColumnCount" defines the number of time columns configured.
The "TimeColumnIndex" attribute can be assigned dynamic properties by means of attribute
TimeColumnRepos. The data type is LONG.

TimeColumnLength property
Length in characters - TimeColumnLength
Specifies the width of a selected time column.
The attribute can be assigned dynamic properties by means of the name TimeColumnLength.
The data type is LONG.

TimeColumnMeasurePoints property
Number of measurement points - TimeColumnMeasurePoints
Defines the number of measurement points to be displayed in the time column selected.
The attribute can be assigned dynamic properties by means of the name
TimeColumnMeasurePoints. The data type is LONG.

TimeColumnName property
Object name - TimeColumnName
Specifies the name of a selected time column.
The "TimeColumnName" attribute can be assigned dynamic properties by means of attribute
TimeColumnRename. The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1323

VBS Reference
2.4 Properties

TimeColumnRangeType property
Time range setting - TimeColumnRangeType
Defines the time range setting for the time column selected.
Value

Description

Explanation

Time range

Defines the start time and time range of the time column.

Start to end time

Defines the start and end time for the time column.

Number of measurement points

Defines the start time and the number of measurement points for the time
column.

The attribute can be assigned dynamic properties by means of the name


TimeColumnRangeType. The data type is LONG.

TimeColumnRemove property
Remove - TimeColumnRemove
Removes the selected time column from the list.
The attribute can be assigned dynamic properties by means of the name
TimeColumnRemove. The data type is STRING.

TimeColumnRename property
TimeColumnRename
Renames a time column which is referenced by means of "TimeColumnIndex" attribute.
The attribute can be assigned dynamic properties by means of the name
TimeColumnRename. "TimeColumnRename" also sets a dynamic attribute
"TimeColumnName". The data type is STRING.

TimeColumnRepos property
Up/Down - TimeColumnRepos
Repositions the order of time columns and of corresponding value columns. "Up" and "Down"
move the time column selected up or down in the list. This moves the time column and
corresponding value columns in the table towards the front or towards the back.
The attribute can be assigned dynamic properties by means of the name TimeColumnRepos.
The data type is LONG.

1324

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeColumnShowDate property
Show date - TimeColumnShowDate
Enables the display of the date and time in the time column selected.
Value

Explanation

TRUE

Date and time are displayed. The date format is defined in the "Date format" field or by using
"TimeColumnDateFormat".

FALSE

The date is not displayed. Only the time is displayed.

The attribute can be assigned dynamic properties by means of the name


TimeColumnShowDate. The data type is BOOLEAN.

TimeColumnShowIcon property
TimeColumnShowIcon
Enables the display of time column contents as icon. This function is only available in WinCC
Alarm Control.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name


TimeColumnShowIcon. The data type is BOOLEAN.

TimeColumnShowTitleIcon property
TimeColumnShowTitleIcon
Enables display of the time column header as icon. This function is only available in WinCC
Alarm Control.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


TimeColumnShowTitleIcon. The data type is BOOLEAN.

TimeColumnSort property
TimeColumnSort
Defines the sorting order of the time column referenced in "TimeColumnIndex" .
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1325

VBS Reference
2.4 Properties
Value

Description

Explanation

No

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name TimeColumnSort .
The data type is LONG.

TimeColumnSortIndex property
TimeColumnSortIndex
Defines the sorting order of the time column referenced in "TimeColumnIndex". The sorting
criterion is removed from "TimeColumnSort" if you set a "0" value..
The attribute can be assigned dynamic properties by means of the name
TimeColumnSortIndex. The data type is LONG.

TimeColumnTimeFormat property
Time format - TimeColumnTimeFormat
Defines the time format for visualizing a selected time column.
The following time formats are available:
Value

Explanation

Automatic

The time format is set automatically.

HH:mm:ss.ms

Hours:Minutes:Seconds, e.g. 15:35:44.240.

hh:mm:ss tt

Hours:Minutes:Seconds AM/PM, e.g. 03:35:44 PM.

hh:mm:ss.ms tt

Hours:Minutes:Seconds.Milliseconds AM/PM, e.g. 03:35:44.240 PM.

The attribute can be assigned dynamic properties by means of the name


TimeColumnTimeFormat. The data type is STRING.

TimeColumnTimeRangeBase property
Time range - TimeColumnTimeRangeBase
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

500

500 ms

1000

1 second

1326

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Description

60000

1 minute

3600000

1 hour

86400000

1 day

The attribute can be assigned dynamic properties by means of the name


TimeColumnTimeRangeBase. The data type is LONG.

TimeColumnTimeRangeFactor property
Time range - TimeColumnTimeRangeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
TimeColumnTimeRangeFactor. The data type is SHORT.

TimeColumnUseValueColumnColors property
Use value column colors - TimeColumnUseValueColumnColors
Defines whether the selected time column will be displayed in the value column colors.
Value

Explanation

TRUE

The colors of the value column are used to display a selected time column. The settings in the "Font color"
and "Background color" fields are disabled.

FALSE

The colors defined in the "Font color" and "Background color" fields are used to display the selected time
column.

The attribute can be assigned dynamic properties by means of the name


TimeColumnUseValueColumnColors. The data type is BOOLEAN.

TimeColumnVisible property
Time columns - TimeColumnVisible
The list shows the time columns you created. Click a time column entry in the list to adapt the
properties and to define the time range of the time column.
Select the time columns to be displayed in the table from the list.
Defines whether the selected time column is displayed.
The attribute can be assigned dynamic properties by means of the name TimeColumnVisible.
The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1327

VBS Reference
2.4 Properties

2.4.19.4

TimeFormat - Tolerance

TimeFormat Property
Description
Defines the format of the time specification.
0: The information is provided in hh:mm
-1: The information is provided in hh:mm:ss
-2: The information is provided in hh:mm:ss.ms
-3: The information is provided in hh:mm (full hours)
-4: The information is provided in hh:mm:ss (full minutes)
-5: The information is provided in hh:mm:ss.ms (full seconds)

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeJump Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeJump" defines whether the time jumps in the
archive should be identified by the color defined in "TimeJumpColor".
WinCC Online Trend Control
The value of this attribute cannot be changed. Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

1328

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeJumpColor Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeJumpColor" defines the color identifying the
time jumps in the archive. Whether the information is evaluated is dependent on the value of
the "TimeJump" property. The color is defined as an RGB value. LONG write-read access.
WinCC Online Trend Control
The value of this property cannot be changed. Read only access.

See also
ScreenItem Object (Page 141)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)

TimeOverlap Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeOverlap" defines whether the time overlaps in
the archive should be identified by the color defined in "TimeOverlapColor".
WinCC Online Trend Control
The value of this property cannot be changed. Read only access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeOverlapColor Property
Description
WinCC Online Trend Control
The "Index" property references a trend. "TimeOverlapColor" defines the color identifying the
time overlaps in the archive. Whether the information is evaluated depends on the value of the
"TimeOverlap" attribute. The color is defined as an RGB value.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1329

VBS Reference
2.4 Properties
WinCC Online Trend Control
The value of this property cannot be changed. Read only access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
ScreenItem Object (Page 141)

TimeRange Property
Description
The "Index" property references a column pair or a trend. "TimeRange" defines how the time
range to be displayed should be defined.
0: The time range to be displayed is defined by a start time ("BeginTime") and end time
("EndTime").
-1: The time range to be displayed is defined by a start time ("BeginTime") and a time range
("TimeRangeBase" and "TimeRangeFactor").

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeRangeBase Property
Description
The "Index" property references a column pair or a trend. The time range to be displayed for
this column pair/trend results from multiplying the values "TimeRangeBase" and
"TimeRangeFactor", whereby the value "TimeRangeBase" is interpreted in milliseconds.
The "TimeRangeBase" and "TimeRangeFactor" properties are only evaluated when the
"TimeRange" property is set, i.e. has the value "-1".

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

1330

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeRangeFactor Property
Description
The "Index" property references a column pair or a trend. The time range to be displayed for
this column pair/trend results from multiplying the values "TimeRangeBase" and
"TimeRangeFactor", whereby the value "TimeRangeBase" is interpreted in milliseconds.
The "TimeRangeBase" and "TimeRangeFactor" properties are only evaluated when the
"TimeRange" property is set, i.e. has the value "-1".

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

TimeStamp Property
Description
Reads the time stamp of the last read access of a tag. The time stamp is returned in local time.
DATE (read only)
The VBS standard function "FormatDateTime(Date[, NamedFormat])" enables the time stamp
property to be output in plain text. The output is dependent on the current language setting.
The language setting can be set using the VBS standard function SetLocale().
By implementing the second parameter of the FormatDate() function and further VBS standard
functions such as Year, WeekDay, Day, Hour, Minute, Second enable the information, required
by the user, to be split. Use the WeekdayName function to receive the name of the weekday
for WeekDay.
Example:

'VBS87
Dim objTag
Dim lngCount
lngCount = 0
Set objTag = HMIRuntime.Tags("Tag11")
objTag.Read
SetLocale("en-gb")
MsgBox FormatDateTime(objTag.TimeStamp)
'Output: e.g. 06/08/2002 9:07:50
MsgBox Year(objTag.TimeStamp)
'Output: e.g. 2002
MsgBox Month(objTag.TimeStamp)
'Output: e.g. 8
MsgBox Weekday(objTag.TimeStamp)
'Output: e.g. 3
MsgBox WeekdayName(Weekday(objTag.TimeStamp))
'Output: e.g. Tuesday
MsgBox Day(objTag.TimeStamp)
'Output: e.g. 6
MsgBox Hour(objTag.TimeStamp)
'Output: e.g. 9
MsgBox Minute(objTag.TimeStamp)
'Output: e.g. 7

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1331

VBS Reference
2.4 Properties

MsgBox Second(objTag.TimeStamp)
'Output: e.g. 50
For lngCount = 0 To 4
MsgBox FormatDateTime(objTag.TimeStamp, lngCount)
Next
'lngCount = 0: Output: e.g. 06/08/2002 9:07:50
'lngCount = 1: Output: e.g. 06 August 2002
'lngCount = 2: Output: e.g. 06/08/2002
'lngCount = 3: Output: e.g. 9:07:50
'lngCount = 4: Output: e.g. 9:07

Example:
The following example issues the time stamp of the tag "Tag1":

'VBS88
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Read
MsgBox objTag.TimeStamp

See also
Tag Object (Page 152)
Alarms object (list) (Page 126)

TimeStepBase property
Precision - TimeStepBase
Defines the precision of the time stamp displayed in a table.
Calculate the precision by multiplying the factor with the time unit. Enter factor "3" and time
unit "1s" to display all values which were generated within 3 seconds in the same row, for
example.
Value

Description

Explanation

Exact

Only values with precisely the same time stamp are displayed in a table
row.

100

100 ms

All values generated within 100 milliseconds are grouped in a table row.

250

250 ms

All values generated within 250 milliseconds are grouped in a table row.

500

500 ms

All values generated within 500 milliseconds are grouped in a table row.

1000

1s

All values generated within 1 second are grouped in a table row.

The attribute can be assigned dynamic properties by means of the name TimeStepBase. The
data type is LONG.

1332

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TimeStepFactor property
Precision - TimeStepFactor
Defines the precision of the time stamp displayed in a table.
Calculate the precision by multiplying the factor with the time unit. Enter factor "3" and time
unit "1s" to display all values which were generated within 3 seconds in the same row.
The factor entered is disabled if "Exact" is selected for the time unit or "0" is selected for
"TimeStepBase".
The attribute can be assigned dynamic properties by means of the name TimeStepFactor. The
data type is LONG.

TimeZone Property
Description
Defines the time zone used as a basis for displaying time values. Four settings are possible:
Local time zone
Server's time zone
UTC (Universal Time Coordinated)
Apply project settings (=> Use WinCC Explorer and access the computer's properties page
to define the time mode specifically for the computer. The following are available for
selection: WinCC V50 (Compatibility mode => Display as was standard in the individual
display sections to V5 ), local time and UTC.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

TitleColor property
Table header background - TitleColor
Specifies the background color of the table headers. The button opens the "Color selection"
dialog.
The attribute can be assigned dynamic properties by means of the name TitleColor. The data
type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1333

VBS Reference
2.4 Properties

TitleCut property
Shorten contents - TitleCut
Truncates the content of column headers if the column is insufficient.
Value

Explanation

TRUE

The column headers are truncated.

FALSE

The column headers are not truncated.

The attribute can be assigned dynamic properties by means of the name TitleCut . The data
type is BOOLEAN.

TitleCut property (before WinCC V7)


Description
Defines whether the content of the fields of a title bar should be shortened if the column width
is too small. Write/Read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

TitleDarkShadowColor property
Dark shading color - TitleDarkShadowColor
Specifies the color of the dark side of shading. The button opens the "Color selection" dialog.
The setting is only active if the "Shading Color" option or "TitleStyle" is activated.
The attribute can be assigned dynamic properties by means of the name
TitleDarkShadowColor. The data type is LONG.

TitleForeColor property
Table header font color - TitleForeColor
Specifies the color of the table header. The button opens the "Color selection" dialog.
The attribute can be assigned dynamic properties by means of the name TitleForeColor. The
data type is LONG.

1334

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TitleGridLineColor property
Color of the divider / header - TitleGridLineColor
Defines the color of row/column dividers in the table header. The button opens the "Color
selection" dialog.
The attribute can be assigned dynamic properties by means of the name TitleGridLineColor.
The data type is LONG.

TitleLightShadowColor property
Bright shading color - TitleLightShadowColor
Specifies the color of the bright side of shading. The button opens the "Color selection" dialog.
The setting is only active if the "Shading Color" option or "TitleStyle" is activated.
The attribute can be assigned dynamic properties by means of the name
TitleLightShadowColor. The data type is LONG.

Titleline Property
Description
TRUE, when the control has a title bar and it can be moved in Runtime. BOOLEAN write-read
access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1335

VBS Reference
2.4 Properties

TitleSort property
Sort by column title- TitleSort
Defines how to trigger sorting by column title. You can only sort by column title if the "Autoscrolling" option is deactivated.
Value

Description

Explanation

No

Sorting by column title is not possible.

With click

Sorting is triggered by clicking in the column header.

With double-click

Sorting is triggered by double-clicking in the column title.

The attribute can be assigned dynamic properties by means of the name TitleSort. The data
type is LONG.

TitleStyle property
Shading color - TitleStyle
Specifies whether to set a shading color for the table header.
Value

Description

Explanation

Flat

Disables the use of shading colors. Flat header style.

Button

Enables the use of shading colors. 3D representation of the header.

The attribute can be assigned dynamic properties by means of the name TitleStyle. The data
type is LONG.

Toggle Property
Description
TRUE, when the button or round button should lock after being operated in Runtime.
BOOLEAN write-read access.

See also
Round Button (Page 223)
ScreenItem Object (Page 141)

1336

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ToleranceHigh Property
Description
Defines or returns the limit value for "Tolerance high".
The type of the evaluation (in percent or absolute) is defined in the "TypeToleranceHigh"
property.
The monitoring of the limit value is only valid if the "CheckToleranceHigh" property is set to
"TRUE".

See also
Bar (Page 189)
ScreenItem Object (Page 141)

ToleranceLow Property
Description
Defines or returns the limit value for "Tolerance low".
The type of the evaluation (in percent or absolute) is defined in the "TypeToleranceLow"
property.
The monitoring of the limit value is only valid if the "CheckToleranceLow" property is set to
"TRUE".

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.19.5

Toolbar

Toolbar Property
Description
TRUE, when a toolbar is to be displayed. BOOLEAN write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1337

VBS Reference
2.4 Properties
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ToolbarAlignment property (before WinCC V7)


Description
Defines or returns the position of the toolbar. Write/Read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ToolbarAlignment Property
Alignment - ToolbarAlignment
Defines the orientation of the Control toolbar.
The following settings are available:
Value

Description

Explanation

Top

The toolbar is aligned to the top edge.

Bottom

The toolbar is aligned to the bottom edge.

Left

The toolbar is aligned to the left edge.

Right

The toolbar is aligned to the right edge.

The attribute can be assigned dynamic properties by means of the name ToolbarAlignment.
The data type is LONG.

ToolbarBackColor property
Background color - ToolbarBackColor
Specifies the background color of the toolbar. Open the "Color selection" dialog by clicking the
button.
The background color you configured is only displayed if the "Display" option is activated or
"ToolbarUseBackColor" is "TRUE".
The attribute can be assigned dynamic properties by means of the name ToolbarBackColor.
The data type is LONG.

1338

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ToolbarButtonActive property
Active - ToolbarButtonActive
Activates a button function in Runtime. Clicking the button in Runtime triggers the
corresponding function.
Value

Explanation

TRUE

The button function is enabled.

FALSE

The button function is disabled. You can assign custom functions to the button by means of scripting.

The attribute can be assigned dynamic properties by means of the name


ToolbarButtonActive. The data type is BOOLEAN.

ToolbarButtonAdd property
New - ToolbarButtonAdd
Creates a new, user-defined button function. The name set by WinCC can be edited in the
"Object name" field.
The attribute can be assigned dynamic properties by means of the name ToolbarButtonAdd .
The data type is STRING.

ToolbarButtonBeginGroup property
Separator - ToolbarButtonBeginGroup
Inserts a leading separator (vertical line) for the selected button function on the toolbar. These
separators can be used to group the icons of the button functions.
Value

Explanation

TRUE

A separator prefix is inserted for the button function selected.

FALSE

A separator prefix is not inserted for the button function selected.

The attribute can be assigned dynamic properties by means of the name


ToolbarButtonBeginGroup. The data type is BOOLEAN.

ToolbarButtonClick AlarmControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1339

VBS Reference
2.4 Properties
ID

Button function

ID

Button function

"Help"

21

"Next message"

"Configuration dialog"

22

"Last message"

"Message list".

23

"Info text dialog"

"Short-term archive list".

24

"Comments dialog"

"Long-term archive list"

25

"Loop In Alarm"

"Lock List".

26

"Lock message"

"Hit List"

27

"Enable message"

"List of messages to be hidden"

28

"Hide messages"

"Ackn. Central Signaling Devices"

29

'Unhide messages"

10

"Single acknowledgment"

30

"Sort dialog"

11

"Group acknowledgement"

31

"Time base dialog"

18

"Emergency acknowledgement"

32

"Copy rows"

13

"Selection dialog"

33

"Connect backup"

14

"Display options dialog"

34

"Disconnect backup"

15

"Lock dialog"

36

"First page"

17

"Print"

37

"Previous page"

35

"Export data"

38

"Next page"

12

"Autoscroll"

39

"Last page"

19

"First message"

1001

"User-defined 1"

20

"Previous message"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick FunctionTrendControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.

1340

ID

Button function

ID

Button function

"Help"

13

"Select time range"

"Configuration dialog"

14

"Previous trend"

"Zoom area"

15

"Next trend"

"Zoom +/-"

16

"Stop"

"Zoom X axis +/-"

16

"Start"

"Zoom Y axis +/-"

17

"Print"

"Shift trend range"

20

"Export data"

"Shift axes range"

"Ruler"

10

"Original view"

18

"Connect backup"

11

"Select data connection"

19

"Disconnect backup"

12

"Select trends"

1001

"User-defined 1"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick OnlineTableControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

ID

Button function

"Help"

13

"Next column"

"Configuration dialog"

14

"Stop"

"First data record"

14

"Start"

"Previous data record"

15

"Print"

"Next data record"

20

"Export data"

"Last data record"

16

"Define statistics area"

"Edit"

17

"Calculate statistics"

"Copy rows"

18

"Connect backup"

"Select data connection"

19

"Disconnect backup"

10

"Select columns"

21

"Create archive value"

11

"Select time range"

1001

"User-defined 1"

12

"Previous column"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick OnlineTrendControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

ID

Button function

"Help"

17

"Select time range"

"Configuration dialog"

18

"Previous trend"

"First data record"

19

"Next trend"

"Previous data record"

20

"Stop"

"Next data record"

20

"Start"

"Last data record"

21

"Print"

"Zoom area"

26

"Export data"

"Zoom +/-"

"Ruler"

10

"Zoom time axis +/-"

22

"Define statistics area"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1341

VBS Reference
2.4 Properties
11

"Zoom value axis +/-"

23

"Calculate statistics"

12

"Shift trend range"

24

"Connect backup"

13

"Shift axes range"

25

"Disconnect backup"

14

"Original view"

27

"Relative axis"

15

"Select data connection"

1001

"User-defined 1"

16

"Select trends"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick RulerControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.
ID

Button function

"Help"

"Configuration dialog"

"Ruler window"

"Statistics range"

"Statistics"

"Print"

"Export data"

1001

"User-defined 1"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonClick UserArchiveControl property


ToolbarButtonClick
Triggers the function linked to the toolbar button. Programmers can use the "ID" to call the
corresponding button function.

1342

ID

Button function

ID

Button function

"Help"

12

"Read tags"

"Configuration dialog"

13

"Write tags"

"Select data connection"

14

"Import archive"

"First row"

15

"Export archive"

"Previous row"

16

"Sort dialog"

"Next row"

17

"Selection dialog"

"Last row"

18

"Print"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
8

"Delete rows"

20

"Export data"

"Cut rows"

19

"Time base dialog"

10

"Copy rows"

1001

"User-defined 1"

11

"Insert rows"

The attribute can be assigned dynamic properties by means of the name ToolbarButtonClick.
The data type is LONG.

ToolbarButtonCount property
ToolbarButtonCount
Defines the number of configurable button functions.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonCount. The data type is LONG.

ToolbarButtonEnabled property
ToolbarButtonEnabled
Enables operation of custom toolbar buttons.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonEnabled. The data type is BOOLEAN.

ToolbarButtonHotKey property
Hotkey - ToolbarButtonHotKey
Shows the hotkey for a button function selected.
You create or edit a hotkey by clicking in the "Hotkey" field and pressing the button or key
shortcut required.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonHotKey. The data type is LONG.

ToolbarButtonID property
Object ID - ToolbarButtonID
Unique ID number for the selected button function. WinCC assigns this read only ID number.
The attribute can be assigned dynamic properties by means of the name ToolbarButtonID.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1343

VBS Reference
2.4 Properties

ToolbarButtonIndex property
ToolbarButtonIndex
References a button function. Using this attribute you can assign the values of other attributes
to a specific button function.
Values between 0 and "ToolbarButtonIndex" minus 1 are valid for "ToolbarButtonCount".
Attribute "ToolbarButtonCount" defines the number of configurable button functions.
The "ToolbarButtonIndex" attribute can be assigned dynamic properties by means of attribute
ToolbarButtonRepos. The data type is LONG.

ToolbarButtonLocked property
ToolbarButtonLocked
Enables/disables the display of the pressed state of a user-defined toolbar button.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonLocked. The data type is BOOLEAN.

ToolbarButtonName property
Object name - ToolbarButtonName
Shows the name for the selected button function. You rename user-defined button functions.
The "ToolbarButtonName" attribute can be assigned dynamic properties by means of attribute
ToolbarButtonRename. The data type is STRING.

ToolbarButtonPasswordLevel property
Operator authorization - ToolbarButtonPasswordLevel
Shows the authorization for a button function selected. You can edit the authorization using
the selection button.
Authorizations are configured in the "User Administrator" editor.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonPasswordLevel. The data type is LONG.

ToolbarButtonRemove property
Remove - ToolbarButtonRemove
Removes the selected button function from the list. Only user-defined button functions can be
removed.

1344

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonRemove. The data type is STRING.

ToolbarButtonRename property
ToolbarButtonRename
Renames a custom toolbar element which is referenced by means of "ToolbarButtonIndex"
attribute.
The attribute for custom elements can be assigned dynamic properties by means of the name
ToolbarButtonRename. "ToolbarButtonRename" also sets a dynamic attribute
"ToolbarButtonName". The data type is STRING.

ToolbarButtonRepos property
Up/Down - ToolbarButtonRepos
Changes the sorting order of button functions. "Up" and "Down" move the button function
selected up or down in the list. This moves the button function in the toolbar of a Control towards
the front or towards the back.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonRepos. The data type is LONG.

ToolbarButtonTooltipText property
ToolbarButtonTooltipText
Specifies the tooltip text for the button.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonTooltipText. The data type is STRING.

ToolbarButtonUserDefined property
ToolbarButtonUserDefined
Indicates whether the project engineer has added a new user-defined toolbar button.
Value

Explanation

TRUE

The toolbar button is assigned a user-defined function.

FALSE

The toolbar button is defined by the system.

The attribute can be assigned dynamic properties by means of the name


ToolbarButtonUserDefined. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1345

VBS Reference
2.4 Properties

ToolbarButtonVisible property
Button functions - ToolbarButtonVisible
Select the button functions to be displayed in the toolbar from the list.
Click a list entry to adapt the properties, or to change the position in the status bar of the Control
by means of the "Up" and "Down" buttons.
The attribute can be assigned dynamic properties by means of the name
ToolbarButtonVisible . The data type is BOOLEAN.

ToolbarButtons Property
Description
Defines or returns the buttons contained in the toolbar by setting or resetting the corresponding
bits. Each button is assigned a bit. There are no limitations as to the bit combinations.
Bit - Value (hex) ; Value (dec) ; Button:
0 - 0x00000001; 1; Message List
1 - 0x00000002; 2; Short-term archive list
2 - 0x00000004; 4; Long-term archive list
3 - 0x00000008; 8; Acknowledgment of central signaling device
4 - 0x00000010; 16; Single Acknowledgment
5 - 0x00000020; 32; Group acknowledgment
6 - 0x00000040; 64; Autoscroll
7 - 0x00000080; 128; Selection Dialog
8 - 0x00000100; 256; Lock Dialog
9 - 0x00000200; 512; Print message log
11 - 0x00000800; 2048; Emergency acknowledgment
12 - 0x00001000; 4096; First message
13 - 0x00002000; 8192; Last message
14 - 0x00004000; 16384; Next message
15- 0x00008000; 32768; Previous message
16 - 0x00010000; 65536; Infotext Dialog
17 -0x00020000; 131072; Comment Dialog
18 - 0x00040000; 262144; Loop in Alarm
20 - 0x00100000; 1048576; Print current view
21 - 0x00200000; 2097152; Lock list
22 - 0x00400000; 4194304; Lock/release message

1346

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
23 - 0x00800000; 8388608; Sorting Dialog
24 - 0x01000000; 16777216; Time basis dialog
25 - 0x02000000; 33554432; Hit list
In order to display more buttons, their values must be logically linked with OR. Write/Read
access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

ToolbarHotKeys Property
Description
Defines or returns hotkeys of the buttons in the toolbar. Write/Read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

ToolbarShowTooltips property
Tooltips - ToolbarShowTooltips
Enables the display of tooltips for the button functions in Runtime.
Value

Explanation

TRUE

Enables the display of tooltips.

FALSE

Disables the display of tooltips.

The attribute can be assigned dynamic properties by means of the name


ToolbarShowTooltips. The data type is BOOLEAN.
Attribute "ToolbarButtonTooltipText" defines the tooltip text.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1347

VBS Reference
2.4 Properties

ToolbarUseBackColor property
Show background color - ToolbarUseBackColor
Enables the display of the background color for a toolbar.
Value

Explanation

TRUE

Enables the display of the background color of a toolbar.

FALSE

Disables the display of the background color of a toolbar.

The attribute can be assigned dynamic properties by means of the name


ToolbarUseBackColor. The data type is BOOLEAN.

ToolbarUseHotKeys property
Hotkeys - ToolbarUseHotKeys
Activates the hotkeys for button functions in Runtime. Insert the hotkeys for button functions
in the "Hotkey" field.
Value

Explanation

TRUE

The hotkeys are activated.

FALSE

The hotkeys are deactivated.

The attribute can be assigned dynamic properties by means of the name


ToolbarUseHotKeys. The data type is BOOLEAN.

ToolbarVisible property
Show toolbar - ToolbarVisible
Enables the display of the Control toolbar.
Value

Explanation

TRUE

Enables the display of the toolbar.

FALSE

Disables the display of the toolbar.

The attribute can be assigned dynamic properties by means of the name ToolbarVisible . The
data type is BOOLEAN.

1348

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.19.6

ToolTip - TrendLower

ToolTipText Property
Description
Defines or returns the text to be displayed as a tooltip when the mouse is positioned over the
object.
STRING (write-read access)

Example:
The following example assigns a tool tip text to every object in the picture "NewPDL1": The
picture "NewPDL1" comprises only objects containing the ToolTipText property:

'VBS89
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
'
'Assign tooltiptexts to the objects
objScrItem.ToolTipText = "Name of object is " & strName
Next

See also
Radio box (Page 221)
Status display (Page 213)
Connector (Page 182)
Text list (Page 211)
Static text (Page 180)
Slider (Page 226)
Group Display (Page 208)
Rounded rectangle (Page 177)
Round Button (Page 223)
Rectangle (Page 174)
Polyline (Page 173)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1349

VBS Reference
2.4 Properties
Polygon (Page 171)
OLE object (Page 206)
Line (Page 169)
Pie segment (Page 167)
Circular arc (Page 166)
Circle (Page 164)
Group (Page 302)
Graphic Object (Page 202)
Ellipse segment (Page 162)
Ellipse arc (Page 161)
Ellipse (Page 159)
I/O Field (Page 199)
Check box (Page 219)
Button (Page 215)
Bar (Page 189)
Customized Object (Page 300)
3D Bar (Page 184)

Top Property
Function
Defines or returns the Y-coordinate of an object (measured from the top left edge of the picture)
in pixels. The Y-coordinate relates to the top left corner of the rectangle enclosing the object.
LONG (write-read access)

Example:
The following example shifts all objects in the picture "NewPDL1" 5 pixels upwards:

'VBS90
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Top = objScrItem.Top - 5

1350

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Next

See also
Left Property (Page 463)
ScreenItem Object (Page 141)

TopConnectedConnectionPointIndex Property
Description
Specifies or sets the index number of the top connecting point.
LONG write-read access.

See also
Connector (Page 182)
ScreenItem Object (Page 141)

TopConnectedObjectName Property
Description
Specifies or sets the object name of the object which is docked on at the bottom connecting
point.
LONG write-read access.

See also
Connector (Page 182)
ScreenItem Object (Page 141)

Transparency property
Description
Defines and returns the percentage transparency of the object.
0 = no transparency; 100 = complete transparency (invisible)
The text and fields of the graphic objects are only transparent at "100."
In runtime, a completely transparent object (invisible) is also functional.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1351

VBS Reference
2.4 Properties

Transparent Property
Description
TRUE, when the button appears completely filled in the color specified in "BackColor".
BOOLEAN write-read access.

See also
WinCC Push Button Control (Page 275)
ScreenItem Object (Page 141)

Trend Property
Description
TRUE, when the tendency (rising or falling) of the measuring value being monitored should
be displayed by a small arrow. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TrendActualize property
Update -TrendActualize
Enables the update of a selected trend.
Value

Explanation

TRUE

Enables updates of the trend selected.

FALSE

Disables updates of the trend selected. This setting can be useful when comparing a logged trend with a current
trend.

The attribute can be assigned dynamic properties by means of the name TrendActualize. The
data type is BOOLEAN.

TrendAdd property
New - TrendAdd
Creates a new trend.

1352

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name TrendAdd. The data
type is STRING.

TrendAutoRangeBeginTagName property
TrendAutoRangeBeginTagName
This attribute sets the low limit tag for the range of values if the range of values is calculated
automatically by means of online tags.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeBeginTagName. The data type is STRING.

TrendAutoRangeBeginValue property
TrendAutoRangeBeginValue
This attribute sets the low limit tag for the range of values if the range of values is calculated
based on the configuration of high and low limits.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeBeginValue. The data type is DOUBLE.

TrendAutoRangeEndTagName property
TrendAutoRangeEndTagName
This attribute sets the high limit tag for the range of values if the range of values is calculated
automatically by means of online tags.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeEndTagName. The data type is STRING.

TrendAutoRangeEndValue property
TrendAutoRangeEndValue
This attribute sets the high limit tag for the range of values if the range of values is calculated
based on the configuration of high and low limits.
The attribute can be assigned dynamic properties by means of the name
TrendAutoRangeEndValue. The data type is DOUBLE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1353

VBS Reference
2.4 Properties

TrendAutoRangeSource property
TrendAutoRangeSource
Defines the mode for automatic calculation of the range of values of trend data.
Value

Description

Explanation

Display data

The range of values is calculated automatically based on the data displayed.

Value range

The range of values is defined based on its configured low and high limit. The low and high
limits are emulated in the "TrendAutoRangeBeginValue" and "TrendAutoRangeEndValue"
attributes.

Online tags

The low and high limits of the range of values are derived from the values of connected online
tags. The low and high limits are emulated in the "TrendAutoRangeBeginTagName" and
"TrendAutoRangeEndTagName" attributes.

The attribute can be assigned dynamic properties by means of the name


TrendAutoRangeSource. The data type is LONG.

TrendBeginTime property
Start time - TrendBeginTime
Defines the start time of the time range for data transfer to the selected trend.
The attribute can be assigned dynamic properties by means of the name TrendBeginTime.
The data type is Date.

TrendColor property
Trend color - TrendColor
Specifies the trend color. Open the "Color selection" dialog by clicking the button.
The attribute can be assigned dynamic properties by means of the name TrendColor. The data
type is LONG.

LTrendColor property (before WinCC V7)


Description
Determines the color of the trend display or returns it.
The trend display indicates the tendency (rising or falling) of the measuring value being
monitored by a small arrow. In order to activate the trend display, the Trend property must be
set to "True". LONG write-read access.

1354

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TrendCount property
TrendCount
Defines the number of configured trends.
The attribute can be assigned dynamic properties by means of the name TrendCount. The
data type is LONG.

TrendEndTime property
End time - TrendEndTime
Defines the end of the time range for data connections of a selected trend.
The attribute can be assigned dynamic properties by means of the name TrendEndTime. The
data type is Date.

TrendExtendedColorSet property
Extended - TrendExtendedColorSet
Enables configuration of the point and fill colors and the display of colors in Runtime.
Value

Explanation

TRUE

The "Point color" and "Fill color" field settings can be configured and are active in Runtime.

FALSE

The "Point color" and "Fill color" field settings cannot be configured and are inactive in
Runtime.

The attribute can be assigned dynamic properties by means of the name


TrendExtendedColorSet. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1355

VBS Reference
2.4 Properties

TrendFill property
Filled - TrendFill
Specifies if the area beneath the trend is to be filled.
Value

Explanation

TRUE

The area beneath the trend is shown filled. You can define the trend color as fill color if the "Advanced"
option is deactivated.
The text background is displayed in the trend color for the trend type "Values". The background color
of the control is used as text color.

FALSE

The trend is not visualized with fill color.

The attribute can be assigned dynamic properties by means of the name TrendFill. The data
type is BOOLEAN.

TrendFillColor property
Fill color - TrendFillColor
Specifies the fill color of the trend. The text fill color is specified for the trend type "Values".
The fill color is used if the "Filled" option is activated or "TrendFill" is "TRUE". Open the "Color
selection" dialog by clicking the button.
The configuration is only possible if the "Advanced" option is activated or
"TrendExtendedColorSet" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendFillColor. The
data type is LONG.

TrendIndex property
TrendIndex
References a configured trend. Using this attribute you can assign the values of other attributes
to a specific trend. The index must always be set before you change the properties of a trend
in runtime.
Values between 0 and "TrendIndex" minus 1 are valid for "TrendCount". Attribute "TrendCount"
defines the number of trends configured.
The "TrendIndex" attribute can be assigned dynamic properties by means of attribute
TrendRepos. The data type is LONG.

1356

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TrendLabel property
Label - TrendLabel
Defines the label of the trend selected. The label is displayed in Runtime if the value at attribute
"UseTrendNameAsLabel" is "FALSE".
The attribute can be assigned dynamic properties by means of the name TrendLabel. The data
type is STRING.

TrendLineStyle property
Line style - TrendLineStyle
Defines the line style for trend visualization.
The following settings are available:
Value

Description

Explanation

Solid

The trend is visualized as solid line.

Dashed

The trend is visualized as dashed line.

Dotted

The trend is visualized as dotted line.

Dash dot

The trend is visualized as dot-dash line.

Dash Dot Dot

The trend is visualized as dash-dot-dot line.

The attribute can be assigned dynamic properties by means of the name TrendLineStyle. The
data type is LONG.

TrendLineType property
Trend type - TrendLineType
Defines how to visualize a trend.
The following settings are available:
Value

Description

Explanation

None

Only the dots are displayed.

Connect dots
linearly

Visualizes a trend with linear interconnection of points.

Stepped

Visualizes a stepped trend and its interconnected points.

Values

Can only be configured with OnlineTrendControl.


A value is displayed at each time stamp or at the main grid line of the time axis instead of
trend points.

The attribute can be assigned dynamic properties by means of the name TrendLineType. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1357

VBS Reference
2.4 Properties

TrendLineWidth property
Line weight - TrendLineWidth
Defines the line weight of the line displayed.
The attribute can be assigned dynamic properties by means of the name TrendLineWidth. The
data type is LONG.

TrendLowerLimit property
TrendLowerLimit
Specifies the low limit of a tag. The values are identified based on the color set in
"TrendLowerLimitColor" if the tag value is less than "TrendLowerLimit". This setting is only
active if the value at attribute "TrendLowerLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendLowerLimit.
The data type is DOUBLE.

TrendLowerLimitColor property
TrendLowerLimitColor
Specifies the color of tag values which are less than the value at "TrendLowerLimit". This
setting is only active if the value at attribute "TrendLowerLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name
TrendLowerLimitColor. The data type is LONG.

TrendLowerLimitColoring property
TrendLowerLimitColoring
Enables the "TrendLowerLimitColor" attribute for identifying tag values which are less than the
value at "TrendLowerLimitValue".
Value

Explanation

TRUE

Attribute "TrendLowerLimitColor" is active.

FALSE

Attribute "TrendLowerLimitColor" is inactive.

The attribute can be assigned dynamic properties by means of the name


TrendLowerLimitColoring. The data type is BOOLEAN.

1358

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.19.7

TrendMeasure - TrendVisible

TrendMeasurePoints property
Number of measurement points - TrendMeasurePoints
Defines the number of measurement points for visualization of selected trends.
Defines the number of value pairs provided to the trend from a user archive.
The attribute can be assigned dynamic properties by means of the name
TrendMeasurePoints. The data type is LONG.

TrendName property
Object name - TrendName
Displays the name of the selected trend. The name is defined on the "Trends" tab.
The "TrendName" attribute can be assigned dynamic properties by means of attribute
TrendRename. The data type is STRING.

TrendPointColor property
Point color - TrendPointColor
Defines the color of trend points. Open the "Color selection" dialog by clicking the button.
The configuration is only possible if the "Advanced" option is activated or
"TrendExtendedColorSet" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendPointColor.
The data type is LONG.

TrendPointStyle property
Dot type - TrendPointStyle
Defines the dot style for trend visualization.
The following settings are available:
Value

Description

Explanation

None

The points are not displayed.

Dots

The trend points are visualized with a size of one pixel. The setting
in the "Dot width" field is deactivated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1359

VBS Reference
2.4 Properties
Value

Description

Explanation

Squares

The dots are displayed as square. The setting in the "Dot width"
field is active.

Circles

The dots are displayed as circles. The setting in the "Dot width" field
is active.

The attribute can be assigned dynamic properties by means of the name TrendPointStyle. The
data type is LONG.

TrendPointWidth property
Dot width - TrendPointWidth
Sets the dot width in pixels. You can only define the dot width for the "square" and "circular"
type.
The attribute can be assigned dynamic properties by means of the name TrendPointWidth.
The data type is LONG.

TrendProvider property
Data source - TrendProvider
Specifies the data source for a selected trend.
The following settings are available:
Value

Description

Explanation

None

No data source configured for implementation in Runtime by means of script.

Archive tags

Data source with archive tags of a process value archive.

Online tags

Data source with online tags derived from tag management.

User archive

Data source with columns of a user archive.

The attribute can be assigned dynamic properties by means of the name TrendProvider. The
data type is LONG.

TrendProviderCLSID_FunctionTrend property
TrendProviderCLSID_FunctionTrend
Indicates the data source of the trend selected.
Value

Explanation
No data source configured for implementation in Runtime by means of script.

{416A09D2-8B5A-11D28B81-006097A45D48}

1360

Data source with archive tags of a process value archive.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Explanation

{A3F69593-8AB0-11D2A440-00A0C9DBB64E}

Data source with online tags derived from tag management.

{2DC9B1C8-4FC1-41B1B354-3E469A13FBFD}

Data source with columns of a user archive.

The attribute can be assigned dynamic properties by means of the name


TrendProviderCLSID. The data type is STRING.

TrendProviderCLSID_OnlineTrend property
TrendProviderCLSID_OnlineTrend
Indicates the data source of the trend selected.
Value

Explanation
No data source configured for implementation in Runtime by means of script.

{416A09D2-8B5A-11D28B81-006097A45D48}

Data source with archive tags of a process value archive.

{A3F69593-8AB0-11D2A440-00A0C9DBB64E}

Data source with online tags derived from tag management.

The attribute can be assigned dynamic properties by means of the name


TrendProviderCLSID. The data type is STRING.

TrendRangeType property
Time range setting - TrendRangeType
Defines the time range for providing data to the selected trend.
You can only define the number of measuring points if you select user archives as the data
source.
The following configuration options are available:
Value

Description

Explanation

Time range

Defines the start time and the time range for the data
connection.

Start to end time

Defines the start and end time for the data connection.

Number of measurement
points

Defines the start time and the number of measurement points


for the data connection.

The attribute can be assigned dynamic properties by means of the name TrendRangeType.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1361

VBS Reference
2.4 Properties

TrendRemove property
Remove - TrendRemove
Removes selected trends from the list.
The attribute can be assigned dynamic properties by means of the name TrendRemove. The
data type is STRING.

TrendRename property
TrendRename
Renames a trend which is referenced by means of "TrendIndex" attribute.
The attribute can be assigned dynamic properties by means of the name TrendRename.
"TrendRename" also sets a dynamic attribute "TrendName". The data type is STRING.

TrendRepos property
Up/Down - TrendRepos
Repositions the trend in the trend window. "Up" and "Down" move the selected trend up or
down in the list. This moves the trend towards the foreground or background for visualization
in Runtime.
The attribute can be assigned dynamic properties by means of the name TrendRepos. The
data type is LONG.

TrendSelectTagName property
TrendSelectTagName
Opens a dialog for selecting the tag name for the source of Y axis data in WinCC
OnlineTrendControl. Programmers can set this attribute to allow users to select a tag name
by means of a button, for example.
The attribute can be assigned dynamic properties by means of the name
TrendSelectTagName. The data type is BOOLEAN.

TrendSelectTagNameX property
TrendSelectTagNameX
Opens a dialog for selecting the tag name for the source of X axis data in WinCC
FunctionTrendControl. Programmers can set this attribute to allow users to select a tag name
by means of a button, for example.

1362

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
TrendSelectTagNameX. The data type is BOOLEAN.

TrendSelectTagNameY property
TrendSelectTagNameY
Opens a dialog for selecting the tag name for the source of Y axis data in WinCC
FunctionTrendControl. Programmers can set this attribute to allow users to select a tag name
by means of a button, for example.
The attribute can be assigned dynamic properties by means of the name
TrendSelectTagNameY. The data type is BOOLEAN.

TrendState property
TrendState
Shows the status of the data link of the selected curve in Runtime.
The attribute can be made dynamic with the name TrendState. The data type is LONG.

TrendTagName property
Tag name - TrendTagName
Displays the name of connected tags. Use the Open button to open a dialog for selecting an
online or archive tag.
The attribute can be assigned dynamic properties by means of the name TrendTagName. The
data type is STRING.

TrendTagNameX property
Tag Name X / Column X - TrendTagNameX
Shows the name of interconnected tags or of the column for the X axis. Using the selection
button, select a tag or a column for the data source you configured.
The attribute can be assigned dynamic properties by means of the name TrendTagNameX.
The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1363

VBS Reference
2.4 Properties

TrendTagNameY property
Tag Name Y / Column Y - TrendTagNameY
Shows the name of interconnected tags or of the column for the Y axis. Using the selection
button, select a tag or a column for the data source you configured.
The attribute can be assigned dynamic properties by means of the name TrendTagNameY.
The data type is STRING.

TrendTimeAxis property
Time axis - TrendTimeAxis
Defines the time axis to be used for the trend selected. Define the available time axes in the
"Time axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendTimeAxis. The
data type is STRING.

TrendTimeRangeBase property
Time Range - TrendTimeRangeBase
Defines the time unit for calculating the time range.
The following time units are available:
Value

Description

500

500 ms

1000

1 second

60000

1 minute

3600000

1 hour

86400000

1 day

The attribute can be assigned dynamic properties by means of the name


TrendTimeRangeBase. The data type is LONG.

TrendTimeRangeFactor property
Time range - TrendTimeRangeFactor
Defines the factor for calculating the time range. Only integer factors are valid.
The attribute can be assigned dynamic properties by means of the name
TrendTimeRangeFactor. The data type is SHORT.

1364

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TrendTrendWindow property
Trend window - TrendTrendWindow
Defines the trend window for visualizing the trend selected. Define the available trend windows
in the "Trend window" tab.
The attribute can be assigned dynamic properties by means of the name
TrendTrendWindow. The data type is STRING.

TrendUncertainColor property
TrendUncertainColor
Value are in uncertain state if the initial value is unknown after runtime has been activated, or
if a substitute value is used. Set attribute "TrendUncertainColor" to define the color identifier
of these values. The "TrendUncertainColoring" attribute determines whether or not this setting
is evaluated.
The attribute can be assigned dynamic properties by means of the name
TrendUncertainColor. The data type is LONG.

TrendUncertainColoring property
TrendUncertainColoring
Value are in uncertain state if the initial value is unknown after runtime has been activated, or
if a substitute value is used. The "TrendUncertainColoring" attribute is used to enable
identification of such values based on the color set in "TrendUncertainColor".
Value

Explanation

TRUE

The settings of the "TrendUncertainColor" attribute are active.

FALSE

The settings of the "TrendUncertainColor" attribute are inactive.

The attribute can be assigned dynamic properties by means of the name


TrendUncertainColoring. The data type is BOOLEAN.

TrendUpperLimit property
TrendUpperLimit
Specifies the high limit of a tag. The values are identified based on the color set in
"TrendUpperLimitColor" if the tag value exceeds the "TrendUpperLimit". This setting is only
active if the value at attribute "TrendUpperLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name TrendUpperLimit.
The data type is DOUBLE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1365

VBS Reference
2.4 Properties

TrendUpperLimitColor property
TrendUpperLimitColor
Specifies the color of tag values which are less than the value at "TrendLowerLimit". This
setting is only active if the value at attribute "TrendUpperLimitColoring" is "TRUE".
The attribute can be assigned dynamic properties by means of the name
TrendUpperLimitColor. The data type is LONG.

TrendUpperLimitColoring property
TrendUpperLimitColoring
Enables the "TrendUpperLimitColor" attribute for identifying tag values which are less than the
value at "TrendUpperLimit".
Value

Explanation

TRUE

The setting of the "TrendUpperLimitColor" attribute is active.

FALSE

The setting of the "TrendUpperLimitColor" attribute is inactive.

The attribute can be assigned dynamic properties by means of the name


TrendUpperLimitColoring. The data type is BOOLEAN.

TrendValueAlignment property
Alignment - TrendValueAlignment
Specifies the alignment of the displayed values for the trend type "Values".
The following settings are available depending on the writing direction of the trend:
The writing direction of the trend is "from right" or "from left"
Value

Description

Explanation

Bottom

The values are displayed at the bottom in the trend window.

Centered

The values are displayed centered in the trend window.

Top

The values are displayed at the top in the trend window.

The writing direction of the trend is "from top" or "from bottom"


Value

Description

Explanation

Left

The values are displayed on the left in the trend window.

Centered

The values are displayed centered in the trend window.

Right

The values are displayed on the right in the trend window.

The attribute can be assigned dynamic properties by means of the name


TrendValueAlignment. The data type is LONG.

1366

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TrendValueAxis property
Value axis - TrendValueAxis
Defines the value axis to be used for the trend selected. Define the available value axes in the
"Value axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendValueAxis. The
data type is STRING.

TrendValueUnit property
Unit - TrendValueUnit
Specifies a unit for the trend type "Values" that is appended to the displayed value, e.g., "%"
or "C".
The attribute can be assigned dynamic properties by means of the name TrendValueUnit. The
data type is STRING.

TrendVisible property
Trends - TrendVisible
The list shows all trends you created.
Select the trends to be displayed in the trend window from the list.
Click a trend entry in the list to adapt the properties and to assign axes and trend windows to
the trend.
The attribute can be assigned dynamic properties by means of the name TrendVisible. The
data type is BOOLEAN.

2.4.19.8

TrendWindow - TrendYAxis

TrendWindowAdd property
New - TrendWindowAdd
Creates a new trend window.
The attribute can be assigned dynamic properties by means of the name TrendWindowAdd.
The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1367

VBS Reference
2.4 Properties

TrendWindowCoarseGrid property
Main grid lines - TrendWindowCoarseGrid
Enables the display of grid lines for the main scale.
Value

Explanation

TRUE

Enables the display of grid lines for the main scale.

FALSE

Disables the display of grid lines for the main scale.

The attribute can be assigned dynamic properties by means of the name


TrendWindowCoarseGrid. The data type is BOOLEAN.

TrendWindowCoarseGridColor property
Color of main scale - TrendWindowCoarseGridColor
Specifies the grid color of the main scale. Open the "Color selection" dialog by clicking the
button.
The attribute can be assigned dynamic properties by means of the name
TrendWindowCoarseGridColor. The data type is LONG.

TrendWindowCount property
TrendWindowCount
Defines the number of configured trend views.
The attribute can be assigned dynamic properties by means of the name
TrendWindowCount. The data type is LONG.

TrendWindowFineGrid property
Secondary grid lines - TrendWindowFineGrid
Enables the display of grid lines for the secondary scale.
Value

Explanation

TRUE

Enables the display of grid lines for the secondary scale.

FALSE

Disables the display of grid lines for the secondary scale.

The attribute can be assigned dynamic properties by means of the name


TrendWindowFineGrid. The data type is BOOLEAN.

1368

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TrendWindowFineGridColor property
Color of secondary scale - TrendWindowFineGridColor
Specifies the grid color of the main scale. Open the "Color selection" dialog by clicking the
button.
The attribute can be assigned dynamic properties by means of the name
TrendWindowFineGridColor. The data type is LONG.

TrendWindowForegroundTrendGrid property
Only for foreground trend - TrendWindowForegroundTrendGrid
Enables the display of grid lines only for the foreground trend in the trend window.
Value

Explanation

TRUE

Enables the display of grid lines for the foreground trend in the trend window.

FALSE

Enables the display of grid lines for all trends in the trend window.

The attribute can be assigned dynamic properties by means of the name


TrendWindowForegroundTrendGrid. The data type is BOOLEAN.

TrendWindowGridInTrendColor property
Use trend color - TrendWindowGridInTrendColor
Sets the trend color for the visualization of the grid lines for the main scale.
Value

Explanation

TRUE

The grid is displayed in the trend color.

FALSE

The grid is displayed with the color set in the "Color" field.

The attribute can be assigned dynamic properties by means of the name


TrendWindowGridInTrendColor. The data type is BOOLEAN.

TrendWindowHorizontalGrid property
For X axis - TrendWindowVerticalGrid
Enables the display of horizontal grid lines.
Value

Explanation

TRUE

The display of horizontal grid lines is enabled.

FALSE

The display of horizontal grid lines is disabled.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1369

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
TrendWindowHorizontalGrid. The data type is BOOLEAN.

TrendWindowIndex property
TrendWindowIndex
References a configured trend view. Using this attribute you can assign the values of other
attributes to a specific trend view.
Values between 0 and "TrendWindowIndex" minus 1 are valid for "TrendWindowCount".
Attribute "TrendWindowCount" defines the number of trend views configured.
The "TrendWindowIndex" attribute can be assigned dynamic properties by means of attribute
TrendWindowRepos. The data type is LONG.

TrendWindowName property
Object name - TrendWindowName
Defines the name of the trend window selected.
The "TrendWindowName" attribute can be assigned dynamic properties by means of attribute
TrendWindowRename. The data type is STRING.

TrendWindowRemove property
Remove - TrendWindowRemove
Removes the selected trend window from the list.
The attribute can be assigned dynamic properties by means of the name
TrendWindowRemove. The data type is STRING.

TrendWindowRename property
TrendWindowRename
Renames a trend view which is referenced by means of "TrendWindowIndex" attribute.
The attribute can be assigned dynamic properties by means of the name
TrendWIndowRename. "TrendWindowRename" also sets a dynamic attribute
"TrendWindowName". The data type is STRING.

1370

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

TrendWindowRepos property
Up/Down - TrendWindowRepos
Changes the sorting order of the trend windows. "Up" and "Down" move the selected trend up
or down in the list.
The sorting order in the list defines the position in the Control. The first trend window is
displayed at the last position, while the last is displayed at the top position.
The attribute can be assigned dynamic properties by means of the name
TrendWindowRepos. The data type is LONG.

TrendWindowRulerColor property
Ruler color - TrendWindowRulerColor
Specifies the ruler color. Open the "Color selection" dialog by clicking the button.
The color can be configured and displayed if "1 - graphic" is set for display of the ruler or
"TrendWindowRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowRulerColor. The data type is LONG.

TrendWindowRulerLayer property
Ruler layer - TrendWindowRulerLayer
Defines the representation layer of a ruler in the trend window.
The following settings are available:
Value

Description

Explanation

Under grid

The ruler is visualized on a layer under the grid.

Between grid and


trend

The ruler is positioned on top of the trend and under the grid.

On top of trend

The ruler is positioned on top of the trend.

The attribute can be assigned dynamic properties by means of the name


TrendWindowRulerLayer. The data type is LONG.

TrendWindowRulerStyle property
Ruler - TrendWindowRulerStyle
Defines the appearance of the ruler.
The following settings are available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1371

VBS Reference
2.4 Properties
Value

Description

Explanation

Simple

The ruler is displayed as basic black line.

Graphic

The ruler is displayed based on the "color" and "weight" configured.

The attribute can be assigned dynamic properties by means of the name


TrendWindowRulerStyle. The data type is LONG.

TrendWindowRulerWidth property
Ruler width - TrendWindowRulerWidth
Defines the width of the ruler in pixels.
The width can be configured and displayed if "1 - graphic" is set for display of the ruler or
"TrendWindowRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowRulerWidth. The data type is LONG.

TrendWindowSpacePortion property
Proportional area - TrendWindowSpacePortion
Specifies the proportion of the trend widow to be used for the selected curve.
The attribute can be assigned dynamic properties by means of the name
TrendWindowSpacePortion. The data type is LONG.

TrendWindowStatisticRulerColor property
Color of ruler for statistics area - TrendWindowStatisticRulerColor
Specifies the color of the ruler for the statistics area. The button opens the "Color selection"
dialog to select the color.
The color can be configured and displayed if "1 - graphic" is set for display of the ruler for the
statistics area or "TrendWindowStatisticRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowStatisticRulerColor. The data type is LONG.

TrendWindowStatisticRulerStyle property
Ruler for statistics area - TrendWindowStatisticRulerStyle
Enables the display of a ruler for defining the statistics area.
The following settings are available:

1372

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
Value

Description

Explanation

Simple

The ruler is displayed as basic black line.

Graphic

The ruler is displayed based on the "color" and "weight" configured.

The attribute can be assigned dynamic properties by means of the name


TrendWindowStatisticRulerStyle. The data type is LONG.

TrendWindowStatisticRulerWidth property
Width of ruler for statistics area - TrendWindowStatisticRulerWidth
Defines the width of the ruler for the statistics area in pixels.
The width of the ruler can be configured and displayed if "1 - graphic" is set for display of the
ruler for the statistics area or "TrendWindowStatisticRulerStyle".
The attribute can be assigned dynamic properties by means of the name
TrendWindowStatisticRulerWidth. The data type is LONG.

TrendWindowVerticalGrid property
for Y axis - TrendWindowVerticalGrid
Enables the display of vertical grid lines.
Value

Explanation

TRUE

The display of vertical grid lines is enabled.

FALSE

The display of vertical grid lines is disabled.

The attribute can be assigned dynamic properties by means of the name


TrendWindowVerticalGrid. The data type is BOOLEAN.

TrendWindowVisible property
Trend window - TimeAxisTrendWindow
The list shows all trend windows you created.
Select the trend windows to be displayed in the control from the list.
Click a list entry to adapt the ruler and grid line properties.
The attribute can be assigned dynamic properties by means of the name
TrendWindowVisible. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1373

VBS Reference
2.4 Properties

TrendXAxis property
X axis - TrendXAxis
Defines the X axis to be used for the trend selected. Define the available X axes inn the "X
Axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendXAxis. The
data type is STRING.

TrendYAxis property
Y axis - TrendYAxis
Defines the Y axis to be used for the trend selected. Define the available Y axes inn the "Y
Axes" tab.
The attribute can be assigned dynamic properties by means of the name TrendYAxis. The
data type is STRING.

2.4.19.9

Type

Type Property
Description
Reads out the object type, e.g. "Rectangle", "Circle" or "Line".
The object type is returned as a string. Read only
A special ID is returned as the type for all the graphic elements provided by WinCC. It can be
found under the topic "Type Identification in VBS in the individual descriptions of the WinCC
Object Types.

Special feature
In the case of non-WinCC controls and OLE objects, the version-independent ProgID is
returned as the type.
It is possible to determine the version-dependent ProgID or "User friendly Name" from the
ProgID: In the following example, "Control1" is a control embedded in the picture which already
returns the version-independent ProgID as a result of the Type property.
Note
Since not every Control has a version-dependent ProgID, an error handling measure should
be integrated to query the version-dependent ProgID or UserFriendlyName. If no error
handling is used, the code is terminated immediately without any result when no ProgID is
found.

1374

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Determine the version-dependent ProgID as follows:

'VBS91
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems("Control1")
strCurrentVersion = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type &
"\CurVer\")
MsgBox strCurrentVersion

Note
In order that example above works, a multimedia control should be inserted in the picture.
Determine the User Friendly Name as follows:

'VBS92
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems("Control1")
strFriendlyName = CreateObject("WScript.Shell").RegRead("HKCR\" & objControl.Type & "\")
MsgBox strFriendlyName

Note
In order that example above works, a multimedia control should be inserted in the picture.

Example:
The following example displays the type for all objects in the picture "NewPDL1":

'VBS93
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1375

VBS Reference
2.4 Properties

lngAnswer = MsgBox(objScrItem.Type, vbOKCancel)


If vbCancel = lngAnswer Then Exit For
Next

See also
ScreenItem Object (Page 141)
Object types of the ScreenItem object (Page 158)

TypeAlarmHigh Property
Description
TRUE, when the upper limit value, at which an alarm is triggered, should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value. BOOLEAN writeread access.

See also
ScreenItem Object (Page 141)
Bar (Page 189)

TypeAlarmLow Property
Description
TRUE, when the lower limit value, at which an alarm is triggered, should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value. BOOLEAN writeread access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitHigh4 Property
Description
TRUE, when the "Reserve 4" upper limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

1376

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitHigh5 Property
Description
TRUE, when the "Reserve 5" upper limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitLow4 Property
Description
TRUE, when the "Reserve 4" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeLimitLow5 Property
Description
TRUE, when the "Reserve 5" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1377

VBS Reference
2.4 Properties

TypeToleranceHigh Property
Description
TRUE, when the "Tolerance high" lower limit value should be evaluated as a percentage.
FALSE, when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeToleranceLow Property
Description
TRUE, when the "Tolerance low" lower limit value should be evaluated as a percentage.
FALSE, when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeWarningHigh Property
Description
TRUE, when the "Warning high" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

TypeWarningLow Property
Description
TRUE, when the "Warning low" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

1378

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.20

2.4.20.1

Un - Up

UnitColor Property
Description
Defines the text color for the names of the unit of measurement. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

UnitFont Property
Description
Controls the display of the labeling for the unit of measurement. Read only access.
The following properties can be set:
- Font
- Font Style
- Font Size
- "Strikethrough" effect
- "Underline" effect

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1379

VBS Reference
2.4 Properties

UnitOffset Property
Description
This attribute defines the distance of the text for the unit of measurement in relation to the top
edge of the object. The text can only be positioned along the vertical diameter of the graduated
scale disk. The value of the property is related to the height of the object and is measured from
the top edge of the object to the base of the text.
The value range is 0 is 1.
0: The base of the text is at the top limit of the object. The text is no longer visible because it
is outside the object.
1: The base of the text is at the bottom limit of the object.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

UnitText Property
Description
Defines the text for the unit of measurement. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

UnselBGColor Property
Description
Defines or returns the background color of entries in the text list object which are not selected.
LONG write-read access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

1380

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

UnselTextColor Property
Description
Defines or returns the color of the text for entries in the text list object which are not selected.
LONG write-read access.

See also
Text list (Page 211)
ScreenItem Object (Page 141)

UpdateCycle Property
Description
Returns the type and frequency of updating the picture window in Runtime. Read only access.

See also
Picture Window (Page 194)
ScreenItem Object (Page 141)

UpperLimit Property
Description
TRUE, when the "UpperLimitColor" specification is to be used in order to identify the tag values
(from a trend referenced via "Index") which lie above the value defined in "UpperLimitValue".
BOOLEAN write-read access.

See also
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1381

VBS Reference
2.4 Properties

UpperLimitColor Property
Description
Defines the color to be used in order to identify the tag values (from a trend referenced via
"Index") which lie above the value defined in "UpperLimitValue". Whether the information is
evaluated is dependent on the value of the "UpperLimit" property. The color is defined as an
RGB value. LONG write-read access.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)
ScreenItem Object (Page 141)

UpperLimitTagName Property
Description
This defines the upper limit of the trend range, which is automatically taken from the variable
properties configured in PCS 7. Write/Read access.

UpperLimitValue Property
Description
Tag values (from a trend referenced via "Index") which lie above the value defined by
"UpperLimitValue" are identified by the color specified in "UpperLimitColor". Whether the
information is evaluated is dependent on the value of the "UpperLimit" property.

See also
ScreenItem Object (Page 141)
WinCC Online Table Control (before WinCC V7) (Page 294)
WinCC Online Trend Control (before WinCC V7) (Page 297)
WinCC Function Trend Control (before WinCC V7) (Page 290)

1382

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.20.2

Us

UseColumnBackColor property
Use column color / background - UseColumnBackColor
Specifies the settings to be activated for the background colors of columns.
Value

Explanation

TRUE

The background color settings are active in the "Time columns" or "TimeColumnBackColor" tabs and in the
"Value columns" or "ValueColumnBackColor" tabs.

FALSE

The background color settings are active in the "Display" tab.

The attribute can be assigned dynamic properties by means of the name


UseColumnBackColors. The data type is BOOLEAN.

UseColumnForeColor property
Use column color / font - UseColumnForeColor
Defines the active font color settings for the columns.
Value

Explanation

TRUE

The font color color settings are active in the "Time columns" or "TimeColumnForeColor" tabs and in the "Value
columns" or "ValueColumnForeColor" tabs.

FALSE

The font color settings are active in the "Display" tab.

The attribute can be assigned dynamic properties by means of the name


UseColumnForeColors. The data type is BOOLEAN.

UseMessageColor property
Show message colors - UseMessageColor
Sets the outputs of messages with colors as agreed by handshake.
Value

Explanation

TRUE

The message colors are displayed.

FALSE

The message colors are not displayed. Instead, the color settings defined for the table content are activated
on the "Display" tab.

The attribute can be assigned dynamic properties by means of the name UseMessageColor.
The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1383

VBS Reference
2.4 Properties

UseOnlineTags Property
Description
This defines whether or not the variable properties configured in PCS 7 are applied as trend
parameters. Write/Read access.

UseRangeSubstitutes Property
Description
TRUE, if a separate scaling of the value axis is displayed for the trends in Trend Control.
BOOLEAN write-read access.

UserData-Property
Description
Contains the value that is to be transferred to the VB script while running a customized menu
item or icon. STRING (write-read access)

Example:
Use the "User data" field in the "Menus and Toolbars" editor to apply a parameter to the
procedure
The following example shows the "ActivateScreen" procedure that executes the picture
change. Enter the picture name in the "User Data" field:

Sub ActivateScreen (ByVal Item)


Dim objScreen
Dim strScreenName
' "UserData" contains the screen name specified
' in editor menus and toolbars.
strScreenName = Item.Userdata
HMIRuntime.BaseScreenName = strScreenName
End Sub

UserName property
Description
Returns the name of the user who triggered the alarm object.

1384

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

See also
Alarms object (list) (Page 126)

UserValue1 Property
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
ScreenItem Object (Page 141)
Group Display (Page 208)

UserValue2-Eigenschaft
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

UserValue3 Property
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1385

VBS Reference
2.4 Properties

UserValue4 Property
Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

See also
Group Display (Page 208)
ScreenItem Object (Page 141)

UseSelectedTitleColor property
Selection color - UseSelectedTitleColor
Specifies whether to use a selection color for the headers of selected table cells.
Value

Explanation

TRUE

A selection color is used. The "Background" or "SelectedTitleColor" and "Font" or "SelectedTitleForeColor"


settings are active in Runtime.

FALSE

Selection color is not used. The "Background" and "Font" settings are disabled in Runtime.

The attribute can be assigned dynamic properties by means of the name


UseSelectedTitleColor. The data type is BOOLEAN.

UseSourceBackColors property
Apply background colors - UseSourceBackColors
Sets the background color derived from the control defined in the "Source" field.
Value

Explanation

TRUE

The background color from the interconnected control is used.

FALSE

The background color from the interconnected control is not used. The settings on the "Layout" tab are used.

The attribute can be assigned dynamic properties by means of the name


UseSourceBackColors. The data type is BOOLEAN.

1386

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

UseSourceForeColors property
Apply font colors - UseSourceForeColors
Sets the font colors derived from the control defined in the "Source" field.
Value

Explanation

TRUE

The font color of the interconnected control is activated.

FALSE

The font color from the connected control is not used. The settings on the "Layout" tab are used.

The attribute can be assigned dynamic properties by means of the name


UseSourceForeColors. The data type is BOOLEAN.

UseTableColor2 property
Row Color 2 - UseTableColor2
Specifies whether to use a second row color for the representation of the table.
Value

Explanation

TRUE

"Row color 2" and "Row color 1" are used alternately.

FALSE

The "Row color 1" settings are used for all rows.

The attribute can be assigned dynamic properties by means of the name UseTableColor2.
The data type is BOOLEAN.

UseTrendNameAsLabel property
UseTrendNameAsLabel
Sets the "TrendName" or "TrendLabel" attribute for labeling the trend in Runtime.
Value

Explanation

TRUE

Sets the "TrendName" attribute for labeling the trend in Runtime.

FALSE

Sets the "TrendLabel" attribute for labeling the trend in Runtime.

The attribute can be assigned dynamic properties by means of the name


UseTrendNameAsLabel. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1387

VBS Reference
2.4 Properties

2.4.21

2.4.21.1

Val - ValueAxis

Value Property
Description of Tag Object
Displays the value of the tags at the last read access or the value written or to be written. Value
represents the value of a tag. After calling in the "Read" method, the tag value read is returned.
Before writing, the new tag value required can be assigned to the property. After calling in the
"Write" method, the property contains the value last written.
VARIANT (write-read access)

Example:
The following example writes a new value in the "Tag1" tag:

'VBS94
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
objTag.Value = 50
objTag.Write

Description of WinCC Gauge Control


Defines the value to which the pointer points. Value Range: "ValueMin" to "ValueMax".

Description of DataItem Object


Returns a value copy or object reference. Furthermore, an already added value can be
changed via the value property.

Example:
The example shows how to add a value to the list, and how to output it as a trace. After that,
the value is changed, output again and then removed. It make sense to perform this in several
different actions.

'VBS198
HMIRuntime.DataSet.Add "motor1", 23
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine
HMIRuntime.DataSet("motor1").Value = 55
HMIRuntime.Trace "motor1: " & HMIRuntime.DataSet("motor1").Value & vbNewLine

1388

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

HMIRuntime.DataSet.Remove("motor1")

Note
For object references it must be ascertained that objects are multiread-enabled.

See also
WinCC Gauge Control (Page 264)
Write Method (Page 796)
Read Method (Page 767)
Tag Object (Page 152)
DataItem Object (Page 129)
ProcessValues Object (List) (Page 140)

ValueAxisAdd property
New - ValueAxisAdd
Creates a new value axis.
The attribute can be assigned dynamic properties by means of the name ValueAxisAdd. The
data type is STRING.

ValueAxisAlign property
Alignment - ValueAxisAlign
Specifies the mode of alignment of a selected value axis.
The following settings are available:
Value

Description

Explanation

left

The value axis selected is displayed on left side of the trend.

right

The value axis selected is displayed on right side of the trend.

The attribute can be assigned dynamic properties by means of the name ValueAxisAlign. The
data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1389

VBS Reference
2.4 Properties

ValueAxisAutoPrecisions property
Decimal places automatic - ValueAxisAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" or
"ValueAxisPrecisions" field is disabled.

FALSE

The value in the "Decimal places" or "ValueAxisPrecisions" field is active.

The attribute can be assigned dynamic properties by means of the name


ValueAxisAutoPrecisions. The data type is BOOLEAN.

ValueAxisAutoRange property
Value range automatic - ValueAxisAutoRange
Enables automatic calculation of the range of values.
Value

Explanation

TRUE

The range of values is calculated automatically.

FALSE

The range of values is calculated based on the values configured in the "from" and "to" or
"ValueAxisBeginValue" and "ValueAxisEndValue" fields.

The attribute can be assigned dynamic properties by means of the name


ValueAxisAutoRange. The data type is BOOLEAN.

ValueAxisBeginValue property
Value range from - ValueAxisBeginValue
Specifies the start value of the value axis selected. You can configure the value if the
"Automatic" option is disabled or "ValueAxisAutoRange" is "FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueAxisBeginValue. The data type is DOUBLE.

ValueAxisColor property
Value axis color - ValueAxisColor
Specifies the color of the time axis. The button opens the "Color selection" dialog to select the
color.
The setting is only active if the "Use trend color" option is disabled or if "ValueAxisInTrendColor"
is "FALSE".

1390

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name ValueAxisColor. The
data type is LONG.

ValueAxisCount property
ValueAxisCount
Defines the number of value axes configured.
The attribute can be assigned dynamic properties by means of the name ValueAxisCount. The
data type is LONG.

ValueAxisEndValue property
Value range to - ValueAxisEndValue
Specifies the end value of the value axis selected. You can configure the value if the
"Automatic" option is disabled or "ValueAxisAutoRange" is "FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueAxisEndValue. The data type is DOUBLE.

ValueAxisExponentialFormat property
Exponential notation - ValueAxisExponentialFormat
Sets exponential notation for the display of values of a value axis selected.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The attribute can be assigned dynamic properties by means of the name


ValueAxisExponentialFormat. The data type is BOOLEAN.

ValueAxisIndex property
ValueAxisIndex
References a value axis. Using this attribute you can assign the values of other attributes to
a specific value axis.
Values between 0 and "ValueAxisCount" minus 1 are valid for "ValueAxisIndex". Attribute
"ValueAxisCount" defines the number of value axes configured.
The "ValueAxisIndex" attribute can be assigned dynamic properties by means of attribute
ValueAxisRepos. The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1391

VBS Reference
2.4 Properties

ValueAxisInTrendColor property
Use trend color - ValueAxisInTrendColor
Sets the trend color for displaying the value axis selected. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The selected value axis is displayed in the trend color. The setting in the "Color" or
"ValueAxisColor" field is disabled.

FALSE

The value axis selected is displayed in the color set in the "Color" or "ValueAxisColor" field.

The attribute can be assigned dynamic properties by means of the name


ValueAxisInTrendColor. The data type is BOOLEAN.

ValueAxisInTrendColor property
Use trend color - ValueAxisInTrendColor
Sets the trend color for displaying the value axis selected. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The selected value axis is displayed in the trend color. The setting in the "Color" or "ValueAxisColor" field is
disabled.

FALSE

The value axis selected is displayed in the color set in the "Color" or "ValueAxisColor" field.

The attribute can be assigned dynamic properties by means of the name


ValueAxisInTrendColor. The data type is BOOLEAN.

ValueAxisLabel property
Label - ValueAxisLabel
Specifies the label of a value axis selected.
The attribute can be assigned dynamic properties by means of the name ValueAxisLabel. The
data type is STRING.

ValueAxisName property
Object name - ValueAxisName
Specifies the name of a value axis selected.

1392

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The "ValueAxisName" attribute can be assigned dynamic properties by means of attribute
ValueAxisRename. The data type is STRING.

ValueAxisPrecisions property
Decimal places - ValueAxisPrecisions
Specifies the decimal precision for displaying the value axis selected. The value can be
configured and is active in Runtime, if the "Automatic" option is disabled or
"ValueAxisAutoPrecisions" is "FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueAxisPrecisions. The data type is SHORT.

ValueAxisRemove property
Remove - ValueAxisRemove
Removes the selected value axis from the list.
The attribute can be assigned dynamic properties by means of the name ValueAxisRemove.
The data type is STRING.

ValueAxisRename property
ValueAxisRename
Renames a value axis which is referenced by means of "ValueAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name ValueAxisRename.
"ValueAxisRename" also sets a dynamic attribute "ValueAxisName". The data type is STRING.

ValueAxisRepos property
Up/Down - ValueAxisRepos
Changes the order of value axes. "Up" and "Down" move the value axis selected up or down
in the list.
The list order determines the value axis position in the trend window. The axis output position
is moved away from the trend if the value axis is moved further up in the list and the orientation
is the same.
The attribute can be assigned dynamic properties by means of the name ValueAxisRepos .
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1393

VBS Reference
2.4 Properties

ValueAxisScalingType property
Scaling - ValueAxisScalingType
Specifies the scaling mode for a selected value axis.
The following settings are available:
Value

Description

Explanation

Linear

Enables linear scaling of a value axis selected.

Logarithmic

Enables logarithmic scaling of a value axis selected.

Logarithmically negated

Enables scaling of a selected value value axis with logarithmic negation.

The attribute can be assigned dynamic properties by means of the name


ValueAxisScalingType. The data type is LONG.

ValueAxisTrendWindow property
Trend window - ValueAxisTrendWindow
Specifies the trend window for displaying the value axis selected. Define the available trend
windows in the "Trend window" tab.
The attribute can be assigned dynamic properties by means of the name
ValueAxisTrendWindow. The data type is STRING.

ValueAxisVisible property
Value axes - ValueAxisVisible
The list shows all value axes you created. Click a value axis entry in the list to adapt the
properties and to assign the value axis to a trend window.
Activate the value axes to be displayed in the trend windows in the list.
The attribute can be assigned dynamic properties by means of the name ValueAxisVisible .
The data type is BOOLEAN.

2.4.21.2

ValueColumn - Vi

ValueColumnAdd property
New - ValueColumnAdd
Creates a new value column.
The attribute can be assigned dynamic properties by means of the name ValueColumnAdd.
The data type is STRING.

1394

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ValueColumnAlign property
Alignment - ValueColumnAlign
Defines the mode of alignment of a selected value column.
The following settings are available:
Value

Description

Explanation

left

The selected value column is displayed on the left.

Centered

The selected value column is aligned to center.

right

The selected value column is displayed on the right.

The attribute can be assigned dynamic properties by means of the name ValueColumnAlign.
The data type is LONG.

ValueColumnAlignment Property
Description
The "Index" property references a pair of columns. "ValueColumnAlignment" defines the
alignment of the tag value for this column pair.
0: Tag values are entered aligned left.
1: Tag values are entered centered.
2: Tag values are entered aligned right.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

ValueColumnAutoPrecisions property
Automatic - ValueColumnAutoPrecisions
Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The decimal precision is defined automatically. The value in the "Decimal places" or
"ValueColumnPrecisions" field is disabled.

FALSE

The value in the "Decimal places" or "ValueColumnPrecisions" field is active.

The attribute can be assigned dynamic properties by means of the name


ValueColumnAutoPrecisions. The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1395

VBS Reference
2.4 Properties

ValueColumnBackColor property
Background color - ValueColumnBackColor
Specifies the background color of the value column selected. Use the button to open the "Color
selection" dialog.
The setting is only active if the "Background color" option is set or "UseColumnBackColor" is
"TRUE" in the "Use column color" field of the "General" tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnBackColor. The data type is LONG.

ValueColumnCaption property
Description - ValueColumnCaption
Defines the label of the value column selected.
The attribute can be assigned dynamic properties by means of the name
ValueColumnCaption. The data type is STRING.

ValueColumnCount property
ValueColumnCount
Defines the number of value columns configured.
The attribute can be assigned dynamic properties by means of the name ValueColumnCount.
The data type is LONG.

ValueColumnExponentialFormat property
Exponential notation - ValueColumnExponentialFormat
Sets exponential notation for the display of values of a value column selected.
Value

Explanation

TRUE

Display with exponential notation.

FALSE

Display with decimal notation.

The attribute can be assigned dynamic properties by means of the name


ValueColumnExponentialFormat. The data type is BOOLEAN.

1396

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ValueColumnForeColor property
Font color - ValueColumnForeColor
Specifies the font color of the value column selected. Use the button to open the "Color
selection" dialog.
The setting is only active if the "Font color" option is set or "UseColumnForeColor" is "TRUE"
in the "Use column color" field of the "General" tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnForeColor. The data type is LONG.

ValueColumnHideText property
ValueColumnHideText
Sets text format for displaying the content of a value column.
Value

Explanation

TRUE

The content is not displayed in text format.

FALSE

The content is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


ValueColumnHideText. The data type is BOOLEAN.

ValueColumnHideTitleText property
ValueColumnHideTitleText
Sets text format for displaying the value column header.
Value

Explanation

TRUE

The header is not displayed in text format.

FALSE

The header is displayed in text format.

The attribute can be assigned dynamic properties by means of the name


ValueColumnHideTitleText. The data type is BOOLEAN.

ValueColumnIndex property
ValueColumnIndex
References a configured value column. Using this attribute you can assign the values of other
attributes to a specific value column.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1397

VBS Reference
2.4 Properties
Values between 0 and "ValueColumnCount" minus 1 are valid for "ValueColumnIndex".
Attribute "ValueColumnCount" defines the number of value columns configured.
The "ValueColumnIndex" attribute can be assigned dynamic properties by means of attribute
ValueColumnRepos. The data type is LONG.

ValueColumnLength property
Length in characters - ValueColumnLength
Specifies the width of a selected value column.
The attribute can be assigned dynamic properties by means of the name
ValueColumnLength. The data type is LONG.

ValueColumnName property
Object name - ValueColumnName
Specifies the name of a selected value column.
The "ValueColumnName" attribute can be assigned dynamic properties by means of attribute
ValueColumnRename. The data type is STRING.

ValueColumnPrecisions property
Decimal places - ValueColumnPrecisions
Specifies the decimal precision for displaying the data of a value column selected. The value
can be entered if the "Automatic" option is disabled or "ValueColumnAutoPrecisions" is
"FALSE".
The attribute can be assigned dynamic properties by means of the name
ValueColumnPrecisions. The data type is SHORT.

ValueColumnProvider property
Data source - ValueColumnProvider
Specifies the data source for a selected value column.
The following settings are available:
Value

Description

Explanation

Archive tags

Data source with archive tags of a process value archive.

Online tags

Data source with online tags derived from tag management.

1398

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The attribute can be assigned dynamic properties by means of the name
ValueColumnProvider. The data type is LONG.

ValueColumnProviderCLSID property
ValueColumnProviderCLSID
Indicates the data source of the value column selected.
Value

Explanation

{416A09D2-8B5A-11D28B81-006097A45D48}

Data source with archive tags of a process value archive.

{A3F69593-8AB0-11D2A440-00A0C9DBB64E}

Data source with online tags derived from tag management.

The attribute can be assigned dynamic properties by means of the name


ValueColumnProviderCLSID. The data type is STRING.

ValueColumnRemove property
Remove - ValueColumnRemove
Removes the selected value column from the list.
The attribute can be assigned dynamic properties by means of the name
ValueColumnRemove. The data type is STRING.

ValueColumnRename property
ValueColumnRename
Renames a value column which is referenced by means of "ValueColumnIndex" attribute.
The attribute can be assigned dynamic properties by means of the name
ValueColumnRename. "ValueColumnRename" also sets a dynamic attribute
"ValueColumnName". The data type is STRING.

ValueColumnRepos property
Up/Down - ValueColumnRepos
Changes the sorting order of the value columns. "Up" and "Down" move the value column
selected up or down in the list.
The sorting order in the list determines the order of value columns after the time column if
several value columns are assigned to the same time column. Higher positions of the value
column in the list moves it to closer proximity towards the time column.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1399

VBS Reference
2.4 Properties
You change the order of time columns and their assigned value columns in the "Time columns"
tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnRepos. The data type is LONG.

ValueColumnSelectTagName property
ValueColumnSelectTagName
Opens a dialog for selecting the tag name for the data source of the value column in WinCC
OnlineTableControl. Programmers can set this attribute to allow users to select a tag name by
means of a button, for example.
The attribute can be assigned dynamic properties by means of the name
ValueColumnSelectTagName. The data type is BOOLEAN.

ValueColumnShowIcon property
ValueColumnShowIcon
Enables the display of value column contents as icon.
Value

Explanation

TRUE

The content is visualized as icon.

FALSE

The content is not visualized as icon.

The attribute can be assigned dynamic properties by means of the name


ValueColumnShowIcon. The data type is BOOLEAN.

ValueColumnShowTitleIcon property
ValueColumnShowTitleIcon
Enables display of the value column header as icon.
Value

Explanation

TRUE

The header is displayed as icon.

FALSE

The header is not displayed as icon.

The attribute can be assigned dynamic properties by means of the name


ValueColumnShowTitleIcon. The data type is BOOLEAN.

1400

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

ValueColumnSort property
ValueColumnSort
Defines the sorting order of the value column referenced in "ValueColumnIndex" .
The following settings are available:
Value

Description

Explanation

No

No sorting

Ascending

Ascending order, starting at the lowest value.

Descending

Descending order, starting at the highest value.

The attribute can be assigned dynamic properties by means of the name ValueColumnSort .
The data type is LONG.

ValueColumnSortIndex property
ValueColumnSortIndex
Defines the sorting order of the value column referenced in "ValueColumnIndex". The sorting
criterion is removed from "ValueColumnSort" if you set a "0" value..
The attribute can be assigned dynamic properties by means of the name
ValueColumnSortIndex. The data type is LONG.

ValueColumnState property
ValueColumnState
Displays the data connection status of a selected value column in Runtime.
The attribute can be assigned dynamic properties by means of the name ValueColumnState.
The data type is LONG.

ValueColumnTagName property
Tag name - ValueColumnTagName
Displays the name of connected tags. You can change the tag connection using the selection
button.
The attribute can be assigned dynamic properties by means of the name
ValueColumnTagName. The data type is STRING.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1401

VBS Reference
2.4 Properties

ValueColumnTimeColumn property
Time column - ValueColumnTimeColumn
Specifies the time column for displaying the value column selected. Define the available time
columns in the "Time columns" tab.
The attribute can be assigned dynamic properties by means of the name
ValueColumnTimeColumn. The data type is STRING.

ValueColumnVisible property
Value columns - ValueColumnVisible
The list shows all value columns you created. Click a value column entry in the list to adapt
the properties, to assign the value column, and to define the data connection.
Select the value columns to be displayed in the table from the list. Value columns are displayed
if interconnected with a time column.
The attribute can be assigned dynamic properties by means of the name
ValueColumnVisible . The data type is BOOLEAN.

ValueMax Property
Description
Defines the value at the end of the scale. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

ValueMin Property
Description
Defines the value at the start of the scale. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

1402

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

Variable Property
Description
The "Index" property references a pair of columns. "Tag" defines the name of the tag which
should be connected to this column pair.

See also
WinCC Online Table Control (before WinCC V7) (Page 294)
ScreenItem Object (Page 141)

VerticalGridLines property
Vertical - VerticalGridLines
Enables the display of vertical dividers.
Value

Explanation

TRUE

Enables the displays of vertical dividers.

FALSE

Disables the display of vertical dividers.

The attribute can be assigned dynamic properties by means of the name VerticalGridLines.
The data type is BOOLEAN.

Visible Property
Description
witches an object visible or invisible or issues a corresponding value:
TRUE : Object is visible
FALSE : Object is invisible
VARIANT_BOOL (write-read access)

Example:
The following example sets all the objects in the picture "NewPDL1" to invisible:

'VBS95
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1403

VBS Reference
2.4 Properties

Set objScreen = HMIRuntime.Screens("NewPDL1")


For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Visible = False
Next

See also
ScreenItem Object (Page 141)
Layer Object (Page 136)
HMIRuntime Object (Page 134)

2.4.22

2.4.22.1

Warning Property

Description
Defines the start of the "Warning zone" as a scale value. Write/Read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

2.4.22.2

WarningColor Property

Description
Defines the color of the "Warning zone" o the scale. LONG write-read access.

See also
WinCC Gauge Control (Page 264)
ScreenItem Object (Page 141)

1404

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.22.3

WarningHigh Property

Description
Defines or returns the upper limit value for "Warning High".
In order that the limit value is monitored, the "CheckWarningHigh" property must be set to
TRUE.
The display on reaching the limit value and the type of evaluation are defined by means of the
"ColorWarningHigh" and "TypeWarningHigh" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.22.4

WarningLow Property

Description
Defines or returns the lower limit value for "Warning Low".
In order that the limit value is monitored, the "CheckWarningLow" property must be set to
TRUE.
The display on reaching the limit value and the type of evaluation are defined by means of the
"ColorWarningLow" and "TypeWarningLow" properties.

See also
Bar (Page 189)
ScreenItem Object (Page 141)

2.4.22.5

Width Property

Description
Sets or outputs the width of an object in pixels.
LONG

Example:
The following example doubles the width of all objects in the pictures "NewPDL1" whose name
begins with "Button":

'VBS96
Dim objScreen

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1405

VBS Reference
2.4 Properties

Dim cmdButton
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'Get all "Buttons"
strName = objScreen.ScreenItems(lngIndex).ObjectName
If "Button" = Left(strName, 6) Then
Set cmdButton = objScreen.ScreenItems(strName)
cmdButton.Width = cmdButton.Width * 2
End If
Next

See also
Height Property (Page 430)
ScreenItem Object (Page 141)

2.4.22.6

WinCCStyle property

Description
Defines the style in which the object is displayed.
User Defined
Global
Windows Style

2.4.22.7

Shows the object according to the respective settings.


Shows the object in a globally defined design.
Shows the object in Windows style.

WindowBorder Property

Description
TRUE, when the window is displayed with borders in Runtime. Read only access.

See also
Picture Window (Page 194)
Application Window (Page 188)
ScreenItem Object (Page 141)

1406

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.22.8

WindowPositionMode property

Description
Defines the position and scaling of the picture window on the screen. It is only effective if the
"Independent window" attribute is set to TRUE.
Standard
Center
Maximize

2.4.22.9

The picture window is positioned in its original size in the configured position on
the screen.
The picture window is positioned in its original size, centered on the screen.
The picture window is scaled to the size of the screen.

WindowsStyle property

Description
Defines whether the object is displayed in the Windows style of WinCC version 6.2. It can only
be selected if "WinCC Classic" is chosen as the current design.
TRUE if the object is displayed in the Windows style of WinCC version 6.2.
FALSE if the object is not displayed in the Windows style of WinCC version 6.2.

2.4.22.10 WindowsStyle Property


Description
TRUE, when the object complies with the general Windows style (e.g. gray buttons without
borders). BOOLEAN write-read access. Note:
When this property is set to "True", the properties which do not comply with the Windows
style are ignored (e.g. "BorderWidth").
On the other hand, the definition of a "BorderWidth" or a background color other than gray
causes "WindowsStyle" to receive the value"False".
Exceptions here are the flash attributes: The definition of flash attributes does not
automatically lead to the deactivation of the "WindowsStyle" attribute.

See also
Slider (Page 226)
Button (Page 215)
ScreenItem Object (Page 141)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1407

VBS Reference
2.4 Properties

2.4.22.11 WindowType Property


Description
Defines the use of the message window.
0 - Message list: shows the currently pending messages.
1 - Short-term archive list: shows the archived messages.
2 - Long-term archive list: shows the archived messages.
3 - Lock list: shows the currently locked messages.
4 - Hit list: To display the statistical information of messages.

See also
WinCC Alarm Control (before WinCC V7) (Page 288)
ScreenItem Object (Page 141)

2.4.22.12 WithAxes Property


Description
TRUE, when the scale should be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

2.4.22.13 WithLabels Property


Description
TRUE, when the scale labels should be displayed. BOOLEAN write-read access.

See also
WinCC Slider Control (Page 281)
ScreenItem Object (Page 141)

1408

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.23

X-Z

2.4.23.1

XAxisColor property (before WinCC V7)

Description
Use this attribute to define the color for the common X-axis. The color is defined as an RGB
value. LONG write-read access.

2.4.23.2

X/YAxisAdd property

New - X/YAxisAdd
Creates a new X or Y axis.
The X axis attribute can be assigned dynamic properties by means of the name XAxisAdd .
The Y axis attribute can be assigned dynamic properties by means of the name YAxisAdd .
The data type is STRING.

2.4.23.3

X/YAxisAlign property

Alignment - X/YAxisAlign
Defines the alignment mode for a selected axis.
The following settings are available for the X axis:
Value

Description

Explanation

Bottom

The X axis selected is displayed below the trend.

Top

The X axis selected is displayed above the trend.

The X axis attribute can be assigned dynamic properties by means of the name XAxisAlign.
The data type is LONG.
The following settings are available for the Y axis:
Value

Description

Explanation

left

The X axis selected is displayed on left side of the trend.

right

The X axis selected is displayed on right side of the trend.

The Y axis attribute can be assigned dynamic properties by means of the name YAxisAlign.
The data type is LONG.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1409

VBS Reference
2.4 Properties

2.4.23.4

X/YAxisAutoPrecisions property

Decimal places automatic - X/YAxisAutoPrecisions


Enables automatic setting of the decimal precision.
Value

Explanation

TRUE

The number of decimal places is set automatically. The value in the "Decimal places" or "X/
YAxisPrecisions" field is disabled.

FALSE

The value in the "Decimal places" or "X/YAxisPrecisions" field is active.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisAutoPrecisions.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisAutoPrecisions.
The data type is BOOLEAN.

2.4.23.5

X/YAxisAutoRange property

Value range automatic - X/YAxisAutoRange


Enables automatic calculation of the value range of the axis selected.
Value

Explanation

TRUE

The range of values is calculated automatically.

FALSE

The range of values is calculated based on the values configured in the "from" and "to" or "X/YAxisBeginValue"
and "X/YAxisEndValue" fields.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisAutoRange.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisAutoRange.
The data type is BOOLEAN.

2.4.23.6

X/YAxisBeginValue property

Value range from - X/YAxisBeginValue


Specifies the lower range of values of the axis selected. You can configure the value if the
"Automatic" option is disabled or "X/YAxisAutoRange" is "FALSE".
The X axis attribute can be assigned dynamic properties by means of the name
XAxisBeginValue.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisBeginValue.

1410

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties
The data type is DOUBLE.

2.4.23.7

X/YAxisColor property

Color XY axis - X/YAxisColor


Specifies the color of the axis selected. The button opens the "Color selection" dialog to select
the color.
The setting is only active if the "Use trend color" field is disabled or "X/YAxisInTrendColor" is
"FALSE".
The X axis attribute can be assigned dynamic properties by means of the name XAxisColor.
The Y axis attribute can be assigned dynamic properties by means of the name YAxisColor.
The data type is LONG.

2.4.23.8

X/YAxisEndValue property

Value range to - X/YAxisEndValue


Specifies the upper range of values of the axis selected. You can configure the value if the
"Automatic" option is disabled or "X/YAxisAutoRange" is "FALSE".
The X axis attribute can be assigned dynamic properties by means of the name
XAxisEndValue.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisEndValue.
The data type is DOUBLE.

2.4.23.9

X/YAxisExponentialFormat property

Exponential notation - X/YAxisExponentialFormat


Enables the exponential notation for visualization of a selected axis.
Value

Explanation

TRUE

The values are displayed with exponential notation.

FALSE

The values are displayed with decimal notation.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisExponentialFormat.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisExponentialFormat.
The data type is BOOLEAN.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1411

VBS Reference
2.4 Properties

2.4.23.10 X/YAxisInTrendColor property


Use trend color - X/YAxisInTrendColor
Enables the display of an axis selected in the trend color. The color of the first trend is activated
if several trends are displayed in the trend window. Define the order of trends on the "Trends"
tab.
Value

Explanation

TRUE

The axis selected is displayed in the trend color. The setting in the "Color" or "X/YAxisColor"
field is disabled.

FALSE

The axis selected is displayed in the color set in the "Color" or "X/YAxisColor" field.

The X axis attribute can be assigned dynamic properties by means of the name
XAxisInTrendColor.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisInTrendColor.
The data type is BOOLEAN.

2.4.23.11 X/YAxisLabel property


Label - X/YAxisLabel
Defines the label text for a selected axis.
The X axis attribute can be assigned dynamic properties by means of the name XAxisLabel.
The Y axis attribute can be assigned dynamic properties by means of the name YAxisLabel.
The data type is STRING.

2.4.23.12 X/YAxisName property


Object name - X/YAxisName
Specifies the name of a selected axis.
Attribute "XAxisName" can be assigned dynamic properties for the X axis by means of
XAxisRename attribute.
Attribute "YAxisName" can be assigned dynamic properties for the Y axis by means of
YAxisRename attribute.
The data type is STRING.

1412

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.23.13 X/YAxisPrecisions property


Decimal places - X/YAxisPrecisions
Specifies the decimal precision for displaying the axis selected. The value can be configured
and is active in Runtime, if the "Automatic" option is disabled or "X/YAxisAutoPrecisions" is
"FALSE".
The X axis attribute can be assigned dynamic properties by means of the name
XAxisPrecisions.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisPrecisions.
The data type is SHORT.

2.4.23.14 X/YAxisRemove property


Remove - X/YAxisRemove
Removes the selected axis from the list.
The X axis attribute can be assigned dynamic properties by means of the name
XAxisRemove .
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisRemove .
The data type is STRING.

2.4.23.15 X/YAxisRepos property


Up/Down - X/YAxisRepos
Changes the sorting order of the axes. "Up" and "Down" move the axis selected up or down
in the list.
The list order determines the axis position in the trend window. The axis output position is
moved away from the trend if the axis is moved further up in the list and the orientation is the
same.
The X axis attribute can be assigned dynamic properties by means of the name XAxisRepos .
The Y axis attribute can be assigned dynamic properties by means of the name YAxisRepos .
The data type is LONG.

2.4.23.16 X/YAxisScalingType property


Scaling - X/YAxisScalingType
Defines the scaling mode for a selected axis.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1413

VBS Reference
2.4 Properties
The following settings are available:
Value

Description

Linear

Logarithmic

Logarithmically negated

The X axis attribute can be assigned dynamic properties by means of the name
XAxisScalingType.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisScalingType.
The data type is LONG.

2.4.23.17 X/YAxisTrendWindow property


Trend window - X/YAxisTrendWindow
Specifies the trend window for a selected axis. Define the available trend windows in the "Trend
window" tab.
The X axis attribute can be assigned dynamic properties by means of the name
XAxisTrendWindow.
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisTrendWindow.
The data type is STRING.

2.4.23.18 X/YAxisVisible property


X/Y axes - X/YAxisVisible
The list shows all axes you created. Click an axis entry in the list to adapt the properties and
to assign the axis to a trend window.
Activate the axes to be displayed in the trend windows in the list.
The X axis attribute can be assigned dynamic properties by means of the name
XAxisVisible .
The Y axis attribute can be assigned dynamic properties by means of the name
YAxisVisible .
The data type is BOOLEAN.

1414

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.23.19 XAxisCount property


XAxisCount
Defines the number of X axes configured.
The attribute can be assigned dynamic properties by means of the name XAxisCount. The
data type is LONG.

2.4.23.20 XAxisIndex property


XAxisIndex
References a configured X axis. Using this attribute you can assign the values of other
attributes to a specific X axis.
Values between 0 and "XAxisCount" minus 1 are valid for "Index"; the attribute "XAxisCount"
defines the number of configured X axes.
The "XAxisIndex" attribute can be assigned dynamic properties by means of attribute
XAxisRepos. The data type is LONG.

2.4.23.21 XAxisRename property


XAxisRename
Renames the X axis which is referenced by means of "XAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name XAxisRename.
"XAxisRename" also sets a dynamic attribute "XAxisName". The data type is STRING.

2.4.23.22 YAxisCount property


YAxisCount
Defines the number of Y axes configured.
The attribute can be assigned dynamic properties by means of the name YAxisCount. The
data type is LONG.

2.4.23.23 YAxisIndex property


YAxisIndex
References a configured Y axis. Using this attribute you can assign the values of other
attributes to a specific Y axis.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1415

VBS Reference
2.4 Properties
Values between 0 and "YAxisCount" minus 1 are valid for "Index". Attribute "YAxisCount"
defines the number of configured Y axes.
The "YAxisIndex" attribute can be assigned dynamic properties by means of attribute
YAxisRepos. The data type is LONG.

2.4.23.24 YAxisRename property


YAxisRename
Renames the Y axis which is referenced by means of "YAxisIndex" attribute.
The attribute can be assigned dynamic properties by means of the name YAxisRename.
"YAxisRename" also sets a dynamic attribute "YAxisName". The data type is STRING.

2.4.23.25 ZeroPoint Property


Description
Defines or returns the position of the zero point of the bar graph.
Specify the value as a %age of the total bar height. The zero point can also be outside of the
range represented.
The "ScalingType" property must be set to "2" and "Scaling" to TRUE.

See also
ScreenItem Object (Page 141)
Bar (Page 189)

2.4.23.26 ZeroPointValue Property


Description
Defines the value of the zero point of the scale indicator.
Defines or returns the absolute value for the zero point.

See also
Bar (Page 189)
3D Bar (Page 184)
ScreenItem Object (Page 141)

1416

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.4 Properties

2.4.23.27 Zoom Property


Description
Sets the zoom factor within a picture or picture window or reads it out.
If the indicated zoom factor is smaller than the minimum value, the zoom factor is automatically
set to the minimum value. If the indicated zoom factor is larger than the minimum value, the
zoom factor is automatically set to the maximum value.
The minimum value of the zoom factor is at 2%, the maximum value at 800%.
With the Screen Object the zoom factor is indicated as a numeric value and with a picture
window object, it is indicated in percent.

Example:
The following example doubles the zoom factor of the current picture:

'VBS97
HMIRuntime.ActiveScreen.Zoom = HMIRuntime.ActiveScreen.Zoom * 2

See also
Picture Window (Page 194)
Screen Object (Page 146)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1417

VBS Reference
2.5 Methods

2.5

Methods

2.5.1

Methods

Overview
Methods, which are applied to individual objects, can be used to read out tag values for further
processing or displaying diagnostics messages in Runtime.

Available Methods in VBS


Activate

MoveToNext

ShowInfoText

ActivateDynami GetStatusbarElementCollection
c

MoveToNextLine

ShowLockDialog

Add

GetTimeAxis

MoveToNextPage

ShowLockList

AttachDB

GetTimeAxisCollection

MoveToPrevious

ShowLongTermArchiveList

CalculateStatist GetTimeColumn
ic

MoveToPreviousLine

ShowMessageList

CopyRows

GetTimeColumnCollection

MoveToPreviousPage

ShowPercentageAxis

CreateTagSet

GetToolbarButton

NextColumn

ShowPropertyDialog

CutRows

GetToolbarButtonCollection

NextTrend

ShowSelectArchive

DeactivateDyna GetTrend
mic

OneToOneView

ShowSelection

DeleteRows

GetTrendCollection

PasteRows

ShowSelectionDialog

DetachDB

GetTrendWindow

PreviousColumn

ShowSelectTimeBase

Edit

GetTrendWindowCollection

PreviousTrend

ShowShortTermArchiveList

Export

GetValueAxis

Print

ShowSort

GetColumn

GetValueAxisCollection

QuitHorn

ShowSortDialog

GetColumnColl
ection

GetValueColumn

QuitSelected

ShowTagSelection

GetHitlistColum GetValueColumnCollection
n

QuitVisible

ShowTimebaseDialog

GetHitlistColum GetXAxis
nCollection

Read

ShowTimeSelection

GetMessageBl
ock

GetXAxisCollection

ReadTags

ShowTrendSelection

GetMessageBl
ockCollection

GetYAxis

Refresh

StartStopUpdate

GetMessageCo GetYAxisCollection
lumn

Remove

Stop

GetMessageCo HideAlarm
lumnCollection

RemoveAll

Trace

GetOperatorMe Item Method


ssage

Restore

UnhideAlarm

1418

GetStatusbarElement

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
GetOperatorMe LockAlarm
ssageCollection

SelectedStatisticArea

UnlockAlarm

GetRulerBlock

LoopInAlarm

ServerExport

Write

GetRulerBlock
Collection

MoveAxis

ServerImport

WriteTags

GetRulerColum MoveRuler (Page 756)


n

ShowColumnSelection

ZoomArea

GetRulerColum MoveToFirst
nCollection

ShowComment

ZoomInOut

GetRulerData

MoveToFirstLine

ShowDisplayOptionsDialog

ZoomInOutTime

GetStatisticAre
aColumn

MoveToFirstPage

ShowEmergencyQuitDialog

ZoomInOutValues

GetStatisticAre MoveToLast
aColumnCollect
ion

ShowHelp

ZoomInOutX

GetStatisticRes MoveToLastLine
ultColumn

ShowHideList

ZoomInOutY

GetStatisticRes MoveToLastPage
ultColumnColle
ction

ShowHitList

ZoomMove

2.5.2

Methods A to E

2.5.2.1

Activate Method

Function
Activates the specified picture and picture element, respectively.
Note
Focus assignments should not be configured during a ButtonDown event. Since the focus is
specifically requested during the ButtonDown event, invalid states may occur.

Syntax
Expression.Activate
Expression
Necessary. An expression which returns an object of type "Screen" or "ScreenItem".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1419

VBS Reference
2.5 Methods

Parameters
--

Examples
The following example shows the use for type "Screen":

'VBS98
Dim objScreen
MsgBox HMIRuntime.ActiveScreen.ObjectName
'Output of active screen
Set objScreen = HMIRuntime.Screens("ScreenWindow1")
objScreen.Activate
'Activate "ScreenWindow1"
MsgBox HMIRuntime.ActiveScreen.ObjectName
'New output of active screen

The following example shows the use for type "ScreenItem":

'VBS158
MsgBox HMIRuntime.ActiveScreen.ActiveScreenItem.ObjectName
HMIRuntime.ActiveScreen.ScreenItems("IOField1").Activate
MsgBox HMIRuntime.ActiveScreen.ActiveScreenItem.ObjectName
item

'Output of active screen item


'New output of active screen

See also
ScreenItem Object (Page 141)
Screen Object (Page 146)

2.5.2.2

ActivateDynamic method

Function
Dynamically activates a trigger for the defined property and with the defined cycle during
runtime. Every time the trigger is activated a different activation cycle can be used.
Examples of this method are available in chapter "VBS for creating procedures and action >
Creating and editing actions > Trigger > Animation trigger".

Syntax
Expression.ActivateDynamic (ByVAl bstrPropertyName As String, ByVal
bstrCycleName As String)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

1420

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Parameters
Parameters

Description

bstrPropertyName

Name of property to which trigger relates.

bstrCycleName

Name of activation cycle, e.g. "CycleTime1s".

See also
Animation trigger (Page 82)

2.5.2.3

Add Method

Description of TagSet Object


Adds a tag to the list. A tag may be added to the tag object by using name or reference.

syntax
Expression.Add [Tag]
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
VARIANT
Parameters

Description

Tag

Name of a WinCC tag or reference to a tag object


to be added to the list.

Example:
In the following example, a TagSet object is generated and a tag is added.

'VBS170
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"

Tag objects may also be added as follows.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1421

VBS Reference
2.5 Methods

'VBS171
Dim Tag
Set Tag = HMIRuntime.Tags("Motor2")
Dim group2
Set group2 = HMIRuntime.Tags.CreateTagSet
group2.Add Tag

Description of DataSet Object


Adds a value or object reference to the list.
Note
The Data Set Object does not support classes.
Objects of type Screen, Screens, ScreenItem, ScreenItems, Tag and TagSet cannot be
included in the DataSet list.
For object references it must be ascertained that objects are multiread-enabled.

syntax
Expression.Add [vtName], [vtUserData]
Expression
Necessary. An expression which returns an object of type "DataSet".

Parameters
VARIANT
Parameters

Description

vtName

Name by which value or tag are to be added to list.

vtUserData

Value to be added to list.

Example:
In this example, a value is included in the DataSet list.

'VBS172
HMIRuntime.DataSet.Add "Motor1",23

1422

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

See also
TagSet Object (List) (Page 156)
DataSet Object (List) (Page 132)

2.5.2.4

AttachDB method

Function
Executes the "Connect backup" key function of the control.

Syntax
Ausdruck.AttachDB()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.2.5

CalculateStatistic method

Function
Executes the "Calculate statistics" key function of the OnlineTrendControl and
OnlineTableControl.

Syntax
Ausdruck.CalculateStatistic()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.2.6

CopyRows method

Function
Executes the "Copy lines" key function of the control.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1423

VBS Reference
2.5 Methods

Syntax
Ausdruck.CopyRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.2.7

Create method

Function
Creates a new Alarm object.

Syntax
Expression.Create (VARIANT vtApplication)
Expression
Necessary. An expression which returns an object of type "Alarm".

Parameters
VARIANT
Parameters

Description

vtApplication

Name of alarm object (optional)

See also
Alarms object (list) (Page 126)

2.5.2.8

CreateTagSet Method

Function
Creates a new TagSet object. This object may be used for optimized multi-tag access.

syntax
Expression.CreateTagSet()

1424

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
VARIANT

Example:
The following example shows how to create a TagSet object.

'VBS168
'Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet

See also
TagSet Object (List) (Page 156)
Tags Object (List) (Page 155)

2.5.2.9

CutRows method

Function
Executes the "Cut lines" key function of the UserArchiveControl.

Syntax
Ausdruck.CutRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.2.10

DeactivateDynamic method

Function
Deactivates the trigger used with the "ActivateDynamic" method for the defined property during
runtime.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1425

VBS Reference
2.5 Methods

Syntax
Ausdruck.DeactivateDynamic(ByVal bstrPropertyName As String)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
String

2.5.2.11

Parameters

Description

bstrPropertyName

Name of property to which trigger relates.

DeleteRows method

Function
Executes the "Delete Rows" key function of the UserArchiveControl.

Syntax
Ausdruck.DeleteRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.2.12

DetachDB method

Function
Executes the "Disconnect backup" key function of the control.

Syntax
Ausdruck.DetachDB()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

1426

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Parameters
--

2.5.2.13

Edit method

Function
Executes the "Edit" key function of the OnlineTableControl.

Syntax
Ausdruck.Edit()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.2.14

Export Method

Function
Executes the "Export archive" or "Export data" key function of the control.

Syntax
Ausdruck.Export()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1427

VBS Reference
2.5 Methods

2.5.3

Get methods

2.5.3.1

GetColumn method

Function
Returns the name or index designated column object of the WinCC UserArchiveControl as
type "ICCAxUAColumn".

Syntax
Ausdruck.GetColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of UserArchiveControl.

Example

'VBS312
Dim ctrl
Dim objColumn
Set ctrl = ScreenItems("UAControl")
Set objColumn = ctrl.GetColumn("Field1")
objColumn.Length = 30
Set objColumn = ctrl.GetColumn(3)
objColumn.Align = 2

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Column" listing, for example, you write "objColumn.Align" instead of
"objColumn.ColumnAlign".

1428

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

See also
Column object (list) (Page 235)

2.5.3.2

GetColumnCollection method

Function
Returns the list of all column objects of the WinCC UserArchiveControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS313
Dim ctrl
Dim coll
Dim field
Set ctrl = ScreenItems("UAControl")
Set coll = ctrl.GetColumnCollection
HMIRuntime.Trace "Number of fields:" & coll.Count & vbCrLf
For Each field In coll
HMIRuntime.Trace field.Name & vbCrLf
HMIRuntime.Trace field.Type & vbCrLf
HMIRuntime.Trace field.Length & vbCrLf
HMIRuntime.Trace field.Caption & vbCrLf

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1429

VBS Reference
2.5 Methods

Next

See also
Column object (list) (Page 235)

2.5.3.3

GetHitlistColumn method

Function
Returns the name or index designated column object of the hitlist of the WinCC AlarmControl
as type "ICCAxMessageColumn".

Syntax
Expression.GetHitlistColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of hitlist column

Example

'VBS314
Dim ctrl
Dim objHitlistColumn
Set ctrl = ScreenItems("AlarmControl")
Set objHitlistColumn = ctrl.GetHitlistColumn("Date")
objHitlistColumn.Sort = 2
Set objHitlistColumn = ctrl.GetHitlistColumn("AverageComeGo")
objHitlistColumn.Visible = FALSE

1430

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "HitlistColumn" listing, for example, you write "objHitlistColumn.Visible" instead of
"objHitlistColumn.HitlistColumnVisible".

See also
HitlistColumn object (list) (Page 236)

2.5.3.4

GetHistlistColumnCollection method

Function
Returns the list of all column objects of the WinCC AlarmControl hitlist as type
"ICCAxCollection".

Syntax
Expression.GetHitlisteColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1431

VBS Reference
2.5 Methods

Example

'VBS315
Dim ctrl
Dim coll
Dim hitlistcol
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetHitlistColumnCollection
HMIRuntime.Trace "Number of hitlist columns:" & coll.Count & vbCrLf
For Each hitlistcol In coll
HMIRuntime.Trace hitlistcol.Index & vbCrLf
HMIRuntime.Trace hitlistcol.Name & vbCrLf
HMIRuntime.Trace hitlistcol.Sort & vbCrLf
HMIRuntime.Trace hitlistcol.SortIndex & vbCrLf
Next

See also
HitlistColumn object (list) (Page 236)

2.5.3.5

GetMessageBlock method

Function
Returns the name or index designated message block object of the WinCC AlarmControl as
type "ICCAxMessageBlock".

Syntax
Expression.GetMessageBlock(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of message block.

Example

'VBS316

1432

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Dim ctrl
Dim objMsgBlock
Set ctrl = ScreenItems("AlarmControl")
Set objMsgBlock = ctrl.GetMessageBlock("Date")
objMsgBlock.Align = 2
Set objMsgBlock = ctrl.GetMessageBlock("Number")
objMsgBlock.LeadingZeros = 4

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "MessageBlock" listing, for example, you write "objMsgBlock.Align" instead of
"objMsgBlock.MessageBlockAlign".

See also
MessageBlock object (list) (Page 237)

2.5.3.6

GetMessageBlockCollection method

Function
Returns the list of all message block objects of the WinCC AlarmControl as type
"ICCAxCollection".

Syntax
Expression.GetMessageBlockCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1433

VBS Reference
2.5 Methods
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS317
Dim ctrl
Dim coll
Dim msgblock
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetMessageBlockCollection
For Each msgblock In coll
msgblock.Align = 1
msgblock.Length = 12
msgblock.Selected = TRUE
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "MessageBlock" listing, for example, you write "msgblock.Align" instead of
"msgblock.MessageBlockAlign".

See also
MessageBlock object (list) (Page 237)

2.5.3.7

GetMessageColumn method

Function
Returns the name or index designated column object of the WinCC AlarmControl as type
"ICCAxMessageColumn".

Syntax
Expression.GetMessageColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

1434

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column in message list.

Example

'VBS318
Dim ctrl
Dim objMessColumn
Set ctrl = ScreenItems("AlarmControl")
Set objMessColumn = ctrl.GetMessageColumn("Date")
objMessColumn.Visible = FALSE
Set objMessColumn = ctrl.GetMessageColumn("Number")
objMessColumn.Sort = 1

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "MessageColumn" listing, for example, you write "objMessColumn.Visible" instead
of "objMessColumn.MessageColumnVisible".

See also
MessageColumn object (list) (Page 238)

2.5.3.8

GetMessageColumnCollection method

Function
Returns the list of all column objects of the WinCC AlarmControl as type "ICCAxCollection".

Syntax
Expression.GetMessageColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1435

VBS Reference
2.5 Methods

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS319
Dim ctrl
Dim coll
Dim msgcol
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetMessageColumnCollection
HMIRuntime.Trace "Number of message columns:" & coll.Count & vbCrLf
For Each msgcol In coll
HMIRuntime.Trace msgcol.Index & vbCrLf
HMIRuntime.Trace msgcol.Name & vbCrLf
HMIRuntime.Trace msgcol.Sort & vbCrLf
HMIRuntime.Trace msgcol.SortIndex & vbCrLf
Next

See also
MessageColumn object (list) (Page 238)

2.5.3.9

GetOperatorMessage method

Function
Returns the name or index designated operator message object of the WinCC AlarmControl
as type "ICCAxOperatorMessage".

Syntax
Expression.GetOperatorMessage(ByVal vIndex As Variant)

1436

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of operator message

Example

'VBS320
Dim ctrl
Dim objOpMess
Set ctrl = ScreenItems("AlarmControl")
Set objOpMess = ctrl.GetOperatorMessage(0)
objOpMess.Source1 = "Number"
objOpMess.SourceType1 = 1

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "OperatorMessage" listing, for example, you write "objOpMess.Source1" instead of
"objOpMess.OperatorMessageSource1".

See also
OperatorMessage object (list) (Page 239)

2.5.3.10

GetOperatorMessageCollection method

Function
Returns the list of all operator message objects of the WinCC AlarmControl as type
"ICCAxCollection".

Syntax
Expression.GetOperatorMessageCollection()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1437

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS321
Dim ctrl
Dim coll
Dim opmsg
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetOperatorMessageCollection
For Each opmsg In coll
HMIRuntime.Trace opmsg.Index & vbCrLf
HMIRuntime.Trace opmsg.Name & vbCrLf
HMIRuntime.Trace opmsg.Number & vbCrLf
HMIRuntime.Trace opmsg.Selected & vbCrLf
Next

See also
OperatorMessage object (list) (Page 239)

2.5.3.11

GetRow method

Function
Returns the row number designated row object of the table-based controls as type
"ICCAxDataRow".

1438

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Syntax
Expression.GetRow(ByVal IRow As Long)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Long
Parameters

Description

IRow

Number of the desired line of the control.

Example

'VBS356
Dim ctrl
Dim lIndex
Dim lCellIndex
Set ctrl = ScreenItems("UAControl")
Set coll = ctrl.GetRowCollection
'enumerate and trace out row numbers
For lIndex = 1 To coll.Count
HMIRuntime.trace "Row: " & (ctrl.GetRow(lIndex).RowNumber) & "
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To ctrl.GetRow(lIndex).CellCount
HMIRuntime.Trace ctrl.GetRow(0).CellText(lCellIndex) & " "
HMIRuntime.trace ctrl.GetRow(lIndex).CellText(lCellIndex) & "
Next
HMIRuntime.trace vbNewLine
Next

"

"

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Row" listing, for example, you write "objRow.CellCount" instead of
"objRow.RowCellCount".

See also
Row object (list) (Page 240)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1439

VBS Reference
2.5 Methods

2.5.3.12

GetRowCollection method

Function
Returns the list of all row objects of the table-based controls type "ICCAxDataRowCollection".

Syntax
Expression.GetRowCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Properties of the ICCAxDataRowCollection


The ICCAxDataRowCollection refers to runtime data. The data is read-only. It is not possible
to add and edit the data.
The following properties are available for the ICCAxDataRowCollection:
Count - Determines the number of rows in the collection.
Item - Access to an individual row within the collection via the row number. Numbering runs
from 1 to Count. A Row object is returned.

Example

'VBS357
Dim ctrl
Dim coll
Dim lIndex
Dim lCellIndex
Set ctrl = ScreenItems("AlarmControl")
Set coll = ctrl.GetRowCollection
HMIRuntime.Trace "Number of message rows:" & coll.Count & vbCrLf
'enumerate and trace out row numbers
For lIndex = 1 To coll.Count
HMIRuntime.Trace "Row: " & (ctrl.GetRow(lIndex).RowNumber) & " "
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To ctrl.GetRow(lIndex).CellCount
HMIRuntime.Trace ctrl.GetMessageColumn(lCellIndex -1).Name & " "
HMIRuntime.Trace ctrl.GetRow(lIndex).CellText(lCellIndex) & " "
Next
HMIRuntime.Trace vbNewLine
Next

1440

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

See also
Row object (list) (Page 240)

2.5.3.13

GetRulerBlock method

Function
Returns the Block object designated as name or index of the WinCC RulerControl as type
"ICCAxRulerBlock".

Syntax
Expression.GetRulerBlock(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of block in RulerControl

Example

'VBS322
Dim ctrl
Dim objRulerBlock
Set ctrl = ScreenItems("RulerControl")
Set objRulerBlock = ctrl.GetRulerBlock(0)
objRulerBlock.Caption = "RulerBlock1"
Set objRulerBlock = ctrl.GetRulerBlock("Name")
objRulerBlock.Length = 10

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "RulerBlock" listing, for example, you write "objRulerBlock.Caption" instead of
"objRulerBlock.BlockCaption".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1441

VBS Reference
2.5 Methods

See also
RulerBlock object (list) (Page 241)

2.5.3.14

GetRulerBlockCollection method

Function
Returns the list of all Block objects of the WinCC RulerControl as type "ICCAxCollection".

Syntax
Expression.GetRulerBlockCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS323
Dim ctrl
Dim coll
Dim rulerblock
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetRulerBlockCollection
For Each rulerblock In coll
rulerblock.Align = 1
rulerblock.Length = 12
Next

1442

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "RulerBlock" listing, for example, you write "rulerblock.Align" instead of
"rulerblock.RulerBlockAlign".

See also
RulerBlock object (list) (Page 241)

2.5.3.15

GetRulerColumn method

Function
Returns the Column object designated as name or index of the WinCC RulerControl as type
"ICCAxRulerColumn".

Syntax
Expression.GetRulerColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of RulerControl.

Example

'VBS324
Dim ctrl
Dim objRulercol
Set ctrl = ScreenItems("RulerControl")
Set objRulercol = ctrl.GetRulerColumn("Name")
objRulercol.Sort = 0
Set objRulercol = ctrl.GetRulerColumn("ValueY")
objRulercol.Visible = FALSE

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1443

VBS Reference
2.5 Methods

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "RulerColumn" listing, for example, you write "objRulercol.Visible" instead of
"objRulercol.ColumnVisible".

See also
RulerColumn object (list) (Page 241)

2.5.3.16

GetRulerColumnCollection method

Function
Returns the list of all Column objects of the WinCC RulerControl as type "ICCAxCollection".

Syntax
Expression.GetRulerColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

1444

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Example

'VBS325
Dim ctrl
Dim coll
Dim rulercol
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetRulerColumnCollection
HMIRuntime.Trace "Number of ruler columns:" & coll.Count & vbCrLf
For Each rulercol In coll
HMIRuntime.Trace rulercol.Index & vbCrLf
HMIRuntime.Trace rulercol.Name & vbCrLf
HMIRuntime.Trace rulercol.Sort & vbCrLf
HMIRuntime.Trace rulercol.SortIndex & vbCrLf
Next

See also
RulerColumn object (list) (Page 241)

2.5.3.17

GetRulerData method

Function
Returns the value of the called trend at the ruler position.

Syntax
Expression.GetRulerData(ByVal RulerIndex As Long, pvValue As
Variant, Optional pvTimeStamp As Variant, Optional pvFlags As
Varian) Long
Expression
Necessary. An expression which returns an object of the "Trend" type.

Parameters
Parameters

Description

RulerIndex

0 =Ruler

pvValue

Value of X axis

pvTimeStamp

Time or value of the Y axis

pvFlags

Qualitycode

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1445

VBS Reference
2.5 Methods

Example

'VBS326
Dim ctrl
Dim objTrend
Dim objIOField1
Dim objIOField2
Dim value
Dim time
Set ctrl = ScreenItems( "Control1" )
Set objTrend = ctrl.GetTrend( "Trend 1" )
Set objIOField1 = ScreenItems( "I/O Field1" )
Set objIOField2 = ScreenItems( "I/O Field2" )
objTrend.GetRulerData 0, value, time
objIOField1.OutputValue = value
objIOField2.OutputValue = time

2.5.3.18

GetSelectedRow method

Function
Returns the selected row object of the table-based controls as type "ICCAxDataRow".

Syntax
Expression.GetSelectedRow()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Example

'VBS358
Dim ctrl
Dim lCellIndex
Dim lCellCount
Dim headingRow
Dim selectedRow
Set ctrl = ScreenItems("TableControl")
Set headingRow = ctrl.GetRow(0)
Set selectedRow = ctrl.GetSelectedRow
lCellCount = headingRow.CellCount
'enumerate and trace out column titles and cell texts

1446

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

For lCellIndex = 1 To lCellCount


HMIRuntime.trace headingRow.CellText(lCellIndex) & ":
HMIRuntime.trace selectedRow.CellText(lCellIndex)
HMIRuntime.trace vbNewLine
Next

"

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Row" listing, for example, you write "objRow.CellCount" instead of
"objRow.RowCellCount".

See also
Row object (list) (Page 240)

2.5.3.19

GetSelectedRows method

Function
Returns the selected row objects of the table-based controls as type "ICCAxDataRow"for
multiple selection.

Syntax
Expression.GetSelectedRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Example

'VBS359
Dim ctrl
Dim lCellIndex
Dim lCellCount
Dim lRowIndex
Dim lRowCount

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1447

VBS Reference
2.5 Methods

Dim headingRow
Dim selectedRow
Dim selectedRows
Set ctrl = ScreenItems("TableControl")
Set headingRow = ctrl.GetRow(0)
Set selectedRows = ctrl.GetSelectedRows
lCellCount = headingRow.CellCount
lRowCount = selectedRows.Count
'enumerate selected rows
For lRowIndex = 1 To lRowCount
Set selectedRow = selectedRows(lRowIndex)
HMIRuntime.Trace "Row number: " & CStr(lRowIndex) & vbNewLine
'enumerate and trace out column titles and cell texts
For lCellIndex = 1 To lCellCount
HMIRuntime.trace headingRow.CellText(lCellIndex) & ": "
HMIRuntime.trace selectedRow.CellText(lCellIndex)
HMIRuntime.trace vbNewLine
Next
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Row" listing, for example, you write "objRow.CellCount" instead of
"objRow.RowCellCount".

See also
Row object (list) (Page 240)

2.5.3.20

GetStatisticAreaColumn method

Function
Returns the name or index designated Column object of the WinCC RulerControl statistics
area window as type "ICCAxRulerColumn".

Syntax
Ausdruck.GetStatisticAreaColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

1448

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of statistics area window.

Example

'VBS327
Dim ctrl
Dim objStatAreaCol
Set ctrl = ScreenItems("RulerControl")
Set objStatAreaCol = ctrl.GetStatisticAreaColumn("DatasourceY")
objStatAreaCol.Visible = FALSE
Set objStatAreaCol = ctrl.GetStatisticAreaColumn("ValueY(LL)")
objStatAreaCol.Sort = 1

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatisticAreaColumn" listing, for example, you write "objStatAreaCol.Visible" instead
of "objStatAreaCol.ColumnVisible".

See also
StatisticAreaColumn object (list) (Page 242)

2.5.3.21

GetStatisticAreaColumnCollection method

Function
Returns the list of all column objects of the WinCC RulerControl statistics area window as type
"ICCAxCollection".

Syntax
Ausdruck.GetStatisticAreaColumnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1449

VBS Reference
2.5 Methods

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS328
Dim ctrl
Dim coll
Dim statcol
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetStatisticAreaColumnCollection
HMIRuntime.Trace "Number of statistic Area columns:" & coll.Count & vbCrLf
For Each statcol In coll
HMIRuntime.Trace statcol.Index & vbCrLf
HMIRuntime.Trace statcol.Name & vbCrLf
HMIRuntime.Trace statcol.Sort & vbCrLf
HMIRuntime.Trace statcol.SortIndex & vbCrLf
Next

See also
StatisticAreaColumn object (list) (Page 242)

2.5.3.22

GetStatisticResultColumn method

Function
Returns the name or index designated Column object of the WinCC RulerControl statistics
window as type "ICCAxRulerColumn".

Syntax
Ausdruck.GetStatisticResultColumn(ByVal vIndex As Variant)

1450

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of column of statistics window.

Example

'VBS329
Dim ctrl
Dim objStatResCol
Set ctrl = ScreenItems("RulerControl")
Set objStatResCol = ctrl.GetStatisticResultColumn("MaxValue")
objStatResCol.Visible = FALSE
Set objStatResCol = ctrl.GetStatisticResultColumn("Average")
objStatResCol.Sort = 2

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatisticResultColumn" listing, for example, you write "objStatResCol.Visible" instead
of "objStatResCol.ColumnVisible".

See also
StatisticResultColumn object (list) (Page 243)

2.5.3.23

GetStatisticResultColumnCollection method

Function
Returns the list of all Column objects of the WinCC RulerControl statistics window as type
"ICCAxCollection".

Syntax
Ausdruck.GetStatisticResultColumnCollection()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1451

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS330
Dim ctrl
Dim coll
Dim statcol
Set ctrl = ScreenItems("RulerControl")
Set coll = ctrl.GetStatisticResultColumnCollection
HMIRuntime.Trace "Number of statistic result columns:" & coll.Count & vbCrLf
For Each statcol In coll
HMIRuntime.Trace statcol.Index & vbCrLf
HMIRuntime.Trace statcol.Name & vbCrLf
HMIRuntime.Trace statcol.Sort & vbCrLf
HMIRuntime.Trace statcol.SortIndex & vbCrLf
Next

See also
StatisticResultColumn object (list) (Page 243)

2.5.3.24

GetStatusbarElement method

Function
Returns the element of the control status bar designated as name or index as type
"ICCAxStatusbarElement".

1452

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Syntax
Ausdruck.GetStatusbarElement(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of status bar element.

Example

'VBS331
Dim ctrl
Dim objStatusBar
Set ctrl = ScreenItems( "Control1" )
Set objStatusBar = ctrl.GetStatusbarElement(1)
objStatusBar.Visible = FALSE
Set objStatusBar = ctrl.GetStatusbarElement(3)
objStatusBar.Width = 10

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatusbarElement" listing, for example, you write "objStatusBar.Visible" instead of
"objStatusBar.StatusbarElementVisible".

See also
StatusbarElement object (list) (Page 244)

2.5.3.25

GetStatusbarElementCollection method

Function
Returns the list of all status bar elements of the control as type "ICCAxCollection".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1453

VBS Reference
2.5 Methods

Syntax
Ausdruck.GetStatusbarElementCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS332
Dim ctrl
Dim coll
Dim statelement
Set ctrl = ScreenItems.Item("Control1")
Set coll = ctrl.GetStatusbarElementCollection
HMIRuntime.Trace "Number of statusbar elements:" & coll.Count & vbCrLf
For Each statelement In coll
HMIRuntime.Trace statelement.Name & vbCrLf
HMIRuntime.Trace statelement.Width & vbCrLf
HMIRuntime.Trace statelement.Text & vbCrLf
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "StatusbarElement" listing, for example, you write "statelement.Name" instead of
"statelement.StatusbarElementName".

1454

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

See also
StatusbarElement object (list) (Page 244)

2.5.3.26

GetTimeAxis method

Function
Returns the time axis object designated as name or index of the WinCC OnlineTrendControl
as type "ICCAxTimeAxis".

Syntax
Ausdruck.GetTimeAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of time axis.

Example

'VBS333
Dim ctrl
Dim objTimeAxis
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTimeAxis = ctrl.GetTimeAxis(1)
objTimeAxis.Visible = FALSE
Set objTimeAxis = ctrl.GetTimeAxis("axis 2")
objTimeAxis.Label = "Time axis 2"
objTimeAxis.DateFormat = "dd.MM.yy"
objTimeAxis.TimeFormat = "HH:mm:ss.ms"
objTimeAxis.RangeType = 2
objTimeAxis.BeginTime = "06.04.2010 9:33:18"
objTimeAxis.MeasurePoints = 100

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1455

VBS Reference
2.5 Methods

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TimeAxis" listing, for example, you write "objTimeAx.Visible" instead of
"objTimeAx.TimeAxisVisible".

See also
TimeAxis object (list) (Page 244)

2.5.3.27

GetTimeAxisCollection method

Function
Returns the list of all time axis objects of the WinCC OnlineTrendControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetTimeAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS334

1456

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Dim ctrl
Dim objTrendWnd
Dim objTimeAxis1
Dim objTimeAxis2
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis1 = ctrl.GetTimeAxisCollection.AddItem("TimeAxis2010")
Set objTimeAxis2 = ctrl.GetTimeAxisCollection.AddItem("TimeAxis2011")
objTimeAxis1.TrendWindow = objTrendWnd.Name
objTimeAxis1.Label = "2010"
objTimeAxis1.RangeType = 1
objTimeAxis1.BeginTime = "01.01.2010 0:00:00"
objTimeAxis1.EndTime = "31.12.2010 11:59:59"
objTimeAxis2.TrendWindow = objTrendWnd.Name
objTimeAxis2.Label = "2011"
objTimeAxis2.RangeType = 1
objTimeAxis2.BeginTime = "01.01.2011 0:00:00"
objTimeAxis2.EndTime = "31.12.2011 11:59:59"
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend1")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.TimeAxis = objTimeAxis1.Name
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend2")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.TimeAxis = objTimeAxis2.Name

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TimeAxis" listing, for example, you write "objTimeAxis1.Label" instead of
"objTimeAxis1.TimeAxisLabel".

See also
TimeAxis object (list) (Page 244)

2.5.3.28

GetTimeColumn method

Function
Returns the time column object designated as name or index of the WinCC OnlineTableControl
as type "ICCAxTimeColumn".

Syntax
Ausdruck.GetTimeColumn(ByVal vIndex As Variant)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1457

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of time column.

Example

'VBS335
Dim ctrl
Dim objTimeCol
Set ctrl = ScreenItems("TableControl")
Set objTimeCol = ctrl.GetTimeColumn("Timecolumn1")
objTimeCol.ShowDate = FALSE
Set objTimeCol = ctrl.GetTimeColumn("Timecolumn2")
objTimeCol.Visible = FALSE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TimeColumn" listing, for example, you write "objTimeColumn.ShowDate" instead of
"objTimeColumn.TimeColumnShowDate".

See also
TimeColumn object (list) (Page 245)

2.5.3.29

GetTimeColumnCollection method

Function
Returns the list of all time column objects of the WinCC OnlineTableControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetTimeColumnCollection()

1458

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS336
Dim ctrl
Dim objTimeCol1
Dim objTimeCol2
Dim coll
Dim timecol
Set ctrl = ScreenItems("TableControl")
Set objTimeCol1 = ctrl.GetTimeColumnCollection.AddItem("TimeColumn2010")
Set objTimeCol2 = ctrl.GetTimeColumnCollection.AddItem("TimeColumn2011")
objTimeCol1.Caption = "2010"
objTimeCol1.RangeType = 1
objTimeCol1.BeginTime = "01.01.2010 0:00:00"
objTimeCol1.EndTime = "31.12.2010 11:59:59"
objTimeCol2.Caption = "2011"
objTimeCol2.RangeType = 0
objTimeCol2.BeginTime = "01.01.2011 0:00:00"
objTimeCol2.TimeRangeFactor = 1
objTimeCol2.TimeRangeBase = 3600000
Set coll = ctrl.GetTimeColumnCollection
For Each timecol In coll
timecol.Align = 1
timecol.Length = 12
timecol.BackColor = RGB(240,240,0)
timecol.ForeColor = RGB(130,160,255)
Next

See also
TimeColumn object (list) (Page 245)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1459

VBS Reference
2.5 Methods

2.5.3.30

GetToolbarButton method

Function
Returns the name or index designated toolbar button function of the control as type
"ICCAxToolbarButton".

Syntax
Ausdruck.GetToolbarButton(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of toolbar button function.

Example

'VBS337
Dim ctrl
Set ctrl = ScreenItems( "Control1" )
Dim toolbu
Set toolbu = ctrl.GetToolbarButton ("ShowHelp")
HMIRuntime.Trace "Name: " & toolbu.Name & vbCrLf
HMIRuntime.Trace "Index: " & toolbu.Index & vbCrLf
HMIRuntime.Trace "Hotkey: " & toolbu.HotKey & vbCrLf

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ToolbarButton" listing, for example, you write "toolbu.Index" instead of
"toolbu.ToolbarButtonIndex".

See also
ToolbarButton object (list) (Page 246)

1460

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

2.5.3.31

GetToolbarButtonCollection method

Function
Returns the list of all toolbar button functions of the control as type "ICCAxCollection".

Syntax
Ausdruck.GetToolbarButtonCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following methods are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS338
Dim ctrl
Dim coll
Dim toolbu
Set ctrl = ScreenItems( "Control1" )
Set coll = ctrl.GetToolbarButtonCollection
HMIRuntime.Trace "Number of toolbar buttons:" & coll.Count & vbCrLf
For Each toolbu In coll
HMIRuntime.Trace toolbu.Name & vbCrLf
HMIRuntime.Trace "Hotkey: " & toolbu.HotKey & vbCrLf
HMIRuntime.Trace "Authorization: " & toolbu.PasswordLevel & vbCrLf
Next

See also
ToolbarButton object (list) (Page 246)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1461

VBS Reference
2.5 Methods

2.5.3.32

GetTrend method

Function
Returns the trend object designated as name or index of the WinCC OnlineTrendControl or
WinCC FunctionTrendControl as type "ICCAxTrend" or "ICCAxFunctionTrend".

Syntax
Ausdruck.GetTrend(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of curve.

Example

'VBS339
Dim ctrl
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrend = ctrl.GetTrend( "Trend 1" )
objTrend.PointStyle = 1
objTrend.LineWidth = 4
Set objTrend = ctrl.GetTrend(2)
objTrend.Provider = 1
objTrend.TagName = "Archive\ArchiveTag2"

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Trend" listing, for example, you write "objTrend.PointStyle" instead of
"objTrend.TrendPointStyle".

See also
Trend object (list) (Page 247)

1462

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

2.5.3.33

GetTrendCollection method

Function
Returns the list of all trend objects of the WinCC OnlineTrendControl or WinCC
FunctionTrendControl as type "ICCAxCollection".

Syntax
Ausdruck.GetTrendCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS340
Dim ctrl
Dim objTrendWnd
Dim objTimeAxis
Dim objValAxis
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = ctrl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValAxis = ctrl.GetValueAxisCollection.AddItem("myValueAxis")
objTimeAxis.TrendWindow = objTrendWnd.Name
objValAxis.TrendWindow = objTrendWnd.Name
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend1")
objTrend.Provider = 1
objTrend.TagName = "Archive\ArchiveTag1"
objTrend.TrendWindow = objTrendWnd.Name
objTrend.TimeAxis = objTimeAxis.Name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1463

VBS Reference
2.5 Methods

objTrend.ValueAxis = objValAxis.Name

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "Trend" listing, for example, you write "objTrend.TagName" instead of
"objTrend.TrendTagName".

See also
Trend object (list) (Page 247)

2.5.3.34

GetTrendWindow method

Function
Returns the trend window object designated as name or index of the WinCC
OnlineTrendControl or WinCC FunctionTrendControl as type "ICCAxTrendWindow".

Syntax
Ausdruck.GetTrendWindow(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of curve window.

Example

'VBS341
Dim ctrl
Dim objTrendWnd
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindow(1)

1464

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

objTrendWnd.Visible = FALSE
Set objTrendWnd = ctrl.GetTrendWindow("trend window 2")
objTrendWnd.VerticalGrid = TRUE
objTrendWnd.FineGrid = TRUE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "TrendWindow" listing, for example, you write "objTrendWnd.Visible" instead of
"objTrendWnd.TrendWindowVisible".

See also
TrendWindow object (list) (Page 249)

2.5.3.35

GetTrendWindowCollection method

Function
Returns the list of all trend window objects of the WinCC OnlineTrendControl or WinCC
FunctionTrendControl as type "ICCAxCollection".

Syntax
Ausdruck.GetTrendWindowCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1465

VBS Reference
2.5 Methods

Example

'VBS342
Dim ctrl
Dim objTrendWnd
Dim objTimeAxis
Dim objValAxis
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objTimeAxis = ctrl.GetTimeAxisCollection.AddItem("myTimeAxis")
Set objValAxis = ctrl.GetValueAxisCollection.AddItem("myValueAxis")
objTimeAxis.TrendWindow = objTrendWnd.Name
objValAxis.TrendWindow = objTrendWnd.Name

See also
TrendWindow object (list) (Page 249)

2.5.3.36

GetValueAxis method

Function
Returns the value axis object designated as name or index of the WinCC OnlineTrendControl
as type "ICCAxValueAxis".

Syntax
Ausdruck.GetValueAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of value axis.

Example

'VBS343
Dim ctrl
Dim objValAxis

1466

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Set ctrl = ScreenItems("OnlineTrendControl")


Set objValAxis = ctrl.GetValueAxis(1)
objValAxis.Visible = FALSE
Set objValAxis = ctrl.GetValueAxis("axis 2")
objValAxis.Label = "Value axis 2"
objValAxis.ScalingType = 0
objValAxis.Precisions = 2
objValAxis.AutoRange = TRUE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ValueAxis" listing, for example, you write "objValueAx.Visible" instead of
"objValueAx.ValueAxisVisible".

See also
ValueAxis object (list) (Page 250)

2.5.3.37

GetValueAxisCollection method

Function
Returns the list of all value axis objects of the WinCC OnlineTrendControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetValueAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1467

VBS Reference
2.5 Methods
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS344
Dim ctrl
Dim objTrendWnd
Dim objValAxis1
Dim objValAxis2
Dim objTrend
Set ctrl = ScreenItems("OnlineTrendControl")
Set objTrendWnd = ctrl.GetTrendWindowCollection.AddItem("myWindow")
Set objValAxis1 = ctrl.GetValueAxisCollection.AddItem("myValueAxis1")
Set objValAxis2 = ctrl.GetValueAxisCollection.AddItem("myValueAxis2")
objValAxis1.TrendWindow = objTrendWnd.Name
objValAxis1.Label = "Value1"
objValAxis2.TrendWindow = objTrendWnd.Name
objValAxis2.inTrendColor = TRUE
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend1")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.ValueAxis = objValAxis1.Name
Set objTrend = ctrl.GetTrendCollection.AddItem("myTrend2")
objTrend.TrendWindow = objTrendWnd.Name
objTrend.ValueAxis = objValAxis2.Name

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ValueAxis" listing, for example, you write "objValueAxis1.Label" instead of
"objValueAxis1.ValueAxisLabel".

See also
ValueAxis object (list) (Page 250)

2.5.3.38

GetValueColumn method

Function
Returns the column object designated as name or index of the WinCC OnlineTableControl as
type "ICCAxValueColumn".

1468

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Syntax
Ausdruck.GetValueColumn(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of value column of


OnlineTableControl.

Example

'VBS345
Dim ctrl
Dim objValueColumn
Set ctrl = ScreenItems("TableControl")
Set objValueColumn = ctrl.GetValueColumn("Valuecolumn1")
objValueColumn.Precisions = 4
Set objValueColumn = ctrl.GetValueColumn(2)
objValueColumn.ExponentialFormat = TRUE

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "ValueColumn" listing, for example, you write "objValueColumn.Precisions" instead
of "objValueColumn.ValueColumnPrecisions".

See also
ValueColumn object (list) (Page 250)

2.5.3.39

GetValueColumnCollection method

Function
Returns the list of all value column objects of the WinCC OnlineTableControl as type
"ICCAxCollection".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1469

VBS Reference
2.5 Methods

Syntax
Ausdruck.GetValueColulmnCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS346
Dim ctrl
Dim objValCol1
Dim objValCol2
Dim coll
Dim valcol
Set ctrl = ScreenItems("TableControl")
Set objValCol1 = ctrl.GetValueColumnCollection.AddItem("ValueColumn1")
Set objValCol2 = ctrl.GetValueColumnCollection.AddItem("ValueColumn2")
objValCol1.Caption = "Value Archive"
objValCol1.Provider = 1
objValCol1.TagName = "ProcessValueArchive\arch1"
objValCol1.TimeColumn = "TimeColumn1"
objValCol2.Caption = "Value Tag"
objValCol2.Provider = 2
objValCol2.TagName = "tagxx"
objValCol2.TimeColumn = "TimeColumn2"
Set coll = ctrl.GetValueColumnCollection
For Each valcol In coll
valcol.Align = 2
valcol.Length = 10
valcol.AutoPrecisions = TRUE
Next

1470

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

See also
ValueColumn object (list) (Page 250)

2.5.3.40

GetXAxis method

Function
Returns the X axis object designated as name or index of the WinCC FunctionTrendControl
as type "ICCAxValueAxis".

Syntax
Ausdruck.GetXAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of X axis.

Example

'VBS347
Dim ctrl
Dim objXAx
Set ctrl = ScreenItems("FunctionTrendControl")
Set objXAx = ctrl.GetXAxis(1)
objXAx.Visible = FALSE
Set objXAx = ctrl.GetXAxis("axis 2")
objXAx.Label = "X axis 2"
objXAx.ScalingType = 0
objXAx.Precisions = 2
objXAx.Color = RGB(109,109,109)

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "XAxis" listing, for example, you write "objXAx.Visible" instead of
"objXAx.XAxisVisible".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1471

VBS Reference
2.5 Methods

See also
XAxis object (list) (Page 251)

2.5.3.41

GetXAxisCollection method

Function
Returns the list of all X axis objects of the WinCC FunctionTrendControl as type
"ICCAxCollection".

Syntax
Ausdruck.GetXAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS348
Dim ctrl
Dim objXAxis1
Dim objXAxis2
Dim coll
Dim axes
Set ctrl = ScreenItems("FunctionTrendControl")
Set objXAxis1 = ctrl.GetXAxisCollection.AddItem("myXAxis1")
objXAxis1.Label = "temperature"

1472

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Set objXAxis2 = ctrl.GetXAxisCollection.AddItem("myXAxis2")


objXAxis2.Label = "pressure"
Set coll = ctrl.GetXAxisCollection
HMIRuntime.Trace "Number of XAxis:" & coll.Count & vbCrLf
For Each axes In coll
HMIRuntime.Trace axes.Name & vbCrLf
HMIRuntime.Trace axes.Label & vbCrLf
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "XAxis" listing, for example, you write "objXAxis1.Label" instead of
"objXAxis1.XAxisLabel".

See also
XAxis object (list) (Page 251)

2.5.3.42

GetYAxis method

Function
Returns the Y axis object designated as name or index of the WinCC FunctionTrendControl
as type "ICCAxValueAxis".

Syntax
Ausdruck.GetYAxis(ByVal vIndex As Variant)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT
Parameters

Description

vIndex

Index or name of Y axis.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1473

VBS Reference
2.5 Methods

Example

'VBS349
Dim ctrl
Dim objYAx
Set ctrl = ScreenItems("FunctionTrendControl")
Set objYAx = ctrl.GetYAxis(1)
objYAx.Visible = FALSE
Set objYAx = ctrl.GetYAxis("axis 2")
objYAx.Label = "Y axis 2"
objYAx.Align = 0
objYAx.Precisions = 3
objYAx.EndValue = 90.000
objYAx.BeginValue = 10.000

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "YAxis" listing, for example, you write "objYAx.Visible" instead of
"objYAx.YAxisVisible".

See also
YAxis object (list) (Page 252)

2.5.3.43

GetYAxisCollection method

Function
Returns the list of all Y axis objects of the WinCC FunctionTrendControl of type
"ICCAxCollection".

Syntax
Ausdruck.GetYAxisCollection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

1474

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Features and functions of the ICCAxCollection


The following properties are available for the ICCAxCollection:
Count
Item
The following functions are available for the ICCAxCollection:
AddItem(vName) As Object
RemoveItem(vIndex)

Example

'VBS350
Dim ctrl
Dim objYAxis1
Dim objYAxis2
Dim coll
Dim axes
Set ctrl = ScreenItems("FunctionTrendControl")
Set objYAxis1 = ctrl.GetXAxisCollection.AddItem("myYAxis1")
objYAxis1.Label = "temperature"
Set objYAxis2 = ctrl.GetXAxisCollection.AddItem("myYAxis2")
objYAxis2.Label = "pressure"
Set coll = ctrl.GetYAxisCollection
HMIRuntime.Trace "Number of YAxis:" & coll.Count & vbCrLf
For Each axes In coll
HMIRuntime.Trace axes.Name & vbCrLf
HMIRuntime.Trace axes.Label & vbCrLf
Next

Note
If you access the properties with the listing object, you do not have to enter the name of the
listing.
For the "YAxis" listing, for example, you write "objYAxis1.Label" instead of
"objYAxis1.YAxisLabel".

See also
YAxis object (list) (Page 252)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1475

VBS Reference
2.5 Methods

2.5.4

Methods H to M

2.5.4.1

HideAlarm method

Function
Executes the "Hide messages" key function of the AlarmControl.

Syntax
Expression.HideAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.2

InsertData method

Function
Adds data to the called trend.

Syntax
Expression.InsertData(dblAxisX As Variant, dblAxisY As Variant)
Expression
Necessary. An expression which returns an object of the "Trend" type.

Parameters
Parameters

Description

dblAxisX

Value of X axis

dblAxisY

Value of Y axis

Example

'VBS300
Dim lngFactor

1476

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Dim dblAxisX
Dim dblAxisY
Dim objTrendControl
Dim objTrend
Set objTrendControl = ScreenItems("Control1")
Set objTrend = objTrendControl.GetTrend("Trend 1")
For lngFactor = -100 To 100
dblAxisX = CDbl(lngFactor * 0.02)
dblAxisY = CDbl(dblAxisX * dblAxisX + 2 * dblAxisX + 1)
objTrend.InsertData dblAxisX, dblAxisY
Next

2.5.4.3

Item Method

Function
Retrieves an object from a collection and enables access to it via Index.

Description of DataItem Object


Access uses the name under which the value was added to the list. Single access using an
index is not recommended since the index changes during adding or deleting of values.

syntax
Expression.Item()
Expression
Necessary. An expression which returns an object of the type "Screens", "Layers" (or "Tags").
Note
In the case of "Tags", restricted functional scope! The standard methods get_Count and
get_NewEnum are missing so that access via Index nor the counting of all tags is possible.

Parameters
VARIANT

Example:
The following example issues the names of all objects contained in the picture "NewPDL1":

'VBS99
Dim objScreen

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1477

VBS Reference
2.5 Methods

Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens("NewPDL1")
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'The objects will be indicate by Item()
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(objScrItem.ObjectName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

See also
ScreenItems Object (List) (Page 144)
ScreenItem Object (Page 141)
Tags Object (List) (Page 155)
Alarms object (list) (Page 126)
ProcessValues Object (List) (Page 140)

2.5.4.4

LockAlarm method

Function
Executes the "Lock Alarm" key function of the AlarmControl.

Syntax
Expression.LockAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.5

LoopInAlarm method

Function
Executes the "Loop in Alarm" key function of the AlarmControl.

1478

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Syntax
Expression.LoopInAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.6

MoveAxis method

Function
Executes the "Move axis" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Expression.MoveAxis()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.7

MoveRuler

Function
Moves the ruler from a specified reference point by a specified distance.

Syntax
Expression.MoveRuler( RulerIndex As Long, RulerMoveRef As Long,
MoveDistance As Long, Optional vTrendWindow As Variant )
Expression
Required. An expression that returns an object of the "ScreenItem" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1479

VBS Reference
2.5 Methods

Parameter
Parameter

Description

RulerIndex

Specifies the ruler to move:


0 = Ruler
1 = Ruler at the start of the statistics area
2 = Ruler at the end of the statistics area

RulerMoveRef

Specifies the reference point as orientation for the third parameter "MoveDistance":
0 = Time axis start position
1 = Current ruler position
2 = Time axis end position

MoveDistance

Number of pixels by which the ruler is moved away from reference point "RulerMoveRef".

vTrendWindow

Optional parameter for handling several, independent trend windows.


Specifies the trend window in which the ruler is moved. The ruler moves in all trend windows
if this parameter is not specified.

Return value
Function that returns the new ruler position.

Example
Table 2-1

Move ruler left by 10 pixels

'VBS367
Sub OnClick(ByVal Item)
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
call ctrl.MoveRuler (0, 1, -10)
End Sub

In the example, the ruler is moved by -10 pixels, starting at reference point 1 (current ruler
position). The ruler is now positioned 10 pixels away from the left of its original position.

Example
Table 2-2

Move ruler right by 10 pixels

'VBS368
Sub OnClick(ByVal Item)
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
ctrl.MoveRuler 0, 1, 10
End Sub

In the example, the ruler is moved by 10 pixels, starting at reference point 1 (current ruler
position). The ruler is now positioned 10 pixels away from the right of its original position.

1480

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Example
Table 2-3

Move ruler to end on opening of the window

'VBS369
Sub OnOpen()
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
ctrl.MoveRuler 0, 2, 0
End Sub

In the example, the ruler is moved by 0 pixels, starting at reference point 2 (time axis end
position). The ruler is now positioned at the time axis end position.

Example
Table 2-4

Calculate current ruler position

'VBS370
Sub OnClick(ByVal Item)
Dim ctrl
Set ctrl = ScreenItems.Item("Control1")
Dim pos
pos = ctrl.MoveRuler (0, 1, 0)
HmiRuntime.Trace "RulerPosition=" & pos & vbCrLf
End Sub

In the example, the ruler is moved by 0 pixels, starting at reference point 1 (current ruler
position). The ruler remains in its original position. The ruler position is returned as value.

2.5.4.8

MoveToFirst method

Function
Executes the "First line" key function of the control.

Syntax
Expression.MoveToFirst()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1481

VBS Reference
2.5 Methods

2.5.4.9

MoveToFirstLine method

Function
Executes the "First message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToFirstLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.10

MoveToFirstPage method

Function
Executes the "First page" key function of the AlarmControl.

Syntax
Ausdruck.MoveToFirstPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.11

MoveToLast method

Function
Executes the "Last data record" key function of the control.

Syntax
Ausdruck.MoveToLast()

1482

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.12

MoveToLastLine method

Function
Executes the "Last message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToLastLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.13

MoveToLastPage method

Function
Executes the "Last page" key function of the AlarmControl.

Syntax
Ausdruck.MoveToLastPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1483

VBS Reference
2.5 Methods

2.5.4.14

MoveToNext method

Function
Executes the "Next data record" key function of the control.

Syntax
Ausdruck.MoveToNext()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.15

MoveToNextLine method

Function
Executes the "Next message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToNextLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.16

MoveToNextPage method

Function
Executes the "Next page" key function of the AlarmControl.

Syntax
Ausdruck.MoveToNextPage()

1484

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.17

MoveToPrevious method

Function
Executes the "Previous data record" key function of the control.

Syntax
Ausdruck.MoveToPrevious()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.4.18

MoveToPreviousLine method

Function
Executes the "Previous message" key function of the AlarmControl.

Syntax
Ausdruck.MoveToPreviousLine()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1485

VBS Reference
2.5 Methods

2.5.4.19

MoveToPreviousPage method

Function
Executes the "Previous page" key function of the AlarmControl.

syntax
Ausdruck.MoveToPreviousPage()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5

Methods N to R

2.5.5.1

NextColumn method

Function
Executes the "Next column" key function of the OnlineTableControl.

Syntax
Ausdruck.NextColumn()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.2

NextTrend method

Function
Executes the "Next curve" key function of the OnlineTrendControl and FunctionTrendControl.

1486

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Syntax
Ausdruck.NextTrend()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.3

OneToOneView method

Function
Executes the "Original view" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Ausdruck.OneToOneView()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

2.5.5.4

PasteRows method

Function
Executes the "Paste Rows" key function of the UserArchiveControl.

Syntax
Expression.PasteRows()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1487

VBS Reference
2.5 Methods

2.5.5.5

PreviousColumn method

Function
Executes the "Previous column" key function of the OnlineTableControl.

Syntax
Ausdruck.PreviousColumn()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.6

PreviousTrend method

Function
Executes the "Previous curve" key function of the OnlineTrendControl and
FunctionTrendControl.

Syntax
Ausdruck.PreviousTrend()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.7

Print method

Function
Executes the "Print" key function of the control.

Syntax
Ausdruck.Print()

1488

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.8

QuitHorn method

Function
Executes the "Acknowledge central signaling devices" key function of the AlarmControl.

Syntax
Ausdruck.QuitHorn()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.9

QuitSelected method

Function
Executes the "Single acknowledgment" key function of the AlarmControl.

Syntax
Ausdruck.QuitSelected()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1489

VBS Reference
2.5 Methods

2.5.5.10

QuitVisible method

Function
Executes the "Group acknowledgment" key function of the AlarmControl.

Syntax
Ausdruck.QuitVisible()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.11

Read Method

Description of Tag Object


Reads out the status of a tag (tag object) shortly after the moment it was called. At the same
time, the tag object is provided with the values read. Upon reading a tag, its value, quality code
and time stamp are determined. The "LastError" property can be used to determine whether
the call was successful.
The "Name", "ServerPrefix" and "TagPrefix" properties are not changed as a result.
If the value of the tag is read successfully, the properties of the tag object are assigned the
following values:
Property

Assignment

Value

Tag values

Name

Tag name (unchanged)

QualityCode

Quality level

Timestamp

Current tag time stamp

LastError

ErrorDescription

""

If the value of the tag is not read successfully, the properties of the tag object are assigned
the following values:

1490

Property

Allocation

Value

VT_Empty

Name

Tag name (unchanged)

QualityCode

Bad Out of Service

Timestamp

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Property

Allocation

LastError

Read operation error codes

ErrorDescription

Error description on LastError

Note
A summary of possible Quality Codes may be found in WinCC Information System under key
word "Communication" > "Diagnostics" or "Communication" > "Quality Codes".

syntax
Expression.Read([Readmode])
Expression
Necessary. An expression which returns a tag object. The return value of the Read method is
the value of the tag read out.

Parameters
The optional "Readmode" parameter enables the distinction between two types of reading:
Parameters

Description

The tag value is read from the process image


(cache). 0 is the default value.

The value of a tag is read directly from AS or


channel (direct).

If the "Readmode" parameter is omitted, the value is read from the process image by default.
The return value of the Read method is the tag value read out as VARIANT.

Reading From the Process Image


When reading from the process image, the tag is logged on and, from that moment, polled
cyclically from the PLC. The login cycle is dependent on the configured trigger. The value is
read from the tag image by WinCC. For Close Picture, the tag actions are ended again. The
call is characterized by the following:
The value is read by WinCC from the tag image.
The call is faster in comparison to direct reading (except with the first call: The first call
basically takes longer because the value from the PLC must be read out and logged on.)
The duration of the call is not dependent on the bus load or AS.
Behavior in actions with a tag trigger
All of the tags contained in the tag trigger are already known with Open Picture and are
registered with the defined monitoring time. Since all tags are requested at once, the best
possible optimization can be targeted from the channel. If a tag, contained in the trigger, is

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1491

VBS Reference
2.5 Methods
requested with Read during an action, the value already exists and is transferred directly to
the call. If a tag is requested which is not contained in the trigger, the behavior is the same as
with a standard trigger.
Behavior in actions with a cyclic trigger
tags are registered with half of the cycle time with the first call. For every other call, the value
is present.
Behavior in event-driven actions
The tag is registered in the "upon change" mode with the first call. Process tags that are
registered in the "upon change" mode correspond with a cyclic read job with a cycle time of
1s.
If an event (e.g. mouse click) requests a value asynchronously, the tag is transferred to the
tag image. The tag is requested cyclically from the AS as of this point in time and therefore
increases the basic load. To bypass this increase in the basic load, the value can also be read
synchronously. The synchronous call causes a one-off increase in the communication load
but the tag is not transferred to the tag image.

Direct reading
In the case of direct reading, the current value is returned. The tag is not registered cyclically,
the value is requested from the AS one time only. Direct reading has the following properties:
The value is read explicitly from the AS.
The call takes longer compared to reading from the process image.
The duration of the call is dependent on the bus load and AS, amongst other things.

Example:
Reading a tag directly from AS or channel

'VBS100
Dim objTag
Dim vntValue
Set objTag = HMIRuntime.Tags("Tagname")
vntValue = objTag.Read(1)
'Read direct
MsgBox vntValue

Reading a tag from the process image

'VBS101
Dim objTag
Dim vntValue
Set objTag = HMIRuntime.Tags("Tagname")
vntValue = objTag.Read
'Read from cache

1492

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

MsgBox vntValue

Description of TagSet Object


The TagSet object offers the option of reading several tags in one call.
Functionality here is mostly identical with that of a tag object. In the following, only deviations
thereof are described.
Expression
Necessary. An expression which returns an object of type "TagSet".

Reading From the Process Image


The TagSet object offers the advantage of requesting several tags in one read command. The
tags are registered in the process image as a group, improving performance in the process.

Direct reading
Since one call may process several read commands, performance is enhanced in comparison
to single calls.

Example:
The following example shows how tags are included in the TagSet list, how tag values are
imported and subsequently read.

'VBS174
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.Read
HMIRuntime.Trace "Motor1: " & group("Motor1").Value & vbNewLine
HMIRuntime.Trace "Motor2: " & group("Motor2").Value & vbNewLine

If the optional parameter "Readmode" is set to 1, the process tags are not registered but read
directly from AS or channel.

group.Read 1

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1493

VBS Reference
2.5 Methods

See also
Example: How to Read Tag Values (Page 812)
Example: Writing tag values (Page 810)
LastError Property (Page 445)
ErrorDescription Property (Page 398)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

2.5.5.12

Read Tags method

Function
Executes the "Read tags" key function of the UserArchiveControl.

Syntax
Ausdruck.ReadTags()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.5.13

Refresh Method

Function
Drawing all visible pictures again.

syntax
Expression.Refresh
Expression
Necessary. An expression which returns a "Screens" or "Screen" type object.

Parameters
--

1494

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Examples
The first example forces all visible pictures to be drawn again:

'VBS149
HMIRuntime.Screens.Refresh

The second example forces the basic picture to be immediately redrawn:

'VBS150
HMIRuntime.Screens(1).Refresh

See also
Screen Object (Page 146)
Screens Object (List) (Page 149)
HMIRuntime Object (Page 134)

2.5.5.14

Remove Method

Description of TagSet Object


Removes a tag from the TagSet list. The tag may be removed by name or reference to a tag
object.

syntax
Expression.Remove [Tag]
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
VARIANT
Parameters

Description

Tag

Name of a WinCC tag or reference to a tag object


to be removed from the list.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1495

VBS Reference
2.5 Methods

Example:
The following example shows how several tags are included in the TagSet list, and how to
remove a tag again.

'VBS175
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.Remove "Motor1"

Description of DataSet Object


Deletes the element specified in parameter "Name" from a list.

syntax
Expression.Remove [Name]
Expression
Necessary. An expression which returns an object of type "DataSet".

Parameters
VARIANT
Parameters

Description

Name

Name of the object to be removed from the list.

Example:
The example shows how to remove the object "motor1" from the list.

'VBS166
HMIRuntime.DataSet.Remove("motor1")

Description of objects Logging, AlarmLogs, DataLogs


The method deletes a previously swapped archive segment from the Runtime project.
Archive segments deleted with the "Remove" method are removed from the common archiving
directory of the project.
The call may require a somewhat longer time period, depending on archive data. This may
block the processing of subsequent scripts. Blockage of actions within the picture may be

1496

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
avoided if you start the call in a Global Scripting action, such as starting the action through a
triggering tag.
The archive separation and deletion creates a CPU load. This will affect performance.
Note
Calling up the "Remove" method is presently only possible at the server. There is an example,
however, which shows how the method may be started by the client from a server.
For redundancy, the following applies: Re-swapped archives are deleted with the "Remove"
method only on the computer from which the method was initiated.

syntax
Objects Logging, AlarmLogs
Expression.Remove [TimeFrom] [TimeTo] [TimeOut] [ServerPrefix]
Expression
Necessary. An expression which returns an object of type "Logging" or "AlarmLogs".

Object DataLogs
Expression.Remove [TimeFrom] [TimeTo] [TimeOut] [Type] [ServerPrefix]
Expression
Necessary. An expression which returns an object of type "DataLogs".

Parameters
TimeFrom
Point in time, from which the archives are to be deleted.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
TimeTo
Time up to which archive segments are to be deleted.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
Timeout
Timeout in milliseconds.
If you enter "-1" as a value, the wait will be infinite. If you enter a value of "0", there will be no
wait.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1497

VBS Reference
2.5 Methods
Type:
Type of archive.
The parameter can (optionally) be used only to delete archive segments of the tag logging.
The following values can be entered:
Assigned Value

Type

Description

hmiDataLogFast

Tag Logging Fast data

hmiDataLogSlow

Tag Logging Slow data

hmiDataLogAll

Tag Logging Fast and Slow data

ServerPrefix
Reserved for future versions.

Return value
If an error occurred during deletion of the archive segments, the method will return an error
message. Additional information may be found under the subject heading "Error Messages
from Database Area".

Time format
Time format is defined as follows: YYYY-MM-DD hh:mm:ss, where YYYY represents the year,
MM the month, DD the day, hh the hour, mm the minute and ss the second. For example, the
time of 2 minutes and one second past 11 o'clock on July 26, 2004 is displayed as follows:
2004-07-26 11:02:01.
For parameters "TimeFrom" and "TimeTo" the statement of data and time is also possible in
short form. Not all format fields must be filled in this case. The short form means that the
information on date and time may be lacking one or several parameters, beginning with the
value for seconds. For example, the statement may be in the form of "YYYY-MM" or "YYYYMM-DD hh". Using the statement "TimeFrom" = "2004-09" and "TimeTo" = "2004-10-04" all
archive segments between September 2004 up to and including October 4th are to be
swapped.

Example:
In the following example, archive segments re-swapped after the fact for a specified time period
may be removed and the return value may be output as Trace.

'VBS182
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Remove("2004-08-22","2004-09-22",-1) &
vbNewLine

In the following example, all archive segments re-swapped after the fact may be removed and
the return value may be output as Trace.

1498

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

'VBS183
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Remove("","",-1) & vbNewLine

See also
Error Messages from Database Area (Page 803)
Example: How to Start an Action on the Server (Logging Object) (Page 817)
Logging Object (Page 138)
DataSet Object (List) (Page 132)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)
TagSet Object (List) (Page 156)

2.5.5.15

RemoveAll Method

Description of TagSet Object


Deletes all tags from a TagSet list.

syntax
Expression.RemoveAll
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
--

Example:
The following example shows how several tags are included in the TagSet list, and how to
remove all tags again.

'VBS176
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
group.RemoveAll

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1499

VBS Reference
2.5 Methods

Description of DataSet Object


Deletes all values or object references from a DataSet list.

syntax
Expression.RemoveAll
Expression
Necessary. An expression which returns an object of type "DataSet".

Parameters
--

Example:
The example shows how all objects are removed from the list.

'VBS167
HMIRuntime.DataSet.RemoveAll

See also
DataSet Object (List) (Page 132)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

2.5.5.16

RemoveData method

Function
Deletes the data of the called trend.

Syntax
Expression.RemoveData
Expression
Necessary. An expression which returns an object of the "Trend" type.

1500

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Example

'VBS310
Dim objTrendControl
Dim objTrend
Set objTrendControl = ScreenItems("Control1")
Set objTrend = objTrendControl.GetTrend("Trend 1")
objTrend.RemoveData

2.5.5.17

Restore Method

Description of objects Logging, AlarmLogs, DataLogs


The method adds swapped archive segments to the Runtime project.
Upon swapping, the archive segments are copied to the common archiving directory of the
project. Therefore, the appropriate storage capacity must be available.
The call may require a somewhat longer time period, depending on archive data. This may
block the processing of subsequent scripts. Blockage of actions within the picture may be
avoided if you start the call in a Global Scripting action, such as starting the action through a
triggering tag.
Linking / copying of the archives generates a CPU load because the SQL server experiences
additional load because of turned-on signature checking in particular. Copying of archive
segments will slow down hard disk access.
Upon turned-on signature checking, an error message is returned if an unsigned or modified
archive is to be swapped. There is always only one error message returned, even if several
errors occurred during the swap process. Additionally, a WinCC system message is generated
for each archive segment. An entry is added to the Windows event log in the "Application"
section. This provides the opportunity to check which archive segments are creating the error.
With an unsigned archive, the return value "0x8004720F" is returned. The archive is stored.
The following text is entered in the event display:
"Validation of database <db_name> failed! No signature found!"
With an changed archive, the return value "0x80047207" is returned. The even screen, the
entry is "Validation of database <db_name> failed !".
The archive is not stored.
Note
Calling up the "Restore" method is presently only possible at the server. There is an
example, however, which shows how the method may be started by the client from a
server.
For redundancy, the following applies: Upon re-swapping of archives with the "Restore"
method, only archive segments are added to the Runtime project on the computer from
which the method was called.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1501

VBS Reference
2.5 Methods

Syntax
Objects Logging, AlarmLogs
Expression.Restore [SourcePath] [TimeFrom] [TimeTo] [TimeOut]
[ServerPrefix]
Expression
Required. An expression which returns an object of type "Logging" or "AlarmLogs".

Object DataLogs
Expression.Restore [SourcePath] [TimeFrom] [TimeTo] [TimeOut] [Type]
[ServerPrefix]
Expression
Required. An expression which returns an object of type "DataLogs".

Parameter
SourcePath
Path to archive data.
TimeFrom
Point in time, from which the archives are to be stored.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
TimeTo
Time up to which archive segments are to be swapped.
When indicating the time format, a short form is also possible. This is described in the "Time
Format" section.
Timeout
Timeout in milliseconds.
If you enter "-1" as a value, the wait will be infinite. If you enter a value of "0", there will be no
wait.
Type
Type of archive.
The parameter can (optionally) be used only to store archive segments of the tag logging.
The following values can be entered:

1502

Assigned Value

Type

Description

hmiDataLogFast

Tag Logging Fast data

hmiDataLogSlow

Tag Logging Slow data

hmiDataLogAll

Tag Logging Fast and Slow data

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
ServerPrefix
Reserved for future versions.

Return value
If an error occurred during swapping of archive segments, the method will return an error
message. Additional information may be found under the subject heading "Error Messages
from Database Area".

Time format
Time format is defined as follows: YYYY-MM-DD hh:mm:ss, where YYYY represents the year,
MM the month, DD the day, hh the hour, mm the minute and ss the second. For example, the
time of 2 minutes and one second past 11 o'clock on July 26, 2004 is displayed as follows:
2004-07-26 11:02:01.
For parameters "TimeFrom" and "TimeTo" the statement of data and time is also possible in
short form. Not all format fields must be filled in this case. The short form means that the
information on date and time may be lacking one or several parameters, beginning with the
value for seconds. For example, the statement may be in the form of "YYYY-MM" or "YYYYMM-DD hh". Using the statement "TimeFrom" = "2004-09" and "TimeTo" = "2004-10-04" all
archive segments between September 2004 up to and including October 4th are to be
swapped.

Example
In the following example, all archive segments since the specified time period are re-swapped,
and the return value is output as Trace.

'VBS184
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.Restore("D:\Folder","2004-09-14","",-1) &
vbNewLine

In the following example, all Tag Logging Slow archive segments since the specified time
period are re-swapped, and the return value is output as Trace.

'VBS185
HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.DataLogs.Restore("D:\Folder","2004-09-14
12:30:05","2004-09-20 18:30",-1,2) & vbNewLine

In the following example, all Alarm Logging archive segments up to the specified time period
are re-swapped, and the return value is output as Trace.

'VBS186

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1503

VBS Reference
2.5 Methods

HMIRuntime.Trace "Ret: " & HMIRuntime.Logging.AlarmLogs.Restore("","2004-09-20",-1) &


vbNewLine

See also
Error Messages from Database Area (Page 803)
Example: How to Start an Action on the Server (Logging Object) (Page 817)
Logging Object (Page 138)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)

2.5.6

Methods S to T

2.5.6.1

SelectAll

Function
Selects all rows in the table-based control.

Syntax
Expression.SelectAll()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

See also
Row object (list) (Page 240)

2.5.6.2

SelectRow

Function
Selects a particular row in the table-based control.

1504

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Syntax
Expression.SelectRow(ByVal IRow As Long, Optional bExtendSelection
As Boolean)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Parameters

Description

IRow

Number of the row to be selected.

bExtendSelection

Indicates as an option whether the current selection will be extended. Is only


relevant if multiple selections are possible.

Example
Row 1 is currently selected. If SelectRow( 2, True ) is called, then row 1 and row 2 will be
selected.
Row 1 is currently selected. If SelectRow( 2, False ) or SelectRow( 2 ) is called without an
optional parameter, then only row 2 will be selected.

See also
Row object (list) (Page 240)

2.5.6.3

SelectedStatisticArea method

Function
Executes the "Set statistic area" key function of the OnlineTableControl.

Syntax
Ausdruck.SelectedStatisticArea()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1505

VBS Reference
2.5 Methods

2.5.6.4

ServerExport method

Function
Executes the "Export archive" key function of the UserArchiveControl.

Syntax
Ausdruck.ServerExport()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.5

ServerImport method

Function
Executes the "Import archive" key function of the UserArchiveControl.

Syntax
Ausdruck.ServerImport()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.6

ShowColumnSelection method

Function
Executes the "Select columns" key function of the OnlineTableControl.

Syntax
Ausdruck.ShowColumnSelection()

1506

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.7

ShowComment method

Function
Executes the "Comments dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowComment()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.8

ShowDisplayOptionsDialog method

Function
Executes the "Display options dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowDisplayOptionsDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1507

VBS Reference
2.5 Methods

2.5.6.9

ShowEmergencyQuitDialog method

Function
Executes the "Emergency acknowledgment" key function of the AlarmControl.

Syntax
Ausdruck.ShowEmergencyQuitDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.10

ShowHelp method

Function
Executes the "Help" key function of the control.

Syntax
Ausdruck.ShowHelp()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

2.5.6.11

ShowHideList method

Function
Executes the "List of messages to be hidden" key function of the AlarmControl.

Syntax
Ausdruck.ShowHideList()

1508

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.12

ShowHitList method

Function
Executes the "Hitlist" key function of the AlarmControl.

Syntax
Ausdruck.ShowHitList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.13

ShowInfoText method

Function
Executes the "Info text dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowInfoText()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1509

VBS Reference
2.5 Methods

2.5.6.14

ShowInsertValue method

Function
Executes the "Create archive value" key function of the OnlineTableControl.

Syntax
Expression.ShowInsertValue()
Expression
Required. An expression that returns an object of the "ScreenItem" type.

2.5.6.15

ShowLockDialog method

Function
Executes the "Lock dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowLockDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.16

ShowLockList method

Function
Executes the "Lock list" key function of the AlarmControl.

Syntax
Ausdruck.ShowLockList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

1510

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Parameters
--

2.5.6.17

ShowLongTermArchiveList method

Function
Executes the "Long-term archive list" key function of the AlarmControl.

Syntax
Ausdruck.ShowLongTermArchiveList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.18

ShowMessageList method

Function
Executes the "Message list" key function of the AlarmControl.

Syntax
Ausdruck.ShowMessageList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.19

ShowPercentageAxis method

Function
Executes the "Relative axis" key function of the OnlineTrendControl.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1511

VBS Reference
2.5 Methods

Syntax
Ausdruck.ShowPercentageAxis()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.20

ShowPropertyDialog method

Function
Executes the "Configuration dialog" key function of the control.

Syntax
Ausdruck.ShowPropertyDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
VARIANT

2.5.6.21

ShowSelectArchive method

Function
Executes the "Select data connection" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSelectArchive()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

1512

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

2.5.6.22

ShowSelection method

Function
Executes the "Selection dialog" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSelection ()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.23

ShowSelectTimeBase method

Function
Executes the "Time base dialog" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSelectTimeBase()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.24

ShowSelectionDialog method

Function
Executes the "Selection dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowSelectionDialog()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1513

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.25

ShowShortTermArchiveList method

Function
Executes the "Short-term archive list" key function of the AlarmControl.

Syntax
Ausdruck.ShowShortTermArchiveList()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.26

ShowSort method

Function
Executes the "Sort dialog" key function of the UserArchiveControl.

Syntax
Ausdruck.ShowSort()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

1514

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

2.5.6.27

ShowSortDialog method

Function
Executes the "Sort dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowSortDialog()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.28

ShowTagSelection method

Function
Executes the "Select data connection" key function of the control.

Syntax
Ausdruck.ShowTagSelection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.29

ShowTimebaseDialog method

Function
Executes the "Time base dialog" key function of the AlarmControl.

Syntax
Ausdruck.ShowTimebaseDialog()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1515

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.30

ShowTimeSelection method

Function
Executes the "Select time range" key function of the control.

Syntax
Ausdruck.ShowTimeSelection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.31

ShowTrendSelection method

Function
Executes the "Select trends" key function of the OnlineTrendControl and
FunctionTrendControl.

Syntax
Ausdruck.ShowTrendSelection()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
-- -

1516

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

2.5.6.32

StartStopUpdate method

Function
Executes the "Start" or "Stop" key function of the control.

Syntax
Ausdruck.StartStopUpdate()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.6.33

Stop Method

Function
Terminates WinCC Runtime.

syntax
HMIRuntime.Stop

Parameters
---

Example:
The following example terminates WinCC Runtime:

'VBS124
HMIRuntime.Stop

See also
HMIRuntime Object (Page 134)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1517

VBS Reference
2.5 Methods

2.5.6.34

Trace Method

Description
Displays messages in the diagnostics window.

syntax
HMIRuntime.Trace

Parameters
STRING

Example:
The following example writes a text in the diagnostics window:

'VBS103
HMIRuntime.Trace "Customized error message"

See also
HMIRuntime Object (Page 134)

2.5.7

Methods U to Z

2.5.7.1

UnhideAlarm method

Function
Executes the "Unhide alarm" key function of the AlarmControl.

Syntax
Ausdruck.UnhideAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

1518

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

2.5.7.2

UnlockAlarm method

Function
Executes the "Unlock alarm" key function of the AlarmControl.

Syntax
Ausdruck.UnlockAlarm()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.7.3

UnselectAll

Function
Deselects all rows in the table-based control.

Syntax
Expression.UnselectAll()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

See also
Row object (list) (Page 240)

2.5.7.4

UnselectRow

Function
Deselects a particular row in the table-based control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1519

VBS Reference
2.5 Methods

Syntax
Expression.UnselectRow(ByVal IRow As Long)
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
Long
Parameters

Description

IRow

Number of the row to be selected.

See also
Row object (list) (Page 240)

2.5.7.5

Write Method

Description of Tag Object


Writes a value synchronously or asynchronously in a tag. The "LastError" property can be used
to determine whether the call was successful.
If the value of the tag is set successfully, the properties of the tag object are assigned the
following values:
Property

Allocation

Value

Tag values set by the user (unchanged)

Name

Tag name (unchanged)

QualityCode

Bad Out of Service

Timestamp

LastError

ErrorDescription

""

If the value of the tag is not set successfully, the properties of the tag object are assigned the
following values:

1520

Property

Allocation

Value

Tag values set by the user (unchanged)

Name

Tag name (unchanged)

QualityCode

Bad Out of Service

Timestamp

LastError

Write operation error codes

ErrorDescription

Error description on LastError

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

syntax
Expression.Write [Value],[Writemode]
Expression
Necessary. An expression which returns a tag object.

Parameters
The value to be written can be transferred directly to the method as a parameter. If the
parameter is not specified, the value in the "Value" property is used. The "Writemode" option
parameter can be used to select whether the tag value should be written synchronously or
asynchronously. If the "Writemode" parameter is not used, writing is performed asynchronously
as its default value.
During the writing process, no information is supplied on the status of the tags.
The "Value" property contains the value which was set before or during the writing operation,
therefore is may not correspond to the real current value of the tag. If the data on the tag should
be updated, use the Read method.
Parameters

Description

Value (optional)

The tag value is specified. The specified value


overwrites the value in the "Value" property in the
tag object.
The tag value is not specified. The tag receives the
current value from the "Value" property of the tag
object.

Writemode (optional)

0 or empty: The tag value is written


asynchronously. 0 is the default value.
1: The tag value is written synchronously.

On asynchronous writing, it is written immediately into the tag image. The user does not receive
any feedback if the value has been written in the programmable controller, too.
In the case of synchronous writing (direct to the PLC), the writing operation actually occurs
when the PLC is ready to operate. The use receives a check-back message if the writing
operation was not successful.

Example:
Asynchronous writing

'VBS104
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Value = 5
objTag.Write
MsgBox objTag.Value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1521

VBS Reference
2.5 Methods
or

'VBS105
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Write 5
MsgBox objTag.Value

Synchronous writing

'VBS106
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Value = 5
objTag.Write ,1
MsgBox objTag.Value

or

'VBS107
Dim objTag
Set objTag = HMIRuntime.Tags("Var1")
objTag.Write 5, 1
MsgBox objTag.Value

Description of TagSet Object


The TagSet object offers the option of writing several tags in one call.
Functionality here is mostly identical with that of a tag object. In the following, only deviations
thereof are described.
Expression
Necessary. An expression which returns an object of type "TagSet".

Parameters
In order to write different values, the "Value" property of individual tag objects must be set, and
write must be called thereafter without the "Value" parameter. Since the write commands are
grouped into one call, it results in improved performance compared to single calls.
In a TagSet object, it is not possible to pass on a value using the "Write" method. Individual
values must be set using the "Value" property of the individual tag objects.

1522

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods

Example:
The following example shows how tags are included in the TagSet list, how tag values are set
and subsequently written.

'VBS173
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Wert1"
group.Add "Wert2"
group("Wert1").Value = 3
group("Wert2").Value = 9
group.Write

If you set the optional parameter "Writemode" equal to 1, the process tags are written
synchronously (directly to AS).

group.Write 1

See also
LastError Property (Page 445)
ErrorDescription Property (Page 398)
TagSet Object (List) (Page 156)
Tag Object (Page 152)

2.5.7.6

WriteTags method

Function
Executes the "Write tags" key function of the UserArchiveControl.

Syntax
Expression.WriteTags()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1523

VBS Reference
2.5 Methods

2.5.7.7

ZoomArea - Method

Function
Executes the "Zoom area" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Ausdruck.ZoomArea()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.7.8

ZoomInOut - Method

Function
Executes the "Zoom +/-" key function of the OnlineTrendControl and FunctionTrendControl.

Syntax
Ausdruck.ZoomInOut()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.7.9

ZoomInOutTime method

Function
Executes the "Zoom time axis +/-" key function of the OnlineTrendControl.

Syntax
Ausdruck.ZoomInOutTime()

1524

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.5 Methods
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.7.10

ZoomInOutValues - Method

Function
Executes the "Zoom value axis +/-" key function of the OnlineTrendControl.

Syntax
Ausdruck.ZoomInOutValues()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.7.11

ZoomInOutX method

Function
Executes the "Zoom X axis +/-" key function of the FunctionTrendControl.

Syntax
Ausdruck.ZoomInOutX()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1525

VBS Reference
2.5 Methods

2.5.7.12

ZoomInOutY - Method

Function
Executes the "Zoom Y axis +/-" key function of the FunctionTrendControl.

Syntax
Ausdruck.ZoomInOutY()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

2.5.7.13

ZoomMove method

Function
Executes the "Move trend area" key function of the OnlineTrendControl and
FunctionTrendControl.

Syntax
Ausdruck.ZoomMove()
Expression
Necessary. An expression that returns an object of the "ScreenItem" type.

Parameters
--

1526

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBS Reference
2.6 Appendix

2.6

Appendix

2.6.1

Error Messages from Database Area

Introduction
Upon access to databases, a value is returned upon execution. Values in the range "0x8..."
represent an error message. Values not equal to "0x8..." represent a status message.
Status Messages
The following status messages are defined:
0x0

OK

0x1

Function did not find any errors in parameter supply and did not find any internal errors. The
following causes may result in this value.
When connecting databases:
- No archive could be found in the given time window.
- Archives were found in the given time window, but they were already connected.
When separating databases:
- No connected archives could be found in the given time window. No checks are performed
on whether or not archives are attached at all.

Error Messages
The following error messages are defined (n in English only):
Error code

Error Message

0x80047200

WinCC is not activated

0x80047201

Invalid archive type

0x80047202

Invalid lower boundary

0x80047203

Invalid upper boundary

0x80047204

Path 'CommonArchiving' could not be created in the project path

0x80047205

Timeout, please retry

0x80047206

WinCC was deactivated

0x80047207

Wrong signification
At least one database had a invalid signature and has not been attached.

0x80047208

Database could not be attached

0x80047209

Copy to 'CommonArchiving' is not possible.

0x8004720A

Invalid syntax for database filename.

0x8004720B

No list of databases.

0x8004720C

Database already detached.

0x8004720D

Database could not be detached.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1527

VBS Reference
2.6 Appendix
Error code

Error Message

0x8004720F

Unsigned database attached.


At least one database without signature has been attached.

0x80047210

Path error :
- Path invalid,
- no *.MDF files found in specified path or
- no permission to specified path.

See also
Remove Method (Page 772)
Write Method (Page 796)
Read Method (Page 767)
Restore Method (Page 777)
Logging Object (Page 138)
DataLogs Object (Page 130)
AlarmLogs Object (Page 128)

1528

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.1

Creating Functions and Actions with ANSI-C

Contents
In Runtime, background tasks, such as printing daily reports, monitoring tags or performing
picture-specific calculations, are performed as actions.
These actions are started by triggers.
Functions can be called from actions. WinCC has a multitude of functions, which can be
modified by the user. Furthermore, the user can also develop his own functions.
The Global Script editor is used to create and edit functions and actions.
This chapter will show you
How to use the Global Script editor
How to create and edit functions
How to create and edit actions
How to use the diagnostic tools to analyze runtime problems

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1529

ANSI-C for Creating Functions and Actions


3.2 Creating Functions and Actions

3.2

Creating Functions and Actions

Introduction
WinCC supports the use of functions and actions for dynamization of the processes in your
WinCC project. These functions and actions are written in ANSI-C.

Difference between Functions and Actions


Actions are activated by a trigger, namely a triggering event. Functions do not have a trigger
and are used as components of actions as well as in Dynamic Dialogs, in Tag Logging and in
Alarm Logging.

Trigger Types
The following trigger types are available:

1530

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.2 Creating Functions and Actions

Outline of the Functions and Actions


The diagram provides an overview of the range of functions and actions:

Actions are used for picture-independent background tasks, such as printing daily reports,
monitoring tags or performing calculations.
Functions are pieces of code, which can be used in several locations, but are only defined in
one place. WinCC includes a multitude of functions. Furthermore, you can also write your own
functions and actions.
The included standard functions can be modified by the user. In the event that WinCC is
reinstalled or upgraded, the standard functions that were modified are deleted or replaced by
the unedited standard functions. Therefore, you should back up the modified functions prior
to upgrading or reinstalling.

Design tool
WinCC provides the "Global Script" editor for designing, creating and editing functions and
actions. Global Script is started from the navigation window of WinCC Explorer.

Unicode support
You can set the suitable code page in the toolbar of the "Global Script" editor. This means that
the system language no longer has to be changed with the Microsoft setting "Start > Settings
> Control Panel > Regional and Language Options".
You can select "Dynamic: Project setting" as the language setting for scripts. The C script is
compiled in English. The code page of the centrally configured language is used for the strings
in runtime.
You can specify the project setting in the "Project Properties" dialog in the WinCC Explorer.
You can select the following from a list in the "Options" under "C scripts with "Dynamic"
language setting in runtime":

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1531

ANSI-C for Creating Functions and Actions


3.2 Creating Functions and Actions
"Respective set WinCC Runtime language". The C script is executed in the WinCC Runtime
language.
Operating system language for non-Unicode programs.
The C script is executed with the code page setting of the operating system. Select the
language from the list.

See also
Runtime Behavior of Actions (Page 1595)
How To Create and Edit Actions (Page 1573)
Creating and Editing Functions (Page 1560)
The Global Script Editor (Page 1546)
Use of DLLs in Functions and Actions (Page 1544)
Use of Global C-Tags (Page 1542)
How to Add Global Script Runtime to a Project's Startup List (Page 1541)
How to Generate a New Header (Page 1555)
Characteristics of Global Actions (Page 1540)
Characteristics of Local Actions (Page 1539)
Characteristics of Internal Functions (Page 1538)
Characteristics of Standard Functions (Page 1536)
Characteristics of Project Functions (Page 1535)

1532

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.3 Characteristics of Project Functions

3.3

Characteristics of Project Functions

Characteristics of Project Functions


Project functions ...
can be created by yourself
can be edited by you
can be password-protected against modification and viewing by unauthorized persons
have no trigger
are only known within the project
are assigned file name extension "*.fct"
Project functions are saved in the "\library"" subdirectory of the WinCC project.

Use of Project Functions


Project functions can be used...
in other project functions
in Global Script actions
in C-Actions in the Graphics Designer and within the Dynamic Dialog
in Alarm Logging within the Loop in Alarm functionality
in Tag Logging when starting and releasing archives and when swapping-out cyclic archives

See also
How to Protect a Function Against Unauthorized Access (Page 1568)
Creating and Editing Functions (Page 1560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1533

ANSI-C for Creating Functions and Actions


3.4 Characteristics of Standard Functions

3.4

Characteristics of Standard Functions

Characteristics of Standard Functions


Standard functions ...
are provided for use in WinCC
cannot be created by yourself
can be edited by you
can be password-protected against modification and viewing by unauthorized persons
have no trigger
are known across projects
are assigned file name extension "*.fct"
Standard functions are saved in the "\aplib" subdirectories in the WinCC installation directory.

Use of Standard Functions


Standard functions can be used...
in project functions
in other standard functions
in Global Script actions
in C-actions in the Graphics Designer and within the Dynamic Dialog
in Alarm Logging within the Loop in Alarm functionality
in Tag Logging when starting and releasing archives and when swapping-out cyclic archives

1534

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.4 Characteristics of Standard Functions

Note
The included standard functions can be edited by the user. In the event that WinCC is
reinstalled or upgraded, the standard functions that were modified are deleted or replaced
by the unedited standard functions. Therefore, you should back up the modified functions
prior to upgrading or reinstalling.

See also
How to Use Standard and Project Functions (Page 1566)
Creating and Editing Functions (Page 1560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1535

ANSI-C for Creating Functions and Actions


3.5 Characteristics of Internal Functions

3.5

Characteristics of Internal Functions

Characteristics of Internal Functions


Internal functions ...
are provided for use in WinCC
cannot be created by you
cannot be edited
cannot be renamed
have no trigger
are know project-wide
are assigned file name extension "*.icf"
Internal functions are saved in the "\aplib" subdirectories in the WinCC installation directory.

Use of Internal Functions


Internal functions can be used...
in project functions
in standard functions
in actions
in C-actions in the Graphics Designer and within the Dynamic Dialog

1536

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.6 Characteristics of Local Actions

3.6

Characteristics of Local Actions

Characteristics of Local Actions


Local actions ...
can be created by yourself
can be edited by you
can be password-protected against modification and viewing by unauthorized persons
have at least one trigger
are only executed on the assigned computer
are assigned file name extension "*.pas"
Local actions are saved in the "\<computer_name\Pas" subdirectory in the project directory.

Use of Local Actions


Actions are used for picture-independent background tasks, such as printing daily reports,
monitoring tags or performing calculations. An action is started by the trigger configured for it.
In order for an action to be executed, Global Script Runtime must be included in the startup
list.
In contrast to global actions, local actions can be assigned to a single computer. It is thus for
example possible to ensure that a report is only printed on the server.

See also
How to Protect an Action Against Unauthorized Access (Page 1580)
Triggers (Page 1582)
How To Create and Edit Actions (Page 1573)
How to Add Global Script Runtime to a Project's Startup List (Page 1541)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1537

ANSI-C for Creating Functions and Actions


3.7 Characteristics of Global Actions

3.7

Characteristics of Global Actions

Characteristics of Global Actions


Global actions ...
can be created by yourself
can be edited by you
can be password-protected against modification and viewing by unauthorized persons
have at least one trigger to start them
are executed on all project computers in a client-server project
are assigned file name extension "*.pas"
Global Actions are saved in the "\Pas" subdirectory of the WinCC project.

Use of Global Actions


Actions are used for background tasks, such as printing daily reports, monitoring tags or
performing calculations. An action is started by the trigger configured for it. In order for an
action to be executed, Global Script Runtime must be included in the startup list.
In contrast to local actions, global actions are executed on all project computers in a clientserver project. In a single-user project there is no difference between global and local actions.

See also
How to Protect an Action Against Unauthorized Access (Page 1580)
Triggers (Page 1582)
How To Create and Edit Actions (Page 1573)
How to Add Global Script Runtime to a Project's Startup List (Page 1541)

1538

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.8 How to Add Global Script Runtime to a Project's Startup List

3.8

How to Add Global Script Runtime to a Project's Startup List

Introduction
In order to run Global Script Actions in Runtime, Global Script Runtime must be added to the
project's startup list. This does not affect the executability of the functions.

Procedure
1. In the shortcut menu of computer in WinCC Explorer, select "Properties". The "Computer
list properties" dialog opens.
2. Click "Properties". The "Computer Properties" dialog opens.
3. Select the "Startup" tab
4. Activate "Global Script Runtime".

5. Click "OK" to close the dialog.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1539

ANSI-C for Creating Functions and Actions


3.9 Use of Global C-Tags

3.9

Use of Global C-Tags

Definition of global C tags


A global C-tag is defined by adding the definition line in front of the function name of a function:
int a; //The tag a is defined as an integer
void dummy() //Function name
{
. //Function code
}

Validity range
A tag defined in this manner is known to every function and action in Runtime. It is created as
soon as Runtime is started, even if the function itself was not called.
Note
When you operate the WinCC Service Mode, there is no common data area for C scripting.
Thus, for example, no global C variables can be exchanged between "Global Script" and the
"Graphics Designer".

Use of global C tags


Global C tags are used in functions or actions by declaring them as external within the function
or action:
void dummy() //Function name
{
extern int a; //External declaration of the tag a
. //Function code
}
The compiler is thus informed that it need not create the tag, since it is created in another
location in Runtime.
If the value of tag a changes, this change can be read by every function and action.
Each C-tag may only be defined in one location. For reasons of clarity and to avoid duplicate
definitions, we recommend defining global C tags in only one location.

1540

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.9 Use of Global C-Tags

Note
A maximum of 64 Kbytes are available to a function and the global C-tag defined with it.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1541

ANSI-C for Creating Functions and Actions


3.10 Use of DLLs in Functions and Actions

3.10

Use of DLLs in Functions and Actions

Adjusting DLLs
WinCC allows you to use your own DLLs (Dynamic Link Libraries).
Functions in existing DLLs can be enabled for functions and actions by making the necessary
additions to the respective function or action.
Add the following code in front of the function or action:
#pragma code("<Name>.dll")
<Type of returned value> <Function_name 1>(...);
<Type of returned value> <Function_name2>(...);
.
.
.
<Type of returned value> <Function_name n>(...);
#pragma code()
The functions <Function_name 1> ... <Function_name n> from <Name.dll> are declared and
can now be called by the respective function or action.
Example:
#pragma code("kernel32.dll")
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
#pragma code()
SYSTEMTIME st;
GetLocalTime(&st);
As an alternative to this procedure, you can also make the necessary additions in the
"Apdefap.h" header file.
When using own DLLs in WinCC, you must use the release version. WinCC is delivered as a
release version and thus uses the release version of the system DLLs. If you generate a custom
DLL in the debug version, it is possible that both the release and the debug version of the DLL
are loaded, increasing the memory requirements.

1542

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.10 Use of DLLs in Functions and Actions
Structures of the DLL have to be set up using 1-byte alignment.
Note
The DLL must be saved in either the "\bin" directory or in a path defined in the "PATH" system
tag. This tag is defined in the operating system properties.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1543

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

3.11

The Global Script Editor

3.11.1

The Global Script Editor

Introduction
WinCC supports the creation and editing of functions and actions with the Global Script editor.
Global Script is started from the project window of WinCC Explorer.

Structure of the Global Script Editor


The Global Script editor is designed in accordance with the Windows standards. It comes with
toolbars, a menu bar and a status bar. It has several windows featuring drop-down menus.







Menu bar (1)


The menu bar content depends on the situation. It is always visible.
Toolbars (2)
Global Script contains two toolbars You may always unhide these toolbars and use the mouse

1544

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor
to move them to any screen position.
You may hide/unhide the toolbars using the "View" > "Toolbars" menu command and move
these to any position in the editor.
Navigation window (3)
The navigation window serves to select functions and actions for editing, or to insert an editing
window at the cursor position. The functions and actions are organized in groups with hierarchic
order. Functions are always displayed by their function name, while actions are displayed by
their file name.
Editing window (4)
The editing window is used to edit functions and actions. It is only visible when a function or
action has been opened for editing. Each function or action is opened in a separate edit
window. Several editing windows can be opened simultaneously.
Output window (5)
The output window displays results of the "Search in files" or "Compile all functions" functions.
By default, it is visible, but can be hidden.
Search in files:
A hit list is returned for each search term found in a single line of the output window, which
consists of the line number, path and file name, as well as the line text with the specified
number of the line in which the search term was found. You can directly open the
corresponding file by double-clicking an entry in the output window. The cursor is placed
in the line in which the search term was found.
Compile All Functions:
Compiler warnings and error messages are output for all functions compiled. In the next
line, the path and file name of the compiled function as well as the summary message from
the compiler are displayed.
Status bar (6)
The status bar is located on the bottom edge of the Global Script window; you may hide/unhide
the status bar. It contains information about the position of the cursor in the edit window and
the keyboard settings. In addition, the status bar shows either a brief description for the
currently selected Global Script functionality or a tip.

Window docking
Window docking is a useful tool for the flexible arrangement of windows. It lets you reposition
windows to obtain separate windows, or to group windows in tab groups. For example, you
can arrange your actions horizontally, vertically, or as tab group. You may hide windows
automatically and show these again as required.
For more information ,refer to chapter "Creating process pictures".

See also
Printing Functions and Actions (Page 1558)
How to Search in Files (Page 1557)
How to Compile All Functions (Page 1556)
How to Generate a New Header (Page 1555)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1545

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor
How to Delete Actions or Project and Standard Functions (Page 1555)
How to Use "Save As..." (Page 1554)
How to Set the Font Style (Page 1553)
How to Set Different Views (Page 1553)
Working with the Toolbars (Page 1550)
Working in the Edit Window (Page 1548)

3.11.2

Working in the Edit Window

3.11.2.1

Working in the Edit Window

Introduction
The edit window includes an array of functions, which can be executed with either the keyboard
or the mouse.
In the edit window, you can edit functions and actions.

Contents
The window can be split. The upper part of the edit window displays the code of the function
or action. In the lower part, you can see the messages that the compiler output while compiling
the function or action.

1546

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

Properties
When the window is opened for the first time, the lower part of the window is minimized. When
the compiler process is started, the lower part of the window is enlarged to allow for the display
of the compiler messages. The division of the window can be adjusted with the mouse. Doubleclick an error message to jump to the corresponding line in the code.

Color code
The C code is color-coded as follows:
Color

Description

Example

Blue

Keywords

define, double, if

Green

Comments

// is a comment

Red

Strings

"Rectangle3"

Black

Other C-codes

level=100*newvalue/255;

Note
A function or action cannot have more than 32767 characters including spaces.

See also
Editing Functions with the Mouse (Page 1550)
Editing Functions with the Keyboard (Page 1549)

3.11.2.2

Editing Functions with the Keyboard


You can carry out the following editing functions using the keyboard:
Editing function

Keyboard operation

Switch between write modes Insert/Overwrite

<INSERT>

Add new line

<ENTER>

Delete one character to the right

<DELETE>

Delete one character to the left

<BACKSPACE>

Delete marked text

<DELETE> or <BACKSPACE>

Jump to beginning of line

<POS1>

Jump to end of line

<END>

Jump to beginning of text

<CTRL+POS1>

Jump to end of text

<CTRL+END>

Move cursor

<Cursor keys>

Move cursor by one window content to beginning


of text

<PAGE UP>

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1547

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor
Editing function

Keyboard operation

Move cursor by one window content to end of text <PAGE DOWN>

3.11.2.3

Move cursor to first line in window

<CTRL+PAGE UP>

Move cursor to last line in window

<CTRL+PAGE DOWN>

Jump to next tab position

<TAB>

Cut marked text and paste to clipboard

<CTRL+X>

Copy marked text to clipboard

<CTRL+C>

Paste text from clipboard

<CTRL+V>

Editing Functions with the Mouse


You can carry out the following editing functions using the mouse:
Editing function

Mouse command (left mouse button)

Select text

Drag mouse over text

Select a word

Double-click the word

Select a line

Triple-click the line

Extended selection

<SHIFT> + mouse-click

Set cursor

Click

Move selected text

Drag and drop

Duplicate selected text

<CTRL>+drag and drop

Other editing functions:


By double-clicking a compiler error message, the editor jumps to the corresponding line in
the code.
Right-clicking calls up a shortcut menu.
With the following actions, the selected text is replaced by the result of the action:
Input of character(s) through the keyboard
Pasting of text from the clipboard
Insertion of a function call by means of parameter assignment

3.11.3

Working with the Toolbars

Purpose
The toolbars are located in their default position below the menu bar, at the top of the Global
Script window. The toolbar buttons allow for fast and easy execution to a number of Global
Script functions.
There are two toolbars available:

1548

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor
"Standard" toolbar

"Edit" toolbar

Contents
The standard toolbar contains buttons for the following functions:
Button

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Function

Key combination

Creates a new action.

<ALT+A> or
<CTRL+N>

Creates a new standard function.

<ALT+S> or
<CTRL+N>

Creates a new project function.

<ALT+P> or
<CTRL+N>

Creates a new header file.

<CTRL+H>

Opens an existing action or function.

<CTRL+O>

Saves the content of the active editing window. This


function is only available if an editing window is open.

<CTRL+S>

Cuts the selected text and copies it to the clipboard. This


function is only available if text has been selected.

<CTRL+X>

Copies the selected text to the clipboard. This function is


only available if text has been selected.

<CTRL+C>

Pastes the contents of the clipboard at the location of the


cursor. This function is only available if the clipboard is not
empty.

<CTRL+V>

Undoes the last of a maximum of 30 editor actions. This


function is only available if an editor action has been
performed.

<CTRL+Z>

Redoes the last editor action that was undone. This


function is only available if an editor action has been
undone.

<CTRL+A>

Prints the contents of the active editing window as project


documentation. This function is only available if an editing
window is open.

<CTRL+P>

Activates the direct help (What's this?).

<SHIFT+F1>

Generates a new header.

<CTRL+G>

Allows you to set the font.

<CTRL+F>

1549

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

Note
The key combination <CTRL+N> is only available if at least one editing window is open. If
the active editing window contains a function and <CTRL+N> is pressed, a new project
function is created. If the active editing window contains an action, this key combination
creates a new global action.
The editing toolbar contains buttons for the following functions:
Button

Function

Key combination

Enables you to add information


about functions and, in the case
of an action, to setup a trigger.
This function is only available if
an editing window is open.

<CTRL+I>

Compiles the code in the active


editing window. This function is
only available if an editing
window is open.

<SHIFT+F8>

Set the appropriate code page.

Verify that the code page


selection matches the source
text. You cannot use more than
one language in the source text.

1550

Opens the tag dialog. This


function is only available if an
editing window is open.

<CTRL+R>

Opens a dialog for the selection


of a picture. The name of the
selected picture is inserted at the
position of the cursor in the
editing window. This function is
only available if an editing
window is open.

<CTRL+W>

Imports an action. This function


is only available if the active
window contains an action.

<CTRL+M>

Exports the action from the


active editing window. This
function is only available if the
active window contains an
action.

<CTRL+T>

Sets the authorization for


operating the action. This
function is only available if the
active window contains an
action.

<CTRL+E>

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

Properties
Both toolbars can be shown or hidden.
They can be pinned below the menu bar.
When they are not pinned down, they can be dragged with the mouse to any position on the
screen.

See also
How to Set Different Views (Page 1553)

3.11.4

How to Set Different Views

Introduction
In this context, views are considered to be different combinations of elements visible in the
Global Script editor, such as the output window, status bar and toolbars. These elements can
be individually displayed or hidden.
By default, all elements are visible.

Procedure
1. Opens the "View" menu in the Global Script menu bar.
2. Activate or deactivate the display of the desired elements e.g. the toolbars. If "show" is
chosen, a check mark is displayed in front of the name.
Note
When Global Script restarted, the editor reverts to the default settings and all elements are
again visible.

3.11.5

How to Set the Font Style

Introduction
The font style is composed of the settings "Font", "Style" and "Size".
The style selected is active in all edit windows.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1551

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

Procedure
1. Click the

button in the standard toolbar to open the dialog for setting the font style.

2. Make the desired settings.


3. Confirm your settings by clicking "OK".

Alternative procedure
You can also open the dialog for the font style settings in the following manner:
Select the "Options" menu in the Global Scripts menu bar and select "Font", or use the
corresponding key combination.
Note
The settings are automatically saved and are not reset when WinCC is restarted.

3.11.6

How to Use "Save As..."

Introduction
If a function or action is created, Global Script saves the corresponding file in a predefined
path with a default file name, e.g. "new_function_1.fct" for functions and "gsccs1.pas" for
actions. Since these default file names are not particularly useful, use "Save As ..." to save
the function or action under a different - more meaningful - file name. The file with the default
file name is retained.
With "Save As ...", only the file name is changed, the function or action name remains
unchanged.
Global Script expects that the function or action is saved in a project directory. If this is not
the case, a message is displayed, but the file is saved nonetheless.

Requirement
"Save As..." is only available, if at least one edit window is open. It saves the content of the
active edit window.

Procedure
1. In the Global Script menu bar, open the "File" menu.
2. Select "Save As...".
3. Enter the new file name.
4. Close the dialog by clicking the "Save" button.

1552

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

See also
How to Delete Actions or Project and Standard Functions (Page 1555)

3.11.7

How to Delete Actions or Project and Standard Functions

Introduction
Actions or project and standard functions can be deleted during configuration or in Runtime.
Global Script deletes the entry in the navigation window as well as the associated file.
If a deleted function is called by an action, the action is terminated upon calling the function.
If a Global Script diagnostic window is open at this time, a message is displayed. The
termination of the action is logged in the "WinCC_Sys_xx.log" diagnostic file (xx = consecutive
number). This diagnostic file is located in the "Diagnostics" subdirectory of the WinCC
installation directory.

Procedure
1. In the Global Script navigation window, call up the shortcut menu for the function or action
to be deleted.
2. Select "Delete".
3. Confirm the command by clicking "Yes".

Alternative operation
Instead of using the shortcut menu, you can also delete the selected function or action by using
the <DELETE> key.
Note
If a function is deleted, the entry in the respective header file is deleted as well.

3.11.8

How to Generate a New Header

Introduction
The header must be generated again in the following cases:
After you have copied project functions from a different project to the "library" directory in
your project path.
After you have copied standard functions from another PC to the "aplib" directory or
subdirectories.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1553

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor
By regenerating the header, you enter the copied functions in the respective header files. You
can then use the functions in your project.

Procedure
1. Click

in the "Standard" toolbar.

Alternative operation
Alternatively, you can start a generation process as follows:
Open the "Options" menu and select "Regenerate Header" or use the corresponding key
combination.
Note
Once the regeneration is finished, the contents of the navigation window are updated.
If WinCC is in Runtime, the Runtime system is not influenced by the regeneration of the
header.

3.11.9

How to Compile All Functions

Introduction
If you have changed the header files manually, you have to recompile all functions. All project
functions, standard functions and internal functions are automatically compiled with the menu
command "Compile all functions".
If functions are called in other functions, error messages are possible. The reason for this is
that the called functions have not yet been compiled. These functions must then be compiled
individually.

Requirement
This function is only available, if all edit windows are closed.

Procedure
1. Open the "Options" menu.
2. Select "Compile All Functions".

Alternative operation
You can compile all functions using the key combination <ALT+U>.

1554

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

Result
The results of the individual compilation runs are displayed in the output window, e.g. warnings
and error messages of the compiler. The path and the file name of the compiled function as
well as the summary message of the compiler are also displayed.
Note
In a multi-user project, the "Compile All Functions" function is not available. Assigning
functions is no longer possible with these projects.
The functions compiled in this way will not become active until the next time you start Runtime
on a WinCC PC.

3.11.10

How to Search in Files

Introduction
All files of the group selected in the navigation window are searched for the specified search
term.
The result of the search is displayed in the output window as follows:
For each found search term, a line is displayed in the output window. This line contains the
line number of the line in the code in which the search term was found, plus the path and file
name as well as the line of code itself.
Standard and project functions as well as actions can be opened by double-clicking the search
results. The cursor is positioned at the start of the line in which the search term was found. In
the case of internal functions, the function containing the search term is shown in the navigation
window and selected.

Procedure
1. Open the shortcut menu for the group to be searched in the Global Script navigation window.
2. Select "Find in Files".
3. In the dialog, enter the search term to be found.
4. Click "Find" to start the search. The result of the search is displayed in the output window.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1555

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor

3.11.11

Printing Functions and Actions

3.11.11.1 Printing Functions and Actions


Introduction
Actions or project or standard functions can be printed using specified system layouts.
This is however only possible, if the function or action to be printed is displayed in the edit
window. The content of the active edit window is printed.
The printout can be examined on the screen in page view.
The printing process can be controlled by a number of print parameters.
The following system layouts are used:
@gsc_pfc.rpl for project functions
@gsc_sfc.rpl for standard functions
@gsc_act.rpl for actions

See also
How to Print the Project Documentation (Page 1559)
How to Open Page View (Page 1559)
How to Set the Print Parameters (Page 1558)

3.11.11.2 How to Set the Print Parameters


Introduction
You can modify the printout as follows:
By specifying a layout that differs from the standard layout
By selecting a page range
By selecting a printer selection
By printing to file

Requirement
At least one edit window must be open.

Procedure
1. In the Global Script menu bar, open the "File" menu.
2. Select "Project Documentation Setup..."

1556

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.11 The Global Script Editor
3. In the subsequent dialog, adjust the desired settings.
4. Apply the settings by clicking "OK".
Note
The settings are automatically saved and are not reset when WinCC is restarted.

3.11.11.3 How to Open Page View


Introduction
Before you begin printing a function or action, it is sometimes an advantage to first see a
preview of the printout on the screen (in page view).
The content of the active edit window is displayed in page view.

Procedure
1. In the Global Script menu bar, open the "File" menu.
2. Select "Project Documentation Setup...".

3.11.11.4 How to Print the Project Documentation


Introduction
You can output the contents of the active edit window to a printer or to a file. The selected print
parameter settings are applied.

Procedure
1. In the Global Script menu bar, open the "File" menu.
2. Select "Print Project Documentation".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1557

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

3.12

Creating and Editing Functions

3.12.1

Creating and Editing Functions

Introduction
The system distinguishes between project, standard and internal functions. WinCC is delivered
with a broad selection of standard and internal functions. Furthermore, you can create your
own project and standard functions or modify standard functions. Please remember, however,
that the standard functions included with WinCC are overwritten when WinCC is reinstalled so
any modifications are lost.
Internal functions cannot be created or edited.

Using Functions
If the same calculation must be performed - with different starting values - in several actions,
it would be to your advantage to program a function to perform this calculation. Subsequently
you can simply call this function with the current parameters in the actions.
This approach has a number of advantages:
The code is only programmed once.
Modifications are only made at one point, namely in the procedure, not in each action.
The action code is shorter and, thus clearer.

1558

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

Finding Functions
To access existing functions or create new ones, you can either use the "File" menu in the
Global Script navigation window or click the corresponding button in the toolbar.
Functions are stored in the file system as follows:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1559

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

Editing and Compiling Functions


A function is edited and compiled in its own edit window. The edit window displays messages
from the compiler after a compilation run. These might be warnings or error messages. In each
case, a summary of the number of warnings and error messages is output.

What Happens When Functions Are Renamed?


In the navigation window, functions are always displayed with their function not their Windows
file names. If you change the name of a function and then compile it, the name displayed in
the navigation window longer match the function name. This is indicated in the navigation
window with the prefix "*" (asterisk) in front of the name. As soon as you save the function, the
current function name is displayed in the navigation window.

Note re. Saving Functions


If you save a function that has not been properly compiled, the
navigation window.

symbol is shown in the

If you save a function that has not been compiled without errors, the
navigation window.

symbol is shown in the

See also
Working in the Edit Window (Page 1546)
How to Use Functions from Other Sources (Page 1571)
How to Rename a Function (Page 1570)
How to Compile and Save a Function (Page 1569)
How to Protect a Function Against Unauthorized Access (Page 1568)
Inserting Additional Function-Related Information (Page 1567)
How to Use Standard and Project Functions (Page 1566)
How to Use Internal Functions (Page 1565)
How to Write Function Code (Page 1564)
How to Create a New Function (Page 1563)
Characteristics of Standard Functions (Page 1534)
Characteristics of Project Functions (Page 1533)

1560

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

3.12.2

How to Create a New Function

Introduction
The procedure is identical for both project and standard functions. In the navigation window,
specify the type (project or standard function) and, for standard functions, the group, e.g.
"graphics". This also specifies the place where the file is to be saved.
Global Script suggests a default name, e.g. "new_function_3", for the new function. This is also
the file name of the function. To ensure that the function name is unique, the suggested name
includes a sequential number.
As a rule, the default name should be replaced with a more informative function name. When
the renamed function is first saved, the file name can also be changed.
Global Script adds the following information to the function: date created, date modified and
version. This information can be viewed in the "Properties" dialog. In the same dialog, you can
also assign a password to protect the function against unauthorized modification or viewing.
button.
To open the dialog, click the
Note
The characters supported by ANSI-C are also supported for the function name:
Letters, apart from regional special characters
Numbers
Underscore

Procedure
1. In the navigation window, open the shortcut menu for the desired group.
2. Select "New"
If a new function has been created, the first line of code in the associated edit window
contains the type of return value and the default name of the new function. In the brackets
following this, you can enter transfer parameters if you wish.
The function code is entered between the curly brackets.

Alternative operation
Alternatively, you can also create a new function by clicking the associated button in the toolbar,
via the "File" menu or by using the corresponding key combination.

See also
Inserting Additional Function-Related Information (Page 1567)
How to Use "Save As..." (Page 1552)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1561

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

3.12.3

How to Write Function Code

Introduction
The function code is written in the edit window for the function. The programming language is
ANSI-C.
The code of any project or standard function can call other functions. The called function can
be a project, standard, internal or DLL function. To make certain that the called function is
known to the calling function, the line #include "apdefap.h" is added as the first line of code in
the calling function code.
In the navigation window under "Internal Functions", the C-function library is available as
"c_bib".
The first line of code contains the type of the returned value and the default name of the new
function. Parameters can be passed by entering them in the following brackets.
The function code is entered between the braces.

Procedure
1. Double-click the function in the navigation window to open it in an edit window.
2. Set the cursor where you wish to begin writing.
3. Enter the desired code.

Alternative operation
You can also open a function as follows:
In the navigation window, open the shortcut menu for the desired action and click "Open" or
button in the standard toolbar or use the corresponding
"File\Open...". You can also click the
key combination.

Note
A maximum of 32 Kbytes of memory is available for local tags (tags defined within the braces
of the function code).

See also
How to Use Standard and Project Functions (Page 1566)
How to Use Internal Functions (Page 1565)
Editing Functions with the Mouse (Page 1548)

1562

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions
Editing Functions with the Keyboard (Page 1547)
Working in the Edit Window (Page 1546)

3.12.4

How to Use Internal Functions

Introduction
You can use any of the internal functions as part of your function code. The internal functions
are found in the navigation window in the "Internal Functions" group.
If you have used the "Assigning Parameters" dialog to add a function, the function's comments
show the type of value returned.

Procedure
1. Place the cursor at the point at which the internal function is to be inserted.
2. In the navigation window, open the shortcut menu for the internal function to be added.
3. Select "Assigning Parameters". The "Assigning Parameters" dialog is opened.
This dialog has one line for each parameter. In the "Value" column, enter the respective
current parameter.
4. In the "Value" column, enter the current value for each of the required parameters.
This can be accomplished by either a direct entry from the keyboard, or you can open the
menu in the "Value" column (single-click and then click the displayed button). From the
menu, you can open the selection dialog for tags, pictures or graphic objects.
5. Confirm your entries with "OK". The parameterized function is inserted in the edit window
at the location of the cursor.

Alternative operation
Alternatively you can also open the "Assigning Parameters" dialog for an internal function by
double-clicking the function to be added.
Note
If you close the "Assigning Parameters" dialog with "OK" without entering the current
parameter value, the internal function is inserted with its formal parameters. You can then
set the parameters in the edit window at a later stage.
Instead of using the "Assigning Parameters" dialog, you can also use the keyboard to enter
the function.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1563

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

3.12.5

How to Use Standard and Project Functions

Introduction
You can use any project or standard function as part of the function code, if you have first
added the line #include "apdefap.h" in the header. The project functions are found in the
navigation window in the "Project Functions" group. The standard functions are found in the
navigation window in the "Standard Functions" group.
Project functions are entered in the "Ap_pbib.h" header file; standard functions are entered in
the "Ap_glob.h" header file. These entries are made by the system. The " Ap_glob.h" header
file is integrated into the "Ap_pbib.h" header file. The "Ap_pbib.h" header file itself is linked to
the "Apdefap.h" header file. Therefore all project and standard functions are declared in the
"Apdefap.h" file header.
To inform the compiler of the project and standard functions added, add the line #include
"apdefap.h" as the first line in the function code.
If you have used the "Assigning Parameters" dialog to add a function, the function comments
show the type of value returned.

Procedure
1. Place the cursor at the point at which the project or standard function is to be inserted.
2. In the navigation window, open the shortcut menu for the function to be added.
3. Select "Assigning Parameters". The "Assigning Parameters" dialog is opened.
This dialog has one line for each parameter. In the "Value" column, enter the respective
current parameter.
4. In the "Value" column, enter the current value for each of the required parameters.
This can be accomplished by either a direct entry from the keyboard, or you can open the
menu in the "Value" column (single-click and then click the displayed button). From the
menu, you can open the selection dialog for tags, pictures or graphic objects.
5. Confirm the entries by clicking "OK".
Note
If the function does not require a parameter, it is added to the function code immediately
without opening the "Assigning Parameters" dialog.
If you close the "Assigning Parameters" dialog with "OK" without entering the current
parameter value, the internal function is inserted with its formal parameters. You can then
set the parameters in the edit window at a later stage.

1564

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

3.12.6

Inserting Additional Function-Related Information

Introduction
Additional information can be assigned to every function.
When a new action is created, the creation date is automatically entered in the function-related
information and is unchangeable. In addition, the version number 1.0 is also assigned to the
number. The version numbers can be individually assigned when editing a function. When a
function is changed and saved, the current date of change is entered automatically and is
unchangeable. This dialog can be used to assign a password to protect the function from
unauthorized viewing and modification.

Requirements
The function to which the information relates must be open in an edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the required entries.

3. Confirm the entries by clicking "OK".

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
Click the "Edit" menu and select the "Info" option or use the corresponding key combination.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1565

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

See also
How to Protect a Function Against Unauthorized Access (Page 1568)
How to Set Different Views (Page 1551)
Working with the Toolbars (Page 1548)

3.12.7

How to Protect a Function Against Unauthorized Access

Introduction
Functions can be protected with a password against unauthorized read and write access. The
password is a part of the function-related information.

Requirements
The function to be compiled must be opened in the edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the "Password" check box.


3. Click the "Change" button.

4. Enter the password in the "Password" field.


5. Enter the password again in the "Confirmation" field.
6. Confirm your entries with "OK".
7. Click "OK" to close the dialog.

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
Click the "Edit" menu and select the "Info" option or use the corresponding key combination.

1566

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

Note
A password-protected function can only be opened in the edit window if the correct password
is entered.
To deactivate the password protection, clear the "Password" check box.

See also
How to Set Different Views (Page 1551)
Working with the Toolbars (Page 1548)

3.12.8

How to Compile and Save a Function

Introduction
In order to use a function, it must first be compiled. Only the function in the active edit window
is compiled.
Errors reported by the compiler are displayed in the lower portion of the window. Each message
is displayed on a separate line. The line includes the line number in the source code where
the error occurred, a hexadecimal encoded error code and a description of the error.
Double-click such a line to select the source code line where the error occurred.
It is recommended that you examine the first message error listed, as subsequent ones could
be errors resulting from the first one. If the first error is corrected, then the others might
disappear after the next compilation.
To make the changes permanent, the function must be saved.
If you save a function that has been compiled with errors, or not at all, the
to this function in the navigation window.
If you save a function that has been compiled without errors, the
function in the navigation window.

icon is assigned

icon is assigned to this

Requirements
The function to be compiled must be opened in the edit window.

Procedure
1. Use the toolbar to set the language for compilation of the C function.
2. Click

on the "Edit" toolbar.

3. Examine the compiler messages in the lower portion of the edit window.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1567

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions
4. If the compiler reported an error, the function code must be corrected. After this has been
done, start again with step 1 in this table.
5. If the compiler generated warnings, the function source code may require correction. After
the code has been corrected, start again with step 1 in this table, otherwise proceed to step
6.
6. Click

on the "Default" toolbar.

Alternative operation
Alternatively, the compilation process can be initiated in the following ways:
Select "Compile" from the "Edit" menu, select the "Compile" option from the shortcut menu of
the edit window or use the corresponding key combination.
Saving may also be performed in the following ways:
Select "Save" from the "File" menu or use the corresponding key combination.
Note
The compiler does not output an error message if tag names are used several times in a C
function. This is also the case if a tag name is used both as transfer parameter and as local
tag definition.
For example, the following faulty script does not trigger an error message in the compiler:
void neue_Funktion(DWORD dwMyVar)
{
DWORD dwMyVar = 0;
}
Message in the output window of the compiler:
Compiling ...
0 Error(s), 0 Warning(s)

See also
Runtime Behavior of Actions (Page 1595)

3.12.9

How to Rename a Function

Introduction
It is recommended that you rename the function, when it is created.

1568

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions
The name of the function in the edit window is then changed accordingly. Since this also
changes the code, the function must be recompiled. The old function name, displayed in the
navigation window, is assigned prefix "*" (asterisk).
Afterwards, the modified function must be saved at which time you can change the path and
file name. The old function should then be deleted to avoid accumulating a collection of
obsolete functions.
Note
Please note that only certain characters may be used in function names: characters (with the
exception of national special characters), numbers and the underscore.

Procedure
1. Change the function name in the edit window.
2. Click the

button in the editing toolbar. The function is compiled.

3. Click the

button in the standard toolbar to save the function.

4. If desired, enter a different path and/or file name.


5. Confirm your entry by clicking "Save".

Alternative operation
Alternatively, the compilation process can be initiated in the following ways:
Select "Compile" from the "Edit" menu, select the "Compile" option from the shortcut menu of
the edit window or use the corresponding keyboard shortcut.
Saving may also be performed in the following ways:
Select "Save" from the "File" menu or use the corresponding key combination.

3.12.10

How to Use Functions from Other Sources

Introduction
Project functions from other WinCC projects and standard functions from other WinCC systems
can also be made useable for the current project. To do so they must be brought into the
current project.
Apart from the location in the file system in which they are saved, there is no difference in the
procedure for project or standard functions.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1569

ANSI-C for Creating Functions and Actions


3.12 Creating and Editing Functions

Procedure
1. Copy the functions. Project functions are copied in the "\library" directory for the WinCC
project. Standard functions are copied in the "\aplib\..." directory in the WinCC path. The
content of the navigation window is updated automatically.
in the "Standard" toolbar. When the header is regenerated, the copied functions
2. Click
are registered so that you can use them in your current project.

Alternative operation
Alternatively, you can start a generation process as follows:
Open the "Options" menu and select "Regenerate Header" or use the corresponding key
combination.
Note
In the event that WinCC is reinstalled or upgraded, the standard functions that were modified
are deleted or replaced by the unedited standard functions.
If WinCC is in Runtime, the Runtime system is not influenced by the regeneration of the
header.

1570

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13

Creating and Editing Actions

3.13.1

How To Create and Edit Actions

Introduction
There system distinguishes between global and local actions. In a client-server project, global
actions are carried out on all computers in the project, whereas local ones are carried out only
on the computer to which they are assigned.
A global action can, for instance, be used to perform a calculation on all computers in the
project.
An example of use for a local action might be to output a log file on a server.
The process of creating and editing both action types is identical.

Differences between actions and functions


Actions, in contrast to functions, can have a trigger. This means that a function, by itself,
cannot be executed in Runtime.
Actions can be exported and imported.
Authorizations can be assigned to actions. This authoriation refers to the operational
options for the Global Script Runtime troubleshooting window.
An action has no parameters.

Finding actions
New actions can be created, and existing actions can be accessed through the Global Script
navigation window.
Actions are stored in the file system as follows:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1571

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

Editing and Compiling Actions


An action is edited and compiled in a separate edit window. The edit window displays
messages from the compiler after a compilation run. These might be warnings or error
messages. In each case, a summary of the number of warnings and error messages is output.

Display of Actions

If a syntactically incorrect action is stored, it is displayed in the Global Script navigation window
with the icon shown to the left.

If a syntactically correct action is stored with no trigger, it is displayed in the Global Script
navigation window with the icon shown to the left.

If a syntactically correct action is stored with a trigger, it is displayed in the Global Script
navigation window with the icon shown to the left.

Please note the following when creating actions:


The CrossReference feature of WinCC allows for the creation of cross-references. When
building the cross-reference list, in order that the tags and images be recognized when function
calls are used as part of actions, the coding rules described further below are to be observed.

Renaming actions
Actions are always displayed with their file names in the navigation window. Renaming an
action means renaming the file containing the action code.

System behavior if actions are changed, deleted and saved at Runtime


If a local action is stored at runtime, then all local and global actions of the computer are reset
on the computer to which the local action belongs.
If a global action is stored in Runtime, then all local and global actions for the entire project
and thus on all computers are reset.

1572

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
Such a reset might reinitialize for examples tags and times that are used as triggers for actions,
triggering the action at that stage.
Static tags used in the reset actions are reinitialized.

Possible causes for an action not being performed in Runtime


Failure of an action to be executed in Runtime might have the following causes:
The action has no trigger
The action was not compiled
Global Script Runtime is not enabled in the project start list

Note
Before creating an action, check whether the relevant functionality can also be implemented
on the automation device.

See also
How to Protect an Action Against Unauthorized Access (Page 1580)
How to Use Actions From Other Sources (Page 1593)
How to Rename an Action (Page 1592)
How to Import an Action (Page 1591)
How to Export an Action (Page 1590)
How to Assign Authorizations (Page 1590)
Triggers (Page 1582)
How to Compile and Save an Action (Page 1581)
How to add action-related information (Page 1578)
How to Edit Actions (Page 1578)
How to Create a New Action (Page 1577)
WinCC Coding Rule (Page 1576)
How to Add Global Script Runtime to a Project's Startup List (Page 1539)
Characteristics of Global Actions (Page 1538)
Characteristics of Local Actions (Page 1537)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1573

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13.2

WinCC Coding Rule

Coding Rules for the Use of CrossReference


The CrossReference feature of WinCC allows for the creation of cross-references. To ensure
that the software can recognize the tags and pictures used in function calls made within actions,
the coding rules given here must be observed.
The action's code begins with two sections. In the first section, you must declare all tags used;
in the second section all picture names used.
Do not enter any other instructions in the sections.
Both sections are already present in the form of comments when an action is created:
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
The sections are expanded, for example as follows:
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
#define ApcTagName1 "TagName1"
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
#define ApcPicName1 "PicName1"
#define ApcPicName2 "PicName2"
#define ApcPicName3 "PicName3"
// WINCC:PICNAME_SECTION_END

1574

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

Calls to functions to read and write tags and the utilization of picture names must then be
handled using the defined names:
GetTagDWord(ApcTagName1);
OpenPicture(ApcPicName1);
SetPictureName(ApcPicName2,"PictureWindow1",ApcPicName3);

3.13.3

How to Create a New Action

Introduction
In a client-server project, global actions are carried out on all computers in the project, whereas
local ones are carried out only on the computer to which they are assigned.
The procedure is identical for both global and local actions. By specifying, in the navigation
window, the location in which the action is saved, you specify its type (global or local).
Global Script suggests a default name for the new action.
A newly created action already contains the instruction #include "apdefap.h". Therefore, all
functions are registered within the action. The name of the action is found in the third line. The
first three lines cannot be deleted nor modified. This means that every function can be called
from each action without requiring any special measures. Furthermore every action has a
returned value of type "int" and it is already set to a value of 0.
A returned value of an action can be used in conjunction with GSC Runtime for diagnostic
purposes.
The action code begins with a code framework in the form of comments. If this coding
framework is filled out in accordance with the coding rules, the tags and picture names are
recognized by CrossReference.

Procedure
1. In the navigation window, open the shortcut menu for the desired action type.
2. Select "New".

Alternative operation
Alternatively, you can also create a new action by clicking the associated button in the toolbar,
via the "File" menu or by using the corresponding key combination.

See also
GSC Runtime (Page 1596)
WinCC Coding Rule (Page 1574)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1575

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13.4

How to Edit Actions

Introduction
An action is edited in its own edit window exactly like a function. Only the first three lines cannot
be edited.
The action must have a return value. The returned value is of the type "int" and is preset to 0.
A returned value of an action can be modified and used in conjunction with GSC Runtime for
diagnostic purposes. The returned value's type cannot be changed.
To execute an action in Runtime, the action must have a trigger.

Procedure
1. Double-click the action in the navigation window to open it in an edit window.
2. Edit the action code.

Alternative operation
You can also open an action as follows:
In the navigation window, open the shortcut menu for the desired action and click "Open" or
button in the standard toolbar or use the corresponding
"File\Open...". You can also click the
key combination.
Note
A maximum of 32 Kbytes of memory is available for local tags (tags defined within the braces
of the action code).

See also
GSC Runtime (Page 1596)
How to Write Function Code (Page 1562)

3.13.5

How to add action-related information

Introduction
Additional information can be assigned to every action.
When a new action is created, the creation date is entered in the action-related information
automatically and is unchangeable. The action is also assigned version number 1.0. The
version numbers can be individually assigned when editing an action. When an action is
changed and saved, the current date of change is entered automatically and is unchangeable.

1576

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
This dialog can be used to assign a password to protect the action against unauthorized read
and write access.

Requirements
The action to which the information relates must be open in an edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the required entries.

3. Confirm your entries with "OK".

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
Click the "Edit" menu and select the "Info" option or use the corresponding key combination.

See also
How to Protect an Action Against Unauthorized Access (Page 1580)
How to Set Different Views (Page 1551)
Working with the Toolbars (Page 1548)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1577

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13.6

How to Protect an Action Against Unauthorized Access

Introduction
Actions can be protected with a password against unauthorized read and write access. The
password is a part of the action-related information.

Requirements
The action to be compiled must be opened in the edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the "Password" check box.


3. Click the "Change" button.

4. Enter the password in the "Password" field.


5. Enter the password again in the "Confirmation" field.
6. Confirm your entries with "OK".
7. Click "OK" to close the dialog.

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
Click the "Edit" menu and select the "Info" option or use the corresponding key combination.
Note
A password-protected action can only be opened in the edit window if the correct password
is entered.
To deactivate the password protection, clear the "Password" check box.

1578

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

See also
How to Set Different Views (Page 1551)
Working with the Toolbars (Page 1548)

3.13.7

How to Compile and Save an Action

Introduction
In order to use an action, it must first be compiled. Only the action in the active edit window is
compiled.
Errors reported by the compiler are displayed in the lower portion of the window. Each message
is displayed on a separate line. The line includes the line number in the source code where
the error occurred, a hexadecimal encoded error code and a description of the error.
Double-click such a line to view the source code line where the error occurred.
It is recommended that you examine the first message error listed, because subsequent ones
could be errors resulting from the first one. If the first error is corrected, then the others might
disappear after the next compilation.

Requirement
The action to be compiled must be opened in the edit window.

Procedure
1. Set the language for C compilation using the toolbar.
2. Click

on the "Edit" toolbar.

3. Examine the compiler messages in the lower portion of the edit window.
4. If the compiler reported an error, the action source code must be corrected. After this has
been done, start again with step 1 in this table.
5. If the compiler generated warnings, the action source code may require correction. After
the code has been corrected, start again with step 1 in this table, otherwise proceed to step
6.
6. Click

on the "Default" toolbar.

Alternative operation
Alternatively, the compilation process can be initiated in the following ways:
Select "Compile" from the "Edit" menu, select the "Compile" option from the shortcut menu of
the edit window or use the corresponding keyboard shortcut.
Saving may also be performed in the following ways:
Select "Save" from the "File" menu or use the corresponding key combination.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1579

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

Display of Actions

If a syntactically incorrect action is stored, it is displayed in the Global Script navigation window
with the icon shown to the left.

If a syntactically correct action is stored with no trigger, it is displayed in the Global Script
navigation window with the icon shown to the left.

If a syntactically correct action is stored with a trigger, it is displayed in the Global Script
navigation window with the icon shown to the left.

See also
Runtime Behavior of Actions (Page 1595)

3.13.8

Triggers

3.13.8.1

Triggers

Defining and Using Triggers


Triggers are used to execute actions in Runtime. To do this, a trigger is linked to an action,
forming the triggering event for calling the action. Actions without triggers are not executed.

Trigger Types
The following trigger types are available:
Acyclic Triggers
These consist of a specified date and time. The action specified by such a trigger is performed
once at the date and time specified.
Cyclic Triggers
These consist of a specified time interval and starting point. The following types of cyclic
triggers are available:
Default cycle. The start of the first time interval coincides with the start of Runtime. The
length of the interval is determined by the cycle.
Hourly. The start of the interval is specified as minutes and seconds. The length of the
interval is an hour.

1580

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
Daily. The start of the interval is specified by the time (hours, minutes and seconds). The
length of the interval is a day.
Weekly. The start of the interval is specified by the day of the week (Monday, Tuesday,
etc.) and the time. The length of the interval is a week.
Monthly. The start of the interval is specified by the day and time. The length of the interval
is a month.
Annually. The start of the interval is specified by the day, month and time. The length of
the interval is a year.
Tag Triggers
These consist of the specification of one or more tags. The action associated with such a trigger
is performed each time a change in the value of one of these tags is detected.
How the tag values are queried may be customized for each tag. Either cyclic polling with a
specified period or a reaction as soon as the system detects a change in the tag value may
be selected.
Depending on the choice of query method, it is possible that the tag changes but the system
does not detect this. In this case the action is not performed.

Effect of Triggers on an Action


If the action is associated with only one trigger, then the action is performed as soon as the
triggering event occurs.
However, an action may be associated with multiple triggers, such as a cyclic trigger and a
tag trigger. In this case, the action is performed whenever one of the two triggering events
occurs. If two events occur simultaneously, the action is executed twice in sequence. If two
tag triggers fire at the same time, the action is performed only once.
The processing of an action should be completed before another call of the action occurs, as
there might otherwise be an overflow of the queue.
Tip:If the action is not to be carried out with each event occurrence, then a condition can be
specified for the action that controls its further course dependent on the event. If the action is
not to be executed any more, it can be terminated with a <value> return.

Rules for the Selection of Triggers


Depending on the system, it cannot be guaranteed that an action with a cyclic trigger is carried
out at exactly the specified time. If this is a requirement, then the task (such as a check, etc.)
must be implemented on the automation device.
For processing, tag triggers have priority over cyclic triggers.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1581

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
For a cyclic trigger, the action is always performed when the trigger event occurs, e.g. every
20 seconds. ( = action is performed)

The tag trigger only causes the action to be performed if the value of the trigger tag has
changed. This is done to reduce the system load ( = action is performed).

The values of tags contained in the trigger are already known when the action begins. The
GetTag() call can be used to access the value directly. Processing is much faster than for
trigger tags than for those not contained in the trigger whose values must be obtained via
GetTag() requests.

Display of Actions

If a syntactically incorrect action is stored, it is displayed in the Global Script navigation window
with the icon shown to the left.

If a syntactically correct action is stored with no trigger, it is displayed in the Global Script
navigation window with the icon shown to the left.

If a syntactically correct action is stored with a trigger, it is displayed in the Global Script
navigation window with the icon shown to the left.

See also
How to delete a trigger (Page 1589)
How to change a trigger (Page 1588)

1582

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
How to Add a New Trigger of the "Tag" Type (Page 1586)
How to Add a New Trigger of the "Timer" Type (Page 1585)

3.13.8.2

How to Add a New Trigger of the "Timer" Type

Introduction
Triggers are used to execute actions in Runtime. To do t his, a trigger is linked to an action,
forming the triggering event for calling the action. Actions without triggers are not executed.
"Timer" type triggers can be cyclic or acyclic triggers.
Acyclic triggers consist of a specified date and time. The action specified by such a trigger is
performed once at the date and time specified.
Cyclic triggers consist of a specified time interval and starting point. The following types of
cyclic triggers are available:
Default cycle. The start of the first time interval coincides with the start of the Runtime
system. The length of the interval is determined by the cycle.
Hourly. The start of the interval is specified as minutes and seconds. The length of the
interval is an hour.
Daily. The start of the interval is specified by the time (hours, minutes and seconds). The
length of the interval is a day.
Weekly. The start of the interval is specified by the day of the week (Monday, Tuesday,
etc.) and the time. The length of the interval is a week.
Monthly. The start of the interval is specified by the day and time. The length of the interval
is a month.
Annually. The start of the interval is specified by the day, month and time. The length of
the interval is a year.

Requirement
The action to be linked with a trigger must be open in the active edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the "Trigger" tab.


3. Select the trigger source "Timer" and click the "Add" button.
4. Select "Single" to add an acyclic trigger or select a cycle to add a cyclical trigger.
5. Complete the required details in the dialog.
6. Confirm the entries by clicking "OK".
7. Close the "Properties" dialog by clicking "OK".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1583

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
In the "Edit" menu, select "Info", select "Info / Trigger" in the shortcut menu of the edit window,
or use the corresponding key combination.

3.13.8.3

How to Add a New Trigger of the "Tag" Type

Introduction
Triggers are used to execute actions in Runtime. To do this, a trigger is linked to an action,
forming the triggering event for calling the action. Actions without triggers are not executed.
Tag triggers consist of one or more specified tags. The action associated with such a trigger
is performed each time a change in the value of one of these tags is detected.
How the tag values are queried may be customized for each tag. Either cyclic polling with a
specified period or a reaction as soon as the system detects a change in the tag value may
be selected.
Depending on the choice of query method, it is possible that the tag changes while the system
fails to detect this. In this case the action is not performed.

Requirements
The action to be linked with a trigger must be open in the active edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the "Trigger" tab.

1584

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
3. Select the trigger source "Tag" and click the "Add" button. The "Add Tags" dialog is opened.

4. Click the
button to open the tag selection dialog, select a tag and confirm your selection
by clicking "OK".
5. In the "Add Trigger" dialog, open the shortcut menu in the "Standard cycle" column and
then select the desired monitoring cycle. Selecting "After Every Change" results continuous
monitoring.
6. Repeat steps 4 and 5, if you want add more tags.
7. Confirm the entries by clicking "OK".
8. Close the "Properties" dialog by clicking "OK".

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
In the "Edit" menu, select "Info", select "Info / Trigger" in the shortcut menu of the edit window,
or use the corresponding key combination.
In the "Add Trigger" dialog, you can also enter a tag name directly and insert the tag in the
"Trigger Name" column by clicking "Add". With this approach, the system does however not
check whether the tag exists.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1585

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13.8.4

How to change a trigger

Introduction
Triggers that have been defined can be changed at any time. They can also be changed in
Runtime.

Requirements
The relevant action must be opened in the edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the "Trigger" tab and select the trigger you wish to change.

3. Click the "Change" button to open the "Change Trigger" dialog.


4. Make the desired changes.
5. Confirm the entries by clicking "OK".
6. Close the "Properties" dialog by clicking "OK".

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
In the "Edit" menu, select "Info", select "Info / Trigger" in the shortcut menu of the edit window,
or use the corresponding key combination.

1586

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13.8.5

How to delete a trigger

Introduction
Triggers that have been defined can be deleted at any time. They can also be deleted in
Runtime.
If a trigger is deleted in Runtime, it only takes effect after the action is saved.

Requirements
The relevant action must be opened in the edit window.

Procedure
1. Click the

button in the editing toolbar. The "Properties" dialog is opened.

2. Select the "Trigger" tab and select the trigger you wish to delete.

3. Delete the selected trigger by clicking "Delete".


4. Close the "Properties" dialog by clicking "OK".

Alternative operation
Alternatively, the "Properties" dialog can be opened as follows:
In the "Edit" menu, select "Info", select "Info / Trigger" in the shortcut menu of the edit window,
or use the corresponding key combination.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1587

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

3.13.9

How to Assign Authorizations

Introduction
With the Global Script - Runtime diagnostic tool, you can influence the processing of actions
in Runtime. Each action can be assigned an authorization. This authorization only effects the
operation in the Global Script - Runtime window.

Requirement
The relevant action must be opened in the editing window.

Procedure
in the toolbar.
1. Click
The "Authorizations" dialog box is opened.
2. Select an authorization.

3. Confirm your selection with "OK".

See also
GSC Runtime (Page 1596)

3.13.10

How to Export an Action

Introduction
Use export and import to move actions between projects. The triggers linked to the actions
are retained in the process.

1588

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

Requirements
The action to be exported must be opened in the edit window.

Procedure
1. Click the

button in the editing toolbar. The "Save As" dialog is opened.

2. Select the path and file name for the action that you wish to export.

3. Close the dialog by clicking the "Save" button.

Alternative operation
Alternatively, you can start the export as follows:
In the "Edit" menu, select "Export", select "Export" in the shortcut menu of the edit window, or
use the corresponding key combination.

3.13.11

How to Import an Action

Introduction
Use export and import to move actions between projects. The triggers linked to the actions
are retained in the process.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1589

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
The action in the active edit window is replaced by the imported action.

Procedure
1. Click the

button in the editing toolbar. The "Open" dialog is opened.

2. Select the path and file name of the action that you wish to import.

3. Close the dialog by clicking the "Open" button.

Alternative operation
Alternatively, you can start the import as follows:
In the "Edit" menu, select "Import", select "Import" in the shortcut menu of the edit window, or
use the corresponding key combination.

3.13.12

How to Rename an Action

Introduction
You may rename an action at any time. The action is thereby assigned a different file name.

1590

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions

Requirements
The action to be renamed may not be open in the edit window.

Procedure
1. Open the shortcut menu of the action to be renamed.
2. Select "Rename".
3. Enter a new name with the file extension ".pas".

4. Confirm the new name by pressing the <ENTER> key.

Alternative operation
Alternatively, click the action name twice to complete the renaming.

Note
If you do not enter the file extension ".pas", the action name remains unchanged.

3.13.13

How to Use Actions From Other Sources

Introduction
You have two options for using actions from other sources in your project:
Importing exported actions
Copy the file with the desired action into the corresponding path in your project. The path
for local actions is "<Computer_name>\Pas" in the project path. The path for global actions
is "\Pas" in the project path.
To show the copied actions in the navigation window, you must refresh the display. This can
be accomplished by quitting and then restarting Global Script.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1591

ANSI-C for Creating Functions and Actions


3.13 Creating and Editing Actions
If Runtime is active, imported actions are only executed, after they have been opened in Global
Script Editor and then saved.
Note
Actions can include calls to project and standard functions. These can in turn have calls to
project and standard functions etc. Therefore, when importing actions from other sources,
you must make sure that the current project has all necessary functions.
Particular attention is called for whenever the actions were imported from a different
computer. Since standard functions can be customized by the user, it is possible that the
standard functions called in the action have a different functionality on the source computer
than the ones with the same names on the target computer.

See also
How to Import an Action (Page 1589)
How to Export an Action (Page 1588)

1592

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

3.14

Runtime Behavior of Actions

3.14.1

Runtime Behavior of Actions

Analysis of Runtime Behavior


WinCC provides a range of tools with which the Runtime behavior of actions can be analyzed.
These are the application windows GSC Runtime and GSC Diagnose plus the application
apdiag.exe.
To use the application windows GSC Runtime and GSC Diagnose, they must be added to a
process picture. This may be a process picture made especially for diagnostic purposes. This
picture is then called in Runtime.
The application windows are used for the following strategies:
GSC Runtime supplies information about the dynamic behavior of all (Global Script) actions,
supports the individual start and the Start and End Action for each individual action and
provides an entry point into Global Script Editor, while Runtime is active.
GSC Diagnose outputs the printf instructions (contained in the actions) in the order in which
they are called. This also applies to the printf instructions in functions that are called in
actions. Through a well thought out use of printf instructions, for example to output the
values of tags, it is possible to follow the action's flow and that of the called functions. Even
error conditions, which result in a call to the OnErrorExecute function, are displayed in the
GSC Diagnose window.
Note
When using dynamic C-scripts with access to picture objects, you should note that
execution of the script is not terminated automatically by closing the picture.
This scenario may to the failure of access to an object that is addressed in the script, e.g.
if properties of the type "Text" are read and the values returned are modified or processed
in subsequent string operations.

See also
GSC Diagnose (Page 1601)
GSC Runtime (Page 1596)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1593

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

3.14.2

GSC Runtime

3.14.2.1

GSC Runtime

GSC Runtime Window


GSC Runtime is a window showing the dynamic behavior of all (Global Script) actions in
Runtime. Additionally, GSC Runtime, enables you to influence the execution of each individual
action and provides an entry point into Global Script Editor, while Runtime is active.
The following information is output:
Action: Name of the action
ID: Action ID. It is used internally to the system and for example is output by the function
OnErrorExecute together with a description of the error in the event that an error occurs in
the action. GSC Runtime supplies the name of the action with this ID. The connection
between the ID and action name ceases to be valid when Runtime is terminated or an action
is saved while Runtime is active.
Status: Current status of the action. For possible statuses, refer to the table below.
Activation Interval: The time in the form hours:minutes:seconds that has elapsed between
two calls to the action.
Return Value: Return value of the action.
Started On: Date and time at which the current action was started.
Next Start: Date and time at which the action is started again.
Error Message: Contains the error text in the case of an error.

Statuses of actions
Possible statuses of actions:
Action was started.
Action was ended.
Action was stopped.
Action is running.

1594

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions
Error during start of action!
Error during execution of action!

Error messages
Possible error messages:
No error occurred.
The application is already connected to the script control. No additional connection setup
is possible.
There is no connection to the script control. Possibly no connection setup took place.
An error occurred during interprocess communication. The cause of the error is unknown.
Undefined error.
The parameter assignment is wrong. Some necessary parameters may be missing.
Script control is not started. Check has whether WinCC has been started.
Time-out occurred. Check the connection or increase the monitoring time.
Script control was terminated.
The service channel could not be installed.
An unknown job number was used for the EndAct job.
The action could not be executed without error. The returned results are invalid.
An error occurred in the server application.
The maximum number of connections to the script control has been reached.
The transaction is unknown. An attempt was made to terminate a transaction that was not
logged on previously.
A pre-compiled header file cannot be generated from a pre-compiled header file.
There is no access to the action. The module is being used presently.
The program is invalid.
The action is invalid.
The script control could not set up the file.
The script interpreter does not have enough memory.
The file format is invalid for the script control.
The script control could not open the file.
The program is presently locked by the script control. No further access is possible.
The action has already been given to the script control for processing.
In this action, a conflict has occurred with another action.
The script control could not find the action.
The script control could not find the function.
The specified line information is invalid.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1595

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions
The specified symbol is outside the valid range.
The provided memory is too small for the script interpreter.
The script interpreter does not recognize the specified type.
The specified symbol was not found.
Load project functions.
A stack overflow has occurred in the script interpreter during execution. Further execution
of the action is being canceled.
Division by 0 occurred during execution of an action. The action is being canceled.
Within the action, a reference was made during execution to a symbol that does not exist.
Within the action, an attempt was made during execution to access an undefined memory
area.
The script interpreter ran into a breakpoint.
The script interpreter was advanced in the debugger by one processing step.
The action contains no interpreter code.
The action has the wrong data format.
The return value of the action cannot be represented as a variant.
There is insufficient memory to execute this operation.
An error has occurred within the transaction. For more information, see the AP_ACT_KEYs.
An error occurred while executing the action. For more information, see the AP_ACT_KEYs.
An error occurred while executing the action. For more information, see the AP_ACT_KEYs.
There is no update capability for the existing data format. The action cannot be read.

Shortcut Menu for Actions


The following functions are available for every action in the shortcut menu:
End Action: The corresponding action is not executed again after the current execution is
completed.
Start Action: The corresponding action is executed again when the next trigger occurs.
Start: The relevant action is executed once.
Edit: The relevant action is opened in the Global Script editor for editing. Runtime remains
active. If the edited action is compiled (if necessary) and saved, the changes are
immediately adopted by the Runtime system.

1596

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

You can determine for each action individually, whether or not the popup menu can be opened
without a password.
To use GSC Runtime, you must first add an application window of the GSC Runtime type in
a process picture. Using the GSC Runtime attributes, you can determine the appearance of
the GSC Runtime window.
Note
Updating the GSC Runtime window increases the load on the system resources. The system
load depends on how many actions are visible in the window. The system load can be lowered
by reducing the height of the window so that fewer lines are visible.

See also
How to Edit Actions (Page 1600)
Attributes of GSC Runtime (Page 1600)
How to Place GSC Runtime in a Process Picture (Page 1599)
How to Assign Authorizations (Page 1588)

3.14.2.2

How to Place GSC Runtime in a Process Picture

Introduction
To use GSC Runtime, you must add GSC Runtime to a process picture. This process picture
can be an existing picture or a picture that just serves diagnostic purposes. GSC Runtime
cannot be added to the process picture directly, rather it must be added as an application in
an application window. The application window is itself part of the process picture. The
measures described must be performed in Graphics Designer.

Requirement
Graphics Designer has been started and the process picture is open.

Procedure
1. In the Object palette, select "Smart Object\Application Window".
2. In the drawing area, open the application window.
3. In the "Window Contents" dialog select "Global Script".
4. Confirm the entries by clicking "OK".
5. In the "Template" dialog, select "GSC Runtime".
6. Click "OK" to confirm your selection.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1597

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

See also
Attributes of GSC Runtime (Page 1600)

3.14.2.3

Attributes of GSC Runtime

GSC Runtime Window Layout


GSC Runtime has attributes with which you can determine the appearance of the GSC Runtime
window in Runtime. These include the geometry attribute and in particular the following
attributes:
Display: With this attribute, you can specify whether the window should be visible or hidden.
The attribute can be made dynamic with the name "Visible".
Sizeable: Use this attribute to specify whether the window size can be changed in Runtime.
Moveable: Use this attribute to specify whether the window can be moved in Runtime.
Border: Use this attribute to specify whether the window has a border. If the window has a
border, its height and width can be changed in Runtime.
Title: Use this attribute to specify whether the window has a title bar.
Can be Maximized: Use this attribute to specify whether the window's title bar has a button
to maximize the window in Runtime.
Can be Closed: Use this attribute to specify whether the window's title bar has a button to
close the window in Runtime.
Foreground: Use this attribute to specify whether the window is always in the foreground.
The attributes are displayed and can be set in Graphics Designer.

3.14.2.4

How to Edit Actions

Introduction
Each of the actions in your project will be displayed on its own line in the GSC Runtime window.
You can open an action in the GSC Runtime window and then edit it using Global Script Editor.
After the edited action is saved, it is used in Runtime.

Procedure
1. Open the shortcut menu for the desired action.
2. Select "Edit".

See also
How To Create and Edit Actions (Page 1571)

1598

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

3.14.3

GSC Diagnose

3.14.3.1

GSC Diagnose

Description of Functions
GSC Diagnose outputs the printf instructions (contained in the actions) in the order in which
they are called in the Diagnose window. This also applies to the printf instructions in functions
that are called in actions. Through a well thought out use of printf instructions, for example to
output the values of tags, it is possible to follow the action's flow and that of the called functions.
Even error conditions, which result in a call to the OnErrorExecute function, are displayed in
the GSC Diagnose window.

Figure 3-1

Diagnose window of GSC Diagnose

To use GSC Diagnose, you must first add an application window of the GSC Diagnose type
in a process picture. Using the GSC Diagnose attributes, you can determine the appearance
of the GSC Diagnose window.
When the picture is changed, the contents in the GSC Diagnose window is deleted.
Note
A printf() may contain maximum 360 characters.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1599

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

See also
The Toolbar of GSC Diagnose (Page 1603)
Attributes of GSC Runtime (Page 1598)
How to Place GSC Diagnose in a Process Picture? (Page 1602)

3.14.3.2

How to Place GSC Diagnose in a Process Picture?

Introduction
To use GSC Diagnose, you must add GSC Diagnose to a process picture. This process picture
can be an existing picture or a picture that just serves diagnostic purposes. GSC Diagnose
cannot be added as an application to the process picture directly, rather it must be added as
an application in an application window. The application window is itself part of the process
picture. The measures described must be performed in Graphics Designer.

Requirement
Graphics Designer has been started and the process picture is open.

Procedure
1. In the Object palette, select "Smart Object\Application Window".
2. In the drawing area, open the application window.
3. In the "Window Contents" dialog select "Global Script".
4. Confirm the entries by clicking "OK".
5. In the "Template" dialog, select "GSC Diagnose".
6. Click "OK" to confirm your selection.

See also
Attributes of GSC Runtime (Page 1598)
The Toolbar of GSC Diagnose (Page 1603)

1600

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

3.14.3.3

Attributes of GSC Diagnose

GSC Diagnose Attributes


GSC Diagnose has attributes with which you can determine the appearance of the GSC
Diagnose window in Runtime. These include the geometry attribute and in particular the
following attributes:
Display: With this attribute, you can specify whether the window should be visible or hidden.
The attribute can be made dynamic with the name "Visible".
Sizeable: Use this attribute to specify whether the window size can be changed in Runtime.
Moveable: Use this attribute to specify whether the window can be moved in Runtime.
Border: Use this attribute to specify whether the window has a border. If the window has a
border, its height and width can be changed in Runtime.
Title: Use this attribute to specify whether the window has a title bar.
Can be Maximized: Use this attribute to specify whether the window's title bar has a button
to maximize the window in Runtime.
Can be Closed: Use this attribute to specify whether the window's title bar has a button to
close the window in Runtime.
Foreground: Use this attribute to specify whether the window is always in the foreground.
The attributes are displayed and can be set in Graphics Designer.

3.14.3.4

The Toolbar of GSC Diagnose

Toolbar Functions
The toolbar of GSC Diagnose includes buttons for the control the output in the Diagnose
window as well as for saving, printing and opening the contents of the window.

The toolbar contains buttons with the following functions:


Button

Function
Deletes the contents of the window.
Stops the updating of the window.
Resumes the updating of the window.
Opens a text file in the window.
Saves the contents of the window in a text file.
DPrints the contents of the window.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1601

ANSI-C for Creating Functions and Actions


3.14 Runtime Behavior of Actions

1602

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15

ANSI-C function descriptions

3.15.1

lpszPictureName

Overview
"lpszPictureName" is the name of the picture.
If you configure an action on a property or a "Mouse-click" event in WinCC, the name of the
picture is provided as "lpszPictureName" in the action. The picture name has the following
structure:
<BASE PICTURE NAME>.<PICTURE WINDOW NAME>:<PICTURE NAME>. ... .<Picture
window name>:<Picture name>.
The "BASE PICTURE NAME" and the "PICTURE NAME" are provided without the file
extension ".PDL".
This enables you to identify the object's picture path. You can also address specific picture
windows, if a process picture is opened more than once for example.
Note
Do not change the text in "lpszPictureName not even using the function "strcat".

3.15.2

Standard functions

3.15.2.1

Standard functions - short description


The system provides standard functions. You can modify these functions to adapt them to your
personal needs. Furthermore, you can create your own standard functions.
The basic system provides you with standard functions. They are divided into the following
function groups:
Alarm
Graphics
Report
TagLog
WinCC
Windows
The "Obsolete functions" directory contains standard functions that were used to control the
control before WinCC V7.
If the corresponding options have been installed, the following additional function groups are
available:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1603

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Options
Split Screen Manager
userarc (user archives)

3.15.2.2

Alarm

AcknowledgeMessage
Function
Acknowledges the message with the number that has been sent as a parameter in the message
system.

Syntax
void AcknowledgeMessage(DWORD MsgNr)

Parameters
MsgNo
Message to be acknowledged
Note
Make sure a configured message exists for the transferred message number.
To use the function on a client with its own project, a standard server for alarms has to be
configured on the client.

See also
AcknowledgeMessage example

AXC_SetFilter
Function
External message window operation
This function sets a filter for WinCC Alarm Control to show a portion of the existing messages
according to the filter criterion.

1604

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL AXC_SetFilter(char* lpszPictureName, char* lpszObjectName,
LPMSG_FILTER_STRUCT lpMsgFilter, LPCMN_ERROR, lpError)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the WinCC Alarm Control name
lpMsgFilter
Pointer to the structure containing the filter criterion
lpError
Pointer to the structure of the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
CMN_ERROR structure definition
ResetFilter example
AXC_SetFilter example
Structure definition MSG_FILTER_STRUCT structure definition

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1605

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GCreateMyOperationMsg
Function
The "GCreateMyOperationMsg" standard function makes it possible to trigger your own
operator input message in the message system. The message with the "dwMsgNum" message
number must have already been configured as the operator input message.

Syntax
int GCreateMyOperationMsg( DWORD dwFlags, DWORD dwMsgNum, char*
lpszPictureName, char* lpszObjectName, DWORD dwMyTextID, double doValueOld, double
doValueNew, char* pszComment)

Parameters
dwFlags
The message form can be selected using the "dwFlags" parameter.
Name

Value

Description

FLAG_COMMENT_PARAMETER

0x00000001

The text is entered as a comment directly into


the message in Runtime, without its own
comment dialog. The pointer to the comment
must not equal "NULL."

FLAG_COMMENT_DIALOG

0x00000003

A comment dialog appears. The comment


entered there is transferred to the message.

FLAG_TEXTID_PARAMETER

0x00000100

The text ID of a text from the TextLibrary is


provided as the accompanying process value
of the message.

dwMsgNum
WinCC message number of a self-created operator input message.
lpszPictureName
Pointer to the picture name of the picture from which the function is called.
lpszObjectName
Pointer to the WinCC tag name to which the old values and new values belong.
The name is forwarded as the instance name of the operator input message and entered in
the accompanying process value "1".
dwMyTextID
Text ID of a text from the TextLibrary.
When the "FLAG_TEXTID_PARAMETER" is set, the text ID is provided as the numeric
accompanying process value "8" of the message and is displayed as a number in process
value block 8. So that the language-dependent text from the TextLibrary is displayed in the
message, you must enter format statement "@8%s@" in the message text block.

1606

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
doValueOld
Numeric old value of the WinCC tags with the name specified in "lpszObjectName".
"doValueOld" is entered in the accompanying process value "2" of the message.
The function itself has no option of reading a tag value before the action. For this, use the
provided "GetTag..." feature.
doValueNew
Numeric new value of the WinCC tags with the name specified in "lpszObjectName".
"doValueNew" is entered in the accompanying proces value "3" of the message.
The function itself has no option of reading a tag value after the action. For this, use the
provided "GetTag..." feature.
pszComment
Comment text or empty string.
When "FLAG_COMMENT_PARAMETER" is set, the text is entered directly into the message
in Runtime as a comment. The message does not need a separate comment dialog.

Return value
Value

Description

The function has been completed without any errors.

-101

The message editing could not be started.

-201

An error occurred when calling the "MSRTGetComment()"


feature.

-301

An error occurred when calling the


"MSRTCreateMsgInstanceWithComment()" feature.

Note
Make sure that only operator input messages are used for the "GCreateMyOperationMsg"
function. The use of messages of different message classes is not permitted.
Please note the role of the standard server when using the function with a Client. For more
information see the chapter "Client configuration".

GMsgFunction
Function
This function provides the message data.
It is a global function for single messages. It is called for each message for which the "Triggers
an action" parameter has been set.
Evaluation of the message data is best made in a project function called from GMsgFunction.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1607

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GMsgFunction(char* pszMsgData)

Parameters
pszMsgData
Pointer to a string whose data are mapped with scanf to the MSG_RTDATA_STRUCT
structure.
The "MSG_RTDATA_STRUCT" string contains the following data, which are separated from
each other with "#":
1. Telegram time
2. Process values
3. Instance
4. User
5. Computer
6. Current time in format "yyyy.mm.dd, hh:mm:ss.mmm"
Note
The value "Instance" of string "MSG_RTDATA_STRUCT" is only supplied if an instance
message was triggered.
The values "User" and "Computer" of the string "MSG_RTDATA_STRUCT" are only
supplied if a comment was provided during the creation of the message with the same
call.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

See also
Structure definition MSG_RTDATA_STRUCT

1608

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.2.3

Graphics

Graphics - short description


The Graphics group contains functions for programming the graphic system.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetLinkedVariable
Function
Provides the name of the variable linked to a certain object property.

Syntax
char* GetLinkedVariable(char* lpszPictureName, char* lpszObjectName, char*
lpszPropertyName);

Parameters
lpszPictureName
Pointer to the picture
lpszObjectName
Pointer to the object
lpszPropertyName
Pointer to the object property

Return value
Pointer to the name of the tag linked to a certain object property.

See also
GetLinkedVariable example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1609

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetLocalPicture
Function
Provides a pointer to the name of the picture. The picture name is the file name without the
".PDL" extension.

Syntax
char* GetLocalPicture(char* lpszPictureName);

Parameters
lpszPictureName
Pointer to the picture

Return value
Pointer on the name of the picture.

Note
The passed call parameter lpszPictureName must have the structure provided by the
graphics system for the picture paths:
<Basic picture name>.<Picture window name>:<Picture name>. ... .<Picture window
name>[:<Picture name>]
where <Basic picture name> and <Picture name> go without the ".PDL" file extension.

Example:
In a basic picture "AAA" there is a picture window "bbb" in which a picture "CCC" is called
which itself contains a picture window "ddd" in which a picture "EEE" is called.
Then the function call
GetLocalPicture(lpszPictureName)
returns the pointer to the picture name:
"EEE" if the functions is called in the picture "EEE";
"CCC" if the functions is called in the picture "CCC";
"AAA" if the functions is called in the picture "AAA".

See also
GetLocalPicture example

1610

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetParentPicture
Function
Provides a pointer to the name of the picture. The picture name is the file name without the
".PDL" extension.

Syntax
char* GetParentPicture(char* lpszPictureName);

Parameters
lpszPictureName
Pointer to the picture

Return value
Name of the current picture if the function is called in the basic picture
Name path of the higher-level picture if the function is called in a picture window

Note
The passed call parameter lpszPictureName must have the structure provided by the
graphics system for the picture paths:
<Basic picture name>.<Picture window name>:<Picture name>. ... .<Picture window
name>[:<Picture name>]
where <Basic picture name> and <Picture name> go without the ".PDL" file extension.

See also
GetParentPicture example

GetParentPictureWindow
Function
Provides a pointer to the name of the picture window.

Syntax
char* GetParentPictureWindow(char* lpszPictureName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1611

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Pointer to the picture

Return value
Pointer to the name of the picture window if the function is called in a picture displayed in a
picture window of a higher-level picture
Call parameter lpszPictureName unchanged if the function is called in the basic picture

Note
The passed call parameter lpszPictureName must have the structure provided by the
graphics system for the picture paths:
<Basic picture name>.<Picture window name>:<Picture name>. ... .<Picture window
name>[:<Picture name>]
where <Basic picture name> and <Picture name> go without the ".PDL" file extension.

Example:
In a basic picture "Picture_1" there is a picture window "Picture_window_1" in which a picture
"Picture_2" is called.
In the picture "Picture_2" there is a picture window "Picture_window_2" in which a picture
"Picture_3" is called.
Then the function call
GetParentPictureWindow(lpszPictureName)
returns the pointer to the picture window name:
"Picture_2" if the function is called in the picture "Picture_3";
"Picture_window_1" if the function is called in the picture "Picture_2";
"Picture_1" if the function is called in the picture "Picture_1".

OpenPicture
Function
Changes the specified basic picture. On the client and in case of a picture name with server
prefix a picture change is performed in the picture window.
If, for example, the picture window is located in a different picture window with a server prefix,
a picture change is not performed in the picture window in which the function was called.

1612

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
If multiple picture windows with server prefix are integrated in the picture and the
"OpenPicture()" function calls the last picture, the picture change is carried out in the first
picture window, e.g.
"screen1.window1(screen2.window2(screen3.window3(screen4.OpenPicture)))" executes a
picture change in "window1".

Syntax
void OpenPicture(Picture PictureName)

Parameters
Picture name
Picture name

Registry2
Function
This function manages a list of string pairs (String0, String1).
It knows the following types of calls controlled by the mode parameter:
Registry2("set", "String0", "String1");
Includes the passed string pair into the list.
Registry2("get", "String0", NULL);
Returns the first string pair partner String1 which belongs to the passed String0 and then
deletes the string pair from the list.
Registry2("reset", NULL, NULL);
Deletes all string pairs from the list.
Registry2("display", NULL, NULL);
Shows the string pairs currently stored in the list in a Global Script diagnostics window.

Syntax
char* Registry2(char* mode, char* String0, char* String1);

Parameters
mode
Defines the working principle of the function.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1613

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
set
get

Incorporation of the string pair into the list


Determination of the first sting pair partner for String0 and deletion of the string
pair from the list
reset
Deletion of all string pairs
display Display of the string pairs in a Global Script diagnostics window
String0
The parameter supply depends on the working principle of the function.
String1
The parameter supply depends on the working principle of the function.

Return value
In the mode=get mode a pointer to the first string pair partner is returned.
Note
This function is used in conjunction with the picture module technology.
If you work with the "Create faceplate as type" and "Create instance(s) in the process picture"
wizards in the "Faceplates" tab of the Dynamic Wizard, using the "Registry2" function is not
permitted!

3.15.2.4

Obsolete functions

Alarm
AXC_OnBtnAlarmHidingList
Function
This function displays the list of hidden messages in a message window.

Syntax
BOOL AXC_OnBtnAlarmHidingList(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located

1614

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnArcLong
Function
This function displays the messages stored in a long-term archive list in a message window.

Syntax
BOOL AXC_OnBtnArcLong (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1615

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnArcShort
Function
This function displays the messages stored in a short-term archive list in a message window.

Syntax
BOOL AXC_OnBtnArcShort(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

1616

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnComment
Function
External message window operation
This function displays the comment of the previously selected messages.

Syntax
BOOL AXC_OnBtnComment (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1617

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

AXC_OnBtnEmergAckn
Function
External message window operation
This function opens the acknowledgement dialog (emergency acknowledgement/reset).

Syntax
BOOL AXC_OnBtnEmergAckn(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnHideDlg
Function
This function opens the display options dialog for defining the messages that are to be
displayed in the message window. The options are "All messages", "Shown messages" or
"Hidden messages".

1618

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL AXC_OnBtnHideDlg(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnHideUnhideMsg
Function
The function hides the selected message or displays again the hidden message.

Syntax
BOOL AXC_OnBtnHideUnhideMsg(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1619

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnHit
Function
This function displays the messages stored in the hit list in a message window.

Syntax
BOOL AXC_OnBtnHit (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

1620

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnHornAckn
Function
External message window operation
This function acknowledges the horn signal.

Syntax
BOOL AXC_OnBtnHornAckn (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1621

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

AXC_OnBtnInfo
Function
External message window operation
This function displays the information text.

Syntax
BOOL AXC_OnBtnInfo (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLock
Function
External message window operation
This function opens the "Set the Lock List Parameters" dialog.

1622

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL AXC_OnBtnLock (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLockUnlock
Function
This function locks the selected message in the message window. This message will then no
longer be archived.
This function unlocks the selected message in the lock list.

Syntax
BOOL AXC_OnBtnLockUnlock (char* lpszPictureName, char* lpszObjectName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1623

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLockWin
Function
External message window operation.
This function calls the lock list.

Syntax
BOOL AXC_OnBtnLockWin (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

1624

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLoop
Function
External message window operation
This function triggers the "LoopInAlarm" function of the selected message.

Syntax
BOOL AXC_OnBtnLoop (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1625

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgFirst
Function
External message window operation
This function switches to the beginning of the message list.

Syntax
BOOL AXC_OnBtnMsgFirst (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

1626

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgLast
Function
External message window operation
This function switches to the beginning of the message list.

Syntax
BOOL AXC_OnBtnMsgLast (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgLast example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1627

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

AXC_OnBtnMsgNext
Function
External message window operation
This function switches to the next message in the message list.

Syntax
BOOL AXC_OnBtnMsgNext (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgPrev
Function
External message window operation
This function switches to the previous message in the message list.

1628

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL AXC_OnBtnMsgPrev (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgWin
Function
External message window operation
This function calls the message list.
Note
The message list contains the currently pending and unacknowledged messages.

Syntax
BOOL AXC_OnBtnMsgWin (char* lpszPictureName, char* lpszObjectName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1629

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnPrint
Function
External message window operation
All messages fulfilling the selection criterion set in the Alarm Control are output to the printer.

Syntax
BOOL AXC_OnBtnPrint(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

1630

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnProtocol
Function
External message window operation
Printing of the current view of the Alarm Control is started. All messages fulfilling the selection
criterion set in the Alarm Control are output to the printer.

Syntax
BOOL AXC_OnBtnProtocol(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1631

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnScroll
Function
External message window operation
This function activates or deactivates the horizontal and vertical scroll functions.

Syntax
BOOL AXC_OnBtnScroll(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnScroll example

1632

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

AXC_OnBtnSelect
Function
External message window operation
This function opens the "Specify Selection" dialog for the displayed list.

Syntax
BOOL AXC_OnBtnSelect(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnSinglAckn
Function
External message window operation
This function acknowledges the currently selected message.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1633

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL AXC_OnBtnSinglAckn(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnSinglAckn example

AXC_OnBtnSortDlg
Function
External operation of the message window
This function opens the dialog for setting a user-defined sorting of the displayed messages for
the displayed list.

Syntax
BOOL AXC_OnBtnSortDlg(char* lpszPictureName, char* lpszObjectName)

1634

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnTimeBase
Function
External operation of the message window
This function opens the dialog for setting the time base for the times shown in the messages.

Syntax
BOOL AXC_OnBtnTimeBase(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1635

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnVisibleAckn
Function
External message window operation
All visible messages in the message window are acknowledged (group acknowledgement).

Syntax
BOOL AXC_OnBtnVisibleAckn(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control
Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

1636

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
AXC_OnBtnMsgFirst example

Report
ReportJob
Function
Depending on the value of the lpMethod Name parameter a print job or the preview for a print
job is started.

Syntax
void ReportJob(LPSTR lpJobName, LPSTR lpMethodName)

Parameters
lpJobName
Pointer to the name of the print job
lpMethodName
PRINTJOB Print job is started
PREVIEW Preview of the print job is started
Note
This function is replaced by the RPTJobPreview and RPTJobPrint functions and should no
longer be used.

TagLog
TOOLBAR_BUTTONS
TlgTableWindowPressEditRecordButton
Function
The editing of the table window is blocked or enabled (toggle function).
If editing is enabled, updating of the table window is stopped at the same time.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1637

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
The updating of the table window remains to be stopped afterward, even if editing is blocked
by a further function call.

Syntax
BOOL TlgTableWindowPressEditRecordButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgTableWindowPressFirstButton
Function
Displays the first data records of the display area in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressFirstButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

1638

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressHelpButton
Function
Displays the online help for the table window.

Syntax
BOOL TlgTableWindowPressHelpButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1639

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressInsertRecordButton
Syntax
BOOL TlgTableWindowPressInsertRecordButton(char* lpszWindowName)
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgTableWindowPressLastButton
Function
Displays the last data records of the display area in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressLastButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

1640

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressNextButton
Function
The data records following the current display area are displayed in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressNextButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1641

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressNextItemButton
Function
The columns of the table window are moved one column to the left, the left column taking the
position of the right column.

Syntax
BOOL TlgTableWindowPressNextItemButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

1642

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgTableWindowPressOpenArchiveVariableSelectionDlgButton
Function
Opens the dialog for connecting table columns to archives and tags.

Syntax
BOOL TlgTableWindowPressOpenArchiveVariableSelectionDlgButton(char*
lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressOpenDlgButton
Function
Opens the dialog for online configuration of the table window.

Syntax
BOOL TlgTableWindowPressOpenDlgButton(char* lpszWindowName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1643

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressOpenDlgButton example

TlgTableWindowPressOpenItemSelectDlgButton
Function
Opens the dialog for selecting the visible columns and the first column of the table window.

Syntax
BOOL TlgTableWindowPressOpenItemSelectDlgButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.

1644

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressOpenTimeSelectDlgButton
Function
Opens the dialog for setting the time range to be displayed in the table columns.

Syntax
BOOL TlgTableWindowPressOpenTimeSelectDlgButton(char* lpszWindowNumber)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1645

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgTableWindowPressPrevButton
Function
The data records preceding the current display area are displayed in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressPrevButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressPrevItemButton
Function
The columns of the table window are moved one column to the right, the right column taking
the position of the left column.

Syntax
BOOL TlgTableWindowPressPrevItemButton(char* lpszWindowName)

1646

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressRemoveRecordButton
Syntax
BOOL TlgTableWindowPressRemoveRecordButton(char* lpszWindowName)
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgTableWindowPressStartStopButton
Function
Updating of the table window is switched on or off (toggle function).

Syntax
BOOL TlgTableWindowPressStartStopButton(char* lpszWindowName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1647

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressFirstButton
Function
Displays the first data records of the display area in the trend window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTrendWindowPressFirstButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.

1648

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressHelpButton
Function
Displays the online help for the trend window.

Syntax
BOOL TlgTableWindowPressNextButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1649

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgTrendWindowPressLastButton
Function
Displays the last data records of the display area in the trend window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTrendWindowPressLastButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressLinealButton
Function
The ruler of the trend window is shown or hidden (toggle function).
The ruler can be moved by means of the "cursor left" and "cursor right" buttons.

Syntax
BOOL TlgTableWindowPressNextButton(char* lpszWindowName)

1650

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressNextButton
Function
The data records following the current display area are displayed in the trend window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTrendWindowPressNextButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1651

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressNextItemButton
Function
Brings all trends in the trend window one layer to the front.
The trend in the foreground is moved into the background.

Syntax
BOOL TlgTrendWindowPressNextItemButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

1652

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOneToOneButton
Function
Restores the standard size (1:1) in the trend window.

Syntax
BOOL TlgTrendWindowPressOneToOneButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenArchiveVariableSelectionDlgButton
Function
Opens the dialog for connecting trends to archives and tags.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1653

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL TlgTrendWindowPressOpenArchiveVariableSelectionDlgButton(char*
lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenDlgButton
Function
Opens the dialog for online configuration of the trend window.

Syntax
BOOL TlgTrendWindowPressOpenDlgButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

1654

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenItemSelectDlgButton
Function
Opens the dialog for selecting the visible trends and the trend which is to be in the foreground.

Syntax
BOOL TlgTrendWindowPressOpenItemSelectDlgButton(char* lpszWindowNumber)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1655

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenTimeSelectDlgButton
Function
Opens the dialog for setting the time range to be displayed.

Syntax
BOOL TlgTrendWindowPressOpenTimeSelectDlgButton(char* lpszWindowNumber)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressPrevButton
Function
The data records preceding the current display area are displayed in the trend window.
The number of displayed data records depends on the configured time range.

1656

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL TlgTrendWindowPressPrevButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressPrevItemButton
Function
Brings all trends in the trend window one layer to the back.
The trend in the background is moved to the foreground.

Syntax
BOOL TlgTrendWindowPressPrevItemButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1657

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressPrintButton
Function
The current view of the trends is output in accordance with the display configured for the WinCC
Trend Control.

Syntax
BOOL TlgTrendWindowPressPrintButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.

1658

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgTrendWindowPressReportSaveButton
Function
The displayed trend window data is saved in a text file.

Syntax
BOOL TlgTrendWindowPressReportSaveButton (char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgTrendWindowPressStartStopButton
Function
Updating of the trend window is switched on or off (toggle function).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1659

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL TlgTrendWindowPressStartStopButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressStatsResultButton
Function
Starts the evaluation of data in the selected time area.
The statistic values minimum, maximum, average and standard deviation are calculated.

Syntax
BOOL TlgTrendWindowPressStatsResultButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

1660

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressStatsSelectRangeButton
Function
To select the time range for the statistics function, the rulers for start and end time are displayed.

Syntax
BOOL TlgTrendWindowPressStatsSelectRangeButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1661

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressZoomInButton
Function
The zoom in the trend window is activated. The zoom range can only be selected with the
mouse.

Syntax
BOOL TlgTrendWindowPressZoomInButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressZoomInButton example

TlgTrendWindowPressZoomOutButton
Function
The trend window is restored to the state in which it was before the zoom was activated. The
zoom is deactivated.

1662

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
The zoom range can only be selected with the mouse (also see
TlgTrendWindowPressZoomInButton).

Syntax
BOOL TlgTrendWindowPressZoomOutButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressZoomOutButton example

Template
TlgGetNumberOfColumns
Function
Provides the number of columns in the table window.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetNumberOfColumns(char* lpszTemplate)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1663

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

Return value
Number of colums in a table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgGetNumberOfRows
Function
Provides the number of lines in the table window.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetNumberOfRows(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

Return value
Number of lines in the table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgGetNumberOfRows example

1664

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgGetNumberOfTrends
Function
Provides the number of trends in the trend window.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetNumberOfTrends(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control

Return value
Number of trends in the trend window
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgGetRowPosition
Function
Provides the current position of the line pointer in the table window.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetRowPosition(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1665

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Current position of the line pointer in the table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgGetRulerArchivNameTrend
Function
Provides the archive name of the trend with the nTrend number in the trend window at the
ruler position.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
char* TlgGetRulerArchivNameTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

Return value
Archive name of the trend with the nTrend number in the trend window at the ruler position
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgGetRulerVariableNameTrend example

1666

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgGetRulerTimeTrend
Function
Provides the time of the trend with the nTrend number in the trend window at the ruler position.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
SYSTEMTIME TlgGetRulerTimeTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

Return value
Time of the trend with the nTrend number in the trend window at the ruler position
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgGetRulerTimeTrend example (Page 2278)

TlgGetRulerValueTrend
Function
Provides the value of the trend with the nTrend number in the trend window at the ruler position.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1667

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
double TlgGetRulerValueTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

Return value
Value of the trend with the nTrend number in the trend window at the ruler position
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgGetRulerVariableNameTrend
Function
Provides the tag name of the trend with the nTrend number in the trend window.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
char* TlgGetRulerVariableNameTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

1668

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
The tag name of the trend with the nTrend number in the trend window.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgGetRulerVariableNameTrend example

TlgGetTextAtPos
Function
Provides the content of a cell of the table window as text for process value archives and user
archives.
The cell is specified by nColumn and nLine.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
char* TlgGetTextAtPos(char* lpszTemplate, int nColumn, int nLine)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control
nColumn
Number of the column
nLine
Number of the line

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1669

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Content of the cell of a table window as text
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgGetRulerVariableNameTrend example

TlgGetColumnPosition
Function
Provides the current position of the column pointer in the table window as column index.

Syntax
int TlgGetColumnPosition(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

Return value
Current position of the column pointer in a table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgGetNumberOfColumns example

1670

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgTrendWindowActivateCurve
Function
Activates a certain trend in WinCC Online Trend Control via the configured name of the trend.
This function is executed independently of the visibility or foreground position of the trend.

Syntax
BOOL TlgTrendWindowActivateCurve(char* lpszPictureName, char* lpszObjectName, char*
szValue)

Parameter
lpszPictureName
Picture name
lpszObjectName
Name of Trend Control
szValue
Name of the curve

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1671

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.2.5

Report

Report - short description


The Report group contains functions with which to start the print preview of a print job or the
printout itself.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

RPTJobPreview
Function
The preview of a print job is started.

Syntax
BOOL RPTJobPreview(LPSTR lpJobName)

Parameters
lpJobName
Pointer to the name of the print job

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
RPTJobPreview example

1672

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

RPTJobPrint
Function
A print job is started.

Syntax
BOOL RPTJobPrint(LPSTR lpJobName)

Parameters
lpJobName
Pointer to the name of the print job

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
RPTJobPrint example

RptShowError
Function
This function provides an error decription for a failed print job.
The function is already integrated into the RptJobPrint and RptJobPreview standard functions
and does not have to be called separately.
The error description is displayed in a Global Script diagnostics window.
Note
As RptShowError is a standard function the output type and form can be changed if required.
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1673

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
void RptShowError ( LPCSTR pszFailedFunction, CMN_ERRORA* pCmnErrorA )

Parameters
pszFailedFunction
Pointer to the name of the failed function.
If this pointer is NULL there will be no output of the function name.
pCmnErrorA
Pointer to the error structure of the failed function.
If this pointer is NULL there will be no output of the error structure.
STRUCTURES_TABLES_ERROR_STRUCTURE

3.15.2.6

WinCC

WinCC - short description


The WinCC group contains functions which affect the entire WinCC system.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetHWDiag
Function
This function realizes the direct start of diagnosis at runtime triggered by an event, which must
be configured, exercised on an object.
If the event occurs, the hardware diagnostics function is started from STEP7 for the associated
PLC.
The following conditions must be fulfilled in order to use the function:
The WinCC project, with the picture from which access should occur, and the STEP7 project
must be on the same computer.
The WinCC project must be stored as a subdirectory of the STEP7 project (STEP7 Projekt
\wincproj\WinCC Projekt).
The S7 tags have been mapped to WinCC.

1674

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GetHWDiag(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpProperties)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the entry point for the
hardware diagnostics
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the entry
point for the hardware diagnostics
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attribute that is connected with the tag that will be used for the entry point for the
hardware diagnostics
If multiple attribute are entered, they must be separated by semicolons (";").

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

GetHWDiagLevel
Function
Checks the logged-in user's authorization on the basis of the User Administrator function
number in dwLevel.
Then, diagnostics is started directly during runtime and is triggered by an event, which has to
be configured, occurring on an object.
If the event occurs, the hardware diagnostics function is started from STEP7 for the associated
PLC.
The following conditions must be fulfilled in order to use the function:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1675

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
The WinCC project, with the picture from which access should occur, and the STEP7 project
must be on the same computer.
The WinCC project must be stored as a subdirectory of the STEP7 project (STEP7 Projekt
\wincproj\WinCC Projekt).
The S7 tags have been mapped to WinCC.
In order for the user logged into WinCC to edit the hardware diagnostics dialog, the user
must have a WinCC user authorization matching the number passed by the function call in
the parameter "dwLevel".

Syntax
BOOL GetHWDiagLevel(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpProperties, DWORD dwLevel)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the entry point for the
hardware diagnostics
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the entry
point for the hardware diagnostics
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attribute that is connected with the tag that will be used for the entry point for the
hardware diagnostics
If multiple attribute are entered, they must be separated by semicolons (";").
dwLevel
Level number for STEP7 write permissions.
This can be defined in User Administrator.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

1676

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetKopFupAwl
Function
This function performs the network entry jump of WinCC into the STEP7 Editor "KFA".
When executing this function two tasks are performed:
Determination of the required date for the network entry jump from WinCC.
Transfer of the data to Step7 and finding the places of use of the operand in a STEP7
program by means of AUTAPI.

Syntax
BOOL GetKopFupAwl(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpProperties)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the network entry jump
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the network
entry jump
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attrribute that is connected with the tag that will be used for the network entry
jump
If multiple attribute are entered, they must be separated by semicolons (";").

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1677

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetKopFupAwlLevel
Function
Checks the active user's authorization on the basis of the User Administrator function number
in dwLevel and then performs the entry jump into the STEP7 Editor "KFA".
When executing this function three tasks are performed:
Determination of the required date for the network entry jump from WinCC.
Authorization check for the active user within WinCC.
Transfer of the data to STEP7 and finding the places of use of the operand in a STEP7
program by means of AUTAPI.
Note
Depending on the result of the authorization check in WinCC the user has either only
reading rights in STEP7 or is authorized to change S7 data.

Syntax
BOOL GetKopFupAwlLevel(LPCTSTR lpszPictureName, LPCTSTR
lpszObjectName,LPCTSTR lpProperties, DWORD dwLevel)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the network entry jump
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the network
entry jump
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attrribute that is connected with the tag that will be used for the network entry
jump
If multiple attribute are entered, they must be separated by semicolons (";").
dwLevel
Level number for STEP7 write permissions.
This can be defined in User Administrator.

1678

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OnDeactivateExecute
Function
This function is called when terminating WinCC Runtime.
As this is a standard function, you can insert instructions which are then executed.
Note
Concerning the instructions it must be taken into account that the Runtime is terminating and
therefore not all functionalities are available.
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

Syntax
void OnDeactivateExecute()

OnErrorExecute
Function
OnErrorExecute is called by the system when an error occurred upon executing an action or
a function.
This allows you to determine the precise error cause.
The function is called by the system and does not require an additional call.
As this function is available as a standard function the output type and form can be changed
if required.

Note
Please note that modified standard functions are overwritten by a new installation so that the
changes will be lost.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1679

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
void OnErrorExecute(CCAPErrorExecute ErrorExecute)

Parameters
ErrorExecute
Structure informing about the error that has occurred

Diagnostic information
These information are displayed in a Global Script diagnostics window.
SystemTime
dwErrorCode1
dwErrorCode2
szErrorText
bCycle
szApplicationName
szFunctionName
szTagName
dwCycle
szErrorTextTagName
status
lpszPictureName
lpszObjectName
lpszPropertyName
dwParamSize
szErrorText

Time (UTC) at which the error occurred


The error codes and their meaning are to be found in the structure
definition
The error codes and their meaning are to be found in the structure
definition
Text description of the error cause
Cycle type
Error-triggering application
FunctionID
Tag name
Cycle type
Text description of the tag status
Tag status
Picture in which the error occurred
Object in which the error occurred
Object property in which the error occurred
only used internally
Text description of the error cause returned by the error structure
"pError"

See also
CCAPErrorExecute structure definition

OnTime
Function
OnTime is exclusively called by the system. The function returns the runtime of all actions or
determines the actions running longer than the specified time. Time measurement can be
enabled/disabled via APDIAG.

1680

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
As this function is available as a standard function the output type can be influenced by
changing the function code.
Note
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

Syntax
void OnTime(CCAPTime time)

Parameters
time
Result structure
STRUCTURES_TABLES_CCAPTIME

3.15.2.7

Windows

Windows - short description


The Windows group contains the ProgramExecute function.
This function can be used to execute any program.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

ProgramExecute
Function
Starts the program with the specified name.

Syntax
unsigned int ProgramExecute(char* Program_Name)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1681

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Program_Name
Pointer to the program name

Return value
If the return value is greater than 31, the function has been completed without any errors.
In case of an error, the return value contains one of the following error codes:
0
2
3
11

out of memory
Specified file could not be found.
Specified path could not be found.
Program could not be started.

See also
ProgramExecute

3.15.3

Internal functions

3.15.3.1

Internal functions - short description


Internal functions are used to make graphic objects and archives dynamic and in project
functions, standard functions and global script actions.
Internal funtions are recognized throughout a project.
They can be neither be newly created nor can existing internal functions be modified.
Internal functions are divided into the following groups:
allocate
Functions to reserve and release working memory space
c_bib
Functions from the standard C-library
graphics
Functions to read and set properties of graphical objects
tag
Functions to read and write tags
wincc
Functions for changing languages, deactivating Runtime and ending WinCC

1682

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.3.2

allocate

SysFree
Function
Releases the memory area previously reserved with the SysMalloc function.

Syntax
void SysFree(void* lpFree);

Parameters
lpFree
Pointer to the memory area reserved with the SysMalloc function

SysMalloc
Function
Reserves memory space for an action. The memory area is assigned to the action. When the
action has been completed and the result transferred, the system releases the memory again.
The SysFree function can be used to release reserved memory space.

Syntax
void* SysMalloc(unsigned long int size);

Parameters
size
Size of the memory area in bytes.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1683

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.3.3

c_bib

c_bib - short description


The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ctype
isalnum
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib

1684

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isalpha
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1685

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isdigit
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1686

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

isgraph
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

islower
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1687

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isprint
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1688

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ispunct
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1689

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

isspace
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isupper
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1690

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isxdigit
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1691

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tolower
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1692

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

toupper
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

math
acos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1693

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

asin
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1694

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

atan
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1695

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

atan2
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ceil
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1696

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

cos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1697

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

cosh
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1698

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

exp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fabs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1699

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

floor
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1700

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fmod
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1701

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

frexp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ldexp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1702

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

log
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1703

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

log10
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1704

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

modf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

pow
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1705

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

sin
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1706

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

sinh
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1707

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

sqrt
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tan
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1708

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tanh
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1709

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memory
memchr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1710

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

memcmp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memcpy
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1711

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memmove
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1712

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memset
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1713

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

stdio
char_io
fgetc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fgets
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib

1714

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fputc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1715

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fputs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1716

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

getc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

putc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1717

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ungetc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1718

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

Directio
fread
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1719

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

fwrite
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

Error
clearerr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

1720

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

feof
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1721

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ferror
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1722

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

File
fclose
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fflush
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1723

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fopen
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1724

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

freopen
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1725

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

remove
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

rename
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1726

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

setbuf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1727

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

setvbuf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1728

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

tmpfile
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tmpnam
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1729

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

File_pos
fgetpos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1730

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fseek
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1731

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

fsetpos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ftell
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1732

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

rewind
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1733

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

Output
vfprintf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1734

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

vsprintf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

stdlib
abs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1735

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

atof
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1736

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

atoi
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1737

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

atol
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

bsearch
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1738

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

calloc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1739

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

div
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1740

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

free
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

getenv
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1741

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

labs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1742

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ldiv
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1743

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

malloc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

qsort
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1744

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

rand
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1745

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

realloc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1746

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

srand
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtod
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1747

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtol
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1748

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtoul
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1749

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

string
strcat
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strchr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

1750

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strcmp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1751

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strcpy
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1752

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

strcspn
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strerror
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1753

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strlen
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1754

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strncat
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1755

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

strncmp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strncpy
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1756

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strpbrk
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1757

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strrchr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1758

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

strspn
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strstr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1759

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtok
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1760

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

time
asctime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1761

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

clock
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ctime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

1762

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

difftime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1763

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

gmtime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

1764

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

localtime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

mktime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1765

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strftime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

1766

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

time
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1767

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.3.4

graphics

Graphics - short description


The functions of the Graphics group allow to modify or query graphical properties of WinCC
objects.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.
Note
If the function is called for the picture object, set the parameter lpszObjectName = ZERO.

get
axes
GetAlignment
Function
When using bar objects, it indicates whether the text is to the right or left of the bar.

Syntax
BOOL GetAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Text is to the right of the bar

1768

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
Text is to the left of the bar

See also
GetScaling example
Beispiel GetScaling (Page 2234)

GetAxisSection
Function
When using bar objects, it specifies the difference between the values of two neighboring axis
labels.

Syntax
double GetAxisSection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Difference between the values of two neighboring axis labels

GetExponent
Function
When using bar objects, it specifies whether the axis label corresponds to the decimal or
exponential form.

Syntax
BOOL GetExponent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1769

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Axis label in exponential form
FALSE
Axis label in decimal form

See also
GetScaling example
Beispiel GetScaling (Page 2234)

GetLeftComma
Function
When using bar objects, it specifies the number of integers in the axis label.

Syntax
long int GetLeftComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
The number of integers in the axis label

1770

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetLongStrokesBold
Function
When using bar objects, it specifies whether the main division lines on the scale are bold or
regular.

Syntax
BOOL GetLongStrokesBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The main division lines on the graph scale are bold
FALSE
The main division lines on the graph scale are regular

See also
GetScaling example
Beispiel GetScaling (Page 2234)

GetLongStrokesOnly
Function
When using bar objects, it specifies whether intermediate division lines are used on the scale.

Syntax
BOOL GetLongStrokesOnly(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1771

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Only main division lines are used on the bar graph scale.
FALSE
Both main and intermediate division lines are used on the bar graph scale.

See also
GetScaling example
Beispiel GetScaling (Page 2234)

GetLongStrokesSize
Function
When using bar objects, it specifies the length of the main division lines.

Syntax
long int GetLongStrokesSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Length of the main division lines as numeric value

1772

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetLongStrokesTextEach
Function
When using bar objects, it specifies the interval between the main division lines being assigned
a label.

Syntax
long int GetLongStrokesTextEach(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Label of the main division lines as numeric value

Example:
Return value = 1 -> Every main division line is assigned a label.
Return value = 2 -> Every 2nd main division line is assigned a label.
etc.

GetRightComma
Function
When using bar objects, it specifies the number of decimal places in the axis label.

Syntax
long int GetRightComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1773

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
The number of decimal places in the axis label

GetScaleTicks
Function
When using bar objects, it specifies the scale marks as number of scale sections. A scale
section is a part of the scale bounded by two main tick marks.

Syntax
long int GetScaleTicks(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Scale marks as number of scale sections
Note
The number of scale sections is given as 0, if the bar object itself calculates a suitable scale
unit.

GetScaling
Function
When using bar objects, it specifies whether the scale is activated or deactivated.

Syntax
BOOL GetScaling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1774

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Display with scale
FALSE
Display without scale

See also
GetScaling example
Beispiel GetScaling (Page 2234)

GetScalingType
Function
When using bar objects, it specifies the type of bar scaling.

Syntax
long int GetScalingType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Type of bar scaling as numeric value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1775

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Bar scaling
Bar Scaling (Page 2284)

color
Color - short description
The various color properties of objects can be modified or queried using the functions in the
Color group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetBackColor
Function
Specifies the background color of the object as a numeric value.

Syntax
long int GetBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Background color of the object as a numeric value
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

1776

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBackColor2
Function
When using bar objects, it specifies the color of the bar as a numeric value.

Syntax
long int GetBackColor2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBackColor3
Function
When using bar objects, it specifies the background color of the bar as a numeric value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1777

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetBackColor3(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar background color

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBackColorBottom
Function
Specifies the background color of the slider objects at the bottom right.

Syntax
long int GetBackColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background color of the slider objects at the bottom right

1778

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBackColorTop
Function
Specifies the background color of the slider objects at the top left.

Syntax
long int GetBackColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background color of the slider objects at the top left

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBorderBackColor
Function
Specifies the background color of the lines or borders.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1779

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background color of the lines or borders

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBorderColor
Function
Specifies the line or border color as a numeric value.

Syntax
long int GetBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the color of lines or borders

1780

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBorderColorBottom
Function
Specifies the 3D border color at the bottom.

Syntax
long int GetBorderColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the 3D border color at the bottom

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetBorderColorTop
Function
Specifies the 3D border color at the top.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1781

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetBorderColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the 3D border color at the top

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetButtonColor
Function
Specifies the button color of slider objects.

Syntax
long int GetButtonColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the button color of slider objects

1782

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetColorBottom
Function
When using slider objects, it specifies the color of the bottom limit.

Syntax
long int GetColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the color of the bottom limit of slider objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetColorTop
Function
When using slider objects, it specifies the color of the top limit.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1783

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the color of the top limit of slider objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetFillColor
Function
Specifies the color of the fill pattern.

Syntax
long int GetFillColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1784

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Numeric value of the fill color
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetForeColor
Function
Specifies the color of the font.

Syntax
long int GetForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the font color

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1785

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetGridColor
Function
Specifies the grid color of Graphics Designer.

Syntax
long int GetGridColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the grid color of Graphics Designer

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetItemBorderBackColor
Function
Specifies the background color of the dividing line for the "text list" object.

Syntax
long int GetItemBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1786

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Numeric value defining the background color of the dividing line for the "text list" object

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetItemBorderColor
Function
Specifies the color of the dividing line for the "text list" object.

Syntax
long int GetItemBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the dividing line color for the "text list" object

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1787

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetScaleColor
Function
Specifies the scale color for bar objects.

Syntax
long int GetScaleColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value of the scale color for bar objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetSelBGColor
Function
Specifies the background color of the selected entry for the "text list" object.

Syntax
long int GetSelBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1788

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Numeric value defining the background color of the selected entry

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetSelTextColor
Function
Specifies the font color of the selected entry for the "text list" object.

Syntax
long int GetSelTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the font color of the selected entry

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1789

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTrendColor
Function
Specifies the trend color of bar objects.

Syntax
long int GetTrendColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the trend color of bar objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

GetUnselBGColor
Function
Specifies the background color of the non-selected entries for the "text list" object.

Syntax
long int GetUnselBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1790

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Numeric value defining the background color of the non-selected entries

See also
GetBackColor example
Color chart
Color chart (Page 2286)
GetBackColor example (Page 2218)

GetUnselTextColor
Function
Specifies the font color of the non-selected entries for the "text list" object.

Syntax
long int GetUnselTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the font color of the non-selected entries

See also
GetBackColor example
Color chart
GetBackColor example (Page 2218)
Color chart (Page 2286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1791

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

fill
Fill - short description
The functions in the Fill group control the dynamic filling of objects.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetFilling
Function
Specifies whether dynamic filling with background color is activated.

Syntax
BOOL GetFilling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Dynamic filling with background color is activated.
FALSE
Dynamic filling with background color is not activated.

See also
GetFilling example
GetFilling example (Page 2219)

1792

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetFillingIndex
Function
Specifies the current fill level.

Syntax
long int GetFillingIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current fill level as a numeric value (0 - 100)

See also
GetFillingIndex example
GetFillingIndex example (Page 2219)

flash
Flash - short description
The various flashing properties can be modified or called in using the functions in the Flash
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1793

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetBackFlashColorOff
Function
Specifies the background flash color for the deactivated status.

Syntax
long int GetBackFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Background flash color for the deactivated status as a numeric value

See also
Color chart (Page 2286)
GetFlashBackColorOn example
GetFlashBackColorOn example (Page 2221)
Color chart

GetBackFlashColorOn
Function
Specifies the background flash color for the activated status.

Syntax
long int GetBackFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1794

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Background flash color for the activated status as a numeric value

See also
GetFlashBackColorOn example (Page 2221)
Color chart (Page 2286)
Color chart
GetFlashBackColorOn example

GetBorderFlashColorOff
Function
Specifies the border or line flashing color for the deactivated status.

Syntax
long int GetBorderFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Border or line flashing color for the deactivated status as a numeric value

See also
GetFlashBackColorOn example (Page 2221)
Color chart (Page 2286)
Color chart
GetFlashBackColorOn example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1795

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetBorderFlashColorOn
Function
Specifies the border or line flashing color for the activated status.

Syntax
long int GetBorderFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Border or line flashing color for the activated status as a numeric value

See also
GetFlashBackColorOn example (Page 2221)
Color chart (Page 2286)
Color chart
GetFlashBackColorOn example

GetFlashBackColor
Function
Specifies whether flashing of the background is activated or not.

Syntax
BOOL GetFlashBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1796

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
TRUE
Flashing background is activated.
FALSE
Flashing background is not activated.

See also
GetFlashBackColor example (Page 2220)
GetFlashBackColor example

GetFlashBorderColor
Function
Specifies whether flashing of the border or line is activated or not.

Syntax
BOOL GetFlashBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Flashing of the border or line is activated.
FALSE
Flashing of the border or line is not activated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1797

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetFlashBackColor example (Page 2220)
GetFlashBackColor example

GetFlashForeColor
Function
Specifies whether flashing of the font is activated or not.

Syntax
BOOL GetFlashForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Flashing of the font is activated.
FALSE
Flashing of the font is not activated.

See also
GetFlashBackColor example (Page 2220)
GetFlashBackColor example

GetFlashRateBackColor
Function
Specifies the flash frequency of the background.

1798

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetFlashRateBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of the background

See also
GetFlashBackColorOn example (Page 2221)
Flash frequencies (Page 2284)
GetFlashBackColorOn example
Flash frequencies

GetFlashRateBorderColor
Function
Specifies the flash frequency of the line or border.

Syntax
long int GetFlashRateBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of the line or border

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1799

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetFlashBackColorOn example (Page 2221)
Flash frequencies (Page 2284)
GetFlashBackColorOn example
Flash frequencies

GetFlashRateForeColor
Function
Specifies the flash frequency of the font.

Syntax
long int GetFlashRateForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of the font

See also
GetFlashBackColorOn example (Page 2221)
Flash frequencies (Page 2284)
GetFlashBackColorOn example
Flash frequencies

GetForeFlashColorOff
Function
Specifies the font flash color for the deactivated status.

1800

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetForeFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Font flash color for the deactivated status as a numeric value

See also
GetFlashBackColorOn example (Page 2221)
Color chart (Page 2286)
GetFlashBackColorOn example
Flash frequencies

GetForeFlashColorOn
Function
Specifies the font flash color for the activated status.

Syntax
long int GetForeFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Font flash color for the activated status as a numeric value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1801

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetFlashBackColorOn example (Page 2221)
Color chart (Page 2286)
GetFlashBackColorOn example
Color chart

focus
Focus - short description
Using the functions in the Focus group, it is possible to set the focus or poll which object has
the focus.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

Get_Focus
Function
Specifies the name of the object currently or last focussed.

Syntax
char *Get_Focus();

Return value
Name of the object currently or last focussed.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetFocus example (Page 2222)
GetFocus example

1802

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

font
Font - short description
The various properties affecting text can be modified or called in using the functions in the
Font group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetAlignmentLeft
Function
Specifies the horizontal text alignment (left, centered, right).

Syntax
long int GetAlignmentLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Horizontal text alignment as a numeric value

See also
Text alignment (Page 2291)
GetFontSize example (Page 2223)
GetFontSize example
Text alignment

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1803

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetAlignmentTop
Function
Specifies the vertical text alignment (top, centered, bottom).

Syntax
long int GetAlignmentTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Vertical text alignment as a numeric value

See also
GetFontSize example (Page 2223)
Text alignment (Page 2291)
GetFontSize example
Text alignment

GetFontBold
Function
Specifies whether the font is bold or not.

Syntax
BOOL GetFontBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1804

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
TRUE
Bold font on
FALSE
Bold font off

See also
GetFontBold example (Page 2223)
GetFontBold example

GetFontItalic
Function
Specifies whether the font is italic or not.

Syntax
BOOL GetFontItalic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Italic font on
FALSE
Italic font off

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1805

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetFontBold example (Page 2223)
GetFontBold example

GetFontName
Function
Indicates the current font name.

Syntax
char* GetFontName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to the name of the font currently selected.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetText example (Page 2251)
GetText example

GetFontSize
Function
Specifies the font size.

1806

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetFontSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current font size

See also
GetFontSize example (Page 2223)
GetFontSize example

GetFontUnderline
Function
Specifies whether the font is underlined or not.

Syntax
BOOL GetFontUnderline(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Underlined font on

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1807

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
Underlined font off

See also
GetFontBold example (Page 2223)
GetFontBold example

GetOrientation
Function
Specifies the text orientation (vertical/horizontal).

Syntax
BOOL GetOrientation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Vertical text orientation
FALSE
Horizontal text orientation

See also
GetFontBold example (Page 2223)
GetFontBold example

1808

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetText
Function
Specifies the value of the "text" property for objects like static text, check box or radio box.

Syntax
char* GetText(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to a text.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
In case of check and radio boxes, the element to be determined must be defined with the
"SetIndex" function before actually activating this function.

See also
GetText example (Page 2251)

general
GetLayer
Function
Specifies the picture layer in which the object is located.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1809

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetLayer(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture layer in which the object is located

geometry
Geometry - short description
The size, position and other geometrical properties of objects can be modified or called in using
the functions in the Geometry group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetActualPointLeft
Function
Specifies the X value of the current position in a polygon or polygon line.

Syntax
long int GetActualPointLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1810

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
X value for the current point of a polygon or polygon line
Note
The current point of the polygon can be set using the SetIndex function.

See also
GetLeft example (Page 2225)
GetLeft example

GetActualPointTop
Function
Specifies the Y value of the current position in a polygon or polygon line.

Syntax
long int GetActualPointTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Y value for the current point of a polygon or polygon line
Note
The current point of the polygon can be set using the SetIndex function.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1811

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetTop example (Page 2252)
GetTop example

GetBoxCount
Function
Specifies the number of fields for check boxes and radio boxes.

Syntax
long int GetBoxCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of fields in a check box or radio box.

GetDirection
Function
Specifies the bar direction for bar objects.

Syntax
long int GetDirection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1812

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Bar direction of bar objects as numeric value

See also
Bar direction (Page 2283)
Bar direction

GetEndAngle
Function
Specifies the end angle of circle and ellipse segments and circle and elliptical arcs.

Syntax
long int GetEndAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
End angle of circle and ellipse segments as well as circle and ellipse arcs

GetGrid
Function
Specifies whether the grid is activated in the graphics area of Graphics Designer.

Syntax
BOOL GetGrid(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1813

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Grid in Graphics Designer is activated.
FALSE
Grid in Graphics Designer is deactivated.

GetGridHeight
Function
Specifies the height of the grid in the graphics area of Graphics Designer.

Syntax
long int GetGridHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Height of the grid in Graphics Designer

GetGridWidth
Function
Specifies the width of the grid in the graphics area of Graphics Designer.

1814

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetGridWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Width of the grid in Graphics Designer

GetHeight
Function
Specifies the height of the rectangle framing an object.

Syntax
long int GetHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Height of the rectangle framing an object
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1815

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetHeight example (Page 2224)

GetLeft
Function
Specifies the X position of the upper left corner of the rectangle framing an object.

Syntax
long int GetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current X value of the upper left corner of the rectangle framing an object

See also
GetLeft example (Page 2225)
GetLeft example

GetPointCount
Function
Specifies the number of corners of a polygon or in a polygon line.

Syntax
long int GetPointCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1816

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of corners of a polygon or in a polyline

GetRadius
Function
Specifies the radius of a circle, circle segment or arc.

Syntax
long int GetRadius(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Radius of a circle, circle segment or arc

See also
GetHeight example (Page 2224)
GetHeight example

GetRadiusHeight
Function
Specifies the radius of an ellipse, ellipse segment or elliptical arc in a vertical direction.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1817

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetRadiusHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Radius of an ellipse, ellipse segment or elliptical arc in a vertical direction

See also
GetHeight example (Page 2224)
GetHeight example

GetRadiusWidth
Function
Specifies the radius of an ellipse, ellipse segment or elliptical arc in a horizontal direction.

Syntax
long int GetRadiusWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Radius of an ellipse, ellipse segment or elliptical arc in a horizontal direction

1818

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetHeight example (Page 2224)
GetHeight example

GetReferenceRotationLeft
Function
Specifies the X value of the rotation reference (central axis about which the object can be
rotated) for lines, polygons and polylines.

Syntax
long int GetReferenceRotationLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
X value of the rotation reference for lines, polygons and polygon lines

See also
GetLeft example (Page 2225)
GetLeft example

GetReferenceRotationTop
Function
Specifies the Y value of the rotation reference (central axis about which the object can be
rotated) for lines, polygons and polylines.

Syntax
long int GetReferenceRotationTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1819

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Y value of the rotation reference for lines, polygons and polygon lines

See also
GetTop example (Page 2252)
GetTop example

GetRotationAngle
Function
Specifies the angle of rotation about the central axis for lines, polygons and polylines.

Syntax
long int GetRotationAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Angle of rotation about the central axis

See also
GetHeight example (Page 2224)
GetHeight example

1820

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetRoundCornerHeight
Function
Specifies the radius of the rounded corner of a rectangle vertically.

Syntax
long int GetRoundCornerHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Vertical radius of the rounded corner of a rectangle

See also
GetHeight example (Page 2224)
GetHeight example

GetRoundCornerWidth
Function
Specifies the radius of the rounded corner of a rectangle horizontally.

Syntax
long int GetRoundCornerWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1821

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Horizontal radius of the corner of the rounded corner of a rectangle

See also
GetWidth example (Page 2253)
GetWidth example

GetStartAngle
Function
Specifies the start angle of circle and ellipse segments and circle and elliptical arcs.

Syntax
long int GetStartAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Start angle of circle and ellipse segments as well as circle and elliptical arcs

See also
GetHeight example (Page 2224)
GetHeight example

GetTop
Function
Specifies the Y position of the upper left corner of the rectangle framing an object.

Syntax
long int GetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1822

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current Y value of the upper left corner of the rectangle framing an object

See also
GetTop example (Page 2252)
GetTop example

GetWidth
Function
Specifies the width of the rectangle framing an object.

Syntax
long int GetWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Width of the rectangle framing an object
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1823

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetWidth example (Page 2253)
GetWidth example

GetZeroPoint
Function
When using bar objects, it indicates the zero point.

Syntax
long int GetZeroPoint(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Zero point for bar objects

See also
GetHeight example (Page 2224)
GetHeight example

i_o
i_o - short description
The various properties affecting input and output values can be modified or called in using the
functions in the i_o group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

1824

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetAssignments
Function
Assignment of text to the value range of lists

Syntax
char* GetAssignments(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
The assignment of text to the value range depends on the list type.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
List types (Page 2290)
List types

GetAssumeOnExit
Function
Specifies for I/O fields whether the entered value is assumed upon exiting the field.

Syntax
BOOL GetAssumeOnExit(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1825

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Value application upon exiting the field.
FALSE
No value application upon exiting the field.

GetAssumeOnFull
Function
Specifies for I/O fields whether the entered value is assumed on completion of input.

Syntax
BOOL GetAssumeOnFull(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Value application on completion of input.
FALSE
No value application on completion of input.

1826

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetBitNumber
Function
Specifies the relevant bit in the output value for the "bit" list type.

Syntax
long int GetBitNumber(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Indication of the relevant bit in the output value for the "bit" list type

See also
GetHiddenInput example (Page 2224)
List types (Page 2290)
List types
GetHiddenInput example

GetClearOnError
Function
Specifies for I/O fields whether deletion of the content in case of input errors is activated.

Syntax
BOOL GetClearOnError(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1827

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
TRUE
Deletion of the content in case of input errors is activated
FALSE
Deletion of the content in case of input errors is not activated

GetClearOnNew
Function
Specifies for I/O fields whether deletion of the content on new input is activated.

Syntax
BOOL GetClearOnNew(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Deletion of the content on new input is activated.
FALSE
Deletion of the content on new input is not activated.

GetDataFormat
Function
Specifies the data type of the field content for I/O fields.

1828

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetDataFormat(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Data type of the field content as numeric value

See also
GetHiddenInput example (Page 2224)
I/O field, data type of the field content (Page 2285)
GetHiddenInput example
I/O field, data type of the field content

GetHiddenInput
Function
Specifies whether hidden input is activated for I/O fields.

Syntax
BOOL GetHiddenInput(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1829

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Hidden input is activated
FALSE
Hidden input is not activated

See also
GetHiddenInput example (Page 2224)
GetHiddenInput example

GetInputValueChar
Function
Specifies the input value in the data type "char" for I/O fields.

Syntax
char* GetInputValueChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to the input value in the data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

1830

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetInputValueDouble
Function
Specifies the input value in the data type "double" for I/O fields.

Syntax
double GetInputValueDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Input value in the data type "double"

GetListType
Function
Specifies the list type for the "text list" object.

Syntax
long int GetListType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
List type for the "text list" object

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1831

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetHiddenInput example (Page 2224)
List types (Page 2290)
GetHiddenInput example
List types

GetNumberLines
Function
Specifies the number of visible lines for the "text list" object.

Syntax
long int GetNumberLines(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of visible lines for the "text list" object
Note
If the amount of configured text is larger than the number of visible lines, the "text list" object
receives a vertical scroll bar.

See also
GetHiddenInput example (Page 2224)
GetHiddenInput example

GetOutputFormat
Function
Specifies the output format for I/O fields.

1832

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
char* GetOutputFormat(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to the output format.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
I/O field, data type of the field content (Page 2285)
I/O field, output format (Page 2284)
I/O field, data type of the field content
I/O field, output format

GetOutputValueChar
Function
Determines the output value in the data type "char" for I/O fields. This function should only be
used if the field content of the I/O field is of the "string" data type.

Syntax
char* GetOutputValueChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1833

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Pointer to the output value in the data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

GetOutputValueDouble
Function
Determines the output value in the data type "double" for I/O fields. This function should only
be used if the field content of the I/O field is not of the "string" data type.

Syntax
double GetOutputValueDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Output value in the data type "double"

See also
GetOutputValueDouble example (Page 2228)
GetOutputValueDouble example

1834

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Limits
Limits - short description
The various properties affecting limit values can be modified or called in using the functions
in the Limits group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetAlarmHigh
Function
Specifies the upper alarm limit for bar objects.

Syntax
double GetAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Upper alarm limit for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1835

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetAlarmLow
Function
Specifies the lower alarm limit for bar objects.

Syntax
double GetAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Lower alarm limit for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetCheckAlarmHigh
Function
When using bar objects, it specifies whether the upper alarm limit is monitored.

Syntax
BOOL GetCheckAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1836

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
In case of bar objects the upper alarm limit is monitored.
FALSE
In case of bar objects the upper alarm limit is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckAlarmLow
Function
When using bar objects, it specifies whether the lower alarm limit is monitored.

Syntax
BOOL GetCheckAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower alarm limit is monitored.
FALSE
In case of bar objects the lower alarm limit is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1837

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetCheckLimitHigh4
Function
When using bar objects, it specifies whether the upper limit value reserve 4 is monitored.

Syntax
BOOL GetCheckLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper limt value reserve 4 is monitored.
FALSE
In case of bar objects the upper limt value reserve 4 is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckLimitHigh5
Function
When using bar objects, it specifies whether the upper limit value reserve 5 is monitored.

Syntax
BOOL GetCheckLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1838

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper limt value reserve 5 is monitored.
FALSE
In case of bar objects the upper limt value reserve 5 is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckLimitLow4
Function
When using bar objects, it specifies whether the lower limit value reserve 4 is monitored.

Syntax
BOOL GetCheckLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limt value reserve 4 is monitored.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1839

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
In case of bar objects the lower limt value reserve 4 is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckLimitLow5
Function
When using bar objects, it specifies whether the lower limit value reserve 5 is monitored.

Syntax
BOOL GetCheckLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limt value reserve 5 is monitored.
FALSE
In case of bar objects the lower limt value reserve 5 is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

1840

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetCheckToleranceHigh
Function
When using bar objects, it specifies whether the upper tolerance limit is monitored.

Syntax
BOOL GetCheckToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper tolerance limit is monitored.
FALSE
In case of bar objects the upper tolerance limit is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckToleranceLow
Function
When using bar objects, it specifies whether the lower tolerance limit is monitored.

Syntax
BOOL GetCheckToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1841

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower tolerance limit is monitored.
FALSE
In case of bar objects the lower tolerance limit is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckWarningHigh
Function
When using bar objects, it specifies whether the upper warning limit is monitored.

Syntax
BOOL GetCheckWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper warning limit is monitored.

1842

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
In case of bar objects the upper warning limit is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

GetCheckWarningLow
Function
When using bar objects, it specifies whether the lower warning limit is monitored.

Syntax
BOOL GetCheckWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower warning limit is monitored.
FALSE
In case of bar objects the lower warning limit is not monitored.

See also
GetMarker example (Page 2228)
GetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1843

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetColorAlarmHigh
Function
Specifies the bar color for bar objects upon reaching the upper alarm limit.

Syntax
long int GetColorAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper alarm limit

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetColorAlarmLow
Function
Specifies the bar color for bar objects upon reaching the lower alarm limit.

Syntax
long int GetColorAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1844

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower alarm limit

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetColorLimitHigh4
Function
Specifies the bar color for bar objects upon reaching the upper limit reserve 4.

Syntax
long int GetColorLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper limit reserve 4

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1845

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetColorLimitHigh5
Function
Specifies the bar color for bar objects upon reaching the upper limit reserve 5.

Syntax
long int GetColorLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper limit reserve 5

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetColorLimitLow4
Function
Specifies the bar color for bar objects upon reaching the lower limit reserve 4.

Syntax
long int GetColorLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1846

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower limit reserve 4

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetColorLimitLow5
Function
Specifies the bar color for bar objects upon reaching the lower limit reserve 5.

Syntax
long int GetColorLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower limit reserve 5

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1847

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetColorToleranceHigh
Function
Specifies the bar color for bar objects upon reaching the upper tolerance limit.

Syntax
long int GetColorToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper tolerance limit

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetColorToleranceLow
Function
Specifies the bar color for bar objects upon reaching the lower tolerance limit.

Syntax
long int GetColorToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1848

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower tolerance limit

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetColorWarningHigh
Function
Specifies the bar color for bar objects upon reaching the upper warning limit limit.

Syntax
long int GetColorWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper warning limit

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1849

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetColorWarningLow
Function
Specifies the bar color for bar objects upon reaching the lower warning limit.

Syntax
long int GetColorWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower warning limit

See also
GetBackColor example (Page 2218)
Color chart (Page 2286)
GetBackColor example
Color chart

GetLimitHigh4
Function
Specifies the upper limit value for reserve 4 for bar objects.

Syntax
double GetLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

1850

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
High limit value for reserve 4 for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetLimitHigh5
Function
Specifies the upper limit value for reserve 5 for bar objects.

Syntax
double GetLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
High limit value for reserve 5 for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetLimitLow4
Function
Specifies the low limit value for reserve 4 for bar objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1851

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
double GetLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Low limit value for reserve 4 for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetLimitLow5
Function
Specifies the low limit value for reserve 5 for bar objects.

Syntax
double GetLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Low limit value for reserve 5 for bar objects

1852

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetLimitMax
Function
Specifies the upper limit value for I/O fields.

Syntax
double GetLimitMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
High limit value for I/O fields

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetLimitMin
Function
Specifies the low limit value for I/O fields.

Syntax
double GetLimitMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1853

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Low limit value for I/O fields

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetMarker
Function
When using bar objects, it specifies whether the limit marker is displayed.

Syntax
BOOL GetMarker(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Limit marker for bar objects is displayed.
FALSE
Limit marker for bar objects is not displayed.

1854

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetMarker example (Page 2228)
GetMarker example

GetToleranceHigh
Function
Specifies the upper tolerance limit for bar objects.

Syntax
double GetToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Upper tolerance limit for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetToleranceLow
Function
Specifies the lower tolerance limit for bar objects.

Syntax
double GetToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1855

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Lower tolerance limit for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetTypeAlarmHigh
Function
Specifies for bar objects whether the upper alarm limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper alarm limit is given in percentages.
FALSE
In case of bar objects the upper alarm limit is given in absolute terms.

1856

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeAlarmLow
Function
Specifies for bar objects whether the lower alarm limit is given in percentages or absolute terms.

Syntax
BOOL GetTypeAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower alarm limit is given in percentages.
FALSE
In case of bar objects the lower alarm limit is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeLimitHigh4
Function
Specifies for bar objects whether the upper limit reserve 4 is given in percentages or absolute
terms.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1857

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GetTypeLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper limit reserve 4 is given in percentages.
FALSE
In case of bar objects the upper limit reserve 4 is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeLimitHigh5
Function
Specifies for bar objects whether the upper limit reserve 5 is given in percentages or absolute
terms.

Syntax
BOOL GetTypeLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1858

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
In case of bar objects the upper limit reserve 5 is given in percentages.
FALSE
In case of bar objects the upper limit reserve 5 is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeLimitLow4
Function
Specifies for bar objects whether the lower limit reserve 4 is given in percentages or absolute
terms.

Syntax
BOOL GetTypeLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limit reserve 4 is given in percentages.
FALSE
In case of bar objects the lower limit reserve 4 is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1859

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTypeLimitLow5
Function
Specifies for bar objects whether the lower limit reserve 5 is given in percentages or absolute
terms.

Syntax
BOOL GetTypeLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limit reserve 5 is given in percentages.
FALSE
In case of bar objects the lower limit reserve 5 is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeToleranceHigh
Function
Specifies for bar objects whether the upper tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1860

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper tolerance limit is given in percentages.
FALSE
In case of bar objects the upper tolerance limit is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeToleranceLow
Function
Specifies for bar objects whether the lower tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower tolerance limit is given in percentages.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1861

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
In case of bar objects the lower tolerance limit is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetTypeWarningHigh
Function
Specifies for bar objects whether the upper warning limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper warning limit is given in percentages.
FALSE
In case of bar objects the upper warning limit is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

1862

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTypeWarningLow
Function
Specifies for bar objects whether the lower warning limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower warning limit is given in percentages.
FALSE
In case of bar objects the lower warning limit is given in absolute terms.

See also
GetMarker example (Page 2228)
GetMarker example

GetWarningHigh
Function
Specifies the upper warning limit for bar objects.

Syntax
double GetWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1863

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Upper warning limit for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

GetWarningLow
Function
Specifies the lower warning limit for bar objects.

Syntax
double GetWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Lower warning limit for bar objects

See also
GetAlarmHigh example (Page 2217)
GetAlarmHigh example

1864

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

link
Link - short description
A tag link property can be created or called in using the functions in the Link group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetLink
Function
Specifies the current tag connection of object properties.

Syntax
BOOL GetLink(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, LPLINKINFO *pLink);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Object property
pLink
Pointer to a structure of the type: LINKINFO

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1865

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Structure definition LINKINFO (Page 2299)
GetLink example (Page 2226)
GetLink example
LINKINFO structure definition

miscs
Miscs - short description
The properties of objects can be modified or called in using the functions in the Miscs group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetAdaptBorder
Function
Specifies for static texts, I/O fields, check boxes and radio boxes whether the border of the
field is to be dynamically adapted to the text size.

Syntax
BOOL GetAdaptBorder(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Border is adapted

1866

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
Border is not adapted

See also
GetVisible example (Page 2253)
GetVisible example

GetAdaptPicture
Function
Specifies for picture windows whether the picture is to be adapted to the window size.

Syntax
BOOL GetAdaptPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture is adapted
FALSE
Picture is not adapted

See also
GetVisible example (Page 2253)
GetVisible example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1867

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetAdaptSize
Function
Specifies for picture windows whether the window is to be adapted.

Syntax
BOOL GetAdaptSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Window is adapted
FALSE
Window is not adapted

See also
GetVisible example (Page 2253)
GetVisible example

GetAverage
Function
When using bar objects, it specifies whether value averaging is activated.

Syntax
BOOL GetAverage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1868

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Averaging is activated for bar objects
FALSE
Averaging is not activated for bar objects

See also
GetVisible example (Page 2253)
GetVisible example

GetBoxType
Function
Specifies the field type (input field, output field, input/output field) for I/O fields.

Syntax
long int GetBoxType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Field type of an I/O field

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1869

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
I/O field, field type (Page 2286)
I/O field, field type

GetCaption
Function
Specifies whether a picture or application window has a title.

Syntax
BOOL GetCaption(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture/application window has a title
FALSE
Picture/application window has no title

See also
GetVisible example (Page 2253)
GetVisible example

GetCloseButton
Function
When using a picture window, it specifies whether the window can be closed.

1870

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GetCloseButton(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture window can be closed
FALSE
Picture window cannot be closed

See also
GetVisible example (Page 2253)
GetVisible example

GetColorChangeType
Function
When using bar objects, it specifies whether the color change upon reaching a limit value only
affects a bar segment or the entire bar.

Syntax
BOOL GetColorChangeType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1871

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Color change applies to the bar sagment
FALSE
Color change applies to the entire bar

See also
GetVisible example (Page 2253)
GetVisible example

GetCursorControl
Function
Specifies whether cursor control is activated for I/O fields.

Syntax
BOOL GetCursorControl(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Cursor control for I/O fields is enabled.
FALSE
Cursor control for I/O fields is disabled.

See also
GetVisible example (Page 2253)
GetVisible example

1872

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetCursorMode
Function
Specifies whether the cursor mode for the picture is alpha cursor or tab order cursor.

Syntax
BOOL GetCursorMode(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Cursor mode for the picture is "Alpha-cursor"
FALSE
Cursor mode for the picture is "tab order cursor"

See also
GetVisible example (Page 2253)
GetVisible example

GetEditAtOnce
Function
Specifies whether the "Immediate input" property is activated for I/O fields.

Syntax
BOOL GetEditAtOnce(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1873

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
"Immediate input" property is activated
FALSE
"Immediate input" property is deactivated

See also
GetVisible example (Page 2253)
GetVisible example

GetExtendedOperation
Function
Specifies whether the "Extended operation" property is activated for slider objects.

Syntax
BOOL GetExtendedOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
"Extended operation" property is activated

1874

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
"Extended operation" property is deactivated

See also
GetVisible example (Page 2253)
GetVisible example

GetHotkey
Function
Specifies the key combination for check boxes.

Syntax
long int GetHotkey(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Key code for key combinations for check boxes

GetHysteresis
Function
When using bar objects, it specifies whether the display appears with or without hysteresis.

Syntax
BOOL GetHysteresis(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1875

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Display with hysteresis for bar objects
FALSE
Display without hysteresis for bar objects

See also
GetVisible example (Page 2253)
GetVisible example

GetHysteresisRange
Function
Specifies the hysteresis value in the display for bar objects.

Syntax
double GetHysteresisRange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Hysteresis in the display for bar objects

1876

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetLanguageSwitch
Function
Specifies fot the "Text list" object whether the assignment texts are to be stored in the text
library or in the object itself.

Syntax
BOOL GetLanguageSwitch(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Assignment texts are stored in the text library
FALSE
Assignment texts are stored in the text list object

See also
GetVisible example (Page 2253)
GetVisible example

GetLastChange
Function
Specifies the date when the picture was last changed.

Syntax
char* GetLastChange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1877

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Date of the last change of the picture.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetPictureName example (Page 2230)
GetPictureName example

GetMax
Function
Specifies the maximum value for bar and slider objects.

Syntax
double GetMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Maximum value for bar and slider objects.

1878

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetMaximizeButton
Function
Specifies for picture or application windows whether the window can be maximized.

Syntax
BOOL GetMaximizeButton(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture or application window can be maximized
FALSE
Picture or application window cannot be maximized

See also
GetVisible example (Page 2253)
GetVisible example

GetMin
Function
Specifies the minimum value for bar and slider objects.

Syntax
double GetMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1879

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Minimum value for bar and slider objects

GetMoveable
Function
Specifies for picture or application windows whether the window can be moved.

Syntax
BOOL GetMoveable(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture or application window is movable
FALSE
Picture or application window is not movable

See also
GetVisible example (Page 2253)
GetVisible example

1880

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetOffsetLeft
Function
Specifies the horizontal picture distance from the left window border for picture windows.

Syntax
long int GetOffsetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Horizontal picture distance from the left window border for picture windows

GetOffsetTop
Function
Specifies the vertical picture distance from the upper window border for picture windows.

Syntax
long int GetOffsetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Vertical picture distance from the upper window border for picture windows

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1881

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetOnTop
Function
Specifies for picture or application windows whether the window is always in the foreground.

Syntax
BOOL GetOnTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture or application window is always in the foreground
FALSE
Picture or application window can be overlapped by other windows.

See also
GetVisible example (Page 2253)
GetVisible example

GetOperation
Function
Specifies whether the object can be operated.

Syntax
BOOL GetOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

1882

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Object is operable
FALSE
Object is not operable
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetVisible example (Page 2253)
GetVisible example

GetOperationMessage
Function
Specifies for I/O fields, check boxes, radio boxes or sliders whether a message is output
following operation.

Syntax
BOOL GetOperationMessage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1883

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Upon operation a message is issued
FALSE
Upon operation no message is issued

See also
GetVisible example (Page 2253)
GetVisible example

GetOperationReport
Function
Specifies for all objects except application and picture windows and OLE control whether the
reason for the operation is logged.

Syntax
BOOL GetOperationReport(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Reason for the operation is logged.
FALSE
Reason for the operation is not logged.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

1884

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetVisible example (Page 2253)
GetVisible example

GetPasswordLevel
Function
Specifies the authorization level for the operation of the object for all objects except application
and picture windows and OLE control.

Syntax
long int GetPasswordLevel(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Authorization level for the operation of the object
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

GetPictureName
Function
Returns the name of the picture currently displayed in the picture window.

Syntax
char* GetPictureName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1885

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Name of the picture window

Return value
Pointer to the name of the currently displayed picture
Note
If both parameters are NULL, a pointer appears indicating the name of the basic screen.

See also
GetPictureName example (Page 2230)
GetPictureName example

GetProcess
Function
Specifies the default setting value for the process value to be displayed for bar and slider
objects.
Specifies the selected fields for check boxes and radio boxes.

Syntax
double GetProcess(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1886

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
For bar and slider objects: Default setting value for the process value to be displayed
For check and radio boxes: In a 32-bit word each field is represented by a bit (field 1
corrsponds to the bit value 0). Selected fields are marked by a set bit. Non-existing are
assigned 0.

GetScrollBars
Function
Specifies for picture windows whether the window has a scroll bar.

Syntax
BOOL GetScrollBars(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture window has a scroll bar
FALSE
Picture window has no scroll bar

See also
GetVisible example (Page 2253)
GetVisible example

GetServerName
Function
Specifies the default setting for the process value to be displayed for OLE control and OLE
object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1887

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
char* GetServerName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Name of the object (OLE control and OLE object) under which it is registered in WINDOWS.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetPictureName example (Page 2230)
GetPictureName example

GetSizeable
Function
Specifies for application or picture windows whether the window size can be changed.

Syntax
BOOL GetSizeable(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1888

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Application or picture window is sizeable
FALSE
Application or picture window is not sizeable

See also
GetVisible example (Page 2253)
GetVisible example

GetSmallChange
Function
Specifies the number of steps for slider objects by which the slider is shifted by a mouse click.

Syntax
long int GetSmallChange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of steps by which the slider is shifted by a mouse click

GetTagPrefix
Function
Returns the tag prefix of a picture window.

Syntax
char* GetTagPrefix(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1889

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Tag prefix of the picture window.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetTagPrefix example (Page 2246)
GetTagPrefix example

GetTrend
Function
When using bar objects, it specifies whether the trend display is activated.

Syntax
BOOL GetTrend(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1890

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Trend display is activated for a bar object
FALSE
Trend display is not activated for a bar object

See also
GetVisible example (Page 2253)
GetVisible example

GetUpdateCycle
Function
Specifies the update cycle for the entire picture.

Syntax
long int GetUpdateCycle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the update cycle

See also
Structure definition LINKINFO (Page 2299)
Structure definition LINKINFO

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1891

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetVisible
Function
Specifies whether the object is displayed.

Syntax
BOOL GetVisible(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Object is displayed
FALSE
Object is not displayed
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetVisible example (Page 2253)
GetVisible example

GetWindowBorder
Function
Specifies for application or picture windows whether the object is displayed with a border.

1892

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GetWindowBorder(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Application or picture window is displayed with a border.
FALSE
Application or picture window is displayed without a border.

See also
GetVisible example (Page 2253)
GetVisible example

GetZeroPointValue
Function
Specifies the absolute value of the zero point for bar objects.

Syntax
double GetZeroPointValue(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1893

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Absolute value of the zero point for the bar display

GetZoom
Function
Specifies the scaling factor for picture windos.

Syntax
long int GetZoom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Scaling factor of a picture window

ole_control
OLE_control - short description
The functions in the ole_Control group can only be used with OCX slider objects.
Various OCX slider object properties and settings can be modified or called in using these
functions.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

1894

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetPosition
Function
Specifies the position of the slider for OCX slider objects.

Syntax
long int GetPosition(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Slider position of the OCX slider object as numeric value

See also
GetPosition example (Page 2231)
GetPosition example

GetRangeMax
Function
Specifies the adjustment range "Max" for OCX slider objects.

Syntax
long int GetRangeMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1895

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Adjustment range "Max" of the OCX slider object as numeric value

See also
GetRangeMax example (Page 2233)
GetRangeMax example

GetRangeMin
Function
Specifies the adjustment range "Min" for OCX slider objects.

Syntax
long int GetRangeMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Adjustment range "Min" of the OCX slider object as numeric value

See also
GetRangeMin example (Page 2234)
GetRangeMin example

1896

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

pictures
Pictures - short description
Various properties of pictures of graphic objects and round buttons can be modified or called
in using the functions in the Pictures group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetPicDeactReferenced
Function
Specifies whether the picture for the "deactivated" status is referenced for round buttons.

Syntax
BOOL GetPicDeactReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The picture assigned to the "deactivated" status was not stored in the object.
FALSE
The picture assigned to the "deactivated" status was stored in the object.

GetPicDeactTransparent
Function
Specifies the transparent color for the "deactivated" status of round buttons.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1897

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetPicDeactTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the transparent color for the "deactivated" status
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
GetBackColor example (Page 2218)
GetBackColor example
Color chart

GetPicDeactUseTransColor
Function
Specifies whether the transparent color for the "deactivated" status is used for round buttons.

Syntax
BOOL GetPicDeactUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1898

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Transparent color for "deactivated" status is used
FALSE
Transparent color for "deactivated" status is not used

GetPicDownReferenced
Function
Specifies whether the picture for the "On/pressed" status is referenced for round buttons.

Syntax
BOOL GetPicDownReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The picture assigned to the "On/pressed" status was not stored in the object.
FALSE
The picture assigned to the "On/pressed" status was stored in the object.

GetPicDownTransparent
Function
Specifies the transparent color for the "On/pressed" status of round buttons.

Syntax
long int GetPicDownTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1899

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the transparent color for the "On/pressed" status
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
GetPictureDown example (Page 2229)
Color chart
GetPictureDown example

GetPicDownUseTransColor
Function
Specifies whether the transparent color for the "On/pressed" status is used for round buttons.

Syntax
BOOL GetPicDownUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1900

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Transparent color for "On/pressed" status is used
FALSE
Transparent color for "On/pressed" status is not used

GetPicReferenced
Function
When using graphic objects, it specifies whether the picture is referenced.

Syntax
BOOL GetPicReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The assigned picture was not stored in the object.
FALSE
The assigned picture was stored in the object.

GetPicTransColor
Function
Specifies the transparent color for a background picture for graphic objects.

Syntax
long int GetPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1901

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background picture of a graphic object
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
GetBackColor example (Page 2218)
GetBackColor example
Color chart

GetPictureDeactivated
Function
Specifies the picture name for the "deactivated" status of round buttons.

Syntax
char* GetPictureDeactivated(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture name for "deactivated" status.

1902

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

GetPictureDown
Function
Specifies the picture name for the "On/pressed" status of round buttons.

Syntax
char* GetPictureDown(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture name for the "On/pressed" status.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1903

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetPictureDown example (Page 2229)
GetPictureDown example

GetPictureUp
Function
Specifies the picture name for the "Off/not pressed" status of round buttons.

Syntax
char* GetPictureUp(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture name for the "Off/not pressed" status.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
GetPictureUp example (Page 2231)
GetPictureUp example

1904

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetPicUpReferenced
Function
Specifies whether the picture for the "Off/not pressed" status is referenced for round buttons.

Syntax
BOOL GetPicUpReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The picture assigned to the "Off/not pressed" status was not stored in the object.
FALSE
The picture assigned to the "Off/not pressed" status was stored in the object.

GetPicUpTransparent
Function
Specifies the transparent color for the "Off/not pressed" status of round buttons.

Syntax
long int GetPicUpTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1905

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Numeric value defining the transparent color for the "Off/not pressed" status
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
GetBackColor example (Page 2218)
GetBackColor example
Color chart

GetPicUpUseTransColor
Function
Specifies whether the transparent color for the "Off/not pressed" status is used for round
buttons.

Syntax
BOOL GetPicUpUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Transparent color for "Off/not pressed" status is used
FALSE
Transparent color for "Off/not pressed" status is not used

1906

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetPicUseTransColor
Function
When using graphic objects, it specifies whether the transparent color is used for a background
picture.

Syntax
BOOL GetPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Transparent color is used for a background picture.
FALSE
Transparent color is not used for a background picture.

property
Property - short description
The properties of objects for which there are no direct functions can be modified or called in
using the functions in the Property group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1907

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetPropBOOL
Function
Specifies the current status of a property of the data type "BOOL".

Syntax
BOOL GetPropBOOL(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property

Return value
Value of the attribute in the data type "BOOL"

See also
GetPropBOOL example (Page 2232)
GetPropBOOL example

GetPropChar
Function
Specifies the current status of a property of the data type "char".

Syntax
char* GetPropChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

1908

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property

Return value
Pointer to a character string containing the value of the object property.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetPropChar example (Page 2233)
GetPropChar example

GetPropDouble
Function
Specifies the current status of a property of the data type "double".

Syntax
double GetPropDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1909

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszPropertyName
Name of the object property

Return value
Value of the attribute in the data type "double"

GetPropWord
Function
Specifies the current status of a property of the data type "long".

Syntax
long GetPropWord(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property

Return value
Value of the attribute in the type "long"

1910

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

state
State - short description
The properties of status displays can be modified or called in using the functions in the State
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetBasePicReferenced
Function
Specifies whether the basic picture is referenced for the status display.

Syntax
BOOL GetBasePicReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The basic picture was not stored in the object.
FALSE
The basic picture was stored in the object.

GetBasePicTransColor
Function
Specifies the transparent color of the basic picture for the status display.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1911

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetBasePicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Transparent color of the basic picture as numeric value
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
GetBackColor example (Page 2218)
GetBackColor example
Color chart

GetBasePicture
Function
Specifies the basic picture name fur the status display.

Syntax
char* GetBasePicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1912

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Basic picture name for the status display.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

GetBasePicUseTransColor
Function
When using the status display, it specifies whether the transparent color is used for the basic
picture.

Syntax
BOOL GetBasePicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Transparent color is used for the basic picture.
FALSE
Transparent color is not used for the basic picture.

GetFlashFlashPicture
Function
Specifies whether the flash picture of the status display is animated dynamically or statically.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1913

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GetFlashFlashPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The flash picture is animated dynamically.
FALSE
The flash picture is animated statically.

GetFlashPicReferenced
Function
Specifies whether the flash picture is referenced for the status display.

Syntax
BOOL GetFlashPicReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The flash picture was not stored in the object.

1914

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
The flash picture was stored in the object.

GetFlashPicTransColor
Function
Specifies the transparent color of the flash picture for the status display.

Syntax
long int GetFlashPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Transparent color of the flash picture as numeric value
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
GetBackColor example (Page 2218)
GetBackColor example
Color chart

GetFlashPicture
Function
Specifies the flash picture name for the status display.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1915

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
char* GetFlashPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash picture name (file name of the graphic).
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

GetFlashPicUseTransColor
Function
When using the status display, it specifies whether the transparent color is used for the flash
picture.

Syntax
BOOL GetFlashPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1916

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Transparent color is used for the flash picture.
FALSE
Transparent color is not used for the flash picture.

GetFlashRateFlashPic
Function
Specifies the flash frequency of the flash picture for the status display.

Syntax
long int GetFlashRateFlashPic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of a flash picture as numeric value
Note
Since the flashing is performed by means of software engineering, the precise frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time etc.).

See also
Flash frequencies (Page 2284)
GetFlashRateFlashPic example (Page 2222)
Flash frequencies
GetFlashRateFlashPic example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1917

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetIndex
Function
Specifies the index of the current position in a polygon or polygon line.
Specifies the index of the current field for check boxes and radio boxes.

Syntax
long int GetIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Index of the current point or field

style
Style - short description
Various properties affecting the appearance of objects can be modified or called in using the
functions in the Style group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetBackBorderWidth
Function
Specifies the frame width of 3D frames and slider objects.

1918

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetBackBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value for the frame width of 3D frames and slider objects

See also
GetBorderStyle example (Page 2218)
GetBorderStyle example

GetBorderEndStyle
Function
Specifies the type of line end.

Syntax
long int GetBorderEndStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Type of line end as numeric value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1919

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetBorderStyle example (Page 2218)
Line end style (Page 2289)
GetBorderStyle example
Line style

GetBorderStyle
Function
Specifies the line or border style.

Syntax
long int GetBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the line or border style

See also
GetBorderStyle example (Page 2218)
Line styles (Page 2289)
GetBorderStyle example
Line styles

GetBorderWidth
Function
Specifies the line or border line width.

1920

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long int GetBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Line or border line width as numeric value

See also
GetBorderStyle example (Page 2218)
GetBorderStyle example

GetBoxAlignment
Function
Specifies the arrangement of controls (left or right justified) in check boxes or radio boxes.

Syntax
long int GetBoxAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the arrangement of controls in check boxes or radio boxes

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1921

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetBorderStyle example (Page 2218)
Text alignment (Page 2291)
GetBorderStyle example
Text alignment

GetFillStyle
Function
Specifies the type of fill pattern.

Syntax
long int GetFillStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Type of fill pattern as numeric value
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
Fill pattern (Page 2288)
GetFillStyle example (Page 2220)
Fill pattern
GetFillStyle example

1922

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetFillStyle2
Function
Specifies the bar fill pattern for a bar graph.

Syntax
long int GetFillStyle2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Bar fill pattern as numeric value

See also
Fill pattern (Page 2288)
GetFillStyle example (Page 2220)
GetFillStyle example
Fill pattern

GetItemBorderStyle
Function
Specifies the dividing line style for the "text list" object.

Syntax
long int GetItemBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1923

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name

Return value
Dividing line style for the "text list" object

See also
GetBorderStyle example (Page 2218)
Line styles (Page 2289)
GetBorderStyle example
Line styles

GetItemBorderWidth
Function
Specifies the dividing line width for the "text list" object.

Syntax
long int GetItemBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the dividing line width for the "text list" object

See also
GetBorderStyle example (Page 2218)
GetBorderStyle example

1924

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetPressed
Function
Specifies for buttons or round buttons whether the switch setting is "pressed" or "not pressed".

Syntax
BOOL GetPressed(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Switch setting is "pressed"
FALSE
Switch setting is "not pressed"

GetToggle
Function
Specifies for buttons or round buttons whether the switch is latchable or not.

Syntax
BOOL GetToggle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1925

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
Switch is latchable
FALSE
Switch is not latchable

GetWindowsStyle
Function
Specifies whether buttons are to be displayed in Windows style.

Syntax
BOOL GetWindowsStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Button is displayed in the usual Windows fashion.
FALSE
The apperance of the button is defined by the user.

set
axes
Axes - short description
The functions in the Axes group can only be used with bar graph objects.

1926

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
This function can be used to modify or query various bar graph object properties.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAlignment
Function
When using bar objects, it indicates whether the text is to the right or left of the bar.

Syntax
BOOL SetAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAlignment);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAlignment
Text alignment
TRUE Text is to the right of the bar
FALSE Text is to the left of the bar

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1927

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetScaling example (Page 2267)
SetScaling example

SetAxisSection
Function
When using bar objects, it specifies the axis section, i.e. the difference between the values of
two neighboring axis labels.

Syntax
BOOL SetAxisSection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dAxisSection);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dAxisSection
Axis section

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)

SetExponent
Function
Sets the axis label display for bar objects (exponential/decimal).

1928

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetExponent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bExponent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bExponent
Axis labeling
TRUE Axis label in exponential form
FALSE Axis label in decimal form

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

SetLeftComma
Function
When using bar objects, it specifies the number of integers in the axis label.

Syntax
BOOL SetLeftComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lLeftComma);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1929

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lLeftComma
Number of integers

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

SetLongStrokesBold
Function
When using bar objects, it specifies whether the main division lines are bold or regular.

Syntax
BOOL SetLongStrokesBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bLongStrokesBold);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bLongStrokesBold
Main division lines on the bar graph scale

1930

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
TRUE bold
FALSE normal

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

SetLongStrokesOnly
Function
When using bar objects, it specifies whether intermediate or only main division lines are used
on the scale.

Syntax
BOOL SetLongStrokesOnly(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bLongStrokesOnly);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bLongStrokesOnly
Only main division lines yes/no

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1931

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

SetLongStrokesSize
Function
When using bar objects, it specifies the length of the main division lines on the bar graph scale.

Syntax
BOOL SetLongStrokesSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lLongStrokesSize);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lLongStrokesSize
Length of the main division marks in pixels

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

1932

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetRightComma
Function
When using bar objects, it specifies the number of decimal places in the axis label.

Syntax
BOOL SetRightComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRightComma);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRightComma
Number of decimal places

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

SetScaleTicks
Function
When using bar objects, it specifies the scale marks as number of scale sections. A scale
section is a part of the scale bounded by two main tick marks.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1933

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetScaleTicks(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lScaleTicks);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lScaleTicks
Number of scale sections

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the number of scale sections is given as 0, the bar object itself calculates a suitable scale
unit.

See also
SetScaling example (Page 2267)
SetScaling example

SetScaling
Function
Switches the bar graph scale of bar objects on or off.

Syntax
BOOL SetScaling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bScaling);

1934

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bScaling
Scale on/off.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2267)
SetScaling example

SetScalingType
Function
When using bar objects, it specifies the type of bar scaling.

Syntax
BOOL SetScalingType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lScalingType);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lScalingType
Type of bar scaling as numeric value
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1935

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Bar Scaling (Page 2284)
SetScaling example (Page 2267)
SetScaling example
Bar scaling

color
Color - short description
The various color properties of objects can be modified or queried using the functions in the
Color group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBackColor
Function
Sets the background color of the object.

Syntax
BOOL SetBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColor);

Parameters
lpszPictureName
Picture name

1936

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
lBackColor
Background color of the object as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetBackColor2
Function
Sets the bar color for bar objects.

Syntax
BOOL SetBackColor2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColor2);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1937

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
lBackColor2
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetBackColor3
Function
Sets the bar background color for bar objects.

Syntax
BOOL SetBackColor3(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColor3);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackColor3
Numeric value defining the bar background color

1938

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetBackColorBottom
Function
Sets the background color of the slider objects at the bottom right.

Syntax
BOOL SetBackColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackColorBottom);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackColorBottom
Numeric value defining the background color of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1939

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetBackColorTop
Function
Sets the background color of the slider objects at the top left.

Syntax
BOOL SetBackColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColorTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackColorTop
Numeric value defining the background color of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

1940

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetBorderBackColor
Function
Sets the background color of the lines or borders.

Syntax
BOOL SetBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderBackColor
Background color of the lines or borders

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetBorderColor
Function
Sets the color of the lines or borders.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1941

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderColor
Numeric value defining the color of lines or borders

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetBorderColorBottom
Function
Sets the 3D border color at the bottom.

Syntax
BOOL SetBorderColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBorderColorBottom);

1942

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderColorBottom
Numeric value defining the 3-D border color at the bottom

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetBorderColorTop
Function
Sets the 3D border color at the top.

Syntax
BOOL SetBorderColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderColorTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1943

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lBorderColorTop
Numeric value defining the 3-D border color at the top

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetButtonColor
Function
Sets the button color of slider objects.

Syntax
BOOL SetButtonColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lButtonColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lButtonColor
Numeric value defining the button color of slider objects

1944

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorBottom
Function
When using slider objects, it sets the color of the bottom limit.

Syntax
BOOL SetColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorBottom);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorBottom
Numeric value defining the color of the bottom limit of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1945

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetColorTop
Function
When using slider objects, it sets the color of the top limit.

Syntax
BOOL SetColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorTop
Numeric value defining the color of the top limit of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

1946

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFillColor
Function
Sets the color of the fill pattern.

Syntax
BOOL SetFillColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFillColor
Numeric value of the fill color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1947

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetForeColor
Function
Sets the font color.

Syntax
BOOL SetForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lForeColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lForeColor
Numeric value defining the font color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetItemBorderBackColor
Function
Sets the background color of the separating line for the "text list" object.

1948

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetItemBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lItemBorderBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderBackColor
Background color of the dividing line as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetItemBorderColor
Function
Sets the color of the dividing line for the "text list" object.

Syntax
BOOL SetItemBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lItemBorderColor);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1949

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderColor
Numeric value defining the dividing line color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetScaleColor
Function
Sets the scale color for bar objects.

Syntax
BOOL SetScaleColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lScaleColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

1950

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lScaleColor
Numeric value of the scale color for bar objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetSelBGColor
Function
Sets the background color of the selected entry for the "text list" object.

Syntax
BOOL SetSelBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lSelBGColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lSelBGColor
Numeric value defining the background color in the selected entry

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1951

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetSelTextColor
Function
Sets the font color of a selected entry for the "text list" object.

Syntax
BOOL SetSelTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lSelTextColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lSelTextColor
Numeric value defining the font color in the selected entry

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

1952

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetTrendColor
Function
Sets the trend color for bar objects.

Syntax
BOOL SetTrendColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lTrendColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lTrendColor
Numeric value defining the trend color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1953

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetUnselBGColor
Function
Sets the background color of non-selected entries for the "text list" object.

Syntax
BOOL SetUnselBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lUnselBGColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lUnselBGColor
Numeric value defining the background color for non-selected entries

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetUnselTextColor
Function
Sets the font color of non-selected entries for the "text list" object.

1954

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetUnselTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lUnselTextColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lUnselTextColor
Numeric value defining the font color for non-selected entries

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

fill
Fill - short description
The functions in the Fill group control the dynamic filling of objects.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1955

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFilling
Function
Activates or deactivates dynamic filling with background color.

Syntax
BOOL SetFilling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bFilling);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFilling
Dynamic filling with background color on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFilling example (Page 2258)
SetFilling example

SetFillingIndex
Function
Sets the fill level.

Syntax
BOOL SetFillingIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillingIndex);

1956

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFillingIndex
Fill level as a numeric value (0 - 100)

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFillingIndex example (Page 2259)
SetFillingIndex example

flash
Flash - short description
The various flashing properties can be modified or called in using the functions in the Flash
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBackFlashColorOff
Function
Sets the background flash color for the deactivated status.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1957

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetBackFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackFlashColorOff);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackFlashColorOff
Background flash color for the deactivated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetFlashBackColorOn example (Page 2260)
Color chart
SetFlashBackColorOn example

SetBackFlashColorOn
Function
Sets the background flash color for the activated status.

Syntax
BOOL SetBackFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackFlashColorOn);

1958

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackFlashColorOn
Background flash color for the activated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetFlashBackColorOn example (Page 2260)
Color chart
SetFlashBackColorOn example

SetBorderFlashColorOff
Function
Sets the border or line flashing color for the deactivated status.

Syntax
BOOL SetBorderFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lBorderFlashColorOff);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1959

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lBorderFlashColorOff
Border or line flashing color for the deactivated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFlashBackColorOn example (Page 2260)
Color chart (Page 2286)
Color chart
SetFlashBackColorOn example

SetBorderFlashColorOn
Function
Sets the border or line flashing color for the activated status.

Syntax
BOOL SetBorderFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lBorderFlashColorOn);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderFlashColorOn
Border or line flashing color for the activated status as a numeric value

1960

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetFlashBackColorOn example (Page 2260)
Color chart
SetFlashBackColorOn example

SetFlashBackColor
Function
Activates or deactivates background flashing.

Syntax
BOOL SetFlashBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashBackColor
Flashing background on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1961

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetFlashBackColor example (Page 2259)
SetFlashBackColor example

SetFlashBorderColor
Function
Activates or deactivates flashing of the border or line.

Syntax
BOOL SetFlashBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashBorderColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashBorderColor
Flashing of the border or line on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFlashBackColor example (Page 2259)
Color chart

1962

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFlashForeColor
Function
Activates or deactivates font flashing.

Syntax
BOOL SetFlashForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashForeColor);

Parameters
lpszPictureName
Picture name

lpszObjectName
Object name
bFlashForeColor
Flashing of the font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFlashBackColor example (Page 2259)
SetFlashBackColor example

SetFlashRateBackColor
Function
Sets the flash frequency of the background.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1963

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetFlashRateBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lFlashRateBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashRateBackColor
Flash frequency of the background

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Flash frequencies (Page 2284)
SetFlashBackColor example (Page 2259)
SetFlashBackColor example
Flash frequencies

SetFlashRateBorderColor
Function
Sets the flash frequency of the line or border.

Syntax
BOOL SetFlashRateBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lFlashRateBorderColor);

1964

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashRateBorderColor
Flash frequency of the line or border

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Flash frequencies (Page 2284)
SetFlashBackColor example (Page 2259)
SetFlashBackColor example
Flash frequencies

SetFlashRateForeColor
Function
Sets the flash frequency of the font.

Syntax
BOOL SetFlashRateForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lFlashRateForeColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1965

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lFlashRateForeColor
Flash frequency of the font

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Flash frequencies (Page 2284)
SetFlashBackColor example (Page 2259)
Flash frequencies
SetFlashBackColor example

SetForeFlashColorOff
Function
Sets the font flash color for the deactivated status.

Syntax
BOOL SetForeFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lForeFlashColorOff);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lForeFlashColorOff
Font flash color for the deactivated status as a numeric value

1966

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetFlashBackColorOn example (Page 2260)
SetFlashBackColorOn example
Color chart

SetForeFlashColorOn
Function
Sets the font flash color for the activated status.

Syntax
BOOL SetForeFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lForeFlashColorOn);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lForeFlashColorOn
Font flash color for the activated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1967

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetFlashBackColorOn example (Page 2260)
SetFlashBackColorOn example
Color chart

focus
Focus - short description
Using the functions in the Focus group, it is possible to set the focus or poll which object has
the focus.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

Set_Focus
Function
Sets the focus on the specified object.

Syntax
BOOL Set_Focus(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The function has been completed without any errors.

1968

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

See also
SetFocus example (Page 2260)
SetFocus example

font
Font - short description
The various properties affecting text can be modified or called in using the functions in the
Font group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAlignmentLeft
Function
Sets the horizontal text alignment (left, centered, right).

Syntax
BOOL SetAlignmentLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lAlignmentLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lAlignmentLeft
Horizontal text alignment as a numeric value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1969

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Text alignment (Page 2291)
SetFontSize example (Page 2261)
Text alignment
SetFontSize example

SetAlignmentTop
Function
Sets the vertical text alignment (top, centered, bottom).

Syntax
BOOL SetAlignmentTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lAlignmentTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lAlignmentTop
Vertical text alignment as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

1970

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Text alignment (Page 2291)
SetFontSize example (Page 2261)
Text alignment
SetFontSize example

SetFontBold
Function
Switches the bold font on or off.

Syntax
BOOL SetFontBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFontBold);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFontBold
Bold font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontBold example (Page 2261)
SetFontBold example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1971

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFontItalic
Function
Switches the italic font on or off.

Syntax
BOOL SetFontItalic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFontItalic);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFontItalic
Italic font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontBold example (Page 2261)
SetFontBold example

SetFontName
Function
Sets a font.

Syntax
BOOL SetFontName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szFontName);

1972

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szFontName
Pointer to name of font

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetText example (Page 2274)
SetText example

SetFontSize
Function
Sets the font size.

Syntax
BOOL SetFontSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFontSize);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFontSize
Font Size
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1973

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontSize example (Page 2261)
SetFontSize example

SetFontUnderline
Function
Switches the underlined font on or off.

Syntax
BOOL SetFontUnderline(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFontUnderline);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFontUnderline
Underlined font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

1974

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetFontBold example (Page 2261)
SetFontBold example

SetOrientation
Function
Defines the text orientation (vertical/horizontal).

Syntax
BOOL SetOrientation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bOrientation);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOrientation
Text orientation
TRUE vertical
FALSE Horizontal

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontBold example (Page 2261)
SetFontBold example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1975

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetText
Function
Sets the value of the "text" property for objects like static text, check box or radio box.

Syntax
BOOL SetText(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char* szText);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szText
Pointer to a text

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
In case of check and radio boxes the element to be changed must be defined with the
SetIndex function before actually activating this function.

See also
SetText example (Page 2274)
SetText example

1976

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

geometry
Geometry - short description
The size, position and other geometrical properties of objects can be modified or called in using
the functions in the Geometry group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetActualPointLeft
Function
Sets the X value for the current point of a polygon or polygon line.

Syntax
BOOL SetActualPointLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lActualPointLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lActualPointLeft
X value for the current point of a polygon or polygon line

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1977

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The current point of the polygon can be set using the SetIndex function.

See also
SetLeft example (Page 2262)
SetLeft example

SetActualPointTop
Function
Sets the Y value for the current point of a polygon or polygon line.

Syntax
BOOL SetActualPointTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lActualPointTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lActualPointTop
Y value for the current point of a polygon or polygon line

Return value
TRUE
The function has been completed without any errors.

1978

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
The current point of the polygon can be set using the SetIndex function.

See also
SetTop example (Page 2275)
SetTop example

SetBoxCount
Function
Sets the number of fields in a check box or radio box.

Syntax
BOOL SetBoxCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBoxCount);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBoxCount
Number of fields in a check box or radio box.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1979

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetDirection
Function
Sets the bar direction for bar objects.

Syntax
BOOL SetDirection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lDirection);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lDirection
Numeric value defining the bar direction

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Bar direction (Page 2283)
SetTop example (Page 2275)
SetTop example
Bar direction

SetEndAngle
Function
Sets the end angle of circle and ellipse segments and circle and elliptical arcs.

1980

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetEndAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lEndAngle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lEndAngle
End angle of circle and ellipse segments as well as circle and ellipse arcs

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetTop example (Page 2275)
SetTop example

SetHeight
Function
Sets the height of the rectangle framing an object.

Syntax
BOOL SetHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lHeight);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1981

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
lHeight
Height of the framing rectangle

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
SetHeight example (Page 2261)
SetHeight example

SetLeft
Function
Sets the X value of the upper left corner of the rectangle framing an object

Syntax
BOOL SetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lLeft
X value of the upper left corner of the framing rectangle

1982

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetLeft example (Page 2262)
SetLeft example

SetPointCount
Function
Sets the number of corners of a polygon or in a polygon line.

Syntax
BOOL SetPointCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPointCount);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPointCount
Number of corner points

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1983

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetLeft example (Page 2262)
SetLeft example

SetRadius
Function
Sets the radius of a circle, circle segment or arc.

Syntax
BOOL SetRadius(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lRadius);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRadius
Radius

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2261)
SetHeight example

SetRadiusHeight
Function
Sets the radius of an ellipse, ellipse segment or elliptical arc in vertical direction.

1984

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetRadiusHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRadiusHeight);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRadiusHeight
Radius in vertical direction

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2261)
SetHeight example

SetRadiusWidth
Function
Sets the radius of an ellipse, ellipse segment or elliptical arc in horizontal direction.

Syntax
BOOL SetRadiusWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRadiusWidth);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1985

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
lRadiusWidth
Radius in horizontal direction

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetWidth example (Page 2275)
SetWidth example

SetReferenceRotationLeft
Function
Sets the X value of the rotation reference (central axis about which the object can be rotated)
for lines, polygons and polylines.

Syntax
BOOL SetReferenceRotationLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lReferenceRotationLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lReferenceRotationLeft
X value of the rotation reference

1986

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetLeft example (Page 2262)
SetLeft example

SetReferenceRotationTop
Function
Sets the Y value of the rotation reference (central axis about which the object can be rotated)
for lines, polygons and polylines.

Syntax
BOOL SetReferenceRotationTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lReferenceRotationTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lReferenceRotationTop
Y value of the rotation reference

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1987

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetTop example (Page 2275)
SetTop example

SetRotationAngle
Function
Sets the angle of rotation about the central axis for lines, polygons and polylines.

Syntax
BOOL SetRotationAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRotationAngle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRotationAngle
Angle of rotation

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetLeft example (Page 2262)
SetLeft example

1988

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetRoundCornerHeight
Function
Specifies the radius of the rounded corner of a rectangle vertically.

Syntax
BOOL SetRoundCornerHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lRoundCornerHeight);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRoundCornerHeight
Vertical radius

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2261)
SetHeight example

SetRoundCornerWidth
Function
Specifies the radius of the rounded corner of a rectangle horizontally.

Syntax
BOOL SetRoundCornerWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lRoundCornerWidth);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1989

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRoundCornerWidth
Horizontal radius

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetWidth example (Page 2275)
SetWidth example

SetStartAngle
Function
Sets the start angle of circle and ellipse segments and circle and elliptical arcs.

Syntax
BOOL SetStartAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lStartAngle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lStartAngle
Starting angle

1990

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2261)
SetHeight example

SetTop
Function
Sets the Y value of the upper left corner of the rectangle framing an object.

Syntax
BOOL SetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lTop
Y value of the upper left corner of the framing rectangle

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1991

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetTop example (Page 2275)
SetTop example

SetWidth
Function
Sets the width of the rectangle framing an object.

Syntax
BOOL SetWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lWidth
Width of the framing rectangle

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
SetWidth example (Page 2275)
SetWidth example

1992

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetZeroPoint
Function
Sets the zero point for bar objects.

Syntax
BOOL SetZeroPoint(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lZeroPoint);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lZeroPoint
Zero point

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetTop example (Page 2275)
SetTop example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1993

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

i_o
i_o - short description
The various properties affecting input and output values can be modified or called in using the
functions in the i_o group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAssumeOnExit
Function
Specifies for I/O fields whether the entered value is assumed upon exiting the field.

Syntax
BOOL SetAssumeOnExit(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAssumeOnExit);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAssumeOnExit
Value application upon exiting the field yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

1994

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetHiddenInput example (Page 2262)
SetHiddenInput example

SetAssumeOnFull
Function
Specifies for I/O fields whether the entered value is assumed on completion of input.

Syntax
BOOL SetAssumeOnFull(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAssumeOnFull);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAssumeOnFull
Value application on completion of input yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHiddenInput example (Page 2262)
SetHiddenInput example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1995

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetBitNumber
Function
Sets the relevant bit in the output value for the "bit" list type.

Syntax
BOOL SetBitNumber(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBitNumber);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBitNumber
Relevant bit in the output value for the "bit" list type

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
List types (Page 2290)
List types

SetClearOnError
Function
Specifies for I/O fields whether deletion of the content in case of input errors is activated.

Syntax
BOOL SetClearOnError(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bClearOnError);

1996

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bClearOnError
Deletion of the entry in case of input errors yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHiddenInput example (Page 2262)
SetHiddenInput example

SetClearOnNew
Function
Specifies the deletion of the content in case of new inputs for I/O fields.

Syntax
BOOL SetClearOnNew(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bClearOnNew);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bClearOnNew
Deletion of content in case of new input yes/no
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

1997

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHiddenInput example (Page 2262)
SetHiddenInput example

SetHiddenInput
Function
Controls the hidden input for I/O fields.

Syntax
BOOL SetHiddenInput(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bHiddenInput);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bHiddenInput
Hidden input yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

1998

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetHiddenInput example (Page 2262)
SetHiddenInput example

SetNumberLines
Function
Sets the number of visible lines lines for the "text list" object.

Syntax
BOOL SetNumberLines(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lNumberLines);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lNumberLines
Number of visible lines

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the amount of configured text is larger than the number of visible lines, the "text list" object
receives a vertical scroll bar.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

1999

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetOutputValueChar
Function
Sets a pointer to the output value for I/O fields

Syntax
BOOL SetOutputValueChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szOutputValueChar);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szOutputValueChar
Pointer to the output value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetOutputValueDouble
Function
Sets the output value for I/O fields.

Syntax
BOOL SetOutputValueDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
double dOutputValueDouble);

2000

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dOutputValueDouble
Output value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetOutputValueDouble example (Page 2264)
SetOutputValueDouble example

Limits
Limits - short description
The various properties affecting limit values can be modified or called in using the functions
in the Limits group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAlarmHigh
Function
Sets the upper alarm limit for bar objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2001

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dAlarmHigh
Upper alarm limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetAlarmLow
Function
Sets the lower alarm limit for bar objects.

Syntax
BOOL SetAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dAlarmLow);

Parameters
lpszPictureName
Picture name

2002

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
dAlarmLow
Lower alarm limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetCheckAlarmHigh
Function
Controls the monitoring of the upper alarm limit for bar objects.

Syntax
BOOL SetCheckAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckAlarmHigh
Monitoring yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2003

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckAlarmLow
Function
Controls the monitoring of the lower alarm limit for bar objects.

Syntax
BOOL SetCheckAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckAlarmLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckAlarmLow
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2004

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckLimitHigh4
Function
Controls the monitoring of the upper limit value reserve 4 for bar objects.

Syntax
BOOL SetCheckLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitHigh4
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2005

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetCheckLimitHigh5
Function
Controls the monitoring of the upper limit value reserve 5 for bar objects.

Syntax
BOOL SetCheckLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitHigh5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitHigh5
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckLimitLow4
Function
Controls the monitoring of the lower limit value reserve 4 for bar objects.

Syntax
BOOL SetCheckLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitLow4);

2006

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitLow4
Monitoring yes/no.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckLimitLow5
Function
Controls the monitoring of the lower limit value reserve 5 for bar objects.

Syntax
BOOL SetCheckLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitLow5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitLow5
Monitoring yes/no
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2007

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckToleranceHigh
Function
Controls the monitoring of the upper tolerance limit for bar objects.

Syntax
BOOL SetCheckToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckToleranceHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckToleranceHigh
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2008

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckToleranceLow
Function
Controls the monitoring of the lower tolerance limit for bar objects.

Syntax
BOOL SetCheckToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckToleranceLow
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2009

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetCheckWarningHigh
Function
Controls the monitoring of the upper warning limit for bar objects.

Syntax
BOOL SetCheckWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckWarningHigh
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetCheckWarningLow
Function
Controls the monitoring of the lower warning limit for bar objects.

Syntax
BOOL SetCheckWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckWarningLow);

2010

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckWarningLow
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetColorAlarmHigh
Function
Sets the bar color for bar objects upon reaching the upper alarm limit.

Syntax
BOOL SetColorAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorAlarmHigh
Numeric value defining the bar color
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2011

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetColorAlarmLow
Function
Sets the bar color for bar objects upon reaching the lower alarm limit.

Syntax
BOOL SetColorAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorAlarmLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorAlarmLow
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2012

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorLimitHigh4
Function
Sets the bar color for bar objects upon reaching the upper limit reserve 4.

Syntax
BOOL SetColorLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitHigh4
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2013

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetColorLimitHigh5
Function
Sets the bar color for bar objects upon reaching the upper limit reserve 5.

Syntax
BOOL SetColorLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitHigh5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitHigh5
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorLimitLow4
Function
Sets the bar color for bar objects upon reaching the lower limit reserve 4.

2014

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetColorLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitLow4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitLow4
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorLimitLow5
Function
Sets the bar color for bar objects upon reaching the lower limit reserve 5.

Syntax
BOOL SetColorLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitLow5);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2015

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitLow5
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetColorToleranceHigh
Function
Sets the bar color for bar objects upon reaching the upper tolerance limit.

Syntax
BOOL SetColorToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorToleranceHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2016

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lColorToleranceHigh
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorToleranceLow
Function
Sets the bar color for bar objects upon reaching the lower tolerance limit.

Syntax
BOOL SetColorToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorToleranceLow
Numeric value defining the bar color

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2017

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorWarningHigh
Function
Sets the bar color for bar objects upon reaching the upper warning limit.

Syntax
BOOL SetColorWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorWarningHigh
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2018

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetColorWarningLow
Function
Sets the bar color for bar objects upon reaching the lower warning limit.

Syntax
BOOL SetColorWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorWarningLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorWarningLow
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2019

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetLimitHigh4
Function
Sets the high limit value for reserve 4 for bar objects.

Syntax
BOOL SetLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitHigh4
High limit value for reserve 4

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetLimitHigh5
Function
Sets the high limit value for reserve 5 for bar objects.

Syntax
BOOL SetLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitHigh5);

2020

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitHigh5
High limit value for reserve 5

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetLimitLow4
Function
Sets the low limit value for reserve 4 for bar objects.

Syntax
BOOL SetLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitLow4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitLow4
Low limit value for reserve 4
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2021

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetLimitLow5
Function
Sets the low limit value for reserve 5 for bar objects.

Syntax
BOOL SetLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitLow5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitLow5
Low limit value for reserve 5

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2022

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetLimitMax
Function
Sets the high limit value for I/O fields.

Syntax
BOOL SetLimitMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitMax);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitMax
High limit value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2023

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetLimitMin
Function
Sets the low limit value for I/O fields.

Syntax
BOOL SetLimitMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitMin);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitMin
Lower limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetMarker
Function
Controls the limit marker display for bar objects.

Syntax
BOOL SetMarker(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bMarker);

2024

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bMarker
Limit marker on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetToleranceHigh
Function
Sets the upper tolerance limit for bar objects.

Syntax
BOOL SetToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dToleranceHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dToleranceHigh
Upper tolerance limit
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2025

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetToleranceLow
Function
Sets the lower tolerance limit for bar objects.

Syntax
BOOL SetToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dToleranceLow
Lower tolerance limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2026

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetAlarmHigh example (Page 2256)
SetAlarmHigh example

SetTypeAlarmHigh
Function
Specifies for bar objects whether the upper alarm limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeAlarmHigh
Upper alarm limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2027

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTypeAlarmLow
Function
Specifies for bar objects whether the lower alarm limit is given in percentages or absolute terms.

Syntax
BOOL SetTypeAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeAlarmLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeAlarmLow
Lower alarm limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeLimitHigh4
Function
Specifies for bar objects whether the upper limit for reserve 4 is given in percentages or
absolute terms.

2028

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetTypeLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

bTypeLimitHigh4
High limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeLimitHigh5
Function
Specifies for bar objects whether the upper limit for reserve 5 is given in percentages or
absolute terms.

Syntax
BOOL SetTypeLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitHigh5);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2029

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeLimitHigh5
High limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeLimitLow4
Function
Specifies for bar objects whether the lower limit for reserve 4 is given in percentages or absolute
terms.

Syntax
BOOL SetTypeLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitLow4);

Parameters
lpszPictureName
Picture name

2030

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
bTypeLimitLow4
Low limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeLimitLow5
Function
Specifies for bar objects whether the lower limit for reserve 5 is given in percentages or absolute
terms.

Syntax
BOOL SetTypeLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitLow5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeLimitLow5
Low limit

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2031

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeToleranceHigh
Function
Specifies for bar objects whether the high tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bTypeToleranceHigh);

Parameter
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeToleranceHigh
High tolerance limit
TRUE Specification in percent
FALSE Absolute specification

2032

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeToleranceLow
Function
Specifies for bar objects whether the lower tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bTypeToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeToleranceLow
Lower tolerance limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2033

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeWarningHigh
Function
Specifies for bar objects whether the upper warning limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeWarningHigh
Upper warning limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2034

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetMarker example (Page 2263)
SetMarker example

SetTypeWarningLow
Function
Specifies for bar objects whether the lower warning limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeWarningLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeWarningLow
Lower warning limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2035

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetWarningHigh
Function
Sets the upper warning limit for bar objects.

Syntax
BOOL SetWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dWarningHigh
Upper warning limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

SetWarningLow
Function
Sets the lower warning limit for bar objects.

Syntax
BOOL SetWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dWarningLow);

2036

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dWarningLow
Lower warning limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2263)
SetMarker example

link
Link - short description
A tag link property can be created or called in using the functions in the Link group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetLink
Function
Creating a tag connection of object properties

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2037

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetLink(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, LPLINKINFO *pLink);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
pLink
Pointer to a structure of the type: LINKINFO

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition LINKINFO (Page 2299)
SetLink example (Page 2263)
LINKINFO structure definition
SetLink example

2038

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

miscs
Miscs - short description
The properties of objects can be modified or called in using the functions in the Miscs group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAverage
Function
Controls the averaging of bar objects.

Syntax
BOOL SetAverage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAverage);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAverage
Averaging yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2039

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetVisible example (Page 2275)
SetVisible example

SetBoxType
Function
Specifies the field type (input field, output field, input/output field) for an I/O object.

Syntax
BOOL SetBoxType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBoxType);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBoxType
Field type

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
I/O field, field type (Page 2286)
I/O field, field type

2040

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetColorChangeType
Function
When using bar objects, it defines whether the color change upon reaching a limit value only
affects a bar segment or the entire bar.

Syntax
BOOL SetColorChangeType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bColorChangeType);

Parameter
lpszPictureName
Picture name
lpszObjectName
Object name
bColorChangeType
Type of color change
TRUE Color change applies to a segment
FALSE Color change applies to the entire bar

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2275)
SetVisible example

SetCursorControl
Function
Sets the cursor control for I/O fields.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2041

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetCursorControl(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCursorControl);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCursorControl
Cursor control on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2275)
SetVisible example

SetCursorMode
Function
Sets the cursor control for pictures.

Syntax
BOOL SetCursorMode(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCursorMode);

2042

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCursorMode
Cursor Mode
TRUE Tab order cursor
FALSE Alpha-Cursor

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Example - SetCursorMode (Page 2258)
SetCursorMode example

SetEditAtOnce
Function
Specifies whether the "Immediate input" property is activated for I/O fields.

Syntax
BOOL SetEditAtOnce(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bEditAtOnce);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2043

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
bEditAtOnce
Immediate input yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2275)
SetVisible example

SetExtendedOperation
Function
Controls the "Extended operation" property of slider objects.

Syntax
BOOL SetExtendedOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bExtendedOperation);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bExtendedOperation
Extended operation yes/no

2044

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2275)
SetVisible example

SetHysteresis
Function
When using bar objects, it specifies whether the display appears with or without hysteresis.

Syntax
BOOL SetHysteresis(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bHysteresis);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bHysteresis
Display with/without hysteresis

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2045

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetVisible example (Page 2275)
SetVisible example

SetHysteresisRange
Function
Sets the hysteresis value in the display for bar objects.

Syntax
BOOL SetHysteresisRange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dHysteresisRange);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dHysteresisRange
Hysteresis value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetMax
Function
Sets the maximum value for bar and slider objects.

Syntax
BOOL SetMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double dMax);

2046

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dMax
Maximum value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetMin
Function
Sets the minimum value for bar and slider objects.

Syntax
BOOL SetMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double dMin);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dMin
Minimum value

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2047

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

SetOffsetLeft
Function
Sets the horizontal picture distance from the left window border for picture windows.

Syntax
BOOL SetOffsetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lOffsetLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lOffsetLeft
Picture distance

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetOffsetTop
Function
Sets the vertical picture distance from the upper window border for picture windows.

Syntax
BOOL SetOffsetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lOffsetTop);

2048

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lOffsetTop
Picture distance

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetOperation
Function
Controls the operability of the objects.

Syntax
BOOL SetOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bOperation);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOperation
Object operable, yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2049

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

See also
SetVisible example (Page 2275)
SetVisible example

SetOperationMessage
Function
Controls the output of a message when operating the objects "I/O field", "Check box", "Radio
box" and "Slider".

Syntax
BOOL SetOperationMessage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bOperationMessage);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOperationMessage
Message output for yes/no operation

Return value
TRUE
The function has been completed without any errors.

2050

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

See also
SetVisible example (Page 2275)
SetVisible example

SetOperationReport
Function
Controls the logging of the operating reason for all objects except application and picture
windows and OLE control.

Syntax
BOOL SetOperationReport(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bOperationReport);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOperationReport
Logging operating reason yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2051

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetVisible example (Page 2275)
SetVisible example

SetPasswordLevel
Function
Defines the authorization level for operating objects for all objects except application and
picture windows and OLE control.

Syntax
BOOL SetPasswordLevel(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPasswordLevel);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPasswordLevel
Authorization level

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

2052

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetPictureName
Function
Sets the name of the picture, which should be shown in a picture window or in a graphic object.

Syntax
BOOL SetPictureName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Name of the picture window or graphic object
szPictureName
Pointer to the picture name

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetPictureName example (Page 2264)
SetPictureName example

SetProcess
Function
Specifies the default setting of the value to be displayed for bar and slider objects.
Sets the selected fields for check boxes and radio boxes.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2053

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetProcess(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dProcess);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dProcess
In case of bar and slider objects, this value is used in Runtime when the associated tag
cannot be connected or updated when a picture is started.
For check boxes and radio boxes the selected fields are specified. In the 32-bit word each
field is represented by a bit (field 1 corrsponds to the bit value 0). Selected fields are marked
by a set bit. Non-existing are assigned 0.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetSmallChange
Function
Sets the number of steps for slider objects by which the slider is shifted by a mouse click.

Syntax
BOOL SetSmallChange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lSmallChange);

Parameters
lpszPictureName
Picture name

2054

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
lSmallChange
Number of setting steps

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetTagPrefix
Function
This function sets the tag prefix of a picture window:
In a picture window the "temperature" tag is requested on an object. If a "Motor1." tag prefix
is assigned to the picture window, the tag "Motor1.Temperature" is requested.
The setting of the tag prefix only becomes effective when newly supplying the picture name.
This means you must either set the prefix before picture selection or newly supply the picture
name if the picture is not changed.

Syntax
BOOL SetTagPrefix(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,char*
szTagPrefix);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szTagPrefix
Tag prefix to be set

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2055

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the tag prefix is set for a picture window, the tag prefix is added to all tags contained in the
picture to be displayed. This also applies if the request takes place in a function. If a tag needs
to be read without the tag prefix, you must add "@NOTP::" to the tag name.
Using a tag prefix greatly simplifies the picture module technology.

See also
SetTagPrefix example (Page 2271)
SetTagPrefix example

SetTrend
Function
Controls the trend display for bar objects.

Syntax
BOOL SetTrend(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bTrend);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTrend
Trend display yes/no

2056

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2275)
SetVisible example

SetVisible
Function
Controls the display of an object.

Syntax
BOOL SetVisible(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bVisible);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bVisible
Object display yes/no

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2057

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
SetVisible example (Page 2275)
SetVisible example

SetZeroPointValue
Function
Sets the absolute value of the zero point for bar objects.

Syntax
BOOL SetZeroPointValue(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dZeroPointValue);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dZeroPointValue
Absolute value of the zero point

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2058

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetZoom
Function
Sets the scaling factor for a picture window.

Syntax
BOOL SetZoom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lZoom);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lZoom
Scaling factor

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

ole_control
OLE_control - short description
The functions in the ole_Control group can only be used with OCX slider objects.
Various OCX slider object properties and settings can be modified or called in using these
functions.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2059

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetPosition
Function
Sets the slider position of the OCX slider object.

Syntax
BOOL SetPosition(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPosition);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPosition
Slider position of the OCX slider object

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetPosition example (Page 2265)
SetPosition example

SetRangeMax
Function
Defines the adjustment range "Max" of the OCX slider object.

Syntax
BOOL SetRangeMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRangeMax);

2060

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRangeMax
Adjustment range "Max" of the OCX slider object

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetRangeMax example (Page 2266)
SetRangeMax example

SetRangeMin
Function
Defines the adjustment range "Min" of the OCX slider object.

Syntax
BOOL SetRangeMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRangeMin);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRangeMin
Adjustment range "Min" of the OCX slider object
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2061

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetRangeMin example (Page 2266)
SetRangeMin example

pictures
Pictures - short description
Various properties of pictures of graphic objects and round buttons can be modified or called
in using the functions in the Pictures group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetPicDeactTransparent
Function
Sets the transparent color for the "deactivated" status of a round button.

Syntax
BOOL SetPicDeactTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lPicDeactTransparent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2062

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lPicDeactTransparent
Transparent color for "deactivated" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetPicDeactUseTransColor
Function
Controls the transparent color for the "deactivated" status of a round button.

Syntax
BOOL SetPicDeactUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicDeactUseTransColor);

Parameter
lpszPictureName
Picture name
lpszObjectName
Object name
bPicDeactUseTransColor
Transparent color yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2063

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetPicDownTransparent
Function
Sets the transparent color for the "On/pressed" status of a round button.

Syntax
BOOL SetPicDownTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lPicDownTransparent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPicDownTransparent
Transparent color for "On/pressed" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

2064

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetPicDownUseTransColor
Function
Controls the transparent color for the "On/pressed" status of a round button.

Syntax
BOOL SetPicDownUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicDownUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPicDownUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetPicTransColor
Function
Sets the transparent color of the background picture of a graphic object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2065

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPicTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPicTransColor
Transparent color of the background picture

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetPictureDeactivated
Function
Specifies the picture name for the "deactivated" status of a round button.

2066

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetPictureDeactivated(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureDeactivated);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szPictureDeactivated
Picture name for "deactivated" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
SetPictureDown example (Page 2264)
SetPictureDown example

SetPictureDown
Function
Specifies the picture name for the "On/pressed" status of a round button.

Syntax
BOOL SetPictureDown(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureDown);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2067

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szPictureDown
Picture name for "On/pressed" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
SetPictureDown example (Page 2264)
SetPictureDown example

SetPictureUp
Function
Specifies the picture name for the "Off/not pressed" status of a round button.

Syntax
BOOL SetPictureUp(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureUp);

Parameters
lpszPictureName
Picture name

2068

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpszObjectName
Object name
szPictureUp
Picture name for "Off/not pressed" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
SetPictureUp example (Page 2265)
SetPictureUp example

SetPicUpTransparent
Function
Sets the transparent color for the "Off/not pressed" status of a round button.

Syntax
BOOL SetPicUpTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lPicUpTransparent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPicUpTransparent
Transparent color for "Off/not pressed" status

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2069

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetPicUpUseTransColor
Function
Controls the transparent color for the "Off/not pressed" status of a round button.

Syntax
BOOL SetPicUpUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicUpUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPicUpUseTransColor
Transparent color yes/no

2070

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetPicUseTransColor
Function
Controls the transparent color of the background picture of a graphic object.

Syntax
BOOL SetPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPicUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2071

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

property
Property - short description
The properties of objects for which there are no direct functions can be modified or called in
using the functions in the Property group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetPropBOOL
Function
Sets a property with the value "bValue".

Syntax
BOOL SetPropBOOL(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, BOOL bValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
bValue
Value in BOOL data format

Return value
TRUE
The function has been completed without any errors.

2072

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

See also
SetPropBOOL example (Page 2265)

SetPropChar
Function
Sets a property with the value the pointer "szValue" points to.

Syntax
BOOL SetPropChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, char* szValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
szValue
Pointer to the value

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2073

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

See also
GetPropChar example (Page 2233)

SetPropDouble
Function
Sets a property with the value "dValue".

Syntax
BOOL SetPropDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, double dValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
dValue
Value in "double" data format

Return value
TRUE
The function has been completed without any errors.

2074

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

SetPropWord
Function
Sets a property with the value "IValue".

Syntax
BOOL SetPropWord(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, long lValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
lValue
Value in "long" data format

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2075

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

state
State - short description
The properties of status displays can be modified or called in using the functions in the State
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBasePicTransColor
Function
Sets the transparent color of the basic picture for the status display.

Syntax
BOOL SetBasePicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBasePicTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBasePicTransColor
Transparent color of the basic picture

Return value
TRUE
The function has been completed without any errors.

2076

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
Color chart
SetBackColor example

SetBasePicUseTransColor
Function
Controls the transparent color of the basic picture for the status display.

Syntax
BOOL SetBasePicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bBasePicUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bBasePicUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2077

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFlashFlashPicture
Function
Specifies whether the flash picture of the status display is animated dynamically or statically.

Syntax
BOOL SetFlashFlashPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashFlashPicture);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashFlashPicture
Type of flash picture
TRUE dynamically animated flash picture
FALSE statically animated flash picture

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetFlashPicTransColor
Function
Sets the transparent color of the flash picture for a status display.

Syntax
BOOL SetFlashPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lFlashPicTransColor);

2078

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashPicTransColor
Transparent color of the flash picture

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2286)
SetBackColor example (Page 2256)
SetBackColor example
Color chart

SetFlashPicUseTransColor
Function
Controls the transparent color of the flash picture for a status display.

Syntax
BOOL SetFlashPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bFlashPicUseTransColor);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2079

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashPicUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetFlashRateFlashPic
Function
Sets the flash frequency of the flash picture for a status display.

Syntax
BOOL SetFlashRateFlashPic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lFlashRateFlashPic);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashRateFlashPic
Flash frequency of the flash picture

2080

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Since the flashing is performed by means of software engineering, the precise frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time etc.).

See also
Flash frequencies (Page 2284)
SetFlashRateFlashPic example (Page 2260)
Flash frequencies

SetIndex
Function
Sets the index of a polygon or polyline thus defining the current object point.

Syntax
BOOL SetIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lIndex);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lIndex
Index value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2081

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

style
Style - short description
Various properties affecting the appearance of objects can be modified or called in using the
functions in the Style group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBackBorderWidth
Function
Sets the frame width of 3D frames and slider objects.

Syntax
BOOL SetBackBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackBorderWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackBorderWidth
Frame width in pixels

2082

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetBorderStyle example (Page 2257)
SetBorderStyle example

SetBorderEndStyle
Function
Sets the type of line end.

Syntax
BOOL SetBorderEndStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderEndStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderEndStyle
Type of line end as numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2083

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Line end style (Page 2289)
SetBorderEndStyle example (Page 2257)
SetBorderEndStyle example
Line style

SetBorderStyle
Function
Sets the line or border style.

Syntax
BOOL SetBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderStyle
Numeric value defining the line or border style

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Line styles (Page 2289)
SetBorderStyle example (Page 2257)
SetBorderStyle example
Line styles

2084

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetBorderWidth
Function
Sets the line or border line width.

Syntax
BOOL SetBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderWidth
Line width or border line width

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetBorderStyle example (Page 2257)
SetBorderStyle example

SetBoxAlignment
Function
Defines the arrangement of controls (left or right justified) in check boxes or radio boxes.

Syntax
BOOL SetBoxAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBoxAlignment);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2085

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBoxAlignment
Arrangement of controls

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Element alignment in check boxes and radio boxes (Page 2286)
SetBorderStyle example (Page 2257)
SetBorderStyle example
Element alignment in check boxes and radio boxes

SetFillStyle
Function
Sets the type of fill pattern.

Syntax
BOOL SetFillStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2086

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lFillStyle
Type of fill pattern as numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
ZERO.

See also
Fill pattern (Page 2288)
SetFillStyle example (Page 2259)
Fill pattern
SetFillStyle example

SetFillStyle2
Function
Sets the bar fill pattern for a bar graph.

Syntax
BOOL SetFillStyle2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillStyle2);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2087

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lFillStyle2
Bar fill pattern as numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Fill pattern (Page 2288)
SetFillStyle example (Page 2259)
Fill pattern
SetFillStyle example

SetItemBorderStyle
Function
Sets the dividing line style for the "text list" object.

Syntax
BOOL SetItemBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lItemBorderStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderStyle
Numeric value defining the dividing line style

2088

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Line styles (Page 2289)
SetBorderStyle example (Page 2257)
Line styles
SetBorderStyle example

SetItemBorderWidth
Function
Sets the dividing line width for the "text list" object.

Syntax
BOOL SetItemBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lItemBorderWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderWidth
Numeric value defining the dividing line width

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2089

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetBorderStyle example (Page 2257)
SetBorderStyle example

SetPressed
Function
Specifies for buttons or round buttons whether the switch setting is "pressed" or "not pressed".

Syntax
BOOL SetPressed(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bPressed);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPressed
Switch setting of the button
TRUE Switch setting "pressed"
FALSE Switch setting "not pressed"

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetToggle
Function
Specifies for buttons or round buttons whether the switch is latchable or not.

2090

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetToggle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bToggle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bToggle
Switch latchable/not latchable

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetWindowsStyle
Function
Specifies whether buttons are to be displayed in Windows style.

Syntax
BOOL SetWindowsStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bWindowStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bWindowStyle
"Windows style" on/off

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2091

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenHomePicture
Function
Opens the entered start picture.

Syntax
BOOL OpenHomePicture();

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenNextPicture
Function
WinCC saves the names of the pictures opened by the user during runtime as well as the
sequence in which these pictures were opened.
The maximum number of picture names saved this way can be set in the WinCC Explorer in
the computer properties on the "Graphics Runtime" tab under "picture buffer size".
The OpenNextPicture function now opens the picture which was opened before the last call
of OpenPrevPicture.

Syntax
BOOL OpenNextPicture();

2092

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenPrevPicture
Function
WinCC saves the names of the pictures opened by the user during runtime as well as the
sequence in which these pictures were opened.
The maximum number of picture names saved this way can be set in the WinCC Explorer in
the computer properties on the "Graphics Runtime" tab under "picture buffer size".
The OpenPrevPicture function now opens the picture which was opened before the currently
open picture.

Syntax
BOOL OpenPrevPicture();

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenStoredPicture
Function
Opens the picture saved with the StorePicture function.

Syntax
BOOL OpenStoredPicture();

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2093

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

StorePicture
Function
Saves the current picture which can then be opened with the OpenStoredPicture function.

Syntax
BOOL StorePicture();

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

3.15.3.5

tag

tag - short description


Tags can be set or called in using the functions from the tag group.

GetTag or GetTagWait?
Process tags that are called with GetTag are put in an image. Since updating and reading the
image is done in two separate procedures, the GetTag call is not directly influenced by the
coupling. It can therefore be executed quicker and more independently than a GetTagWait
retrieval.
With GetTagWait, process tags that have been requested are not accepted in the image. A
GetTagWait retrieval reads the value explicitly from the AS. This always includes the send and
return path through the coupling and the response time of the AS. During this runtime, the
processing of the C actions is blocked and the time required for the retrieval cannot be
estimated. If multiple tags are read, the time is added.
A GetTagWait call is required if

2094

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
fast write/read procedures are to be synchronized
a value is read explicitly from the AS
or a registration is to be avoided in the image deliberately.
The GetTagWait call is to be avoided in cyclic C-Actions, this is the main reason for
performance problems.

SetTag or SetTagWait?
The SetTag retrieval distributes a write job without waiting for confirmation from the AS.
The SetTagWait retrieval distributes a write job and waits for confirmation from the AS. This
always includes the send and return path through the coupling and the response time of the
AS. During this runtime, the processing of the C actions is blocked and the time required for
the retrieval cannot be estimated. If multiple tags are written, the time is added.
A SetTagWait call is set to guarantee that the value has been written before the C-Action is
processed any further. The SetTagWait call in cyclic C actions is to be avoided.
Note
The difference between GetTag and GetTagWait also exists for internal tags. The difference
is not quite so serious here however, since no coupling comes into play. To synchronize fast
write/read procedures, the respective wait function is to be used with internal tags as well.
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

get
Functionality of the GetTag functions
GetTagXXX
By calling the function the tag is logged on and, from that moment, polled cyclically from the
AS. The cycle for the registration depends on the trigger (see following description). For
GetTagXXX calls, the value that is available in WinCC is sent. For Close Picture, the tag actions
are ended again.
The call is marked by the following:
The value is read from the tag image by WinCC.
The call is faster in comparison to GetTagXXXWait (except for the first call which generally
takes longer because the value from the PLC must be read out and logged on).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2095

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
The duration of the call does not depend on the bus-load or on the AS.
The function does not deliver any information on the status of the tags

Note
If a tag is requested in a Global Script action, it remains registered throughout the enter
Runtime of WinCC.
In Callback functions, the respective GetTagXXXWait function must be used.
Behavior in actions with tag trigger (recommended):
All of the tags contained in the tag trigger are already known with Open Picture and are
registered with the defined monitoring time.
Since all tags are requested at once, the best possible optimization can be targeted from the
channel. If a tag is requested with GetTagXXX() within a C-Action, which is contained in the
trigger, the value already exists and is sent directly to the call (high-performance).
Registering tags in actions with tag trigger
As the tags are already known when the picture is selected, they can be transmitted in a job
to the Data Manager and so be registered collectively to the channel.

Note
If a tag is requested, which is not in the trigger, then the behavior is the same as with the
default trigger.

2096

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Behavior in actions with default trigger:
tags are registered with half of the cycle time with the first call. For every other call, the value
is present.
Registering tags in actions with default trigger and event trigger
Only when the individual actions are executed is it identified which tags are needed in the
picture. As a result, the tags are registered to the channel in a large number of single jobs.
When a picture with cyclic actions is selected, the continual reorganization may place a heavy
strain on communications.
Example: The channel supports custom cycle creation. Usually cycles are created by the
channel directly from the AS. The resources for these cycles are limited by the AS. As a result,
the channel stops the current jobs for this cycle and reconfigures the cycle on the AS.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2097

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Behavior in event triggered actions:
The tag is registered in the "upon change" mode with the first call. Process tags that are
registered in the "upon change" mode correspond with a cyclic read job with a cycle time of
1s.
Note
If a value is requested by GetTagXXX() by a mouse click for example, the tag is accepted in
the tag image. The tag is requested cyclically from the AS as of this point in time and therefore
increases the basic load.
To avoid this increase in basic loading, the value can be requested by GetTagXXXWait().
The call GetTagXXXWait() causes a higher communication load one time but the tag is not
added to the tag image.

GetTagXXXWait
The function returns the current value. The tag is not registered cyclically, the value is
requested from the AS one time only.
The call is marked by the following:
The value is read explicitly from the AS.
The call, compared with GetTagXXX, takes longer.
The duration of the call does not depend on the bus-load or on the AS.
The function does not deliver any information on the status of the tags.

GetTagXXXState
The function GetTagXXXState has the same features as GetTagXXX, it also sends the function
information on the status of the tags. Since the status is always delivered internally, there is
no performance difference to GetTagXXX.

2098

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagXXXStateWait
The function GetTagXXXStateWait has the same features as GetTagXXXWait, additionally it
sends the function information on the status of the tags. Since the status is always delivered
internally, there is no performance difference to GetTagXXXWait.
The difference between functions GetTagXXXStateWait and GetTagXXXState corresponds
with the difference between GetTagXXXWait and GetTagXXX. Since the value is explicitly
read from the AS for process tags, the value and the status can be more current than for
GetTagXXXState.

GetTagXXXStateQC
The function GetTagXXXStateQC has the same features as GetTagXXXState. The function
also delivers information on the quality code of the tag.

GetTagXXXStateQCWait
The function GetTagXXXStateQCWait has the same features as GetTagXXXStateWait. The
function also delivers information on the quality code of the tag.

GetTagMultiWait
The function GetTagMultiWait has the same features as GetTagXXXWait. However, it allows
the request for more tags in a job. Therefore, the read requests in the direction of the AS can
be optimized in most cases so that only one request will be given to the AS.

GetTagMultiStateWait
The function GetTagMultiStateWait has the same features as GetTagMultiWait, additionally it
sends the function information on the statuses of the tags.

GetTagMultiStateQCWait
The function GetTagMultiStateQCWait has the same features as GetTagMultiStateWait. The
function also delivers information on the quality codese of the tags.

state
wait
getTagBitStateWait
Function
Determines the value of a tag of data type "Binary tag". The value is read explicitly from the
AS. The status of the tag is also returned.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2099

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL GetTagBitStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "BOOL"

See also
Tag statuses (Page 2291)
GetTagBitStateWait example (Page 2239)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTagBitStateWait example
GetTag functions, function principle

GetTagByteStateWait
Function
Determines the value of a tag of data type "unsigned 8 bit". The value is read explicitly from
the AS. The status of the tag is also returned.

Syntax
BYTE GetTagByteStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2100

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "BYTE"

See also
Tag statuses (Page 2291)
GetTagWordStateWait example (Page 2251)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateWait example

GetTagCharStateWait
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The value is read
explicitly from the AS. The status of the tag is also returned.

Syntax
char* GetTagCharStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2101

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
{
.......
}

See also
Functionality of the GetTag functions (Page 2095)
Tag statuses (Page 2291)
Beispiel GetTagCharStateWait (Page 2241)
GetTagCharStateWait example
GetTag functions, function principle
Tag states

GetTagDoubleStateWait
Function
Determines the value of a tag of data type "64-bit floating point value". The value is read
explicitly from the AS. The status of the tag is also returned.

Syntax
double GetTagDoubleStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "double"

See also
Tag statuses (Page 2291)
GetTagFloatStateWait example (Page 2243)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateWait example

2102

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTag functions, function principle
Tag states

GetTagDWordStateWait
Function
Determines the value of a tag of data type "unsigned 32 bit". The value is read explicitly from
the AS. The status of the tag is also returned.

Syntax
DWORD GetTagDWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "DWORD"

See also
Tag statuses (Page 2291)
GetTagWordStateWait example (Page 2251)
Functionality of the GetTag functions (Page 2095)
GetTagWordStateWait example
GetTag functions, function principle
Tag states

GetTagFloatStateWait
Function
Determines the value of a tag of data type "32-bit floating point value". The value is read
explicitly from the AS. The status of the tag is also returned.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2103

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
float GetTagFloatStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "float"

See also
Tag statuses (Page 2291)
GetTagFloatStateWait example (Page 2243)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateWait example
Tag states
GetTag functions, function principle

GetTagMultiStateWait
Function
The values and states of several tags are established and stored in the corresponding
addresses in the specified format. The values are read explicitly from the AS.
The function must transfer a DWORD array whose members contain the individual tag states
after the function is invoked. The size of the array must be selected so that sufficient memory
space is available for these statuses.

Syntax
BOOL GetTagMultiStateWait(DWORD* pdwState, const char* pFormat)

Parameters
pdwState
Field in which the tag statuses are stored.

2104

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
pFormat
Format description for all requested tags and for each tag name and address of the value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2287)
Tag statuses (Page 2291)
GetTagMultiStateWait example (Page 2244)
Functionality of the GetTag functions (Page 2095)
Tag states
Format descriptors
GetTag functions, function principle
GetTagMultiStateWait example

GetTagRawStateWait
Function
Determines the value of a tag of data type "Raw data type". The value is read explicitly from
the AS. The status of the tag is also returned.

Syntax
BOOL GetTagRawStateWait(Tag Tag_Name, BYTE pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2105

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
GetTagRawStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
GetTagRawStateWait example
GetTag functions, function principle
Tag states

GetTagSByteStateWait
Function
Determines the value of a tag of data type "signed 8 bit". The value is read explicitly from the
AS. The status of the tag is also returned.

Syntax
signed char GetTagSByteStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

2106

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
The value of the tag in the data type "signed char"

See also
Tag statuses (Page 2291)
GetTagSByteStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateWait example
GetTag functions, function principle
Tag states

GetTagSDWordStateWait
Function
Determines the value of a tag of data type "signed 32 bit". The value is read explicitly from the
AS. The status of the tag is also returned.

Syntax
long GetTagSDWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "long"

See also
Tag statuses (Page 2291)
GetTagSByteStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateWait example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2107

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTag functions, function principle
Tag states

GetTagSWordStateWait
Function
Determines the value of a tag of data type "signed 16 bit". The value is read explicitly from the
AS. The status of the tag is also returned.

Syntax
short GetTagSWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "short"

See also
Functionality of the GetTag functions (Page 2095)
Tag statuses (Page 2291)
GetTagSByteStateWait example (Page 2249)
GetTagSByteStateWait example
GetTag functions, function principle
Tag states

GetTagWordStateWait
Function
Determines the value of a tag of data type "unsigned 16 bit". The value is read explicitly from
the AS. The status of the tag is also returned.

2108

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
WORD GetTagWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "WORD"

See also
Tag statuses (Page 2291)
GetTagWordStateWait example (Page 2251)
Functionality of the GetTag functions (Page 2095)
GetTagWordStateWait example
GetTag functions, function principle
Tag states

GetTagBitState
Function
Determines the value of a tag of data type "Binary tag". The status of the tag is also returned.

Syntax
BOOL GetTagBitState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2109

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Value of the tag in the data type "BOOL"

See also
Tag statuses (Page 2291)
GetTagBitStateWait example (Page 2239)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTagBitStateWait example
GetTag functions, function principle

GetTagByteState
Function
Determines the value of a tag of data type "unsigned 8 bit". The status of the tag is also returned.

Syntax
BYTE GetTagByteState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "BYTE"

See also
Tag statuses (Page 2291)
GetTagWordStateWait example (Page 2251)
Functionality of the GetTag functions (Page 2095)
Tag states

2110

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTag functions, function principle
GetTagWordStateWait example

GetTagCharState
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The status of the
tag is also returned.

Syntax
char* GetTagCharState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
Tag statuses (Page 2291)
Beispiel GetTagCharStateWait (Page 2241)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagCharStateWait example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2111

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagDoubleState
Function
Determines the value of a tag of data type "64-bit floating point value". The status of the tag
is also returned.

Syntax
double GetTagDoubleState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "double"

See also
Tag statuses (Page 2291)
GetTagFloatStateWait example (Page 2243)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagFloatStateWait example

GetTagDWordState
Function
Determines the value of a tag of data type "unsigned 32 bit". The status of the tag is also
returned.

Syntax
DWORD GetTagDWordState(Tag Tag_Name, PDWORD lp_dwstate);

2112

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "DWORD"

See also
Tag statuses (Page 2291)
GetTagWordStateWait example (Page 2251)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateWait example

GetTagFloatState
Function
Determines the value of a tag of data type "32-bit floating point value". The status of the tag
is also returned.

Syntax
float GetTagFloatState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2113

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Value of the tag in the data type "float"

See also
GetTagFloatStateWait example (Page 2243)
Tag statuses (Page 2291)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateWait example
Tag states
GetTag functions, function principle

GetTagRawState
Function
Determines the value of a tag of data type "Raw data type". The status of the tag is also
returned.

Syntax
BOOL GetTagRawState(Tag Tag_Name, BYTE* pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function has been completed without any errors.

2114

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
GetTagRawStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagRawStateWait example

GetTagSByteState
Function
Determines the value of a tag of data type "signed 8 bit". The status of the tag is also returned.

Syntax
signed char GetTagSByteState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
The value of the tag in the data type "signed char"

See also
Tag statuses (Page 2291)
GetTagSByteStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2115

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTag functions, function principle
GetTagSByteStateWait example

GetTagSDWordState
Function
Determines the value of a tag of data type "signed 32 bit". The status of the tag is also returned.

Syntax
long GetTagSDWordState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "long"

See also
Tag statuses (Page 2291)
GetTagSByteStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateWait example

GetTagSWordState
Function
Determines the value of a tag of data type "signed 16 bit". The status of the tag is also returned.

2116

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
short GetTagSWordState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "short"

See also
Tag statuses (Page 2291)
GetTagSByteStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateWait example

GetTagWordState
Function
Determines the value of a tag of data type "unsigned 16 bit". The status of the tag is also
returned.

Syntax
WORD GetTagWordState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2117

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "WORD"

See also
Tag statuses (Page 2291)
GetTagWordStateWait example (Page 2251)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateWait example

stateqc
wait
GetTagBitStateQCWait
Function
Determines the value of a tag of data type "Binary tag". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

Syntax
BOOL GetTagBitStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

2118

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "BOOL".

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
Tag states
GetTagWordStateQCWait example

GetTagByteStateQCWait
Function
Determines the value of a tag of data type "unsigned 8 bit". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
BYTE GetTagByteStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "BYTE".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2119

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTagWordStateQCWait example
Tag states
GetTag functions, function principle

GetTagCharStateQCWait
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The value is read
explicitly from the AS. In addition, the status and the quality code of the tags are returned.

Syntax
char* GetTagCharStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

2120

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Tag statuses (Page 2291)
GetTagCharStateQCWait example (Page 2240)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagCharStateQCWait example

GetTagDoubleStateQCWait
Function
Determines the value of a tag of data type "64-bit floating point value". The value is read
explicitly from the AS. In addition, the status and the quality code of the tags are returned.

Syntax
double GetTagDoubleStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "double".

See also
Tag statuses (Page 2291)
GetTagFloatStateQCWait example (Page 2242)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2121

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Tag states
GetTagFloatStateQCWait example

GetTagDWordStateQCWait
Function
Determines the value of a tag of data type "unsigned 32 bit". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
DWORD GetTagDWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "DWORD".

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

2122

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagFloatStateQCWait
Function
Determines the value of a tag of data type "32-bit floating point value". The value is read
explicitly from the AS. In addition, the status and the quality code of the tags are returned.

Syntax
float GetTagFloatStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "float".

See also
Tag statuses (Page 2291)
GetTagFloatStateQCWait example (Page 2242)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagFloatStateQCWait example

GetTagMultiStateQCWait
Function
The values, states and quality codes are determined for several tags and are stored in the
respective addresses in the specified format. The values are read explicitly from the AS.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2123

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
The function must be provided with two DWORD arrays, the member of which contains the
states and quality codes of the individual tags after the function has been called. The size of
the arrays must be selected so that sufficient memory space is available for these statuses.

Syntax
BOOL GetTagMultiStateQCWait(DWORD* pdwState, DWORD* pdwQualityCode, const char*
pFormat)

Parameters
pdwState
Field in which the status of the individual tags is stored after the function has been completed.
pdwQualityCode
Field in which the quality codes of the individual tags is stored after the function has been
completed.
pFormat
Format description for all requested tags and for each tag name and address of the value.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2287)
Tag statuses (Page 2291)
GetTagMultiStateQCWait example (Page 2243)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagMultiStateQCWait example

2124

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagRawStateQCWait
Function
Determines the value of a tag of data type "Raw data type". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
BOOL GetTagRawStateQCWait(Tag Tag_Name, BYTE pValue, DWORD size, PDWORD
lp_dwstate, PDWORD pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
pValue
Pointer to a byte field containing the value of the raw data tag.
size
Size of the byte field in bytes.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
GetTagRawStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2125

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Tag states
GetTag functions, function principle
GetTagRawStateQCWait example

GetTagSByteStateQCWait
Function
Determines the value of a tag of data type "signed 8 bit". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

Syntax
signed char GetTagSByteStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "signed char".

See also
Tag statuses (Page 2291)
GetTagSByteStateQCWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateQCWait example

2126

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagSDWordStateQCWait
Function
Determines the value of a tag of data type "signed 32 bit". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

Syntax
long GetTagSDWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "long".

See also
Tag statuses (Page 2291)
GetTagSByteStateQCWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateQCWait example

GetTagSWordStateQCWait
Function
Determines the value of a tag of data type "signed 16 bit". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2127

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
short GetTagSWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "short".

See also
Tag statuses (Page 2291)
GetTagSByteStateQCWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateQCWait example

GetTagValueStateQCWait
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value. The value is read explicitly from the AS. In addition, the status
and the quality code of the tags are returned.

Syntax
BOOL GetTagValueStateQCWait(LPDM_VARKEY lpdmVarKey,
LPDM_VAR_UPDATE_STRUCTEX lpdmresult, LPCMN_ERROR lpdmError);

2128

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCTEX"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2295)
Structure definition DM_VAR_UPDATE_STRUCTEX (Page 2297)
Structure definition DM_VARKEY (Page 2298)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
CMN_ERROR structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
DM_VARKEY structure definition

GetTagWordStateQCWait
Function
Determines the value of a tag of data type "unsigned 16 bit". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
WORD GetTagWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2129

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "WORD".

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

GetTagBitStateQC
Function
Determines the value of a tag of data type "Binary tag". In addition, the status and the quality
code of the tags are returned.

Syntax
BOOL GetTagBitStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.

2130

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "BOOL".

See also
Tag statuses (Page 2291)
GetTagBitStateQC example (Page 2238)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagBitStateQC example

GetTagByteStateQC
Function
Determines the value of a tag of data type "unsigned 8 bit". In addition, the status and the
quality code of the tags are returned.

Syntax
BYTE GetTagByteStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2131

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Value of the tag in the data type "BYTE".

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

GetTagCharStateQC
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". In addition, the
status and the quality code of the tags are returned.

Syntax
char* GetTagCharStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");

2132

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
if(pszValue != NULL)
{
.......
}

See also
Tag statuses (Page 2291)
GetTagCharStateQCWait example (Page 2240)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagCharStateQCWait example

GetTagDoubleStateQC
Function
Determines the value of a tag of data type "64-bit floating point value". In addition, the status
and the quality code of the tags are returned.

Syntax
double GetTagDoubleStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "double".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2133

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
GetTagFloatStateQCWait example (Page 2242)
Tag statuses (Page 2291)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateQCWait example
Tag states
GetTag functions, function principle

GetTagDWordStateQC
Function
Determines the value of a tag of data type "unsigned 32 bit". In addition, the status and the
quality code of the tags are returned.

Syntax
DWORD GetTagDWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "DWORD".

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)

2134

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTagWordStateQCWait example
GetTag functions, function principle
Tag states

GetTagFloatStateQC
Function
Determines the value of a tag of data type "32-bit floating point value". In addition, the status
and the quality code of the tags are returned.

Syntax
float GetTagFloatStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "float".

See also
GetTagFloatStateQCWait example (Page 2242)
Tag statuses (Page 2291)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateQCWait example
Tag states
GetTag functions, function principle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2135

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagRawStateQC
Function
Determines the value of a tag of data type "Raw data type". In addition, the status and the
quality code of the tags are returned.

Syntax
BOOL GetTagRawStateQC(Tag Tag_Name, BYTE* pValue, DWORD size, PDWORD
lp_dwstate, PDWORD pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
pValue
Pointer to a byte field containing the value of the raw data tag.
size
Size of the byte field in bytes.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
GetTagRawStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)

2136

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTagRawStateQCWait example
GetTag functions, function principle
Tag states

GetTagSByteStateQC
Function
Determines the value of a tag of data type "signed 8 bit". In addition, the status and the quality
code of the tags are returned.

Syntax
signed char GetTagSByteStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "signed char".

See also
Tag statuses (Page 2291)
GetTagSByteStateQCWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateQCWait example
Tag states
GetTag functions, function principle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2137

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagSDWordStateQC
Function
Determines the value of a tag of data type "signed 32 bit". In addition, the status and the quality
code of the tags are returned.

Syntax
long GetTagSDWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "long".

See also
Tag statuses (Page 2291)
GetTagSByteStateQCWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateQCWait example
GetTag functions, function principle
Tag states

GetTagSWordStateQC
Function
Determines the value of a tag of data type "signed 16 bit". In addition, the status and the quality
code of the tags are returned.

2138

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
short GetTagSWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "short".

See also
Tag statuses (Page 2291)
GetTagSByteStateQCWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateQCWait example
GetTag functions, function principle
Tag states

GetTagValueStateQC
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value. In addition, the status and the quality code of the tags are
returned.

Syntax
BOOL GetTagValueStateQC(LPDM_VARKEY lpdmVarKey,
LPDM_VAR_UPDATE_STRUCTEX lpdmresult, LPCMN_ERROR lpdmError);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2139

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCTEX"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2295)
Structure definition DM_VAR_UPDATE_STRUCTEX (Page 2297)
Structure definition DM_VARKEY (Page 2298)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
DM_VARKEY structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

GetTagWordStateQC
Function
Determines the value of a tag of data type "unsigned 16 bit". In addition, the status and the
quality code of the tags are returned.

Syntax
WORD GetTagWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

2140

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "WORD".

See also
Tag statuses (Page 2291)
GetTagWordStateQCWait example (Page 2250)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

wait
GetTagBitWait
Function
Determines the value of a tag of data type "Binary tag". The value is read explicitly from the
AS.

Syntax
BOOL GetTagBitWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2141

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
Value of the tag in the data type "BOOL"

See also
GetTagBit example (Page 2237)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagBit example

GetTagByteWait
Function
Determines the value of a tag of data type "unsigned 8 bit". The value is read explicitly from
the AS.

Syntax
BYTE GetTagByteWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "BYTE"

See also
GetTagWord example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagWord example

2142

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagCharWait
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The value is read
explicitly from the AS.

Syntax
char* GetTagCharWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Pointer to a character string containing the value of the tag.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetTagChar example (Page 2239)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagChar example

GetTagDoubleWait
Function
Determines the value of a tag of data type "64-bit floating point value". The value is read
explicitly from the AS.

Syntax
double GetTagDoubleWait(Tag Tag_Name);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2143

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "double"

See also
GetTagFloat example (Page 2241)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagFloat example

GetTagDWordWait
Function
Determines the value of a tag of data type "unsigned 32 bit". The value is read explicitly from
the AS.

Syntax
DWORD GetTagDWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "DWORD"

See also
Functionality of the GetTag functions (Page 2095)
GetTagWord example (Page 2250)
GetTagWord example
GetTag functions, function principle

2144

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagFloatWait
Function
Determines the value of a tag of data type "32-bit floating point value". The value is read
explicitly from the AS.

Syntax
float GetTagFloatWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "float"

See also
GetTagFloat example (Page 2241)
Functionality of the GetTag functions (Page 2095)
GetTagFloat example
GetTag functions, function principle

GetTagMultiWait
Function
The values of several tags are established and stored in the corresponding addresses in the
specified format. The value is read explicitly from the AS. The memory for the tag value is
created by the function with SysMalloc.

Syntax
BOOL GetTagMultiWait(const char* pFormat,...)

Parameters
pFormat
Format description for all requested tags and for each tag name and address of the value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2145

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2287)
GetTagMultiWait example (Page 2245)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagMultiWait example
Format descriptors

GetTagRawWait
Function
Determines the value of a tag of data type "Raw data type". The value is read explicitly from
the AS.

Syntax
BOOL GetTagRawWait(Tag Tag_Name , BYTE pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

Return value
TRUE
The function has been completed without any errors.

2146

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
FALSE
An error has occurred.

See also
Functionality of the GetTag functions (Page 2095)
GetTagRaw example (Page 2246)
GetTag functions, function principle
GetTagRaw example

GetTagSByteWait
Function
Determines the value of a tag of data type "signed 8 bit". The value is read explicitly from the
AS.

Syntax
signed char GetTagSByteWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
The value of the tag in the data type "signed char"

See also
GetTagSByte example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagSByte example

GetTagSDWordWait
Function
Determines the value of a tag of data type "signed 32 bit". The value is read explicitly from the
AS.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2147

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
long GetTagSDWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "long"

See also
GetTagSByte example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagSByte example
GetTag functions, function principle

GetTagSWordWait
Function
Determines the value of a tag of data type "signed 16 bit". The value is read explicitly from the
AS.

Syntax
short GetTagSWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "short"

See also
GetTagSByte example (Page 2248)
Functionality of the GetTag functions (Page 2095)

2148

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTagSByte example
GetTag functions, function principle

GetTagValueWait
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value. The value is read explicitly from the AS.

Syntax
BOOL GetTagValueWait(LPDM_VARKEY lpdmVarKey, LPDM_VAR_UPDATE_STRUCT
lpdmresult, LPCMN_ERROR lpdmError);

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCT"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2295)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2296)
Structure definition DM_VARKEY (Page 2298)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
DM_VARKEY structure definition

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2149

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

GetTagWordWait
Function
Determines the value of a tag of data type "unsigned 16 bit". The value is read explicitly from
the AS.

Syntax
WORD GetTagWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "WORD"

See also
GetTagWord example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

GetTagBit
Function
Determines the value of a tag of data type "Binary tag".

Syntax
BOOL GetTagBit(Tag Tag_Name);

2150

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "BOOL"

See also
GetTagBit example (Page 2237)
Functionality of the GetTag functions (Page 2095)
GetTagBit example
GetTag functions, function principle

GetTagByte
Function
Determines the value of a tag of data type "unsigned 8 bit".

Syntax
BYTE GetTagByte(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "BYTE"

See also
GetTagWord example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2151

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagChar
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag".

Syntax
char* GetTagChar(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Pointer to a character string containing the value of the tag.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetTagChar example (Page 2239)
Functionality of the GetTag functions (Page 2095)
GetTagChar example
GetTag functions, function principle

GetTagDateTime
Function
Determines the value of a tag of data type "Date/Time".

Syntax
SYSTEMTIME GetTagDateTime(Tag Tag_Name);

2152

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameter
Tag_Name
Name of the tag

Return value
Value of the tag in the data type "Date/Time".

GetTagDouble
Function
Determines the value of a tag of data type "64-bit floating point value".

Syntax
double GetTagDouble(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "double"

See also
GetTagFloat example (Page 2241)
Functionality of the GetTag functions (Page 2095)
GetTagFloat example
GetTag functions, function principle

GetTagDWord
Function
Determines the value of a tag of data type "unsigned 32 bit".

Syntax
DWORD GetTagDWord(Tag Tag_Name);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2153

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "DWORD"

See also
GetTagWord example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

GetTagFloat
Function
Determines the value of a tag of data type "32-bit floating point value".

Syntax
float GetTagFloat(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "float".

See also
GetTagFloat example (Page 2241)
Functionality of the GetTag functions (Page 2095)
GetTagFloat example
GetTag functions, function principle

2154

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagRaw
Function
Determines the value of a tag of data type "Raw data type".

Syntax
BOOL GetTagRaw(Tag Tag_Name, BYTE* pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
GetTagRaw example (Page 2246)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagRaw example

GetTagSByte
Function
Determines the value of a tag of data type "signed 8 bit".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2155

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
signed char GetTagSByte(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
The value of the tag in the data type "signed char"

See also
GetTagSByte example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagSByte example
GetTag functions, function principle

GetTagSDWord
Function
Determines the value of a tag of data type "signed 32 bit".

Syntax
long GetTagSDWord(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "long"

See also
GetTagSByte example (Page 2248)
Functionality of the GetTag functions (Page 2095)

2156

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
GetTagSByte example
GetTag functions, function principle

GetTagSWord
Function
Determines the value of a tag of data type "signed 16 bit".

Syntax
short GetTagSWord(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "short"

See also
GetTagSByte example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagSByte example
GetTag functions, function principle

GetTagValue
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value.

Syntax
BOOL GetTagValue(LPDM_VARKEY lpdmVarKey, LPDM_VAR_UPDATE_STRUCT
lpdmresult, LPCMN_ERROR lpdmError);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2157

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCT"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2295)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2296)
Structure definition DM_VARKEY (Page 2298)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
DM_VARKEY structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

GetTagWord
Function
Determines the value of a tag of data type "unsigned 16 bit".

Syntax
WORD GetTagWord(Tag Tag_Name);

2158

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "WORD"

See also
GetTagWord example (Page 2250)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

set
Principle of the SetTag functions
SetTagXXX
The SetTagXXX function assigns the job a value to write and returns immediately to the caller.
In this case, the system does not wait until value is actually written.
The call is marked by the following:
The call is fast.
The caller does not know when the value is actually written.
The function provides no information on the state of the write job.

SetTagXXXWait
The function SetTagXXXWait assigns the job of writing a value and will first return to the caller
when the value has actually been written.
The call is marked by the following:
The call takes longer in comparison to SetTagXXX. The duration is also dependent on the
channel and AS, amongst other things.
The value is written after the call.
The function provides no information on the state of the write job.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2159

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTagXXXState
The function SetTagXXXState has the same features as SetTagXXX; plus the function returns
information regarding the status of the write request.
Since the status is always provided internally, there is no performance difference compared
to SetTagXXX.

SetTagXXXStateWait
The function SetTagXXXStateWait has the same features as SetTagXXXWait; plus the
function returns information regarding the status of the write request.
Since the status is always provided internally, there is no performance difference compared
to SetTagXXXWait.
The difference between the functions SetTagXXXStateWait and SetTagXXXState
corresponds to the difference between SetTagXXXWait and SetTagXXX.
Note, that certain statuses can only be generated when the write process has been completed.

SetTagMultiWait
The SetTagMultiWait function has the same features as SetTagXXXWait. It also offers the
option of granting several write jobs in a single job.

state
wait
SetTagBitStateWait
Function
Sets the value of a tag of data type "Binary tag". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagBitStateWait(Tag Tag_Name, short value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "short"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagBitStateWait (Page 2267)
Tag states
SetTagBitStateWait example

SetTagByteStateWait
Function
Sets the value of a tag of the data type "unsigned 8 Bit". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagByteStateWait(Tag Tag_Name, BYTE value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2161

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "BYTE"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagWordStateWait (Page 2274)
Tag states
SetTagWordStateWait example

SetTagCharStateWait
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag". The function is ended
after the AS has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagCharStateWait(Tag Tag_Name, LPSTR value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2162

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "LPSTR"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagCharStateWait example (Page 2268)
Tag states
SetTagCharStateWait example

SetTagDoubleStateWait
Function
Defines the value of a tag of the data type "64-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagDoubleStateWait(Tag Tag_Name, double value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2163

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "double"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagFloatStateWait example (Page 2269)
Tag states
SetTagFloatStateWait example

SetTagDWordStateWait
Function
Sets the value of a tag of the data type "unsigned 32 Bit". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagDWordStateWait(Tag Tag_Name, DWORD value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2164

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "DWORD"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagWordStateWait (Page 2274)
Tag states
SetTagWordStateWait example

SetTagFloatStateWait
Function
Defines the value of a tag of the data type "32-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagFloatStateWait(Tag Tag_Name, float value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2165

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "float"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagFloatStateWait example (Page 2269)
Tag states
SetTagFloatStateWait example

SetTagMultiStateWait
Function
Sets the values of several tags. The function is ended after the AS has acknowledged
acceptance of the value.
The function must transfer a DWORD array whose members contain the individual tag states
after the function is invoked. The size of the array must be selected so that sufficient memory
space is available for these statuses.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagMultiStateWait(DWORD* pdwState, const char* pFormat,...)

2166

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
pdwState
Field in which the tag statuses are stored.
pFormat
Format description for all requested tags and for each tag name and value.
FormatdescriberEXAMPLES_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagMultiStateWait example (Page 2270)
Tag states
SetTagMultiStateWait example

SetTagRawStateWait
Function
Sets the value of a tag of the data type "Raw data type". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagRawStateWait(Tag Tag_Name, BYTE pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2167

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagRawStateWait example (Page 2272)
Tag states
SetTagRawStateWait example

SetTagSByteStateWait
Function
Sets the value of a tag of the data type "signed 8 bit". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagSByteStateWait(Tag Tag_Name, signed char value, PDWORD lp_dwstate);

2168

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagSByteStateWait (Page 2273)
Tag states
SetTagSByteStateWait example

SetTagSDWordStateWait
Function
Sets the value of a tag of the data type "signed 32 bit". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagSDWordStateWait(Tag Tag_Name, long value, PDWORD lp_dwstate);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2169

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagSByteStateWait (Page 2273)
SetTagSByteStateWait example
Tag states

SetTagSWordStateWait
Function
Sets the value of a tag of the data type "signed 16 bit". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagSWordStateWait(Tag Tag_Name, short value, PDWORD lp_dwstate);

2170

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagSByteStateWait (Page 2273)
Tag states
SetTagSByteStateWait example

SetTagWordStateWait
Function
Sets the value of a tag of the data type "unsigned 16 Bit". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagWordStateWait(Tag Tag_Name, WORD value, PDWORD lp_dwstate);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2171

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "WORD"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagWordStateWait (Page 2274)
SetTagWordStateWait example
Tag states

SetTagBitState
Function
Sets the value of a tag of data type "Binary tag". The status of the tag is also returned.

Syntax
BOOL SetTagBitState(Tag Tag_Name, short int value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2172

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "short int"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagBitStateWait (Page 2267)
Principle of the SetTag functions (Page 2159)
Tag states
SetTagBitStateWait example
SetTag functions, function principle

SetTagByteState
Function
Sets the value of a tag of the data type "unsigned 8 Bit". The status of the tag is also returned.

Syntax
BOOL SetTagByteState(Tag Tag_Name, BYTE value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "BYTE"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2173

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagWordStateWait (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
Tag states
SetTagWordStateWait example

SetTagCharState
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag". The status of the
tag is also returned.

Syntax
BOOL SetTagCharState(Tag Tag_Name, LPSTR value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "LPSTR"

2174

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagCharStateWait example (Page 2268)
Principle of the SetTag functions (Page 2159)
Tag states
SetTag functions, function principle
SetTagCharStateWait example

SetTagDoubleState
Function
Defines the value of a tag of the data type "64-bit floating point value". The status of the tag is
also returned.

Syntax
BOOL SetTagDoubleState(Tag Tag_Name, double value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "double"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2175

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagFloatStateWait example (Page 2269)
Principle of the SetTag functions (Page 2159)
Tag states
SetTag functions, function principle
SetTagFloatStateWait example

SetTagDWordState
Function
Sets the value of a tag of the data type "unsigned 32 Bit". The status of the tag is also returned.

Syntax
BOOL SetTagDWordState(Tag Tag_Name, DWORD value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "DWORD"

2176

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagWordStateWait (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWordStateWait example
Tag states
SetTag functions, function principle

SetTagFloatState
Function
Defines the value of a tag of the data type "32-bit floating point value". The status of the tag is
also returned.

Syntax
BOOL SetTagFloatState(Tag Tag_Name, float value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "float"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2177

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
SetTagFloatStateWait example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTagFloatStateWait example
Tag states
SetTag functions, function principle

SetTagRawState
Function
Sets the value of a tag of the data type "Raw data type". The status of the tag is also returned.

Syntax
BOOL SetTagRawState(Tag Tag_Name, BYTE* pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag

2178

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
GetTagRaw example (Page 2246)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
Tag states
GetTagRaw example

SetTagSByteState
Function
Sets the value of a tag of the data type "signed 8 bit". The status of the tag is also returned.

Syntax
BOOL SetTagSByteState(Tag Tag_Name, signed char value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2179

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagSByteStateWait (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTagSByteStateWait example
SetTag functions, function principle
Tag states

SetTagSDWordState
Function
Sets the value of a tag of the data type "signed 32 bit". The status of the tag is also returned.

Syntax
BOOL SetTagSDWordState(Tag Tag_Name, long value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"

2180

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagSByteStateWait (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTagSByteStateWait example
SetTag functions, function principle
Tag states

SetTagSWordState
Function
Sets the value of a tag of the data type "signed 16 bit". The status of the tag is also returned.

Syntax
BOOL SetTagSWordState(Tag Tag_Name, short value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2181

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagSByteStateWait (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTagSByteStateWait example
SetTag functions, function principle
Tag states

SetTagWordState
Function
Sets the value of a tag of the data type "unsigned 16 Bit". The status of the tag is also returned.

Syntax
BOOL SetTagWordState(Tag Tag_Name, WORD value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

2182

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2291)
Beispiel SetTagWordStateWait (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWordStateWait example
Tag states
SetTag functions, function principle

wait
SetTagBitWait
Function
Sets the value of a tag of data type "Binary tag". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagBitWait(Tag Tag_Name, short value);

Parameter
Tag_Name
Name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2183

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Value
Value of the tag in the data type "short"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagBit example (Page 2267)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagBit example

SetTagByteWait
Function
Sets the value of a tag of the data type "unsigned 8 Bit". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagByteWait(Tag Tag_Name, BYTE value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "BYTE"

Return value
TRUE
The function itself has been completed without any errors.

2184

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagWord example

SetTagCharWait
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag". The function is ended
after the AS has acknowledged acceptance of the value.

Syntax
BOOL SetTagCharWait(Tag Tag_Name, LPSTR value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "LPSTR"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2185

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
Principle of the SetTag functions (Page 2159)
SetTagChar example (Page 2268)
SetTag functions, function principle
SetTagChar example

SetTagDoubleWait
Function
Defines the value of a tag of the data type "64-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value.

Syntax
BOOL SetTagDoubleWait(Tag Tag_Name, double value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "double"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagFloat example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagFloat example

2186

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTagDWordWait
Function
Sets the value of a tag of the data type "unsigned 32 Bit". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagDWordWait(Tag Tag_Name, DWORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "DWORD"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagFloatWait
Function
Defines the value of a tag of the data type "32-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2187

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetTagFloatWait(Tag Tag_Name, float value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "float"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagFloat example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTagFloat example
SetTag functions, function principle

SetTagMultiWait
Function
The values of several tags are set in the specified format. The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagMultiWait(const char* pFormat,...)

Parameters
pFormat
Format description for all requested tags and for each tag name and value.

2188

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2287)
SetTagMultiWait example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
Format descriptors
SetTagMultiWait example

SetTagRawWait
Function
Sets the value of a tag of the data type "Raw data type". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagRawWait(Tag Tag_Name, BYTE pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2189

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagRaw example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagRaw example

SetTagSByteWait
Function
Sets the value of a tag of the data type "signed 8 bit". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagSByteWait(Tag Tag_Name, signed char value);

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

2190

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetTagSByte example (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagSByte example

SetTagSDWordWait
Function
Sets the value of a tag of the data type "signed 32 bit". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagSDWordWait(Tag Tag_Name, long value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Principle of the SetTag functions (Page 2159)
SetTagSByte example (Page 2273)
SetTag functions, function principle
SetTagSByte example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2191

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTagSWordWait
Function
Sets the value of a tag of the data type "signed 16 bit". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagSWordWait(Tag Tag_Name, short value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTagSByte example
SetTag functions, function principle

SetTagValueWait
Function
Enables the transfer of a value in the form of a variant and sets the pointer to the value of the
data type "Variant". The function is ended after the AS has acknowledged acceptance of the
value.

2192

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetTagValueWait(LPDM_VARKEY lpdmVarKey, LPVARIANT lpdmValue, PDWORD
dwState, LPCMN_ERROR lpdmError);

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmValue
Pointer to the value of data type "Variant". A description of the data type VARIANT can be
found in the associated documentation.
dwState
Tag status which is returned after the function has been run.
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2295)
Tag statuses (Page 2291)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2296)
Structure definition DM_VARKEY (Page 2298)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
DM_VARKEY structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2193

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTagWordWait
Function
Sets the value of a tag of the data type "unsigned 16 Bit". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagWordWait(Tag Tag_Name, WORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "WORD"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagBit
Function
Sets the value of a tag of data type "Binary tag".

2194

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
BOOL SetTagBit(Tag Tag_Name, short int value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short int"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Principle of the SetTag functions (Page 2159)
SetTagBit example (Page 2267)
SetTagBit example
SetTag functions, function principle

SetTagByte
Function
Sets the value of a tag of the data type "unsigned 8 Bit".

Syntax
BOOL SetTagByte(Tag Tag_Name, BYTE value);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2195

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
value
Value of the tag in the data type "BYTE"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagChar
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag".

Parameter
Tag_Name
Name of the tag
Value
Value of the tag in the data type "LPSTR"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

2196

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetTagChar example (Page 2268)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagChar example

SetTagDateTime
Function
Sets the value of a tag of data type "Date/Time".

Syntax
BOOL SetTagDateTime(Tag Tag_Name, SYSTEMTIME value);

Parameter
Tag_Name
Name of the tag
value
Value of the tag in the data type "Date/Time".

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

SetTagDouble
Function
Defines the value of a tag of the data type "64-bit floating point value".

Syntax
BOOL SetTagDouble(Tag Tag_Name, double value);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2197

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "double"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagFloat example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagFloat example

SetTagDWord
Function
Sets the value of a tag of the data type "unsigned 32 Bit".

Syntax
BOOL SetTagDWord(Tag Tag_Name, DWORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "DWORD"

2198

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagFloat
Function
Defines the value of a tag of the data type "32-bit floating point value".

Syntax
BOOL SetTagFloat(Tag Tag_Name, float value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "float"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2199

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

See also
SetTagFloat example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTagFloat example
SetTag functions, function principle

SetTagRaw
Function
Sets the value of a tag of the data type "Raw data type".

Syntax
BOOL SetTagRaw(Tag Tag_Name, BYTE* pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagRaw example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagRaw example

2200

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTagSByte
Function
Sets the value of a tag of the data type "signed 8 bit".

Syntax
BOOL SetTagSByte(Tag Tag_Name, signed char value);

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagSByte example

SetTagSDWord
Function
Sets the value of a tag of the data type "signed 32 bit".

Syntax
BOOL SetTagSDWord(Tag Tag_Name, long value);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2201

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTagSByte example
SetTag functions, function principle

SetTagSWord
Function
Sets the value of a tag of the data type "signed 16 bit".

Syntax
BOOL SetTagSWord(Tag Tag_Name, short value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

2202

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
size
Size of the byte field in bytes

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2273)
Principle of the SetTag functions (Page 2159)
SetTagSByte example
SetTag functions, function principle

SetTagValue
Function
Enables the transfer of a value in the form of a variant and sets the pointer to the value of the
data type "Variant".

Syntax
BOOL SetTagValue(LPDM_VARKEY lpdmVarKey, LPVARIANT lpdmValue, PDWORD
dwState, LPCMN_ERROR lpdmError);

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmValue
Pointer to the value of data type "Variant". A description of the data type VARIANT can be
found in the associated documentation.
dwState
Tag status which is returned after the function has been run.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2203

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Principle of the SetTag functions (Page 2159)
Structure definition CMN_ERROR (Page 2295)
Tag statuses (Page 2291)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2296)
Structure definition DM_VARKEY (Page 2298)
SetTag functions, function principle
CMN_ERROR structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
DM_VARKEY structure definition

SetTagWord
Function
Sets the value of a tag of the data type "unsigned 16 Bit".

Syntax
BOOL SetTagWord(Tag Tag_Name, WORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "WORD"

2204

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2274)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

3.15.3.6

WinCC

WinCC - short description


The functions of the WinCC group allow to define various setting in Runtime.
The functions of the System subgroup can be used to influence WinCC Runtime.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2205

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

system
DeactivateRTProject
Function
Deactivates the activated project.
Note
If Runtime is exited on a server or client this applies only to the respective computer.
An activated project for which the WinCC Explorer has not been started must be closed with
the internal function "ExitWinCC".
If the activated project was exited with the internal function "DeactivateRTProject" the WinCC
project remains open in the background. To close this project, the WinCC Explorer must be
opened and then be closed by means of the menu commands "File" > "Exit".

Syntax
BOOL DeactivateRTProject();

Return value
TRUE
The function has been completed without any errors.

FALSE
An error has occurred.

See also
DeactivateRTProject example (Page 2217)
DeactivateRTProject example

2206

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

ExitWinCC
Function
Deactivates Runtime and exits WinCC on the computer executing the function.
Note
If Runtime is exited on a server or client this applies only to the respective computer.
An activated project for which the WinCC Explorer has not been started must be closed with
the internal function "ExitWinCC".
If the activated project was exited with the internal function "DeactivateRTProject" the WinCC
project remains open in the background. To close this project, the WinCC Explorer must be
opened and then be closed by means of the menu commands "File" > "Exit".

Syntax
BOOL ExitWinCC ();

Return value
TRUE
The function has been completed without any errors.

FALSE
An error has occurred.

See also
ExitWinCC example (Page 2217)
ExitWinCC example

GetLanguage
Function
Determines the current Runtime language.

Syntax
DWORD GetLanguage();

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2207

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Return value
The current Runtime language with the associated language identifier is returned.
Note
You can find a comprehensive "Language code" table in the "Basic Principles of VBScript"
documentation under the index entry "Language code".

See also
GetLanguage example (Page 2225)
GetLanguage example

InquireLanguage
Function
Determines all languages configured in the text library for the runtime.
Use dWCount to specify where the number of determined language IDs is to be stored.

Syntax
DWORD* InquireLanguage(DWORD* dwCount);

Parameters
dwCount
Pointer to the number of determined language IDs

Return value
The configured languages with the associated language identifiers are returned.
Note
You can find a comprehensive "Language code" table in the "Basic Principles of VBScript"
documentation under the index entry "Language code".

See also
InquireLanguage example (Page 2254)
InquireLanguage example

2208

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetLanguage
Function
Changes the language setting in Runtime.

Syntax
BOOL SetLanguage(DWORD dwLocaleID);

Parameters
dwLocaleID
Language ID of the language to be set

Return value
TRUE
The function has been completed without any errors.

FALSE
An error has occurred.

See also
Language ID (Page 2290)
SetLanguage example (Page 2262)
SetLanguage example
Language IDs

FillDiagnoseInTags
Function
Activates or deactivates the storage of diagnostic information in tags.
As filling the tags is an additional load for the system, it should only be activated temporarily
for diagnostic information.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2209

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Syntax
void FillDiagnoseInTags(BOOL bfill);

Parameters
bFill
Storage of diagnostic information in tags on/off
TRUE Activate supply of diagnostic tags
FALSE Deactivate supply of diagnostic tags

Diagnostic tags of GlobalScript


@SCRIPT_COUNT_TAGS
This tag contains the current number of tags requested via Script.
@SCRIPT_COUNT_REQUEST_IN_QUEUES
This tag contains the current number of jobs.
@SCRIPT_COUNT_ACTIONS_IN_QUEUES
This tag contains the current number of actions.

GetServerTagPrefix
Function
To be able to access tags of the respective server from a WinCC client in a distributed system,
the tag names must be supplemented with the server prefix.
If the tags are accessed by means of the functions GetTagxx or SetTagxx, the required addition
is made by the script control.
If WinCC API functions are used for accessing, the tag names have to be supplemented by
the user. The GetServer TagPrefix function provides the required prefixes.
One pointer each of the "char" type to ServerPrefix, TagPrefix and WindowPrefix is returned.
The user must neither change the memory (also no strcat) nor release it.

Syntax
void GetServerTagPrefix(char** ppszServerPrefix, char** ppszTagPrefix, char**
ppszWindowPrefix);

2210

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters
ppszServerPrefix
Pointer to a pointer referring to the server prefix
ppszTagPrefix
Pointer to a pointer referring to the tag prefix
ppszWindowPrefix
Pointer to a pointer referring to the window prefix

See also
GetServerTagPrefix example (Page 2236)
GetServerTagPrefix example

TraceText
Function
The value defined in <Parameter> is recorded in APDiag if the specified diagnostic level has
been reached.

Syntax
void TraceText(DWORD dwTraceLevel, char* pszFormat, <Parameter>);

Parameters
dwTraceLevel
Diagnostic level
pszFormat
Output format (according to printf function)
<Parameter>
Value to be reported
Note
The parameterization dialog for this function provides the selection of tags, graphic objects
and pictures.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2211

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TraceTime
Function
The value defined in <Parameter> is recorded in APDiag if the specified diagnostic level has
been reached.
In addition, the time since the AP start of diagnosis is output in milliseconds to enable
performance measurements.

Syntax
void TraceTime(DWORD dwTraceLevel, char* pszFormat, <Parameter>);

Parameters
dwTraceLevel
Diagnostic level
pszFormat
Output format (according to printf function)
<Parameter>
Value to be reported
Note
The parameterization dialog for this function provides the selection of tags, graphic objects
and pictures.

3.15.4

Examples

3.15.4.1

Examles - A to G

AcknowledgeMessage example

{
//Acknowledge the AlarmLogging message which is selected
AcknowledgeMessage(GetTagWord("U08i_MsgNr"));
}

Specify the message number to be acknowledged. It is read from a tag.

2212

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

AXC_OnBtnMsgFirst example

{
// jump to the first message in the WinCC Alarm Control
AXC_OnBtnMsgFirst("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnMsgFirst function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

Beispiel AXC_OnBtnMsgLast

{
// jump to the last message in the WinCC Alarm Control
AXC_OnBtnMsgLast("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnMsgLast function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

AXC_OnBtnScroll example

{
// activate/deactivate the scroll function
AXC_OnBtnScroll("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnScroll function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2213

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Control1 is the object name of the WinCC Alarm Control.

AXC_OnBtnSinglAckn example

{
// acknowledge the active message
AXC_OnBtnSinglAckn("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnSinglAckn function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

AXC_SetFilter example

{
BOOL ret;
MSG_FILTER_STRUCT Filter;
CMN_ERROR Error;
//Reset the filter struct
memset( &Filter, 0, sizeof( MSG_FILTER_STRUCT ) );
//Set the filter name
strcpy( Filter.szFilterName, "Control1");
// Choose selection elements
Filter.dwFilter = MSG_FILTER_NR_FROM | MSG_FILTER_NR_TO;
// Message number
Filter.dwMsgNr[0]
// Message number
Filter.dwMsgNr[1]

from
= 2;
to
= 2;

ret = AXC_SetFilter("gs_alarm_00","Control1",&Filter,&Error);
}

1. Name the filter.


2. Select the filter type.
3. Specify the filter criteria.
4. Set the filter.

2214

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Note
The filter type and the filter criteria are to be adapted, all other filter types are described in
the filter structure.

DeactivateRTProject example

{
//deactivate the runtime
DeactivateRTProject ();
}

This function deactivates WinCC Runtime.

ExitWinCC example

{
//exit wincc
ExitWinCC ();
}

This function exits WinCC.

3.15.4.2

Examples - GetAlarmHigh to GetPropChar

GetAlarmHigh example

{
double dAlarmHigh;
//Get the Alarm High Limit
dAlarmHigh = GetAlarmHigh(lpszPictureName,"Bar1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetAlarmHigh:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2215

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
1. Read out the upper alarm limit and temporarily store it in dAlarmHigh.
2. Executing user-defined code for processing return values.

GetBackColor example

{
long int bk_color;
//Get the background color
bk_color = GetBackColor(lpszPictureName,"StatischerText1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetBackColor:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
1. Read out the current background color and temporarily store it in bk_color.
2. Executing user-defined code for processing return values.

GetBorderStyle example

{
long int lstyle;
//Get the current border style
lstyle = GetBorderStyle(lpszPictureName,"Rectangle1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetBorderStyle:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.

2216

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

1. Read out the current line style of the object and temporarily store it in lstyle.
2. Executing user-defined code for processing return values.

GetFilling example

{
BOOL bfilling;
//Get the actual state of dynamic filling
bfilling = GetFilling(lpszPictureName,"Rectangle1");
if(bfilling)
{
// User defined code if the
// dynamic filling is activated
...
}
Else
{
// User defined code if the
// dynamic filling is deactivated
...
}
}

Parameters of the function GetFilling:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out whether dynamic filling is activated or not and temporary store in bfilling.
2. Executing user-defined code, depending on the return value of the function.

GetFillingIndex example

{
long int filling_index;
//Get the actual filling index of the object
filling_index = GetFillingIndex(lpszPictureName,"Rectangle1");
//User defined code where the
//user can do something with the return value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2217

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

...
}

Parameters of the function GetFillingIndex:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out the current fill level of the object and temporarily store it in filling_index.
2. Executing user-defined code for processing return values.

GetFillStyle example

{
long int lstyle;
//Get the current fill style
lstyle = GetFillStyle(lpszPictureName,"Rectangle1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetFillStyle:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out the current fill pattern of the object and temporarily store it in lstyle.
2. Executing user-defined code for processing return values.

GetFlashBackColor example

{
BOOL bflash_col;
//Get if the flashing is on or off
bflash_col = GetFlashBackColor(lpszPictureName,"Group1");

2218

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

if(bflash_col)
{
// User defined code if the
// flashing is activated
...
}
Else
{
// User defined code if the
// flashing is deactivated
...
}
}

Parameters of the function GetFlashBackColor:


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
1. Read out whether flashing of the background color is activated or not and temporary store
in bflash_col.
2. Executing user-defined code, depending on the return value of the function.

GetFlashBackColorOn example

{
long int flashcol_on;
//Get the BackFlashColor
flashcol_on = GetBackFlashColorOn(lpszPictureName,"Group1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetBackFlashColorOn function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
1. Read out the background flash color for the "On" status of the obvject and and temporarily
store it in flashcol_on.
2. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2219

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetFlashRateFlashPic example

{
long lFlashRate;
//Get the flashrate
lFlashRate = GetFlashRateFlashPic(lpszPictureName,"StatusDisplay1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetFlashRateFlashPic function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Status display1" is the name of the object.
1. Read out the flash frequency of the object and temporarily store it in lFlashRate.
2. Executing user-defined code for processing return values.

GetFocus example

{
char* pszValue = NULL;
char szValue[_MAX_PATH+1];

//Get the Object which has the focus


pszValue = Get_Focus();
//Copy the string
if(pszValue != NULL)
{
strncpy(szValue,pszValue,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

1. Read out on which object the focus is and temporarily store in pszValue.
2. If a valid value has been returned, store the return value of the function in the local string
szValue. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

2220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetFontBold example

{
BOOL bbold;
//Get if the text is bold
bbold = GetFontBold(lpszPictureName,"StaticText1");
if(bbold)
{
// User
// font
...
}
Else
{
// User
// font
...
}
}

defined code if the


is bold

defined code if the


is not bold

Parameters of the GetBackColor function


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
1. Read out whether the text is in bold or not and temporarily store in bbold.
2. Executing user-defined code, depending on the return value of the function.

GetFontSize example

{
long int fontsize;
//Get the actual Font size
fontsize = GetFontSize(lpszPictureName,"StaticText1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetFontSize function:


"lpszPictureName" is the name of the picture in which the object was configured.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2221

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"StaticText1" is the name of the object.
1. Read out the current font size and temporarily store it in fontsize.
2. Executing user-defined code for processing return values.

GetHeight example

{
long lHeight;
//Get the height of the object
lHeight = GetHeight(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetHeight function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
1. Read out the current height of the object and temporarily store it in lHeight.
2. Executing user-defined code for processing return values.

GetHiddenInput example

{
BOOL bHiddenInput;
//Get the state of hidden input
bHiddenInput = GetHiddenInput(lpszPictureName,"IOField1");
if(bHiddenInput)
{
// User defined
// hidden input
...
}
Else
{
// User defined
// hidden input
...

2222

code if the
is activated

code if the
is activated

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

}
}

Parameters of the GetHiddenInput function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
1. Read out whether the text is in bold or not and temporarily store in bHiddenInput.
2. Executing user-defined code, depending on the return value of the function.

GetLanguage example

{
DWORD rt_language;
//Get the current language
rt_language = GetLanguage ();
//User defined code where the
//user can do something with the return value
...
}

1. Read out the current Runtime language and temporarily store it in rt_language.
2. Executing user-defined code for processing return values.

GetLeft example

{
long lPos;
//Get the x-position of the object
lPos = GetLeft(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetLeft function:


"lpszPictureName" is the name of the picture in which the object was configured.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2223

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"WinCCLogo" is the name of the object.
1. Read out the current X position of the object and temporarily store it in lPos.
2. Executing user-defined code for processing return values.

GetLink example

{
LINKINFO linkinfo;
//Get the linked Tag
GetLink(lpszPictureName,"Bar1","Process",&linkinfo);
// linkinfo.szLinkName is the tag name
// linkinfo.dwCycle is the update cycle
// linkinfo.LinkType is the type of the connection

//User defined code where the


//user can do something with the return value
...
}

Parameters of the GetLink function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"Process" is the property connected to a tag.
"&linkinfo" is the address of the linkinfo structure.
1. Fills the passed linkinfo structure with the tag connection information.
2. Executing user-defined code, depending on the return value of the function.

GetLinkedVariable example

{
char* pszVarName = NULL;
char szVarName[_MAX_PATH+1];
//Get the TagName
pszVarName = GetLinkedVariable("gs_stand_graph_00","StaticText6","Visible");
//Copy the string
if (strcmp (pszVarName,"")!= 0)

2224

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

{
strncpy(szVarName,pszVarName,_MAX_PATH);
}
else printf("Attribute 'visible' is not made dynamic\r\n");
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetLinkedVariable function:


"gs_stand_graph_00" is the name of the picture in which the object was configured.
"StaticText6" is the name of the object.
"Visible" is the property connected to a tag.
1. Temporarily store the return value of the GetLinkedVariable function in pszVarName.
2. If a valid value has been returned, store the return value in szVarName. A maximum of
_MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

GetLocalPicture example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the Local Picture
pszPicName = GetLocalPicture(lpszPictureName);
//Copy the string
if (pszPicName != NULL)
{
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

1. Temporarily store the return value of the GetLocalPicture function in pszPicName.


2. If a valid value has been returned, store the return value in szPicName. A maximum of
_MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2225

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetMarker example

{
BOOL bmarker;
//Get the state of the Marker
bmarker = GetMarker(lpszPictureName,"Bar1");
if(bmarker)
{
// User defined code if the
// marker is activated
...
}
Else
{
// User defined code if the
// marker is deactivated
...
}
}

Parameters of the GetMarker function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
1. Read out whether the marker is displayed or not and temporarily store in bmarker.
2. Executing user-defined code, depending on the return value of the function.

GetOutputValueDouble example

{
double doutput;
//Get the output value of IO Field 1
doutput = GetOutputValueDouble(lpszPictureName,"IOField1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetOutputValueDouble function:


"lpszPictureName" is the name of the picture in which the object was configured.

2226

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"IOField1" is the name of the object.
1. Read out the output value and temporarily store it in doutput.
2. Executing user-defined code for processing return values.

GetParentPicture example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the parent picture
pszPicName = GetParentPicture(lpszPictureName);
//Copy the string
if (pszPicName != NULL)
{
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

1. Temporarily store the return value of the GetParentPicture function in pszPicName.


2. If a valid value has been returned, store the return value in szPicName. A maximum of
_MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

GetPictureDown example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the current picture name
pszPicName = GetPictureDown(lpszPictureName,"Roundbutton1");
if (pszPicName != NULL)
{
//Copy the string
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2227

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

...
}

Parameters of the GetPictureDown function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
1. Read out the picture name of the picture displayed in round button 1 and temporarily store
it in pszPicName.
2. If a valid value has been returned, store the return value of the function in the local string
szPicName. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

GetPictureName example

{
char* pszPictureName = NULL;
char szPictureName[_MAX_PATH + 1];
//Get the current PictureName
pszPictureName = GetPictureName(lpszPictureName,"GraphicObject1");
if(pszPictureName != NULL)
{
//copy the string
strncpy(szPictureName,pszPictureName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetPictureName function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
1. Read out the picture name of the picture displayed in graphic object 1 and temporarily store
it in pszPictureName.
2. If a valid value has been returned, store the return value of the function in the local string
szPictureName. A maximum of _MAX_PATH characters is stored.

2228

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
3. Executing user-defined code for processing return values.

GetPictureUp example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the current picture name
pszPicName = GetPictureUp(lpszPictureName,"Roundbutton1");
if (pszPicName != NULL)
{
//Copy the string
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetPictureUp function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
1. Read out the picture name of the picture displayed in round button 1 and temporarily store
it in pszPicName.
2. If a valid value has been returned, store the return value of the function in the local string
szPicName. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

GetPosition example

{
long int lpos;
//Get the actual position of the Slider
lpos = GetPosition(lpszPictureName,"Control1");
//User defined code where the
//user can do something with the return value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2229

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

...
}

Parameters of the GetPosition function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
1. Read out the current slider position and temporarily store it in lpos.
2. Executing user-defined code for processing return values.

GetPropBOOL example

{
BOOL bProp;
//Get the property Visible
bProp = GetPropBOOL("gs_graph_eafield","IOField1","Visible");
if(bProp)
{
// User defined code if the
// object is visible
...
}
else
{
// User defined code if the
// object is not visible
...
}
}

Parameters of the GetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"Visible" is the object property.
1. Read out whether the object is visible or not and temporarily store in bProp.
2. Executing user-defined code, depending on the return value of the function.

2230

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetPropChar example

{
char* pszProp = NULL;
char szProp[14];
//Get the property Tooltiptext
pszProp = GetPropChar("lpszPictureName","EAFeld1","Tooltiptext");
if(pszProp != NULL)
{
//Copy the string
strncpy(szProp,pszProp,13);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetPropChar function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"Tooltiptext" is the object property.
1. Read out the tooltip text of the object and temporarily store it in pszProp.
2. If a valid value has been returned, store the return value of the function in the local string
szProp. A maximum of 13 characters is stored.
3. Executing user-defined code for processing return values.

3.15.4.3

Examples - GetRangeMax to GetWidth

GetRangeMax example

{
long int lrange;
//Get the upper scale Limit
lrange = GetRangeMax(lpszPictureName,"Control1");
//User defined code where the
//user can do something with the return value
...
}

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2231

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters of the GetRangeMax function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
1. Read out the current upper limit of the object and temporarily store it in lrange.
2. Executing user-defined code for processing return values.

GetRangeMin example

{
long int lrange;
//Get the lower scale Limit
lrange = GetRangeMin(lpszPictureName,"Control1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetRangeMin function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
1. Read out the current lower limit of the object and temporarily store it in lrange.
2. Executing user-defined code for processing return values.

Beispiel GetScaling

{
BOOL bscaling;
//Get the Scaling state
bscaling = GetScaling(lpszPictureName,"Bar1");
if (bscaling)
{
// User defined code if the
// bar object has an additional scale
...
}

2232

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Else
{
// User defined code if the
// bar object has no additional scale
...
}
}

Parameters of the GetScaling function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
1. Read out whether the scale of the bar is displayed or not and temporarily store in bscaling.
2. Executing user-defined code, depending on the return value of the function.

GetServerTagPrefix example

{
char* pszServerPrefix;
char* pszTagPrefix;
char* pszWindowPrefix;
int nServerPrefixLen = 0;
int nTagPrefixLen = 0;
int nTagLen = 0;
char myTagName[MAX_DM_VAR_NAME+1];
//Initialize the return value
memset(myTagName,0,MAX_DM_VAR_NAME + 1);
//Get the serverprefix the tagprefix and the windowprefix
GetServerTagPrefix(&pszServerPrefix, &pszTagPrefix, &pszWindowPrefix);
//If a serverprefix exists
if (pszServerPrefix)
{
//Get the length of the string
nServerPrefixLen = strlen(pszServerPrefix);
}
Else
{
printf("No server prefix was returned.");
return;
}
//If a tagprefix exists
if (pszTagPrefix)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2233

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

{
//Get the length of the string
nTagPrefixLen = strlen(pszTagPrefix);
}
//Get the length of the tag
nTagLen = strlen("TagName");
//Check if the lenght of the
//ServerPrefix+TagPrefix+VarName + the double points < MAX_DM_VAR_NAME)
if (nServerPrefixLen + nTagPrefixLen + nTagLen+2 < MAX_DM_VAR_NAME)
{
sprintf(myTagName,"%s::%s%s",pszServerPrefix,pszTagPrefix,"TagName");
//User defined code where the
//user can do something with the return value
...
}
Else
{
printf("The resulting string is too long.");
return;
}
}

1. Initialize the myTagName tag.


2. Read out the server prefix, the tag prefix and the window prefix.
3. If no server prefix has been returned, a text ist output and the function is terminated.
4. If a server prefix has been returned, determine its length and temporarily store it in
nServerPrefixLen.
5. If a tag prefix has been returned, determine its length and temporarily store it in TagPrefixLen.
6. Determine the length of the tag name and temporarily store it in nVarLen.
7. If the length permitted for tag names is exceeded a text is output and the function is
terminated.
8. If the length permitted for tag names is not exceeded, the tag name required for a client
environment is compiled.
9. Executing user-defined code for processing return values.

GetServerTagPrefix example

{
char* pszServerPrefix;
char* pszTagPrefix;
char* pszWindowPrefix;
//Get the serverprefix and the tagprefix
GetServerTagPrefix(&pszServerPrefix, &pszTagPrefix, &pszWindowPrefix);

2234

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//User defined code where the


//user can do something with the return value
...
}

Parameters of the GetServerTagPrefix function:


"pszServerPrefix" is the tag which is written into the server prefix.
"pszTagPrefix" is the tag which is written into the tag prefix.
"pszWindowrPrefix" is the tag which is written into the window prefix.

1. Read out the server prefix, the tag prefix and the window prefix.
2. The pszServerPrefix tag contains the returned server prefix.
3. The pszTagPrefix tag contains the returned tag prefix.
4. The pszWindowPrefix tag contains the returned window prefix.
5. Executing user-defined code for processing return values.

GetTagBit example

{
BOOL bstate;
//Get the current state of the tag
bstate = GetTagBit("gs_tag_bit");
if(bstate)
{
// User defined
// value of the
...
}
else
{
// User defined
// value of the
...
}
}

code if the
tag is true

code if the
tag is false

Parameters of the GetTagBit function

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2235

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"gs_tag_bit" is the name of the tag.
1. Read out the value of the tag and temporarily store it in bstate.
2. Executing user-defined code, depending on the return value of the function.

GetTagBitStateQC example

{
DWORD dwState;
DWORD dwQC;
BOOL bValue;
dwState = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
bValue = GetTagBitStateQCWait("gs_tag_bit",&dwState,&dwQC);
//Create a string
if (bValue)
{
// User defined
// value of the
...
}
else
{
// User defined
// value of the
...
}
}

which includes the tag value

code if the
tag is true

code if the
tag is false

Parameters of the GetTagBitStateQC function:


"gs_tag_bit" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in bValue. The function puts the tag
status in dwState and the quality code in dwQC.
2. Executing user-defined code, depending on the return value of the function.

2236

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagBitStateWait example

{
DWORD dwstate;
BOOL bValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
bValue = GetTagBitStateWait("gs_tag_bit",&dwstate);
//Create a string
if (bValue)
{
// User defined
// value of the
...
}
else
{
// User defined
// value of the
...
}
}

which includes the tag value

code if the
tag is true

code if the
tag is false

Parameters of the GetTagBitStateWait function:


"gs_tag_bit" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in bstate. The function puts the tag
status in dwstate.
2. Executing user-defined code, depending on the return value of the function.

GetTagChar example

{
char* pszValue = NULL;
char szValue[13];
//Get the current value of the tag
pszValue = GetTagChar("gs_tag_char");
if(pszValue != NULL)
{
//Copy the string

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2237

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

strncpy(szValue,pszValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagChar function:


"gs_tag_char" is the name of the tag.
1. Reading the value of the tag and temporarily storing in pszValue.
2. If a valid value has been returned, store the return value of the function in the local string
szValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

GetTagCharStateQCWait example

{
DWORD dwState;
DWORD dwQC;
char* pszRetValue = NULL;
char szRetValue[13];
dwState = 0xFFFFFFFF;
//Get the tag value
pszRetValue = GetTagCharStateQCWait("gs_tag_char",&dwState, &dwQC);
if (pszRetValue != NULL)
{
//Copy the string
strncpy(szRetValue,pszRetValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagCharStateQCWait function:


"gs_tag_char" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.

2238

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
1. Read out the value of the tag and temporarily store it in pszRetValue. The function puts the
tag status in dwState and the quality code in dwQC.
2. If a valid value has been returned, store the return value of the function in the local string
szRetValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

Beispiel GetTagCharStateWait

{
DWORD dwstate;
char szValue[11];
char* pszRetValue = NULL;
char szRetValue[13];
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
pszRetValue = GetTagCharStateWait("gs_tag_char",&dwstate);
if (pszRetValue != NULL)
{
//Copy the string
strncpy(szRetValue,pszRetValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagCharStateWait function:


"gs_tag_char" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in pszRetValue. The function puts the
tag status in dwstate.
2. If a valid value has been returned, store the return value of the function in the local string
szRetValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

GetTagFloat example

{
float fValue;

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2239

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//Get the current value of the tag


fValue = GetTagFloat("gs_tag_float");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagFloat function:


"gs_tag_float" is the name of the tag.
1. Read out the value of the tag and temporarily store it in fValue.
2. Executing user-defined code for processing return values.

GetTagFloatStateQCWait example

{
DWORD dwState;
DWORD dwQC;
float fValue;
dwState = 0xFFFFFFFF;
//Get the tag value
fValue = GetTagFloatStateQCWait("gs_tag_float",&dwState, &dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagFloatStateQCWait function:


"gs_tag_float" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in fValue. The function puts the tag
status in dwState and the quality code in dwQC.
2. Executing user-defined code for processing return values.

2240

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagFloatStateWait example

{
DWORD dwstate;
float fValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
fValue = GetTagFloatStateWait("gs_tag_float",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagFloatStateWait function:


"gs_tag_float" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in fValue. The function puts the tag
status in dwstate.
2. Executing user-defined code for processing return values.

GetTagMultiStateQCWait example

{
#define DATA_SIZE 5
DWORD dwState[DATA_SIZE];
DWORD dwQC[DATA_SIZE];
//define all Datas
BOOL lValue1;
long lValue2 ;
char* szValue3;
double dblValue4 ;
WORD lValue5 ;

//Set the tags


GetTagMultiStateQCWait(dwState,dwQC,"%d%d%s%f%d",
"gs_tag_bit",&lValue1,
"gs_tag_SByte",&lValue2,
"gs_tag_char",&szValue3,
"gs_tag_float",&dblValue4,
"gs_tag_word",&lValue5);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2241

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//User defined code where the


//user can do something with the return value
...
}

Parameters of the GetTagMultiStateWait function:


"dwState" is the DWord-Array, in which the tag statuses are stored.
"dwQC" is the DWord-Array, in which the quality codes are stored.
"%d%d%s%f%d" are the type descriptions of the tags to be read.
"gs_tag_bit" is the tag to be read.
"&lValue1" is the address of the tags in which the value of the tags gs_tag_bit should be stored.
"gs_tag_SByte" is the tag to be read.
"&lValue2" is the address of the tags in which the value of the tags gs_tag_SByte should be
stored.
The other parameters are to be handled in the same way as those described previously.
1. Creating a DWord-Array with the required size (Number of tags).
2. Reading and storing the values of the tags. The value of the tags gs_tag_bit is stored
temporarily in lValue1. The value of the tags gs_tag_SByte is stored temporarily in lValue2,
etc.
3. Executing user-defined code for processing return values.

GetTagMultiStateWait example

{
#define DATA_SIZE 5
DWORD dwData[DATA_SIZE];
//define all Datas
BOOL lValue1;
long lValue2 ;
char* szValue3;
double dblValue4 ;
WORD lValue5 ;

//Set the tags


GetTagMultiStateWait(dwData,"%d%d%s%f%d",
"gs_tag_bit",&lValue1,
"gs_tag_SByte",&lValue2,
"gs_tag_char",&szValue3,
"gs_tag_float",&dblValue4,
"gs_tag_word",&lValue5);

2242

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//User defined code where the


//user can do something with the return value
...
}

Parameters of the GetTagMultiStateWait function:


"dwData" is the DWord-Array, in which the tag statuses are stored.
"%d%d%s%f%d" are the type descriptions of the tags to be read.
"gs_tag_bit" is the tag to be read.
"&lValue1" is the address of the tags in which the value of the tags gs_tag_bit should be stored.
"gs_tag_SByte" is the tag to be read.
"&lValue2" is the address of the tags in which the value of the tags gs_tag_SByte should be
stored.
The other parameters are to be handled in the same way as those described previously.
1. Creating a DWord-Array with the required size (Number of tags).
2. Reading and storing the values of the tags. The value of the tags gs_tag_bit is stored
temporarily in lValue1. The value of the tags gs_tag_SByte is stored temporarily in lValue2,
etc.
3. Executing user-defined code for processing return values.

GetTagMultiWait example

DWORD dwVar1Value;
char* szVar2Value;
//Memory for the tag value is
//created by teh function with SysMalloc
double dbVar3Value;
BOOL ok;
ok=GetTagMultiWait("%d%s%f", "Ernie_word", &dwVar1Value,
"Ernie_char", &szVar2Value,
"Ernie_double", &dbVar3Value);
printf("Word %d, String %s, Double %f\r\n",
dwVar1Value, szVar2Value, dbVar3Value);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2243

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagPrefix example

{
char* pszTagPrefix = NULL;
char szTagPrefix[7];
//Get the current tag prefix
pszTagPrefix = GetTagPrefix(lpszPictureName,"PicWindow1");
if(pszTagPrefix != NULL)
{
//Copy the string
strncpy(szTagPrefix,pszTagPrefix,6);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagPrefix function:


"lpszPictureName" is the name of the picture in which the object was configured.
"PictureWindow1" is the name of the object.
1. Read out the current tag prefix of picture window 1 and temporarily store it in pszTagPrefix.
2. If a valid value has been returned, store the return value of the function in the local string
szTagPrefix. A maximum of 6 characters is stored.
3. Executing user-defined code for processing return values.

GetTagRaw example

{
#define DATA_SIZE 3
BYTE byData[DATA_SIZE];
//Get the current values of the tag
GetTagRaw("gs_tag_raw",byData,DATA_SIZE);
//Use the values received in the array byData
...
}

Parameters of the GetTagRaw function:

2244

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"gs_tag_raw" is the name of the tag.
"byData" is the byte array in which the values of the raw data tags will be stored.
"DATA_SIZE" is the number of values that will be read.
1. Reading the values of the tags and temporarily storing in byData.
2. Executing user-defined code for processing return values.

GetTagRawStateQCWait example

{
#define DATA_SIZE 3
DWORD dwState;
DWORD dwQC;
BYTE byData[DATA_SIZE];
dwState = 0xFFFFFFFF;
//Get the values of the tag
GetTagRawStateQCWait("gs_tag_raw",byData,DATA_SIZE,&dwState,&dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagRawStateQCWait function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array in which the values of the raw data tags will be stored.
"DATA_SIZE" is the number of values that will be read.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Reading the values of the tags and temporarily storing in byData.
2. Executing user-defined code for processing return values.

GetTagRawStateWait example

{
#define DATA_SIZE 3
DWORD dwstate;
BYTE byData[DATA_SIZE];

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2245

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

char szValue[11];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Get the values of the tag
//dwstate is the tag state
GetTagRawStateWait("gs_tag_raw",byData,DATA_SIZE,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagRawStateWait function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array in which the values of the raw data tags will be stored.
"DATA_SIZE" is the number of values that will be read.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Reading the values of the tags and temporarily storing in byData.
2. Executing user-defined code for processing return values.

GetTagSByte example

{
long lValue;
//Get the current value of the tag
lValue = GetTagSByte("gs_tag_SByte");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagSByte function:


"gs_tag_SByte" is the name of the tag.
1. Read the value of the tag and temporarily store it in lValue.
2. Executing user-defined code for processing return values.

2246

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetTagSByteStateQCWait example

{
DWORD dwState;
DWORD dwQC;
long lValue;
dwState = 0xFFFFFFFF;
//Get the tag value
lValue = GetTagSByteStateQCWait("gs_tag_SByte",&dwState, &dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagSByteStateQCWait function:


"gs_tag_SByte" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read the value of the tag and temporarily store it in lValue. The function puts the tag status
in dwState and the quality code in dwQC.
2. Executing user-defined code for processing return values.

GetTagSByteStateWait example

{
DWORD dwstate;
long lValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
lValue = GetTagSByteStateWait("gs_tag_SByte",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagSByteStateWait function:


"gs_tag_SByte" is the name of the tag.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2247

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read the value of the tag and temporarily store it in lValue. The function puts the tag status
in dwstate.
2. Executing user-defined code for processing return values.

GetTagWord example

{
WORD wValue;
//Get the current value of the tag
wValue = GetTagWord("gs_tag_word");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagWord function:


"gs_tag_word" is the name of the tag.
1. Read out the value of the tag and temporarily store it in wValue.
2. Executing user-defined code for processing return values.

GetTagWordStateQCWait example

{
DWORD dwState;
DWORD dwQC;
WORD wValue;
dwState = 0xFFFFFFFF;
//Get the tag value
wValue = GetTagWordStateQCWait("gs_tag_word",&dwState, &dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagWordStateQCWait function:

2248

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"gs_tag_word" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in wValue. The function puts the tag
status in dwState and the quality code in dwQC.
2. Executing user-defined code for processing return values.

GetTagWordStateWait example

{
DWORD dwstate;
WORD wValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
wValue = GetTagWordStateWait("gs_tag_word",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of then GetTagWordStateWait function:


"gs_tag_word" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in wValue. The function puts the tag
status in dwstate.
2. Executing user-defined code for processing return values.

GetText example

{
char* pszValue = NULL;
char szValue[13];
//Get the Text which is actually set
pszValue = GetText(lpszPictureName,"StaticText1");
if(pszValue != NULL)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2249

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

{
//Copy the string
strncpy(szValue,pszValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetText function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
1. Read out the text in the object StaticText1 and temporarily store it in pszValue.
2. If a valid value has been returned, store the return value of the function in the local string
szValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

GetTop example

{
long lPos;
//Get the y-Position of the Object
lPos = GetTop(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTop function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
1. Read out the current Y position of the object and temporarily store it in lPos.
2. Executing user-defined code for processing return values.

2250

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

GetVisible example

{
BOOL bVisible;
//Get the visibility
bVisible = GetVisible(lpszPictureName,"GraphicObject1");
if(bVisible)
{
// User defined code if the
// object is visible
...
}
else
{
// User defined code if the
// object is not visible
...
}
}

Parameters of the GetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
1. Read out whether the object is visible or not and temporarily store in bVisible.
2. Executing user-defined code, depending on the return value of the function.

GetWidth example

{
long lWidth;
//Get the width of the object
lWidth = GetWidth(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetWidth function:


"lpszPictureName" is the name of the picture in which the object was configured.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2251

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"WinCCLogo" is the name of the object.
1. Read out the current width of the object and temporarily store it in lWidth.
2. Executing user-defined code for processing return values.

3.15.4.4

Examples - H to S

InquireLanguage example

{
DWORD count;
DWORD* language;
int i;
//Count the installed languages
language = InquireLanguage(&count);
printf("##################### INQUIRE LANGUAGE ####################");
//Print out the count of languages
printf ( "\r\nCount Languages=%d\r\n", count );
//print out which languages are installed
for (i=1;i<=count; i++)
{
printf ("\r\n%d.language=%x", i,*language++);
}
}

1. Determine the languages configured for the runtime. In language the language IDs are
temporarily stored. In count the number of languages is temporarily stored.
2. The number of determined languages is output.
3. All determined language IDs are displayed.

ProgramExecute example

{
//start the program calc.exe
ProgramExecute("C:\\Winnt\\system32\\calc.exe");
}

As parameter the file is to be specified with its path.

2252

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

ResetFilter example

{
BOOL ret;
MSG_FILTER_STRUCT Filter;
CMN_ERROR Error;
//delete the whole Filter struct
memset( &Filter, 0, sizeof( MSG_FILTER_STRUCT ) );
//set an empty filter struct
AXC_SetFilter("gs_alarm_00","Control1",&Filter,&Error);
}

1. Delete the filter structure.


2. Write empty values into the filter structure.

RPTJobPreview example

{
//Start the print preview of the specified print job
RPTJobPreview("Documentation Text Library");
}

Parameters of the "RPTJobPreview" function:


"Documentation Text Library" is the name of the print job.

RPTJobPrint example

{
//Print the specified print job out
RPTJobPrint("@Text library (compact)");
}

Parameters of the RPTJobPrint function:


@Text library (compact) is the name of the print job.

SysMalloc example

char* main(...);
{

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2253

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

char* returnwert;
char text[17];
returnwert=SysMalloc(17);
strcpy(returnwert,&text[0];
return returnwert;
}

3.15.4.5

Examples - SetAlarmHigh to SetPropChar

SetAlarmHigh example

{
//Set the upper limit for the warning
SetAlarmHigh(lpszPictureName,"Bar1",3.0);
}

Parameters of the SetAlarmHigh funtion:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"3.0" is the value to which the upper alarm limit will be set.

SetBackColor example

{
//Set the back color blue
SetBackColor(lpszPictureName,"StaticText1",CO_BLUE);
}

Parameters of the SetBackColor function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"CO_BLUE" is the constant for the color "Blue".
Note
Instead of using the constant for the color value you may also specify the color by means of
a hexadecimal value.

2254

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetBorderEndStyle example

{
SetBorderEndStyle(lpszPictureName,"Line", (2|393216));
}

Sets the left line end as filled arrow and the right one as filled circle. The left line end is stored
in the two lower bytes, the right line end in the two upper bytes. The parameters are transferred
by means of numeric values.

Example of setting the line ends with symbolic names

{
SetBorderEndStyle(lpszPictureName,"Line", (LE_FULL_ARROW|(LE_FULL_CIRCLE <<16));
}

Sets the left line end as filled arrow and the right one as filled circle. The left line end is stored
in the two lower bytes, the right line end in the two upper bytes. To address the right line end
the symbolic designation "LE_FULL_CIRCLE" is moved by 2 bytes or 16 bit into the two upper
bytes.

SetBorderStyle example

{
//Change the Border style
SetBorderStyle(lpszPictureName,"Rectangle1",3);
}

Parameters of the SetBorderStyle function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"3" is the line style which is set for the object.

SetColorAlarmHigh example

{
//Set the Color for the alarm high limit to red

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2255

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetColorAlarmHigh(lpszPictureName,"Bar1",CO_RED);
}

Parameters of the SetColorAlarmHigh function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"CO_RED" is the constant for the color red.
Note
Instead of using the constant for the color value you may also specify the color by means of
a hexadecimal value.

Example - SetCursorMode

{
//Set the Cursor Mode to Alpha cursor
SetCursorMode(lpszPictureName,"GraphikObjekt1",FALSE);
}

Parameters of the SetCursorMode function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
"FALSE" signifies: Cursor mode "Alpha-Cursor" is set.

SetFilling example

{
//Set the dynamic filling true
SetFilling(lpszPictureName,"Rectangle1",TRUE);
}

Parameters of the SetFilling function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"TRUE" means: Activating dynamic filling.

2256

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFillingIndex example

{
//Set the Filling of Rectangle1 to 10
SetFillingIndex(lpszPictureName,"Rectangle1",10);
}

Parameters of the SetFillingIndex function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"10" is the fill level which is assigned to the object.

SetFillStyle example

{
//Change the fill style
SetFillStyle(lpszPictureName,"Rectangle1",196617);
}

Parameters of the SetFillStyle function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"196617" is the fill pattern (brick wall) which is set for the object.

SetFlashBackColor example

{
//Set the flashing to True
SetFlashBackColor(lpszPictureName,"Group1",TRUE);
}

Parameters of the SetFlashBackColor function


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
"TRUE" means: Activating flashing of the background color.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2257

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetFlashBackColorOn example

{
//Set the Flash color for the state on to red
SetBackFlashColorOn(lpszPictureName,"Group1",CO_RED);
}

Parameters of the SetBackFlashColorOn function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
"CO_Red" is the constant for the color "Red".
Note
Instead of using the constant for the color value you may also specify the color by means of
a hexadecimal value.

SetFlashRateFlashPic example

{
//Set the flash rate to 0
SetFlashRateFlashPic(lpszPictureName,"Statusdisplay1",0);
}

Parameters of the SetFlashRateFlashPic function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Status display1" is the name of the object.
"0" is the flash frequency of the object.

SetFocus example

{
//Set the Focus on the Object Button 1
Set_Focus(lpszPictureName,"Button1");
}

Parameters of the Set_Focus function


"lpszPictureName" is the name of the picture in which the object was configured.

2258

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"Button1" is the name of the object on which the focus is set.

SetFontBold example

{
//Set the displayed Text bold
SetFontBold(lpszPictureName,"StatischerText1",TRUE);
}

Parameters of the SetFontBold function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"TRUE" means: The text is written in bold face.

SetFontSize example

{
//Set Font Size to 12
SetFontSize(lpszPictureName,"StaticText1",12);
}

Parameters of the SetFontSize function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"12" is the font size to which the text is set.

SetHeight example

{
//Set the height of the object to 100
SetHeight(lpszPictureName,"WinCCLogo",100);
}

Parameters of the SetHeight function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2259

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"100" is the height to which the object is set.

SetHiddenInput example

{
//Set the hidden input true
SetHiddenInput(lpszPictureName,"IOField1",TRUE);
}

Parameters of the SetHiddenInput function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"TRUE" means: Activating the hidden input.

SetLanguage example

{
//German
SetLanguage(0x0407);
}

The Runtime language is set to German.

SetLeft example

{
//Set the x-position to 0
SetLeft(lpszPictureName,"WinCCLogo",0);
}

Parameters of the SetLeft function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"0" is the X position to which the object is set.

2260

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetLink example

{
LINKINFO linkinfo;
//Set the link type
linkinfo.LinkType = 1;
//Set the update cycle
linkinfo.dwCycle = 0;
//set the Structmember
strcpy(linkinfo.szLinkName, "U08i_link_00");
//Set the connection to the tag
SetLink(lpszPictureName,"Bar1","Process",&linkinfo);
}

Parameters of the SetLink function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"Process" is the property connected to a tag.
"&linkinfo" is the address of the linkinfo structure.
1. Set the connection type for the process property to direct connection.
2. Set the update cycle to "Upon change".
3. Set the tag name to U08i_link_00.

SetMarker example

{
//Set the marker visible
SetMarker(lpszPictureName,"Bar1",TRUE);
}

Parameters of the SetMarker function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"TRUE" means: The marker is displayed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2261

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetOutputValueDouble example

{
//Set the output value of the IO field to 55.5
SetOutputValueDouble(lpszPictureName,"IOField1",55.5);
}

Parameters of the SetOutputValueDouble function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"55.5" is the value which is output.

SetPictureDown example

{
//Set the picture name to activated.bmp
SetPictureDown(lpszPictureName,"Roundbutton1","activated.bmp");
}

Parameters of the SetPictureDown function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
"activated.bmp" is the picture name of the picture to be displayed in round button 1.

SetPictureName example

{
//Set the picture name cool_man.bmp
SetPictureName(lpszPictureName,"GraphicObject1","cool_man.bmp");
}

Parameters of the SetPictureName function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
"cool_man.bmp" is the picture name of the picture to be displayed in graphic object 1.

2262

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetPictureUp example

{
//Set the picture name to deactivated.bmp
SetPictureUp(lpszPictureName,"Roundbutton1","deactivated.bmp");
}

Parameters of the SetPictureUp function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
"deactivated.bmp" is the picture name of the picture to be displayed in round button 1.

SetPosition example

{
//Set the Slider Position to 30
SetPosition(lpszPictureName,"Control1",30);
}

Parameters of the SetPosition function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
"30" is the position to which the slider is to be set.

SetPropBOOL example

{
//Set the visibility TRUE
SetPropBOOL("lpszPictureName","EAFeld1","Visible",TRUE);
}

Parameters of the SetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"TRUE" means: The object is intended to be visible.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2263

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetPropChar example

{
//Set the property Tooltiptext
SetPropChar("gs_graph_eafield","IOField1","ToolTipText","Tooltiptext1 ");
}

Parameters of the SetPropChar function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"Tooltiptext" is the object property.
"Tooltiptext 1" is the value to which the property is to be set.

3.15.4.6

Examples - SetRangeMax to SetWidth

SetRangeMax example

{
//Set the Upper Scale Limit
SetRangeMax(lpszPictureName,"Control1",80);
}

Parameters of the SetRangeMax function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
"80" is the upper limit to be assigned to the object.

SetRangeMin example

{
//Set the lower Scale Limit
SetRangeMin(lpszPictureName,"Control1",0);
}

Parameters of the SetRangeMin function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.

2264

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"0" is the lower limit to be assigned to the object.

SetScaling example

{
//Set the Scaling Visible
SetScaling(lpszPictureName,"Bar1",TRUE);
}

Parameters of the SetScaling function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"TRUE" means: Making the scaling visible.

SetTagBit example

{
//Set the tag to true
SetTagBit("gs_tag_bit",TRUE);
}

Parameters of the SetTagBit function:


"gs_tag_bit" is the name of the tag.
"TRUE" is the value to be written to the tag.

Beispiel SetTagBitStateWait

{
DWORD dwstate;
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the value of the tag to TRUE
//dwstate is the tag state
SetTagBitStateWait("gs_tag_bit",TRUE,&dwstate);
//User defined code where the
//user can do something with the return value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2265

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

...
}

Parameters of the SetTagBitStateWait function:


"gs_tag_bit" is the name of the tag.
"TRUE" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

SetTagChar example

{
//Set the tag to Example text
SetTagChar("gs_tag_char","Example Text");
}

Parameters of the SetTagChar function:


"gs_tag_char" is the name of the tag.
"Example text" is the value to be written to the tag.

SetTagCharStateWait example

{
DWORD dwstate;
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to Example Text
//dwstate is the tag state
SetTagCharStateWait("gs_tag_char","Example Text",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagCharStateWait function:

2266

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
"gs_tag_char" is the name of the tag.
"Example text" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

SetTagFloat example

{
//Set the tag to 55.4711
SetTagFloat("gs_tag_float",55.4711);
}

Parameters of the SetTagFloat function:


"gs_tag_float" is the name of the tag.
"55.4711" is the value to be written to the tag.

SetTagFloatStateWait example

{
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to 55.4711
//dwstate is the tag state
SetTagFloatStateWait("gs_tag_float",55.4711,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagFloatStateWait function:


"gs_tag_float" is the name of the tag.
"55.4711" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2267

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

SetTagMultiStateWait example

{
#define DATA_SIZE 5
DWORD dwData[DATA_SIZE];
//define all tags
BOOL lValue1;
long lValue2 ;
char szValue3[_MAX_PATH];
float lValue4;
char lValue5;
// Fill the tags with the values
// you want to set into the WinCC tags
...
//Set the WinCC tags
SetTagMultiStateWait(dwData,"%d%d%s%f%d","gs_tag_bit",lValue1,
"gs_tag_SByte",lValue2,
"gs_tag_char",szValue3,
"gs_tag_float",lValue4,
"gs_tag_word",lValue5);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagMultiStateWait function:


"dwData" is the DWord-Array, in which the tag statuses are stored.
"%d%d%s%f%d" are the type descriptions of the tags to be written.
"gs_tag_bit" is the WinCC tag to be written.
"lValue1" is the tag to whose value the WinCC tag gs_tag_bit is to be set.
"gs_tag_SByte" is the WinCC tag to be written.
"&lValue2" is the tag to whose value the WinCC tag gs_tag_SByte is to be set.
The other parameters are to be handled in the same way as those described previously.
1. Creating a DWord-Array with the required size (Number of tags).
2. Creating tags whose values are to be written to the WinCC tags.
3. Writing the values of the previously created and filled tags to the WinCC tags.l

2268

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
4. Executing user-defined code for processing return values.

SetTagMultiWait example

BOOL ok;
ok=SetTagMultiWait("%d%s%f", "Ernie_word", 16,
"Ernie_char", "Hello World",
"Ernie_double", 55.4711);

SetTagPrefix example

{
//Set the TagPrefix to Struct1.
SetTagPrefix(lpszPictureName,"PicWindow1","Struct1.");
//Set the picture name again to update the tag prefix
SetPictureName(lpszPictureName,"PicWindow1","gs_graph_eafield");
}

Parameters of the SetTagPrefix function:


"lpszPictureName" is the name of the picture in which the object was configured.
"PictureWindow1" is the name of the object.
"Struct1." is the tag prefix to be set at picture window 1.
1. Set the tag prefix of the object "PictureWindow1" to "Struct1.".
2. Reset the name of the picture shown in the picture window to make the tag prefix setting
effective.

SetTagRaw example

{
#define DATA_SIZE 3
BYTE byData[DATA_SIZE];
// Fill the Byte array with the values
// you want to set into the raw data tag
...
//Set the tag to the default values
SetTagRaw("gs_tag_raw",byData,DATA_SIZE);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2269

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Parameters of the SetTagRaw function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array whose values are written to the raw data tags.
"DATA_SIZE" is the number of values that will be written.
1. Creating a BYTE-Array with the required size (size of the raw data tag).
2. Filling the BYTE-Array with the values to be written.
3. Writing the values of the BYTE-Array to the raw data tag.

SetTagRawStateWait example

{
#define DATA_SIZE 3
BYTE byData[DATA_SIZE];
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
// Fill the Byte array with the values
// you want to set into the raw data tag
...
//Set the tag to the default values
//dwstate is the tag state
SetTagRawStateWait("gs_tag_raw",byData,DATA_SIZE,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagRawStateWait function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array whose values are written to the raw data tags.
"DATA_SIZE" is the number of values that will be written.
"&dwstate" is the address of the tags in which the tag status is to be stored.

2270

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
1. Creating a BYTE-Array with the required size (size of the raw data tag).
2. Filling the BYTE-Array with the values to be written.
3. Writing the values of the BYTE-Array to the raw data tag.
4. Executing user-defined code for processing return values.

SetTagSByte example

{
//Set the tag to 50
SetTagSByte("gs_tag_SByte",50);
}

Parameters of the SetTagSByte function:


"gs_tag_SByte" is the name of the tag.
"50" is the value to be written to the tag.

Beispiel SetTagSByteStateWait

{
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to 50
//dwstate is the tag state
SetTagSByteStateWait("gs_tag_SByte",50,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagSByteStateWait:


"gs_tag_SByte" is the name of the tag.
"50" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2271

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetTagWord example

{
//Set the tag to 50
SetTagWord("gs_tag_word",50);
}

Parameters of the SetTagWord function:


"gs_tag_word" is the name of the tag.
"50" is the value to be written to the tag.

Beispiel SetTagWordStateWait

{
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to 50
//dwstate is the tag state
SetTagWordStateWait("gs_tag_word",50,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagWordStateWait funtion:


"gs_tag_word" is the name of the tag.
"50" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

SetText example

2272

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//Set the text Example Text on the StaticText field


SetText(lpszPictureName,"StaticText1","Example Text");
}

Parameters of the SetText function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"ExampleText" is the text which is to be output.

SetTop example

{
//Set the y-position to 0
SetTop(lpszPictureName,"WinCCLogo",140);
}

Parameters of the SetTop function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"140" is the Y position to which the object is set.

SetVisible example

{
//Set the Object visible
SetVisible(lpszPictureName,"GraphicObject1",TRUE);
}

Parameters of the SetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
"TRUE" means: The object is intended to be visible.

SetWidth example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2273

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//Set the width of the object to 400


SetWidth(lpszPictureName,"WinCCLogo",400);
}

Parameters of the SetWidth function


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"400" is the width to which the object is set.

3.15.4.7

Examples - T to Z

TlgGetNumberOfColumns example

{
char text[5];
long int columns
//get number of Columns
columns = GetNumberOfColumns("TableControl_01");
//convert long int to char
sprintf(text,"%d",columns);
//set text on TextField5
SetText(lpszPictureName,"StaticText5",text);
}

Parameters of the TlgGetNumberOfColumns function:


"TableControl_01" is the name of the WinCC Table Control.
1. Temporarily store the return value of the TlgGetNumberofColumns in columns.
2. Temporarily store the return value in the text string.
3. Output the return value to a static text field.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2274

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgGetNumberOfColumns example

{
char text[5];
long int columns
//get number of Columns
columns = GetNumberOfColumns("TableControl_01");
//convert long int to char
sprintf(text,"%d",columns);
//set text on TextField5
SetText(lpszPictureName,"StaticText5",text);
}

Parameters of the TlgGetNumberOfColumns function:


"TableControl_01" is the name of the WinCC Table Control.
1. Temporarily store the return value of the TlgGetNumberofColumns in columns.
2. Temporarily store the return value in the text string.
3. Output the return value to a static text field.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

TlgGetNumberOfRows example

{
char text[5];
long int rows;
//get number of rows
rows = TlgGetNumberOfRows("TableControl_01");

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2275

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//convert long int to char


sprintf(text,"%d",rows);
//set text on TextField5
SetText(lpszPictureName,"StaticText5",text);
}

Parameters of the TlgGetNumberOfRows function:


TableControl_01 is the name of the WinCC Table Control.
1. Temporarily store the return value of the TlgGetNumberofRows in rows.
2. Temporarily store the return value in the text string.
3. Output the return value to a static text field.

TlgGetRulerTimeTrend example

{
SYSTEMTIME systime;
WORD wHour;
WORD wMin;
WORD wSec;
char szTime[10];
//Get the current systemtime
systime = TlgGetRulerTimeTrend("TrendControl_01",0);
//Get the hour
wHour = systime.wHour;
//Get the minute
wMin = systime.wMinute;
//Get the second
wSec = systime.wSecond;
//
sprintf(szTime,"%d:%d:%d",wHour,wMin,wSec);
//output the variable name
SetText(lpszPictureName,"StaticText7",szTime);
}

1. Read out the current system time.


2. Read out hour, minute and second from the SYSTEMTIME structure.
3. Create a string containing the time.
4. Output the current time.

2276

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

TlgGetRulerVariableNameTrend example

{
char* pszVarName = NULL;
char szVarName[20];
//Get the ruler variable name
pszVarName = TlgGetRulerVariableNameTrend("TrendControl_01",0);
if (pszVarName != NULL)
{
//Copy the string
strncpy(szVarName,pszVarName,19);
}
//output the variable name
SetText(lpszPictureName,"StaticText6",szVarName);
}

Parameters of the TlgGetRulerVariableNameTrend function:


"TrendControl_01" is the name of the WinCC Trend Control.
"0" is the number of the trend.
1. Temporarily store the return value of the TlgGetRulerVariableNameTrend function in
pszVarName.
2. If a valid value has been returned, copy the return value to szVarName.
3. Output the return value to a static text field.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

TlgTrendWindowPressOpenDlgButton example

{
//Opens the Property Dialog
TlgTrendWindowPressOpenDlgButton("TrendControl_01");
}

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2277

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Parameters of the TlgTrendWindowPressOpenDlgButton function:
"TrendControl_01" is the window title of WinCC Trend Control.

TlgTrendWindowPressStartStopButton example

{
//start/stop the actualization
TlgTrendWindowPressStartStopButton("TrendControl_01");
}

Parameters of the TlgTrendWindowPressStartStopButton function:


"TrendControl_01" is the window title of WinCC Trend Control.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

TlgTrendWindowPressZoomInButton example

{
//zoom in
TlgTrendWindowPressZoomInButton("TrendControl_01");
}

Parameters of the TlgTrendWindowPressZoomInButton function:


"TrendControl_01" is the window title of WinCC Trend Control.

TlgTrendWindowPressZoomOutButton example

{
// zoom out
TlgTrendWindowPressZoomOutButton("TrendControl_01");
}

2278

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Parameters of the TlgTrendWindowPressZoomOutButton function:
"TrendControl_01" is the window title of WinCC Trend Control.

3.15.4.8

Examples of WinCC controls

How to add elements to a WinCC OnlineTrendControl


Introduction
In the following example, insert value columns with properties in an empty WinCC
OnlineTableControl and link the columns to archive tags.

Prerequisite
An archive is created in the "Tag Logging Editor" with three archive tags.
A "WinCC OnlineTableControl" with the name "Control2" is inserted in the process picture
in the Graphics Designer.
A button is inserted in the Graphics Designer. You have configured, for example, the event
"mouse click" with a C action and the following script for the button.

Example

//enable BackColor
SetPropBOOL(lpszPictureName, "Control2", "UseColumnBackColor",TRUE);
//add new TimeColumn and assign column length
SetPropChar(lpszPictureName, "Control2", "TimeColumnAdd", "myRefTimeColumn");
SetPropWord(lpszPictureName, "Control2", "TimeColumnLength", 20);
//add new ValueColumn and assign properties
SetPropChar(lpszPictureName, "Control2", "ValueColumnAdd", "myValueTable1");
SetPropWord(lpszPictureName, "Control2", "ValueColumnProvider", 1);
SetPropChar(lpszPictureName, "Control2", "ValueColumnTagName", "Process value archive\
\PDL_ZT_1");
SetPropWord(lpszPictureName, "Control2", "ValueColumnBackColor", RGB(255,255,255));
SetPropChar(lpszPictureName, "Control2", "ValueColumnTimeColumn", "myRefTimeColumn");
//add new ValueColumn and assign properties
SetPropChar(lpszPictureName, "Control2", "ValueColumnAdd", "myValueTable2");
SetPropWord(lpszPictureName, "Control2", "ValueColumnProvider", 1);
SetPropChar(lpszPictureName, "Control2", "ValueColumnTagName", "Process value archive\
\PDL_ZT_2");
SetPropWord(lpszPictureName, "Control2", "ValueColumnBackColor", RGB(0,255,255));
SetPropChar(lpszPictureName, "Control2", "ValueColumnTimeColumn", "myRefTimeColumn");
//add new ValueColumn and assign properties
SetPropChar(lpszPictureName, "Control2", "ValueColumnAdd", "myValueTable3");

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2279

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

SetPropWord(lpszPictureName,
SetPropChar(lpszPictureName,
\PDL_ZT_3");
SetPropWord(lpszPictureName,
SetPropChar(lpszPictureName,

"Control2", "ValueColumnProvider", 1);


"Control2", "ValueColumnTagName", "Process value archive\
"Control2", "ValueColumnBackColor", RGB(255,255,0));
"Control2", "ValueColumnTimeColumn", "myRefTimeColumn");

Result

How to add elements to a WinCC OnlineTrendControl


Introduction
In the following example you insert the Trend Window, Value Axis, Time Axis and Trends
elements into an empty WinCC OnlineTrendControl.

Prerequisite
An archive is created in the "Tag Logging Editor" with three archive tags.
A "WinCC OnlineTrendControl" with the name "Control2" is inserted in the process picture
in the Graphics Designer.
A button is inserted in the Graphics Designer. You have configured, for example, the event
"mouse click" with a C action and the following script for the button.

Example

//create reference to new window, time and value axis


SetPropChar(lpszPictureName, "Control2", "TrendWindowAdd", "myWindow");
SetPropChar(lpszPictureName, "Control2", "TimeAxisAdd", "myTimeAxis");
SetPropChar(lpszPictureName, "Control2", "ValueAxisAdd", "myValueAxis");

2280

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

//assign time and value axis to the window


SetPropChar(lpszPictureName, "Control2", "TimeAxisTrendWindow", "myWindow");
SetPropChar(lpszPictureName, "Control2", "ValueAxisTrendWindow", "myWindow");
//add new trend and assign properties
SetPropChar(lpszPictureName, "Control2",
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
\PDL_ZT_1");
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
//add new trend and assign properties
SetPropChar(lpszPictureName, "Control2",
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
\PDL_ZT_2");
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
//add new trend and assign properties
SetPropChar(lpszPictureName, "Control2",
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
\PDL_ZT_3");
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",

3.15.5

Lists

3.15.5.1

Bar direction

"TrendAdd", "myTrend1");
"TrendProvider", 1);
"TrendTagName", "Process value archive\
"TrendColor", RGB(255,0,0));
"TrendTrendWindow", "myWindow");
"TrendTimeAxis", "myTimeAxis");
"TrendValueAxis", "myValueAxis");

"TrendAdd", "myTrend2");
"TrendProvider", 1);
"TrendTagName", "Process value archive\
"TrendColor", RGB(0,255,0));
"TrendTrendWindow", "myWindow");
"TrendTimeAxis", "myTimeAxis");
"TrendValueAxis", "myValueAxis");

"TrendAdd", "myTrend3");
"TrendProvider", 1);
"TrendTagName", "Process value archive\
"TrendColor", RGB(0,0,255));
"TrendTrendWindow", "myWindow");
"TrendTimeAxis", "myTimeAxis");
"TrendValueAxis", "myValueAxis");

Bar direction Numeric value


Up

bottom

left

right

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2281

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.5.2

Bar Scaling

Numeric
value

Bar Scaling

Linear (same weighting)

Logarithmic (low values emphasized)

Negative logarithmic (high values emphasized)

Automatic (linear)

Tangential (high and low values emphasized)

Square (high values emphasized)

Cubic (high values strongly emphasized)

3.15.5.3

Flash frequencies

Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Since the flashing is performed by means of software engineering, the flash frequency is both
system-dependent and hardware-bound (number of objects, processor speed, RAM size,
update time etc.).
The information in the table is therefore only for orientation purposes.

3.15.5.4

I/O field, output format


The display of numeric values output into an I/O field is controlled by a format specification.
A format indication consists of one or several formatting characters. The valid formatting
characters and their meaning are listed in the following table:

2282

Charact Meaning
ers

Note

Positive numbers are displayed


with signs

Always in the first position of the format specification


May only appear once in the format specification

0(ZER
O)

Leading and ending zeros are


output.

Always following s
If s is missing, it is in the first position
May only appear once in the format specification

Specifies the position of a digit in


the number to be output

May appear in the format indication as often as required.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Charact Meaning
ers

Note

,
(comm
a)

Position of the decimal point

Returns the number in exponential


form

Always at the last position of the format specification

Example:
Numb Format
er

Representation

123,4
55

999,999

123,455

123,4
55

999,99

123,46

123,4
55

9999,9999 123,4550

123,4
55

s09999.99 +0123,4550
99

123,4
55

9.99999e

1.23455e+002

If the decimal point is left out in the format specification the decimal places are not displayed
and the number is rounded to an integer.
If fewer decimal positions are provided in the format specification than the number actually
has, only the decimal places specified in the format specification are output.
The number is rounded correspondingly.
If the number has more places before the decimal point than specified in the format
specification, three asterisks (***) are output which means that the number cannot be displayed
in this format.

3.15.5.5

I/O field, data type of the field content

Data type

Numeric value

Binary

decimal

string

hexadeci
mal

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2283

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.5.6

3.15.5.7

I/O field, field type

Type

Numeric value

Edition

Input

Output and
input

Element alignment in check boxes and radio boxes

Alignment Numeric value

3.15.5.8

left

right

-1

Color chart
The 16 primary colors are:

2284

Color

Color value
(Hex)

symbolic constant

Red

0x000000F
F

CO_RED

Dark red

0x00000080 CO_DKRED

Green

0x0000FF0
0

Dark green

0x00008000 CO_DKGREEN

Blue

0x00FF000
0

Dark blue

0x00800000 CO_DKBLUE

Cyan

0x00FFFF0
0

Dark cyan

0x00808000 CO_DKCYAN

Yellow

0x0000FFF
F

Dark yellow

0x00008080 CO_DKYELLOW

Magenta

0x00FF00F
F

Dark magenta

0x00800080 CO_DKMAGENTA

Light gray

0x00C0C0C CO_LTGRAY
0

Gray

0x00808080 CO_DKGRAY

CO_GREEN

CO_BLUE

CO_CYAN

CO_YELLOW

CO_MAGENTA

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Color

Color value
(Hex)

symbolic constant

Black

0x00000000 CO_BLACK

White

0x00FFFFF
F

CO_WHITE

Note
The symbolic constants are externally predefined by #define and provied by WinCC.

3.15.5.9

Format descriptors
For format descriptors the following type is expected:
%d = DWORD / Int
%f = double
%s = char*
It is also possible e.g. to read a text tag with %d if provisions are made that the value can be
mapped in a DWORD.
The following provision makes sure the value can be mapped:
Variab Form
le
at

C-tag

Bit

%d

DWORD / long int signed

Byte

%d

DWORD / long int signed

SByte

%d

DWORD / long int signed

Word

%d

DWORD / long int signed

SWor
d

%d

DWORD / long int signed

DWor
d

%d

DWORD / long int signed

SDWo %d
rd

DWORD / long int signed

Float

%f

double

Doubl
e

%f

double

Char

%s

char*

Note
If a "DWORD," for which the 32nd bit is set, is to be read, a format descriptor must be used
for unsigned integers (%u).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2285

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.5.10 Fill pattern


Fill pattern

Value

Transparent

65536

Solid

Fill pattern

2286

Value

Fill pattern

Value

Fill pattern

Value

1048576

196611

196627

1048577

196612

196628

1048578

196613

196629

1048579

196614

196630

1048832

196615

196631

1048833

196616

196632

1048834

196617

196633

1048835

196618

196634

131072

196619

196635

131073

196620

196636

131074

196621

196637

131075

196622

196638

131076

196623

196639

196608

196624

196640

196609

196625

196641

196610

196626

196642

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Note
The "Solid" fill pattern fills the object with the set background color.

3.15.5.11 Line styles

Line style

hidden

symbolic name

Value

LS_SOLID

LS_DASH

LS_DOT

LS_DASHDOT

LS_DASHDOT
DOT

LS_INVISIBLE

3.15.5.12 Line end style

Line end

symbolic name

Value for the left line ends

Value for the right line ends

LE_NO

LE_HOLLOW_ARROW

65536

LE_FULL_ARROW

131072

LE_CFULL_ARROW

196608

LE_LINE

262144

LE_HOLLOW_CIRCLE

327680

LE_FULL_CIRCLE

393216

Note
From a line width > 5 the line end "empty circle" is displayed as filled circle.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2287

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.5.13 List types


List type

Numeric value

decimal

Binary

bit

3.15.5.14 Language ID
WinCC only supports the SUBLANG_DEFAULT languages of Windows.
symbolic name

Value
(hexadecimal)

LANG_ARABIC

0x0401

LANG_AFRIKAANS

0x0436

LANG_ALBANIAN

0x041C

Abbreviation

LANG_BASQUE

0x042D

LANG_BULGARIAN

0x0402

LANG_BYELORUSSIAN

0x0423

LANG_CATALAN

0x0403

LANG_CHINESE

0x0404

LANG_CROATIAN

0x041A

LANG_CZECH

0x0405

CSY

LANG_DANISH

0x0406

DAN

LANG_DUTCH

0x0413

NLD

LANG_ENGLISH

0x0409

ENU

LANG_ESTONIAN

0x0425

LANG_FAEROESE

0x0438

LANG_FARSI

0x0429

LANG_FINNISH

0x040B

FIN

LANG_FRENCH

0x040C

FRA

LANG_GERMAN

0x0407

DEU

LANG_GREEK

0x0408

LANG_HEBREW

0x040D

LANG_HUNGARIAN

0x040E

HUN

LANG_ICELANDIC

0x040F

ISL

LANG_INDONESIAN

0x0421

LANG_ITALIAN

0x0410

LANG_JAPANESE

0x0411

LANG_KOREAN

0x0412

LANG_LATVIAN

0x0426

LANG_LITHUANIAN

0x0427

2288

ITA

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
symbolic name

Value
(hexadecimal)

Abbreviation

LANG_NORWEGIAN

0x0414

NOR

LANG_POLISH

0x0415

PLK

LANG_PORTUGUESE

0x0416

PTB

LANG_ROMANIAN

0x0418

LANG_RUSSIAN

0x0419

RUS

LANG_SLOVAK

0x041B

SKY

LANG_SLOVENIAN

0x0424

LANG_SORBIAN

0x042E

LANG_SPANISH

0x040A

ESP

LANG_SWEDISH

0x041D

SVE

LANG_THAI

0x041E

LANG_TURKISH

0x041F

LANG_UKRAINIAN

0x0422

TRK

3.15.5.15 Text alignment

Horizon
tal

Alignmen Numeric value


t
left

centered

right

Vertica Alignmen Numeric value


l
t
Up

centered

bottom

3.15.5.16 Tag statuses

Value
(decimal)

Value
(hexdecimal)

Meaning

0x0000

No error

0x0001

Connection to partner not established

0x0002

Handshake error

0x0004

Network module defective

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2289

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Value
(decimal)

Value
(hexdecimal)

Meaning

0x0008

Configured upper limit exceeded

16

0x0010

Configured lower limit exceeded

32

0x0020

Format upper limit exceeded

64

0x0040

Format lower limit exceeded

128

0x0080

Conversion error

256

0x0100

Tag initialization value

512

0x0200

Tag replacement value

1024

0x0400

Channel addressing error

2048

0x0800

Tag not found or not available

4096

0x1000

Access to tag not permitted

8192

0x2000

Timeout, no check-back message from the channel

16384

0x4000

Server not available.

3.15.6

Structure definitions

3.15.6.1

Structure definition CCAPErrorExecute

typedef struct {
DWORD dwCurrentThreadID;
DWORD dwErrorCode1;
DWORD dwErrorCode2;
BOOL bCycle;
char* szApplicationName;
char* szFunctionName;
char* szTagName;
LPVOID lpParam;
DWORD dwParamSize;
DWORD dwCycle;
CMN_ERROR* pError;
} CCAPErrorExecute;

2290

Thread ID of the current thread


Error code 1
Error code 2
cycle/acycle
Name of the application
Name of the function
Name of the tag
Pointer to the action stack
Size of the action stack
Cycle of the variable
Pointer to CMN_ERROR

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Members
The meaning of the individual error IDs and the structure elements depending on them are
specified in the following table:

1007001

Action requires exception

1007001

Exception when
accessing the return
result

1007001

4097

Stack overflow while


executing the action

1007001

4098

The action contains a


division by 0

1007001

4099

The action contains an


access to a non-existing
symbol

1007001

4100

The action contains an


access violation

1007004

1007005

Action does not include a


P code.

1007005

Incorrect function name

1007005

Return value type is


invalid

1007005

32768ff

Ciss Compiler error when


loading the action

1007006

1007006

1007006

Tag cannot be returned in


the desired format

1007006

Tag returns status


violation, status present
in
CMN_ERROR.dwError1

1007007

Error in PDLRTGetProp

1007007

Error in PDLRTSetProp

1007007

Error with DM call

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Function is not known

Tag is not defined


Tag timeout

2291

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Error structure
The OnErrorExecute function uses the error structure to evaluate or to output error messages,
if marked by an "x" in the pError column.

See also
Structure definition CMN_ERROR (Page 2295)

3.15.6.2

Structure definition CCAPTime

typedef struct {
DWORD dwCurrentThreadID;
DWORD dwCode;
BOOL bCycle;
char* szApplicationName;
char* szFunctionName;
LPVOID lpParam;
DWORD dwParamSize;
double dblTime;
DWORD dwFlags;
} CCAPTime;

ThreadID of the current Thread


Code
cycle/acycle
Name of the Application
Name of the Function
Pointer to the Action-Stack
size of the Action-Stack
flags

Members
dwCode
The structure element dwCode provides information on calling OnTime:
dwCode = 113

Call with time definition for each action

dwCode = 114

Call with time monitoring for each action

dwFlags
The structure element dwFlags provides information on the output type:
dwFlags = TRUE

The results are output to a file

dwFlags = FALSE

The results are output to the diagnostics window

2292

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

3.15.6.3

Structure definition CMN_ERROR

struct CMNERRORSTRUCT {
DWORD
dwError1,
DWORD
dwError2,
DWORD
dwError3,
DWORD
dwError4,
DWORD
dwError5;
TCHAR
szErrorText[MAX_ERROR_LEN];
}
CMN_ERROR

Description
The extended error structure contains the error code and an error text for the error that has
occurred. Each application can use the error structure to evaluate or to output error messages.

Members
dwError1 .. dwError5
These entries can be used in any way by the API functions.
The API descriptions inform about the values the respective entries contain in case of an error.
If not specified otherwise, the error codes are present in dwError1.
szErrorText
Buffer for the text description of the error cause
The content is determined from the resources and therefore language-dependent.

3.15.6.4

Structure definition DM_TYPEREF

typedef struct {
DWORD dwType;
DWORD dwSize;
char szTypeName[MAX_DM_TYPE_NAME + 1];
}
DM_TYPEREF;

Members
dwType
Specifies the tag type

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2293

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
DM_VARTYPE_BIT

Binary tag

DM_VARTYPE_SBYTE

Signed 8-bit value

DM_VARTYPE_BYTE

Unsigned 8-bit value

DM_VARTYPE_SWORD

Signed 16-bit value

DM_VARTYPE_WORD

Unsigned 16-bit value

DM_VARTYPE_SDWORD

Signed 32-bit value

DM_VARTYPE_DWORD

Unsigned 32-bit value

DM_VARTYPE_FLOAT

Floating-point number 32-bit IEEE 754

DM_VARTYPE_DOUBLE

Floating-point number 64-bit IEEE 754

DM_VARTYPE_TEXT_8

Text tag, 8-bit font

DM_VARTYPE_TEXT_16

Text tag, 16-bit font

DM_VARTYPE_RAW

Raw data type

DM_VARTYPE_STRUCT

Structure tag

DM_VARTYPE_TEXTREF

Text reference tag

dwSize
Specifies the length of the data type in bytes.
szTypeName
In the case of structure tags, contains the name of the structure type

3.15.6.5

Structure definition DM_VAR_UPDATE_STRUCT

typedef struct {
DM_TYPEREF dmTypeRef;
DM_VARKEY dmVarKey;
VARIANT dmValue;
DWORD dwState;
}
DM_VAR_UPDATE_STRUCT;

Members
dmTypeRef
Contains information on the tag type. For performance reasons, nothing is entered into this
structure in case of cyclic requirements.
dmVarKey
Specifies the tags to be edited.
dmValue
Tag value
Upon access to the value of the VARIANT a ".u." has to be inserted between the name of the
VARIANT and the name of the member.

2294

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Example:
// Supply variant
myVariant.vt = VT_I4;
myVariant.u.lVal = 233;
A description of the data type VARIANT can be found in the associated documentation. The
VARIANT dmValue must be initialized with VariantInit() before first use and enabled again with
VariantClear(&dmValue) after use. For this reason, the structure
DM_VAR_UPDATE_STRUCT must not be deleted with ZeroMemory() or memset().
dwState
Identifies the tag status.

See also
Tag statuses (Page 2289)
Structure definition DM_VARKEY (Page 2298)
Structure definition DM_TYPEREF (Page 2293)

3.15.6.6

Structure definition DM_VAR_UPDATE_STRUCTEX

typedef struct {
DM_TYPEREF dmTypeRef;
DM_VARKEY dmVarKey;
VARIANT dmValue;
DWORD dwState;
DWORD dwQualityCode;
}
DM_VAR_UPDATE_STRUCTEX;

Members
dmTypeRef
Contains information on the tag type. For performance reasons, nothing is entered into this
structure in case of cyclic requirements.
dmVarKey
Specifies the tags to be edited.
dmValue
Tag value
Upon access to the value of the VARIANT a ".u." has to be inserted between the name of the
VARIANT and the name of the member.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2295

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Example:
// Supply variant
myVariant.vt = VT_I4;
myVariant.u.lVal = 233;
A description of the data type VARIANT can be found in the associated documentation. The
VARIANT dmValue must be initialized with VariantInit() before first use and enabled again with
VariantClear(&dmValue) after use. For this reason, the structure
DM_VAR_UPDATE_STRUCTEX must not be deleted with ZeroMemory() or memset().
dwState
Identifies the tag status.
dwQualityCode
Identifies the tag quality code.

See also
Tag statuses (Page 2289)
Structure definition DM_VARKEY (Page 2298)
Structure definition DM_TYPEREF (Page 2293)

3.15.6.7

Structure definition DM_VARKEY

typedef struct {
DWORD dwKeyType;
DWORD dwID;
char szName[ MAX_DM_VAR_NAME + 1 ];
LPVOID lpvUserData;
}
DM_VARKEY;

Members
dwKeyType
Defines whether the tag is to be addressed by a key ID or by its name.
DM_VARKEY_ID Specification via key ID
DM_VARKEY_NAME Specification via tag name
dwID
Contains the key ID of the tags if dwKeyType is set accordingly

2296

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
szName
Contains the name of the tag if dwKeyType is set accordingly
lpvUserData
Pointer to application-specific data

3.15.6.8

Structure definition LINKINFO

typedef struct {
LINKTYPE LinkType;
DWORD dwCycle;
TCHAR szLinkName[256];
}
LINKINFO;

Members
LinkType
LinkType are enumeration constants defined in the "Trigger.h" file. They are to be integrated
into your script with the #include "Trigger.h" command and the corresponding enumeration
constants.
BUBRT_LT_NOLINK

no shortcut

BUBRT_LT_VARIABLE_DIRECT

direct tag

BUBRT_LT_VARIABLE_INDIRECT

indirect tag

BUBRT_LT_ACTION

C action

BUBRT_LT_ACTION_WIZARD

Dynamic Dialog

BUB_LT_DIRECT_CONNECTION

Direct connection

BUBRT_LT_ACTION_WIZARD_INPROC

Dynamic Dialog

For the function SetLink only the enumeration constants BUBRT_LT_VARIABLE_DIRECT and
BUBRT_LT_VARIABLE_INDIRECT may be used. The function GetLink allows to return all
listed enumeration constants.

dwCycle
Update cycle time
dwCycle

Update Cycle

255

Picture cycle

235

Window Cycle

Upon change

250ms

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2297

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
dwCycle

Update Cycle

500 ms

1s

2s

5s

10s

1min

5min

10min

10

1h

11-15

User cycle 1-5

szLinkName
Tag name

3.15.6.9

Structure definition MSG_FILTER_STRUCT

typedef struct {
CHAR
szFilterName[MSG_MAX_TEXTLEN+1];
WORD
dwFilter;
SYSTEMTIME st[2];
DWORD
dwMsgNr[2];
DWORD
dwMsgClass;
DWORD
dwMsgType[MSG_MAX_CLASS];
DWORD
dwMsgState;
WORD
wAGNr[2];
WORD
wAGSubNr[2];
DWORD
dwArchivMode;
char
szTB[MSG_MAX_TB][
MSG_MAX_TB_CONTENT+1]
DWORD
dwTB;
Double
dPValue[MSG_MAX_PVALUE][2];
DWORD
dwPValue[2];
DWORD
dwMsgCounter[2];
DWORD
dwQuickSelect;
}
MSG_FILTER_STRUCT;

Description
In this structure the filter criteria are specified.

2298

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions

Members
dwFilter
The filter conditions are defined by means of the following constants from the file "m_global.h":
MSG_FILTER_DATE_FROM

Date from

MSG_FILTER_DATE_TO

Date to

MSG_FILTER_TIME_FROM

Time from

MSG_FILTER_TIME_TO

Time to

MSG_FILTER_NR_FROM

Message number from

MSG_FILTER_NR_TO

Message number to

MSG_FILTER_CLASS

Message classes

MSG_FILTER_STATE

Message status

MSG_FILTER_AG_FROM

AS number from

MSG_FILTER_AG_TO

AS number to

MSG_FILTER_AGSUB_FROM

AG subnumber from

MSG_FILTER_AGSUB_TO

AG subnumber to

MSG_FILTER_TEXT

Message texts

MSG_FILTER_PVALUE

Process values

MSG_FILTER_COUNTER_FROM

Internal message counter from

MSG_FILTER_COUNTER_TO

Internal message counter to

MSG_FILTER_PROCESSMSG

Process messages

MSG_FILTER_SYSMSG

System messages

MSG_FILTER_BEDMSG

Operator messages

MSG_FILTER_DATE

Date from to

MSG_FILTER_TIME

Time from to

MSG_FILTER_NR

Message number from to

MSG_FILTER_VISIBLEONLY

Display visible messages

MSG_FILTER_HIDDENONLY

Display hidden messages

st
Date/time from - to
Where st[0] is the start time (from), st[1] the end time (to)
Assign these fields for the filter criteria: MSG_FILTER_DATE, MSG_FILTER_DATE_FROM,
MSG_FILTER_DATE_TO, MSG_FILTER_TIME, MSG_FILTER_TIME_FROM or
MSG_FILTER_TIME_TO
If a current time is needed for the transfer of a SYSTEMTIME parameter the function
GetLocalTime is to be used instead of GetSystemTime. As a rule there is a significant time
difference between these two functions.
dwMsgNr
Message number from - to
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2299

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Where dwMsgNr[0] is the start no. (from), dwMsgNr[1] the end no. (to)
Assign these fields for the filter criteria: MSG_FILTER_NR, MSG_FILTER_NR_FROM or
MSG_FILTER_NR_TO
dwMsgClass
Message classes bit-coded.
Assign this field for the filter criterion: MSG_FILTER_CLASS
dwMsgType
Message type per message class, bit-coded
Assign this field for the filter criterion: MSG_FILTER_CLASS
dwMsgState
Message status bit-coded.
Assign this field for the filter criterion: MSG_FILTER_STATE
wAGNr
AGNr from - to
Assign these fields for the filter criteria: MSG_FILTER_AG_FROM or MSG_FILTER_AG_TO
wAGSubNr
AGSubNr from - to
Assign this field for the filter criteria: MSG_FILTER_AGSUB_FROM or
MSG_FILTER_AGSUB_TO
dwArchivMode
Archiving / logging
Must be assigned 0.
szTB
Texts of the text blocks
Assign these fields for the filter criterion: MSG_FILTER_TEXT
dwTB
Active text blocks (from - to, bit-coded)
Assign this field for the filter criterion: MSG_FILTER_TEXT
dPValue
Process values from - to
Assign these fields for the filter criterion: MSG_FILTER_PVALUE
dwPValue
Active process values (from - to, bit-coded)

2300

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
Assign this field for the filter criterion: MSG_FILTER_PVALUE
dwMsgCounter
Internal message counter from - to
Assign these fields for the filter criteria: MSG_FILTER_COUNTER_FROM,
MSG_FILTER_COUNTER_TO
dwQuickSelect
Quick selection for hour, day, month
The parameter is reserved for future upgrades and must be preset to 0.
Assign this field for the filter criterion: MSG_FILTER_QUICKSELECT
LOWORD type:
MSG_FILTER_QUICK_MONTH

Quick selection last n months

MSG_FILTER_QUICK_DAYS

Quick selection last n days

MSG_FILTER_QUICK_HOUR

Quick selection last n hours

HIWORD number: 1...n


The end time of the quick selection refers to the current system time of the local computer.
The start time is calucalted back n * ( months, days, hours ).

3.15.6.10 Structure definition MSG_RTDATA_STRUCT

typedef struct {
DWORD
DWORD
SYSTEMTIME
DWORD
DWORD
DWORD
WORD
WORD
double
MSG_TEXTVAL_STRUCT
}
MSG_RTDATA_STRUCT;

dwMsgState;
dwMsgNr;
stMsgTime;
dwTimeDiff;
dwCounter;
dwFlags;
wPValueUsed;
wTextValueUsed;
dPValue[MSG_MAX_PVALUE];
mtTextValue[MSG_MAX_PVALUE];

Members
dwMsgState
Message status
MSG_STATE_COME

0x00000001

Message came in

MSG_STATE_GO

0x00000002

Message went out

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2301

ANSI-C for Creating Functions and Actions


3.15 ANSI-C function descriptions
MSG_STATE_QUIT

0x00000003

Message acknowledged

MSG_STATE_LOCK

0x00000004

Message locked

MSG_STATE_UNLOCK

0x00000005

Message unlocked

MSG_STATE_QUIT_SYSTEM

0x00000010

Message acknowledged by system

MSG_STATE_QUIT_EMERGENCY

0x00000011

Emergency acknowledgement

MSG_STATE_QUIT_HORN

0x00000012

Horn acknowledgement

MSG_STATE_COMEGO

0x00000013

Message came in and went out, only display in message list

MSG_STATE_UPDATE

0x00010000

Bit for message update

MSG_STATE_RESET

0x00020000

Bit for message reset

MSG_STATE_SUMTIME

0x00040000

Bit active for daylight savings time

MSG_STATE_INSTANCE

0x00080000

Bit for instance message (n messages of a no.)

dwMsgNr
Message number
stMsgTime
Date/Time: Telegram time depending on the calling function
dwTimeDiff
Duration coming/Telegram time in seconds
dwCounter
Internal message counter
dwFlags
Message flags in the database
MSG_FLAG_SUMTIME

0x00000001

Daylight savings time active

MSG_FLAG_COMMENT

0x00000002

Message has comments

MSG_FLAG_ARCHIV

0x00000004

Archiving

MSG_FLAG_PROTOCOL

0x00000008

Logging

MSG_FLAG_TEXTVALUES

0x00000010

Message has values accompanying the text

MSG_FLAG_TIMEINVALID

0x00000020

Bit for invalid date/time stamp

MSG_FLAG_INSTANCE

0x00000040

Instance message identification (185269)

wPValueUsed
Process values used, bit-coded. Every bit may only be set in one of the two structure elements
"wPValueUsed" or "wTextValueUsed". An accompanying value may either be a number or a
text.
wTextValueUsed
text values used, bit-coded. Every bit may only be set in one of the two structure elements
"wPValueUsed" or "wTextValueUsed". An accompanying value may either be a number or a
text.

2302

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.1

lpszPictureName

Overview
"lpszPictureName" is the name of the picture.
If you configure an action on a property or a "Mouse-click" event in WinCC, the name of the
picture is provided as "lpszPictureName" in the action. The picture name has the following
structure:
<BASE PICTURE NAME>.<PICTURE WINDOW NAME>:<PICTURE NAME>. ... .<Picture
window name>:<Picture name>.
The "BASE PICTURE NAME" and the "PICTURE NAME" are provided without the file
extension ".PDL".
This enables you to identify the object's picture path. You can also address specific picture
windows, if a process picture is opened more than once for example.
Note
Do not change the text in "lpszPictureName not even using the function "strcat".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2303

ANSI-C function descriptions


4.2 Standard functions

4.2

Standard functions

4.2.1

Standard functions - short description


The system provides standard functions. You can modify these functions to adapt them to your
personal needs. Furthermore, you can create your own standard functions.
The basic system provides you with standard functions. They are divided into the following
function groups:
Alarm
Graphics
Report
TagLog
WinCC
Windows
The "Obsolete functions" directory contains standard functions that were used to control the
control before WinCC V7.
If the corresponding options have been installed, the following additional function groups are
available:
Options
Split Screen Manager
userarc (user archives)

4.2.2

Alarm

4.2.2.1

AcknowledgeMessage

Function
Acknowledges the message with the number that has been sent as a parameter in the message
system.

Syntax
void AcknowledgeMessage(DWORD MsgNr)

2304

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Parameters
MsgNo
Message to be acknowledged
Note
Make sure a configured message exists for the transferred message number.
To use the function on a client with its own project, a standard server for alarms has to be
configured on the client.

See also
AcknowledgeMessage example

4.2.2.2

AXC_SetFilter

Function
External message window operation
This function sets a filter for WinCC Alarm Control to show a portion of the existing messages
according to the filter criterion.

Syntax
BOOL AXC_SetFilter(char* lpszPictureName, char* lpszObjectName,
LPMSG_FILTER_STRUCT lpMsgFilter, LPCMN_ERROR, lpError)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the WinCC Alarm Control name
lpMsgFilter
Pointer to the structure containing the filter criterion
lpError
Pointer to the structure of the error description

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2305

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
CMN_ERROR structure definition
ResetFilter example
AXC_SetFilter example
Structure definition MSG_FILTER_STRUCT structure definition

4.2.2.3

GCreateMyOperationMsg

Function
The "GCreateMyOperationMsg" standard function makes it possible to trigger your own
operator input message in the message system. The message with the "dwMsgNum" message
number must have already been configured as the operator input message.

Syntax
int GCreateMyOperationMsg( DWORD dwFlags, DWORD dwMsgNum, char*
lpszPictureName, char* lpszObjectName, DWORD dwMyTextID, double doValueOld, double
doValueNew, char* pszComment)

Parameters
dwFlags
The message form can be selected using the "dwFlags" parameter.

2306

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
Name

Value

Description

FLAG_COMMENT_PARAMETER

0x00000001

The text is entered as a comment directly into


the message in Runtime, without its own
comment dialog. The pointer to the comment
must not equal "NULL."

FLAG_COMMENT_DIALOG

0x00000003

A comment dialog appears. The comment


entered there is transferred to the message.

FLAG_TEXTID_PARAMETER

0x00000100

The text ID of a text from the TextLibrary is


provided as the accompanying process value
of the message.

dwMsgNum
WinCC message number of a self-created operator input message.
lpszPictureName
Pointer to the picture name of the picture from which the function is called.
lpszObjectName
Pointer to the WinCC tag name to which the old values and new values belong.
The name is forwarded as the instance name of the operator input message and entered in
the accompanying process value "1".
dwMyTextID
Text ID of a text from the TextLibrary.
When the "FLAG_TEXTID_PARAMETER" is set, the text ID is provided as the numeric
accompanying process value "8" of the message and is displayed as a number in process
value block 8. So that the language-dependent text from the TextLibrary is displayed in the
message, you must enter format statement "@8%s@" in the message text block.
doValueOld
Numeric old value of the WinCC tags with the name specified in "lpszObjectName".
"doValueOld" is entered in the accompanying process value "2" of the message.
The function itself has no option of reading a tag value before the action. For this, use the
provided "GetTag..." feature.
doValueNew
Numeric new value of the WinCC tags with the name specified in "lpszObjectName".
"doValueNew" is entered in the accompanying proces value "3" of the message.
The function itself has no option of reading a tag value after the action. For this, use the
provided "GetTag..." feature.
pszComment
Comment text or empty string.
When "FLAG_COMMENT_PARAMETER" is set, the text is entered directly into the message
in Runtime as a comment. The message does not need a separate comment dialog.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2307

ANSI-C function descriptions


4.2 Standard functions

Return value
Value

Description

The function has been completed without any errors.

-101

The message editing could not be started.

-201

An error occurred when calling the "MSRTGetComment()"


feature.

-301

An error occurred when calling the


"MSRTCreateMsgInstanceWithComment()" feature.

Note
Make sure that only operator input messages are used for the "GCreateMyOperationMsg"
function. The use of messages of different message classes is not permitted.
Please note the role of the standard server when using the function with a Client. For more
information see the chapter "Client configuration".

4.2.2.4

GMsgFunction

Function
This function provides the message data.
It is a global function for single messages. It is called for each message for which the "Triggers
an action" parameter has been set.
Evaluation of the message data is best made in a project function called from GMsgFunction.

Syntax
BOOL GMsgFunction(char* pszMsgData)

Parameters
pszMsgData
Pointer to a string whose data are mapped with scanf to the MSG_RTDATA_STRUCT
structure.
The "MSG_RTDATA_STRUCT" string contains the following data, which are separated from
each other with "#":
1. Telegram time
2. Process values
3. Instance
4. User

2308

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
5. Computer
6. Current time in format "yyyy.mm.dd, hh:mm:ss.mmm"
Note
The value "Instance" of string "MSG_RTDATA_STRUCT" is only supplied if an instance
message was triggered.
The values "User" and "Computer" of the string "MSG_RTDATA_STRUCT" are only
supplied if a comment was provided during the creation of the message with the same
call.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

See also
Structure definition MSG_RTDATA_STRUCT

4.2.3

Graphics

4.2.3.1

Graphics - short description


The Graphics group contains functions for programming the graphic system.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2309

ANSI-C function descriptions


4.2 Standard functions

4.2.3.2

GetLinkedVariable

Function
Provides the name of the variable linked to a certain object property.

Syntax
char* GetLinkedVariable(char* lpszPictureName, char* lpszObjectName, char*
lpszPropertyName);

Parameters
lpszPictureName
Pointer to the picture
lpszObjectName
Pointer to the object
lpszPropertyName
Pointer to the object property

Return value
Pointer to the name of the tag linked to a certain object property.

See also
GetLinkedVariable example

4.2.3.3

GetLocalPicture

Function
Provides a pointer to the name of the picture. The picture name is the file name without the
".PDL" extension.

Syntax
char* GetLocalPicture(char* lpszPictureName);

Parameters
lpszPictureName
Pointer to the picture

2310

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
Pointer on the name of the picture.

Note
The passed call parameter lpszPictureName must have the structure provided by the
graphics system for the picture paths:
<Basic picture name>.<Picture window name>:<Picture name>. ... .<Picture window
name>[:<Picture name>]
where <Basic picture name> and <Picture name> go without the ".PDL" file extension.

Example:
In a basic picture "AAA" there is a picture window "bbb" in which a picture "CCC" is called
which itself contains a picture window "ddd" in which a picture "EEE" is called.
Then the function call
GetLocalPicture(lpszPictureName)
returns the pointer to the picture name:
"EEE" if the functions is called in the picture "EEE";
"CCC" if the functions is called in the picture "CCC";
"AAA" if the functions is called in the picture "AAA".

See also
GetLocalPicture example

4.2.3.4

GetParentPicture

Function
Provides a pointer to the name of the picture. The picture name is the file name without the
".PDL" extension.

Syntax
char* GetParentPicture(char* lpszPictureName);

Parameters
lpszPictureName
Pointer to the picture

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2311

ANSI-C function descriptions


4.2 Standard functions

Return value
Name of the current picture if the function is called in the basic picture
Name path of the higher-level picture if the function is called in a picture window

Note
The passed call parameter lpszPictureName must have the structure provided by the
graphics system for the picture paths:
<Basic picture name>.<Picture window name>:<Picture name>. ... .<Picture window
name>[:<Picture name>]
where <Basic picture name> and <Picture name> go without the ".PDL" file extension.

See also
GetParentPicture example

4.2.3.5

GetParentPictureWindow

Function
Provides a pointer to the name of the picture window.

Syntax
char* GetParentPictureWindow(char* lpszPictureName);

Parameters
lpszPictureName
Pointer to the picture

Return value
Pointer to the name of the picture window if the function is called in a picture displayed in a
picture window of a higher-level picture
Call parameter lpszPictureName unchanged if the function is called in the basic picture

2312

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Note
The passed call parameter lpszPictureName must have the structure provided by the
graphics system for the picture paths:
<Basic picture name>.<Picture window name>:<Picture name>. ... .<Picture window
name>[:<Picture name>]
where <Basic picture name> and <Picture name> go without the ".PDL" file extension.

Example:
In a basic picture "Picture_1" there is a picture window "Picture_window_1" in which a picture
"Picture_2" is called.
In the picture "Picture_2" there is a picture window "Picture_window_2" in which a picture
"Picture_3" is called.
Then the function call
GetParentPictureWindow(lpszPictureName)
returns the pointer to the picture window name:
"Picture_2" if the function is called in the picture "Picture_3";
"Picture_window_1" if the function is called in the picture "Picture_2";
"Picture_1" if the function is called in the picture "Picture_1".

4.2.3.6

OpenPicture

Function
Changes the specified basic picture. On the client and in case of a picture name with server
prefix a picture change is performed in the picture window.
If, for example, the picture window is located in a different picture window with a server prefix,
a picture change is not performed in the picture window in which the function was called.
If multiple picture windows with server prefix are integrated in the picture and the
"OpenPicture()" function calls the last picture, the picture change is carried out in the first
picture window, e.g.
"screen1.window1(screen2.window2(screen3.window3(screen4.OpenPicture)))" executes a
picture change in "window1".

Syntax
void OpenPicture(Picture PictureName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2313

ANSI-C function descriptions


4.2 Standard functions

Parameters
Picture name
Picture name

4.2.3.7

Registry2

Function
This function manages a list of string pairs (String0, String1).
It knows the following types of calls controlled by the mode parameter:
Registry2("set", "String0", "String1");
Includes the passed string pair into the list.
Registry2("get", "String0", NULL);
Returns the first string pair partner String1 which belongs to the passed String0 and then
deletes the string pair from the list.
Registry2("reset", NULL, NULL);
Deletes all string pairs from the list.
Registry2("display", NULL, NULL);
Shows the string pairs currently stored in the list in a Global Script diagnostics window.

Syntax
char* Registry2(char* mode, char* String0, char* String1);

Parameters
mode
Defines the working principle of the function.
set
get

Incorporation of the string pair into the list


Determination of the first sting pair partner for String0 and deletion of the string
pair from the list
reset
Deletion of all string pairs
display Display of the string pairs in a Global Script diagnostics window

String0
The parameter supply depends on the working principle of the function.
String1
The parameter supply depends on the working principle of the function.

2314

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
In the mode=get mode a pointer to the first string pair partner is returned.
Note
This function is used in conjunction with the picture module technology.
If you work with the "Create faceplate as type" and "Create instance(s) in the process picture"
wizards in the "Faceplates" tab of the Dynamic Wizard, using the "Registry2" function is not
permitted!

4.2.4

Obsolete functions

4.2.4.1

Alarm

AXC_OnBtnAlarmHidingList
Function
This function displays the list of hidden messages in a message window.

Syntax
BOOL AXC_OnBtnAlarmHidingList(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2315

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnArcLong
Function
This function displays the messages stored in a long-term archive list in a message window.

Syntax
BOOL AXC_OnBtnArcLong (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

2316

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

AXC_OnBtnArcShort
Function
This function displays the messages stored in a short-term archive list in a message window.

Syntax
BOOL AXC_OnBtnArcShort(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnComment
Function
External message window operation
This function displays the comment of the previously selected messages.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2317

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL AXC_OnBtnComment (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnEmergAckn
Function
External message window operation
This function opens the acknowledgement dialog (emergency acknowledgement/reset).

Syntax
BOOL AXC_OnBtnEmergAckn(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located

2318

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnHideDlg
Function
This function opens the display options dialog for defining the messages that are to be
displayed in the message window. The options are "All messages", "Shown messages" or
"Hidden messages".

Syntax
BOOL AXC_OnBtnHideDlg(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2319

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnHideUnhideMsg
Function
The function hides the selected message or displays again the hidden message.

Syntax
BOOL AXC_OnBtnHideUnhideMsg(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

2320

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

AXC_OnBtnHit
Function
This function displays the messages stored in the hit list in a message window.

Syntax
BOOL AXC_OnBtnHit (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnHornAckn
Function
External message window operation
This function acknowledges the horn signal.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2321

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL AXC_OnBtnHornAckn (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnInfo
Function
External message window operation
This function displays the information text.

Syntax
BOOL AXC_OnBtnInfo (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located

2322

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLock
Function
External message window operation
This function opens the "Set the Lock List Parameters" dialog.

Syntax
BOOL AXC_OnBtnLock (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2323

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLockUnlock
Function
This function locks the selected message in the message window. This message will then no
longer be archived.
This function unlocks the selected message in the lock list.

Syntax
BOOL AXC_OnBtnLockUnlock (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

2324

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnLockWin
Function
External message window operation.
This function calls the lock list.

Syntax
BOOL AXC_OnBtnLockWin (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2325

ANSI-C function descriptions


4.2 Standard functions

AXC_OnBtnLoop
Function
External message window operation
This function triggers the "LoopInAlarm" function of the selected message.

Syntax
BOOL AXC_OnBtnLoop (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgFirst
Function
External message window operation
This function switches to the beginning of the message list.

2326

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL AXC_OnBtnMsgFirst (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgLast
Function
External message window operation
This function switches to the beginning of the message list.

Syntax
BOOL AXC_OnBtnMsgLast (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2327

ANSI-C function descriptions


4.2 Standard functions
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgLast example

AXC_OnBtnMsgNext
Function
External message window operation
This function switches to the next message in the message list.

Syntax
BOOL AXC_OnBtnMsgNext (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

2328

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgPrev
Function
External message window operation
This function switches to the previous message in the message list.

Syntax
BOOL AXC_OnBtnMsgPrev (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2329

ANSI-C function descriptions


4.2 Standard functions

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnMsgWin
Function
External message window operation
This function calls the message list.
Note
The message list contains the currently pending and unacknowledged messages.

Syntax
BOOL AXC_OnBtnMsgWin (char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

2330

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

AXC_OnBtnPrint
Function
External message window operation
All messages fulfilling the selection criterion set in the Alarm Control are output to the printer.

Syntax
BOOL AXC_OnBtnPrint(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnProtocol
Function
External message window operation
Printing of the current view of the Alarm Control is started. All messages fulfilling the selection
criterion set in the Alarm Control are output to the printer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2331

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL AXC_OnBtnProtocol(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnScroll
Function
External message window operation
This function activates or deactivates the horizontal and vertical scroll functions.

Syntax
BOOL AXC_OnBtnScroll(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

2332

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnScroll example

AXC_OnBtnSelect
Function
External message window operation
This function opens the "Specify Selection" dialog for the displayed list.

Syntax
BOOL AXC_OnBtnSelect(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2333

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

AXC_OnBtnSinglAckn
Function
External message window operation
This function acknowledges the currently selected message.

Syntax
BOOL AXC_OnBtnSinglAckn(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

2334

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

See also
AXC_OnBtnSinglAckn example

AXC_OnBtnSortDlg
Function
External operation of the message window
This function opens the dialog for setting a user-defined sorting of the displayed messages for
the displayed list.

Syntax
BOOL AXC_OnBtnSortDlg(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnTimeBase
Function
External operation of the message window
This function opens the dialog for setting the time base for the times shown in the messages.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2335

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL AXC_OnBtnTimeBase(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

AXC_OnBtnVisibleAckn
Function
External message window operation
All visible messages in the message window are acknowledged (group acknowledgement).

Syntax
BOOL AXC_OnBtnVisibleAckn(char* lpszPictureName, char* lpszObjectName)

Parameters
lpszPictureName
Pointer to the name of the picture in which the WinCC Alarm Control is located
lpszObjectName
Pointer to the object name of the WinCC Alarm Control

2336

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC AlarmControl as of WinCC
V7.0.

See also
AXC_OnBtnMsgFirst example

4.2.4.2

Report

ReportJob
Function
Depending on the value of the lpMethod Name parameter a print job or the preview for a print
job is started.

Syntax
void ReportJob(LPSTR lpJobName, LPSTR lpMethodName)

Parameters
lpJobName
Pointer to the name of the print job
lpMethodName
PRINTJOB Print job is started
PREVIEW Preview of the print job is started
Note
This function is replaced by the RPTJobPreview and RPTJobPrint functions and should no
longer be used.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2337

ANSI-C function descriptions


4.2 Standard functions

4.2.4.3

TagLog

TOOLBAR_BUTTONS
TlgTableWindowPressEditRecordButton
Function
The editing of the table window is blocked or enabled (toggle function).
If editing is enabled, updating of the table window is stopped at the same time.
The updating of the table window remains to be stopped afterward, even if editing is blocked
by a further function call.

Syntax
BOOL TlgTableWindowPressEditRecordButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgTableWindowPressFirstButton
Function
Displays the first data records of the display area in the table window.
The number of displayed data records depends on the configured time range.

2338

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL TlgTableWindowPressFirstButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressHelpButton
Function
Displays the online help for the table window.

Syntax
BOOL TlgTableWindowPressHelpButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2339

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressInsertRecordButton
Syntax
BOOL TlgTableWindowPressInsertRecordButton(char* lpszWindowName)
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgTableWindowPressLastButton
Function
Displays the last data records of the display area in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressLastButton(char* lpszWindowName)

2340

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressNextButton
Function
The data records following the current display area are displayed in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressNextButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2341

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressNextItemButton
Function
The columns of the table window are moved one column to the left, the left column taking the
position of the right column.

Syntax
BOOL TlgTableWindowPressNextItemButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

2342

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

TlgTableWindowPressOpenArchiveVariableSelectionDlgButton
Function
Opens the dialog for connecting table columns to archives and tags.

Syntax
BOOL TlgTableWindowPressOpenArchiveVariableSelectionDlgButton(char*
lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressOpenDlgButton
Function
Opens the dialog for online configuration of the table window.

Syntax
BOOL TlgTableWindowPressOpenDlgButton(char* lpszWindowName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2343

ANSI-C function descriptions


4.2 Standard functions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressOpenDlgButton example

TlgTableWindowPressOpenItemSelectDlgButton
Function
Opens the dialog for selecting the visible columns and the first column of the table window.

Syntax
BOOL TlgTableWindowPressOpenItemSelectDlgButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.

2344

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressOpenTimeSelectDlgButton
Function
Opens the dialog for setting the time range to be displayed in the table columns.

Syntax
BOOL TlgTableWindowPressOpenTimeSelectDlgButton(char* lpszWindowNumber)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2345

ANSI-C function descriptions


4.2 Standard functions

TlgTableWindowPressPrevButton
Function
The data records preceding the current display area are displayed in the table window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTableWindowPressPrevButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressPrevItemButton
Function
The columns of the table window are moved one column to the right, the right column taking
the position of the left column.

Syntax
BOOL TlgTableWindowPressPrevItemButton(char* lpszWindowName)

2346

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTableWindowPressRemoveRecordButton
Syntax
BOOL TlgTableWindowPressRemoveRecordButton(char* lpszWindowName)
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgTableWindowPressStartStopButton
Function
Updating of the table window is switched on or off (toggle function).

Syntax
BOOL TlgTableWindowPressStartStopButton(char* lpszWindowName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2347

ANSI-C function descriptions


4.2 Standard functions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Table Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressFirstButton
Function
Displays the first data records of the display area in the trend window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTrendWindowPressFirstButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.

2348

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressHelpButton
Function
Displays the online help for the trend window.

Syntax
BOOL TlgTableWindowPressNextButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2349

ANSI-C function descriptions


4.2 Standard functions

TlgTrendWindowPressLastButton
Function
Displays the last data records of the display area in the trend window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTrendWindowPressLastButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressLinealButton
Function
The ruler of the trend window is shown or hidden (toggle function).
The ruler can be moved by means of the "cursor left" and "cursor right" buttons.

Syntax
BOOL TlgTableWindowPressNextButton(char* lpszWindowName)

2350

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressNextButton
Function
The data records following the current display area are displayed in the trend window.
The number of displayed data records depends on the configured time range.

Syntax
BOOL TlgTrendWindowPressNextButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2351

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressNextItemButton
Function
Brings all trends in the trend window one layer to the front.
The trend in the foreground is moved into the background.

Syntax
BOOL TlgTrendWindowPressNextItemButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

2352

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOneToOneButton
Function
Restores the standard size (1:1) in the trend window.

Syntax
BOOL TlgTrendWindowPressOneToOneButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenArchiveVariableSelectionDlgButton
Function
Opens the dialog for connecting trends to archives and tags.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2353

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL TlgTrendWindowPressOpenArchiveVariableSelectionDlgButton(char*
lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenDlgButton
Function
Opens the dialog for online configuration of the trend window.

Syntax
BOOL TlgTrendWindowPressOpenDlgButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

2354

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenItemSelectDlgButton
Function
Opens the dialog for selecting the visible trends and the trend which is to be in the foreground.

Syntax
BOOL TlgTrendWindowPressOpenItemSelectDlgButton(char* lpszWindowNumber)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2355

ANSI-C function descriptions


4.2 Standard functions

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressOpenTimeSelectDlgButton
Function
Opens the dialog for setting the time range to be displayed.

Syntax
BOOL TlgTrendWindowPressOpenTimeSelectDlgButton(char* lpszWindowNumber)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressPrevButton
Function
The data records preceding the current display area are displayed in the trend window.
The number of displayed data records depends on the configured time range.

2356

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL TlgTrendWindowPressPrevButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressPrevItemButton
Function
Brings all trends in the trend window one layer to the back.
The trend in the background is moved to the foreground.

Syntax
BOOL TlgTrendWindowPressPrevItemButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2357

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressPrintButton
Function
The current view of the trends is output in accordance with the display configured for the WinCC
Trend Control.

Syntax
BOOL TlgTrendWindowPressPrintButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.

2358

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgTrendWindowPressReportSaveButton
Function
The displayed trend window data is saved in a text file.

Syntax
BOOL TlgTrendWindowPressReportSaveButton (char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgTrendWindowPressStartStopButton
Function
Updating of the trend window is switched on or off (toggle function).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2359

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL TlgTrendWindowPressStartStopButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressStatsResultButton
Function
Starts the evaluation of data in the selected time area.
The statistic values minimum, maximum, average and standard deviation are calculated.

Syntax
BOOL TlgTrendWindowPressStatsResultButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

2360

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressStatsSelectRangeButton
Function
To select the time range for the statistics function, the rulers for start and end time are displayed.

Syntax
BOOL TlgTrendWindowPressStatsSelectRangeButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2361

ANSI-C function descriptions


4.2 Standard functions

See also
TlgTrendWindowPressStartStopButton example

TlgTrendWindowPressZoomInButton
Function
The zoom in the trend window is activated. The zoom range can only be selected with the
mouse.

Syntax
BOOL TlgTrendWindowPressZoomInButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressZoomInButton example

TlgTrendWindowPressZoomOutButton
Function
The trend window is restored to the state in which it was before the zoom was activated. The
zoom is deactivated.

2362

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
The zoom range can only be selected with the mouse (also see
TlgTrendWindowPressZoomInButton).

Syntax
BOOL TlgTrendWindowPressZoomOutButton(char* lpszWindowName)

Parameter
lpszWindowName
Pointer to the window title of the WinCC Online Trend Control

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgTrendWindowPressZoomOutButton example

Template
TlgGetNumberOfColumns
Function
Provides the number of columns in the table window.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetNumberOfColumns(char* lpszTemplate)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2363

ANSI-C function descriptions


4.2 Standard functions

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

Return value
Number of colums in a table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgGetNumberOfRows
Function
Provides the number of lines in the table window.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetNumberOfRows(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

Return value
Number of lines in the table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgGetNumberOfRows example

2364

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

TlgGetNumberOfTrends
Function
Provides the number of trends in the trend window.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetNumberOfTrends(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control

Return value
Number of trends in the trend window
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgGetRowPosition
Function
Provides the current position of the line pointer in the table window.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
int TlgGetRowPosition(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2365

ANSI-C function descriptions


4.2 Standard functions

Return value
Current position of the line pointer in the table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

TlgGetRulerArchivNameTrend
Function
Provides the archive name of the trend with the nTrend number in the trend window at the
ruler position.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
char* TlgGetRulerArchivNameTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

Return value
Archive name of the trend with the nTrend number in the trend window at the ruler position
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgGetRulerVariableNameTrend example

2366

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

TlgGetRulerTimeTrend
Function
Provides the time of the trend with the nTrend number in the trend window at the ruler position.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
SYSTEMTIME TlgGetRulerTimeTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

Return value
Time of the trend with the nTrend number in the trend window at the ruler position
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgGetRulerTimeTrend example (Page 2276)

TlgGetRulerValueTrend
Function
Provides the value of the trend with the nTrend number in the trend window at the ruler position.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2367

ANSI-C function descriptions


4.2 Standard functions

Syntax
double TlgGetRulerValueTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

Return value
Value of the trend with the nTrend number in the trend window at the ruler position
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

TlgGetRulerVariableNameTrend
Function
Provides the tag name of the trend with the nTrend number in the trend window.
The window title of the corresponding WinCC Online Trend Control is passed with the
lpszTemplate parameter.

Syntax
char* TlgGetRulerVariableNameTrend(char* lpszTemplate, int nTrend)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Trend Control
nTrend
Number of the trend
(0 <= nTrend <= Number of visible trends - 1)

2368

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
The tag name of the trend with the nTrend number in the trend window.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

See also
TlgGetRulerVariableNameTrend example

TlgGetTextAtPos
Function
Provides the content of a cell of the table window as text for process value archives and user
archives.
The cell is specified by nColumn and nLine.
The window title of the corresponding WinCC Online Table Control is passed with the
lpszTemplate parameter.

Syntax
char* TlgGetTextAtPos(char* lpszTemplate, int nColumn, int nLine)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control
nColumn
Number of the column
nLine
Number of the line

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2369

ANSI-C function descriptions


4.2 Standard functions

Return value
Content of the cell of a table window as text
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgGetRulerVariableNameTrend example

TlgGetColumnPosition
Function
Provides the current position of the column pointer in the table window as column index.

Syntax
int TlgGetColumnPosition(char* lpszTemplate)

Parameter
lpszTemplate
Pointer to the window title of the WinCC Online Table Control

Return value
Current position of the column pointer in a table window
Note
The standard function is no longer supported for the new WinCC OnlineTableControl as of
WinCC V7.0.

See also
TlgGetNumberOfColumns example

2370

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

TlgTrendWindowActivateCurve
Function
Activates a certain trend in WinCC Online Trend Control via the configured name of the trend.
This function is executed independently of the visibility or foreground position of the trend.

Syntax
BOOL TlgTrendWindowActivateCurve(char* lpszPictureName, char* lpszObjectName, char*
szValue)

Parameter
lpszPictureName
Picture name
lpszObjectName
Name of Trend Control
szValue
Name of the curve

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
The standard function is no longer supported for the new WinCC OnlineTrendControl as of
WinCC V7.0.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2371

ANSI-C function descriptions


4.2 Standard functions

4.2.5

Report

4.2.5.1

Report - short description


The Report group contains functions with which to start the print preview of a print job or the
printout itself.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.2.5.2

RPTJobPreview

Function
The preview of a print job is started.

Syntax
BOOL RPTJobPreview(LPSTR lpJobName)

Parameters
lpJobName
Pointer to the name of the print job

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
RPTJobPreview example

2372

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

4.2.5.3

RPTJobPrint

Function
A print job is started.

Syntax
BOOL RPTJobPrint(LPSTR lpJobName)

Parameters
lpJobName
Pointer to the name of the print job

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
RPTJobPrint example

4.2.5.4

RptShowError

Function
This function provides an error decription for a failed print job.
The function is already integrated into the RptJobPrint and RptJobPreview standard functions
and does not have to be called separately.
The error description is displayed in a Global Script diagnostics window.
Note
As RptShowError is a standard function the output type and form can be changed if required.
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2373

ANSI-C function descriptions


4.2 Standard functions

Syntax
void RptShowError ( LPCSTR pszFailedFunction, CMN_ERRORA* pCmnErrorA )

Parameters
pszFailedFunction
Pointer to the name of the failed function.
If this pointer is NULL there will be no output of the function name.
pCmnErrorA
Pointer to the error structure of the failed function.
If this pointer is NULL there will be no output of the error structure.
STRUCTURES_TABLES_ERROR_STRUCTURE

4.2.6

WinCC

4.2.6.1

WinCC - short description


The WinCC group contains functions which affect the entire WinCC system.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.2.6.2

GetHWDiag

Function
This function realizes the direct start of diagnosis at runtime triggered by an event, which must
be configured, exercised on an object.
If the event occurs, the hardware diagnostics function is started from STEP7 for the associated
PLC.
The following conditions must be fulfilled in order to use the function:
The WinCC project, with the picture from which access should occur, and the STEP7 project
must be on the same computer.
The WinCC project must be stored as a subdirectory of the STEP7 project (STEP7 Projekt
\wincproj\WinCC Projekt).
The S7 tags have been mapped to WinCC.

2374

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Syntax
BOOL GetHWDiag(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpProperties)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the entry point for the
hardware diagnostics
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the entry
point for the hardware diagnostics
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attribute that is connected with the tag that will be used for the entry point for the
hardware diagnostics
If multiple attribute are entered, they must be separated by semicolons (";").

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

4.2.6.3

GetHWDiagLevel

Function
Checks the logged-in user's authorization on the basis of the User Administrator function
number in dwLevel.
Then, diagnostics is started directly during runtime and is triggered by an event, which has to
be configured, occurring on an object.
If the event occurs, the hardware diagnostics function is started from STEP7 for the associated
PLC.
The following conditions must be fulfilled in order to use the function:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2375

ANSI-C function descriptions


4.2 Standard functions
The WinCC project, with the picture from which access should occur, and the STEP7 project
must be on the same computer.
The WinCC project must be stored as a subdirectory of the STEP7 project (STEP7 Projekt
\wincproj\WinCC Projekt).
The S7 tags have been mapped to WinCC.
In order for the user logged into WinCC to edit the hardware diagnostics dialog, the user
must have a WinCC user authorization matching the number passed by the function call in
the parameter "dwLevel".

Syntax
BOOL GetHWDiagLevel(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpProperties, DWORD dwLevel)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the entry point for the
hardware diagnostics
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the entry
point for the hardware diagnostics
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attribute that is connected with the tag that will be used for the entry point for the
hardware diagnostics
If multiple attribute are entered, they must be separated by semicolons (";").
dwLevel
Level number for STEP7 write permissions.
This can be defined in User Administrator.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2376

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

4.2.6.4

GetKopFupAwl

Function
This function performs the network entry jump of WinCC into the STEP7 Editor "KFA".
When executing this function two tasks are performed:
Determination of the required date for the network entry jump from WinCC.
Transfer of the data to Step7 and finding the places of use of the operand in a STEP7
program by means of AUTAPI.

Syntax
BOOL GetKopFupAwl(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpProperties)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the network entry jump
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the network
entry jump
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attrribute that is connected with the tag that will be used for the network entry
jump
If multiple attribute are entered, they must be separated by semicolons (";").

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2377

ANSI-C function descriptions


4.2 Standard functions

4.2.6.5

GetKopFupAwlLevel

Function
Checks the active user's authorization on the basis of the User Administrator function number
in dwLevel and then performs the entry jump into the STEP7 Editor "KFA".
When executing this function three tasks are performed:
Determination of the required date for the network entry jump from WinCC.
Authorization check for the active user within WinCC.
Transfer of the data to STEP7 and finding the places of use of the operand in a STEP7
program by means of AUTAPI.
Note
Depending on the result of the authorization check in WinCC the user has either only
reading rights in STEP7 or is authorized to change S7 data.

Syntax
BOOL GetKopFupAwlLevel(LPCTSTR lpszPictureName, LPCTSTR
lpszObjectName,LPCTSTR lpProperties, DWORD dwLevel)

Parameters
lpszPictureName
Name of the picture (PDL file) that contains the tag that will be used for the network entry jump
Since the name "lpszPictureName" stands for the current picture, entries are only required
here in cases where it is necessary to access an object tag in a different picture.
lpszObjectName
Name of the object in the picture that connected with the tag that will be used for the network
entry jump
Since the name "lpszObjectName" stands for the current object entries are only required here
in cases where it is necessary to access a tag in a different object.
lpProperties
Name of the attrribute that is connected with the tag that will be used for the network entry
jump
If multiple attribute are entered, they must be separated by semicolons (";").
dwLevel
Level number for STEP7 write permissions.
This can be defined in User Administrator.

2378

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

4.2.6.6

OnDeactivateExecute

Function
This function is called when terminating WinCC Runtime.
As this is a standard function, you can insert instructions which are then executed.
Note
Concerning the instructions it must be taken into account that the Runtime is terminating and
therefore not all functionalities are available.
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

Syntax
void OnDeactivateExecute()

4.2.6.7

OnErrorExecute

Function
OnErrorExecute is called by the system when an error occurred upon executing an action or
a function.
This allows you to determine the precise error cause.
The function is called by the system and does not require an additional call.
As this function is available as a standard function the output type and form can be changed
if required.

Note
Please note that modified standard functions are overwritten by a new installation so that the
changes will be lost.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2379

ANSI-C function descriptions


4.2 Standard functions

Syntax
void OnErrorExecute(CCAPErrorExecute ErrorExecute)

Parameters
ErrorExecute
Structure informing about the error that has occurred

Diagnostic information
These information are displayed in a Global Script diagnostics window.
SystemTime
dwErrorCode1
dwErrorCode2
szErrorText
bCycle
szApplicationName
szFunctionName
szTagName
dwCycle
szErrorTextTagName
status
lpszPictureName
lpszObjectName
lpszPropertyName
dwParamSize
szErrorText

Time (UTC) at which the error occurred


The error codes and their meaning are to be found in the structure
definition
The error codes and their meaning are to be found in the structure
definition
Text description of the error cause
Cycle type
Error-triggering application
FunctionID
Tag name
Cycle type
Text description of the tag status
Tag status
Picture in which the error occurred
Object in which the error occurred
Object property in which the error occurred
only used internally
Text description of the error cause returned by the error structure
"pError"

See also
CCAPErrorExecute structure definition

4.2.6.8

OnTime

Function
OnTime is exclusively called by the system. The function returns the runtime of all actions or
determines the actions running longer than the specified time. Time measurement can be
enabled/disabled via APDIAG.

2380

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.2 Standard functions
As this function is available as a standard function the output type can be influenced by
changing the function code.
Note
Please note that modified standard functions are overwritten by a WinCC installation so that
the changes will be lost.

Syntax
void OnTime(CCAPTime time)

Parameters
time
Result structure
STRUCTURES_TABLES_CCAPTIME

4.2.7

Windows

4.2.7.1

Windows - short description


The Windows group contains the ProgramExecute function.
This function can be used to execute any program.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.2.7.2

ProgramExecute

Function
Starts the program with the specified name.

Syntax
unsigned int ProgramExecute(char* Program_Name)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2381

ANSI-C function descriptions


4.2 Standard functions

Parameters
Program_Name
Pointer to the program name

Return value
If the return value is greater than 31, the function has been completed without any errors.
In case of an error, the return value contains one of the following error codes:
0
2
3
11

out of memory
Specified file could not be found.
Specified path could not be found.
Program could not be started.

See also
ProgramExecute

2382

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

4.3

Internal functions

4.3.1

Internal functions - short description


Internal functions are used to make graphic objects and archives dynamic and in project
functions, standard functions and global script actions.
Internal funtions are recognized throughout a project.
They can be neither be newly created nor can existing internal functions be modified.
Internal functions are divided into the following groups:
allocate
Functions to reserve and release working memory space
c_bib
Functions from the standard C-library
graphics
Functions to read and set properties of graphical objects
tag
Functions to read and write tags
wincc
Functions for changing languages, deactivating Runtime and ending WinCC

4.3.2

allocate

4.3.2.1

SysFree

Function
Releases the memory area previously reserved with the SysMalloc function.

Syntax
void SysFree(void* lpFree);

Parameters
lpFree
Pointer to the memory area reserved with the SysMalloc function

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2383

ANSI-C function descriptions


4.3 Internal functions

4.3.2.2

SysMalloc

Function
Reserves memory space for an action. The memory area is assigned to the action. When the
action has been completed and the result transferred, the system releases the memory again.
The SysFree function can be used to release reserved memory space.

Syntax
void* SysMalloc(unsigned long int size);

Parameters
size
Size of the memory area in bytes.

4.3.3

c_bib

4.3.3.1

c_bib - short description


The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file

2384

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

4.3.3.2

ctype

isalnum
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2385

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isalpha
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2386

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

isdigit
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isgraph
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2387

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

islower
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2388

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isprint
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2389

ANSI-C function descriptions


4.3 Internal functions

ispunct
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isspace
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2390

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isupper
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2391

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

isxdigit
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2392

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

tolower
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

toupper
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2393

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

4.3.3.3

math

acos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2394

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

asin
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2395

ANSI-C function descriptions


4.3 Internal functions

atan
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

atan2
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2396

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ceil
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2397

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

cos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2398

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

cosh
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

exp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2399

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fabs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2400

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

floor
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2401

ANSI-C function descriptions


4.3 Internal functions

fmod
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

frexp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2402

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ldexp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2403

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

log
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2404

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

log10
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

modf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2405

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

pow
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2406

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

sin
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2407

ANSI-C function descriptions


4.3 Internal functions

sinh
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

sqrt
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2408

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tan
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2409

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tanh
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2410

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

4.3.3.4

memory

memchr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memcmp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2411

ANSI-C function descriptions


4.3 Internal functions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memcpy
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2412

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

memmove
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2413

ANSI-C function descriptions


4.3 Internal functions

memset
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

4.3.3.5

stdio

char_io
fgetc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib

2414

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fgets
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2415

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fputc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2416

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

fputs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

getc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2417

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

putc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2418

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ungetc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2419

ANSI-C function descriptions


4.3 Internal functions

Directio
fread
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fwrite
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

2420

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

Error
clearerr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2421

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

feof
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2422

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

ferror
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

File
fclose
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2423

ANSI-C function descriptions


4.3 Internal functions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fflush
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2424

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fopen
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2425

ANSI-C function descriptions


4.3 Internal functions

freopen
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

remove
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2426

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

rename
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2427

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

setbuf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2428

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

setvbuf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tmpfile
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2429

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

tmpnam
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2430

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

File_pos
fgetpos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2431

ANSI-C function descriptions


4.3 Internal functions

fseek
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

fsetpos
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2432

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ftell
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2433

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

rewind
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2434

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Output
vfprintf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

vsprintf
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2435

ANSI-C function descriptions


4.3 Internal functions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

4.3.3.6

stdlib

abs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2436

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

atof
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2437

ANSI-C function descriptions


4.3 Internal functions

atoi
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

atol
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2438

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

bsearch
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2439

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

calloc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2440

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

div
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

free
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2441

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

getenv
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2442

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

labs
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2443

ANSI-C function descriptions


4.3 Internal functions

ldiv
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

malloc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2444

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

qsort
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2445

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

rand
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2446

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

realloc
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

srand
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2447

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtod
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2448

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtol
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2449

ANSI-C function descriptions


4.3 Internal functions

strtoul
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

4.3.3.7

string

strcat
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

2450

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strchr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2451

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strcmp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2452

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

strcpy
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strcspn
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2453

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strerror
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2454

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strlen
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2455

ANSI-C function descriptions


4.3 Internal functions

strncat
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strncmp
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

2456

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strncpy
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2457

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strpbrk
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2458

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

strrchr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strspn
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2459

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strstr
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2460

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strtok
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2461

ANSI-C function descriptions


4.3 Internal functions

4.3.3.8

time

asctime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

clock
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time

2462

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

ctime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2463

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

difftime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

2464

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

gmtime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

localtime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2465

ANSI-C function descriptions


4.3 Internal functions
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

mktime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output

2466

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

strftime
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2467

ANSI-C function descriptions


4.3 Internal functions

time
The function group c_bib contains C functions from the C library and is divided into:
ctype
math
memory
stdio
stdlib
string
time
stdio itself is further divided into:
char_io
directio
error
file
file_pos
output
You can find a description of this function in related technical literature.
Note
The function localtime reacts as follows in respect of date output:
Numbering of the months begins with 0.
The years are counted from 1900, beginning with 0.
The C-library functions printf(), sprintf(), fprintf() can only process 360 characters in WinCC.

4.3.4

graphics

4.3.4.1

Graphics - short description


The functions of the Graphics group allow to modify or query graphical properties of WinCC
objects.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2468

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
Note
If the function is called for the picture object, set the parameter lpszObjectName = ZERO.

4.3.4.2

get

axes
GetAlignment
Function
When using bar objects, it indicates whether the text is to the right or left of the bar.

Syntax
BOOL GetAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Text is to the right of the bar
FALSE
Text is to the left of the bar

See also
GetScaling example
Beispiel GetScaling (Page 2232)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2469

ANSI-C function descriptions


4.3 Internal functions

GetAxisSection
Function
When using bar objects, it specifies the difference between the values of two neighboring axis
labels.

Syntax
double GetAxisSection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Difference between the values of two neighboring axis labels

GetExponent
Function
When using bar objects, it specifies whether the axis label corresponds to the decimal or
exponential form.

Syntax
BOOL GetExponent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2470

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Axis label in exponential form
FALSE
Axis label in decimal form

See also
GetScaling example
Beispiel GetScaling (Page 2232)

GetLeftComma
Function
When using bar objects, it specifies the number of integers in the axis label.

Syntax
long int GetLeftComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
The number of integers in the axis label

GetLongStrokesBold
Function
When using bar objects, it specifies whether the main division lines on the scale are bold or
regular.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2471

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL GetLongStrokesBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The main division lines on the graph scale are bold
FALSE
The main division lines on the graph scale are regular

See also
GetScaling example
Beispiel GetScaling (Page 2232)

GetLongStrokesOnly
Function
When using bar objects, it specifies whether intermediate division lines are used on the scale.

Syntax
BOOL GetLongStrokesOnly(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2472

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Only main division lines are used on the bar graph scale.
FALSE
Both main and intermediate division lines are used on the bar graph scale.

See also
GetScaling example
Beispiel GetScaling (Page 2232)

GetLongStrokesSize
Function
When using bar objects, it specifies the length of the main division lines.

Syntax
long int GetLongStrokesSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Length of the main division lines as numeric value

GetLongStrokesTextEach
Function
When using bar objects, it specifies the interval between the main division lines being assigned
a label.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2473

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetLongStrokesTextEach(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Label of the main division lines as numeric value

Example:
Return value = 1 -> Every main division line is assigned a label.
Return value = 2 -> Every 2nd main division line is assigned a label.
etc.

GetRightComma
Function
When using bar objects, it specifies the number of decimal places in the axis label.

Syntax
long int GetRightComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
The number of decimal places in the axis label

2474

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetScaleTicks
Function
When using bar objects, it specifies the scale marks as number of scale sections. A scale
section is a part of the scale bounded by two main tick marks.

Syntax
long int GetScaleTicks(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Scale marks as number of scale sections
Note
The number of scale sections is given as 0, if the bar object itself calculates a suitable scale
unit.

GetScaling
Function
When using bar objects, it specifies whether the scale is activated or deactivated.

Syntax
BOOL GetScaling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2475

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
TRUE
Display with scale
FALSE
Display without scale

See also
GetScaling example
Beispiel GetScaling (Page 2232)

GetScalingType
Function
When using bar objects, it specifies the type of bar scaling.

Syntax
long int GetScalingType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Type of bar scaling as numeric value

See also
Bar scaling
Bar Scaling (Page 2282)

2476

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

color
Color - short description
The various color properties of objects can be modified or queried using the functions in the
Color group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetBackColor
Function
Specifies the background color of the object as a numeric value.

Syntax
long int GetBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Background color of the object as a numeric value
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2477

ANSI-C function descriptions


4.3 Internal functions
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBackColor2
Function
When using bar objects, it specifies the color of the bar as a numeric value.

Syntax
long int GetBackColor2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBackColor3
Function
When using bar objects, it specifies the background color of the bar as a numeric value.

Syntax
long int GetBackColor3(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2478

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar background color

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBackColorBottom
Function
Specifies the background color of the slider objects at the bottom right.

Syntax
long int GetBackColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background color of the slider objects at the bottom right

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2479

ANSI-C function descriptions


4.3 Internal functions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBackColorTop
Function
Specifies the background color of the slider objects at the top left.

Syntax
long int GetBackColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background color of the slider objects at the top left

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBorderBackColor
Function
Specifies the background color of the lines or borders.

2480

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background color of the lines or borders

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBorderColor
Function
Specifies the line or border color as a numeric value.

Syntax
long int GetBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the color of lines or borders

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2481

ANSI-C function descriptions


4.3 Internal functions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBorderColorBottom
Function
Specifies the 3D border color at the bottom.

Syntax
long int GetBorderColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the 3D border color at the bottom

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetBorderColorTop
Function
Specifies the 3D border color at the top.

2482

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetBorderColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the 3D border color at the top

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetButtonColor
Function
Specifies the button color of slider objects.

Syntax
long int GetButtonColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the button color of slider objects

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2483

ANSI-C function descriptions


4.3 Internal functions

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetColorBottom
Function
When using slider objects, it specifies the color of the bottom limit.

Syntax
long int GetColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the color of the bottom limit of slider objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetColorTop
Function
When using slider objects, it specifies the color of the top limit.

2484

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the color of the top limit of slider objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetFillColor
Function
Specifies the color of the fill pattern.

Syntax
long int GetFillColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2485

ANSI-C function descriptions


4.3 Internal functions

Return value
Numeric value of the fill color
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetForeColor
Function
Specifies the color of the font.

Syntax
long int GetForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the font color

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

2486

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetGridColor
Function
Specifies the grid color of Graphics Designer.

Syntax
long int GetGridColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the grid color of Graphics Designer

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetItemBorderBackColor
Function
Specifies the background color of the dividing line for the "text list" object.

Syntax
long int GetItemBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2487

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Numeric value defining the background color of the dividing line for the "text list" object

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetItemBorderColor
Function
Specifies the color of the dividing line for the "text list" object.

Syntax
long int GetItemBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the dividing line color for the "text list" object

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

2488

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetScaleColor
Function
Specifies the scale color for bar objects.

Syntax
long int GetScaleColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value of the scale color for bar objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetSelBGColor
Function
Specifies the background color of the selected entry for the "text list" object.

Syntax
long int GetSelBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2489

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Numeric value defining the background color of the selected entry

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetSelTextColor
Function
Specifies the font color of the selected entry for the "text list" object.

Syntax
long int GetSelTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the font color of the selected entry

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

2490

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetTrendColor
Function
Specifies the trend color of bar objects.

Syntax
long int GetTrendColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the trend color of bar objects

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

GetUnselBGColor
Function
Specifies the background color of the non-selected entries for the "text list" object.

Syntax
long int GetUnselBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2491

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Numeric value defining the background color of the non-selected entries

See also
GetBackColor example
Color chart
Color chart (Page 2284)
GetBackColor example (Page 2216)

GetUnselTextColor
Function
Specifies the font color of the non-selected entries for the "text list" object.

Syntax
long int GetUnselTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the font color of the non-selected entries

See also
GetBackColor example
Color chart
GetBackColor example (Page 2216)
Color chart (Page 2284)

2492

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

fill
Fill - short description
The functions in the Fill group control the dynamic filling of objects.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetFilling
Function
Specifies whether dynamic filling with background color is activated.

Syntax
BOOL GetFilling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Dynamic filling with background color is activated.
FALSE
Dynamic filling with background color is not activated.

See also
GetFilling example
GetFilling example (Page 2217)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2493

ANSI-C function descriptions


4.3 Internal functions

GetFillingIndex
Function
Specifies the current fill level.

Syntax
long int GetFillingIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current fill level as a numeric value (0 - 100)

See also
GetFillingIndex example
GetFillingIndex example (Page 2217)

flash
Flash - short description
The various flashing properties can be modified or called in using the functions in the Flash
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2494

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetBackFlashColorOff
Function
Specifies the background flash color for the deactivated status.

Syntax
long int GetBackFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Background flash color for the deactivated status as a numeric value

See also
Color chart (Page 2284)
GetFlashBackColorOn example
GetFlashBackColorOn example (Page 2219)
Color chart

GetBackFlashColorOn
Function
Specifies the background flash color for the activated status.

Syntax
long int GetBackFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2495

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Background flash color for the activated status as a numeric value

See also
GetFlashBackColorOn example (Page 2219)
Color chart (Page 2284)
Color chart
GetFlashBackColorOn example

GetBorderFlashColorOff
Function
Specifies the border or line flashing color for the deactivated status.

Syntax
long int GetBorderFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Border or line flashing color for the deactivated status as a numeric value

See also
GetFlashBackColorOn example (Page 2219)
Color chart (Page 2284)
Color chart
GetFlashBackColorOn example

2496

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetBorderFlashColorOn
Function
Specifies the border or line flashing color for the activated status.

Syntax
long int GetBorderFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Border or line flashing color for the activated status as a numeric value

See also
GetFlashBackColorOn example (Page 2219)
Color chart (Page 2284)
Color chart
GetFlashBackColorOn example

GetFlashBackColor
Function
Specifies whether flashing of the background is activated or not.

Syntax
BOOL GetFlashBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2497

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
TRUE
Flashing background is activated.
FALSE
Flashing background is not activated.

See also
GetFlashBackColor example (Page 2218)
GetFlashBackColor example

GetFlashBorderColor
Function
Specifies whether flashing of the border or line is activated or not.

Syntax
BOOL GetFlashBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Flashing of the border or line is activated.
FALSE
Flashing of the border or line is not activated.

2498

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetFlashBackColor example (Page 2218)
GetFlashBackColor example

GetFlashForeColor
Function
Specifies whether flashing of the font is activated or not.

Syntax
BOOL GetFlashForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Flashing of the font is activated.
FALSE
Flashing of the font is not activated.

See also
GetFlashBackColor example (Page 2218)
GetFlashBackColor example

GetFlashRateBackColor
Function
Specifies the flash frequency of the background.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2499

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetFlashRateBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of the background

See also
GetFlashBackColorOn example (Page 2219)
Flash frequencies (Page 2282)
GetFlashBackColorOn example
Flash frequencies

GetFlashRateBorderColor
Function
Specifies the flash frequency of the line or border.

Syntax
long int GetFlashRateBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of the line or border

2500

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetFlashBackColorOn example (Page 2219)
Flash frequencies (Page 2282)
GetFlashBackColorOn example
Flash frequencies

GetFlashRateForeColor
Function
Specifies the flash frequency of the font.

Syntax
long int GetFlashRateForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of the font

See also
GetFlashBackColorOn example (Page 2219)
Flash frequencies (Page 2282)
GetFlashBackColorOn example
Flash frequencies

GetForeFlashColorOff
Function
Specifies the font flash color for the deactivated status.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2501

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetForeFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Font flash color for the deactivated status as a numeric value

See also
GetFlashBackColorOn example (Page 2219)
Color chart (Page 2284)
GetFlashBackColorOn example
Flash frequencies

GetForeFlashColorOn
Function
Specifies the font flash color for the activated status.

Syntax
long int GetForeFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Font flash color for the activated status as a numeric value

2502

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetFlashBackColorOn example (Page 2219)
Color chart (Page 2284)
GetFlashBackColorOn example
Color chart

focus
Focus - short description
Using the functions in the Focus group, it is possible to set the focus or poll which object has
the focus.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

Get_Focus
Function
Specifies the name of the object currently or last focussed.

Syntax
char *Get_Focus();

Return value
Name of the object currently or last focussed.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetFocus example (Page 2220)
GetFocus example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2503

ANSI-C function descriptions


4.3 Internal functions

font
Font - short description
The various properties affecting text can be modified or called in using the functions in the
Font group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetAlignmentLeft
Function
Specifies the horizontal text alignment (left, centered, right).

Syntax
long int GetAlignmentLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Horizontal text alignment as a numeric value

See also
Text alignment (Page 2289)
GetFontSize example (Page 2221)
GetFontSize example
Text alignment

2504

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetAlignmentTop
Function
Specifies the vertical text alignment (top, centered, bottom).

Syntax
long int GetAlignmentTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Vertical text alignment as a numeric value

See also
GetFontSize example (Page 2221)
Text alignment (Page 2289)
GetFontSize example
Text alignment

GetFontBold
Function
Specifies whether the font is bold or not.

Syntax
BOOL GetFontBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2505

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
TRUE
Bold font on
FALSE
Bold font off

See also
GetFontBold example (Page 2221)
GetFontBold example

GetFontItalic
Function
Specifies whether the font is italic or not.

Syntax
BOOL GetFontItalic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Italic font on
FALSE
Italic font off

2506

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetFontBold example (Page 2221)
GetFontBold example

GetFontName
Function
Indicates the current font name.

Syntax
char* GetFontName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to the name of the font currently selected.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetText example (Page 2249)
GetText example

GetFontSize
Function
Specifies the font size.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2507

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetFontSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current font size

See also
GetFontSize example (Page 2221)
GetFontSize example

GetFontUnderline
Function
Specifies whether the font is underlined or not.

Syntax
BOOL GetFontUnderline(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Underlined font on

2508

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
Underlined font off

See also
GetFontBold example (Page 2221)
GetFontBold example

GetOrientation
Function
Specifies the text orientation (vertical/horizontal).

Syntax
BOOL GetOrientation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Vertical text orientation
FALSE
Horizontal text orientation

See also
GetFontBold example (Page 2221)
GetFontBold example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2509

ANSI-C function descriptions


4.3 Internal functions

GetText
Function
Specifies the value of the "text" property for objects like static text, check box or radio box.

Syntax
char* GetText(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to a text.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
In case of check and radio boxes, the element to be determined must be defined with the
"SetIndex" function before actually activating this function.

See also
GetText example (Page 2249)

general
GetLayer
Function
Specifies the picture layer in which the object is located.

2510

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetLayer(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture layer in which the object is located

geometry
Geometry - short description
The size, position and other geometrical properties of objects can be modified or called in using
the functions in the Geometry group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetActualPointLeft
Function
Specifies the X value of the current position in a polygon or polygon line.

Syntax
long int GetActualPointLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2511

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
X value for the current point of a polygon or polygon line
Note
The current point of the polygon can be set using the SetIndex function.

See also
GetLeft example (Page 2223)
GetLeft example

GetActualPointTop
Function
Specifies the Y value of the current position in a polygon or polygon line.

Syntax
long int GetActualPointTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Y value for the current point of a polygon or polygon line
Note
The current point of the polygon can be set using the SetIndex function.

2512

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetTop example (Page 2250)
GetTop example

GetBoxCount
Function
Specifies the number of fields for check boxes and radio boxes.

Syntax
long int GetBoxCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of fields in a check box or radio box.

GetDirection
Function
Specifies the bar direction for bar objects.

Syntax
long int GetDirection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2513

ANSI-C function descriptions


4.3 Internal functions

Return value
Bar direction of bar objects as numeric value

See also
Bar direction (Page 2281)
Bar direction

GetEndAngle
Function
Specifies the end angle of circle and ellipse segments and circle and elliptical arcs.

Syntax
long int GetEndAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
End angle of circle and ellipse segments as well as circle and ellipse arcs

GetGrid
Function
Specifies whether the grid is activated in the graphics area of Graphics Designer.

Syntax
BOOL GetGrid(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2514

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Grid in Graphics Designer is activated.
FALSE
Grid in Graphics Designer is deactivated.

GetGridHeight
Function
Specifies the height of the grid in the graphics area of Graphics Designer.

Syntax
long int GetGridHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Height of the grid in Graphics Designer

GetGridWidth
Function
Specifies the width of the grid in the graphics area of Graphics Designer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2515

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetGridWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Width of the grid in Graphics Designer

GetHeight
Function
Specifies the height of the rectangle framing an object.

Syntax
long int GetHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Height of the rectangle framing an object
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

2516

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetHeight example (Page 2222)

GetLeft
Function
Specifies the X position of the upper left corner of the rectangle framing an object.

Syntax
long int GetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current X value of the upper left corner of the rectangle framing an object

See also
GetLeft example (Page 2223)
GetLeft example

GetPointCount
Function
Specifies the number of corners of a polygon or in a polygon line.

Syntax
long int GetPointCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2517

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of corners of a polygon or in a polyline

GetRadius
Function
Specifies the radius of a circle, circle segment or arc.

Syntax
long int GetRadius(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Radius of a circle, circle segment or arc

See also
GetHeight example (Page 2222)
GetHeight example

GetRadiusHeight
Function
Specifies the radius of an ellipse, ellipse segment or elliptical arc in a vertical direction.

2518

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetRadiusHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Radius of an ellipse, ellipse segment or elliptical arc in a vertical direction

See also
GetHeight example (Page 2222)
GetHeight example

GetRadiusWidth
Function
Specifies the radius of an ellipse, ellipse segment or elliptical arc in a horizontal direction.

Syntax
long int GetRadiusWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Radius of an ellipse, ellipse segment or elliptical arc in a horizontal direction

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2519

ANSI-C function descriptions


4.3 Internal functions

See also
GetHeight example (Page 2222)
GetHeight example

GetReferenceRotationLeft
Function
Specifies the X value of the rotation reference (central axis about which the object can be
rotated) for lines, polygons and polylines.

Syntax
long int GetReferenceRotationLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
X value of the rotation reference for lines, polygons and polygon lines

See also
GetLeft example (Page 2223)
GetLeft example

GetReferenceRotationTop
Function
Specifies the Y value of the rotation reference (central axis about which the object can be
rotated) for lines, polygons and polylines.

Syntax
long int GetReferenceRotationTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2520

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Y value of the rotation reference for lines, polygons and polygon lines

See also
GetTop example (Page 2250)
GetTop example

GetRotationAngle
Function
Specifies the angle of rotation about the central axis for lines, polygons and polylines.

Syntax
long int GetRotationAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Angle of rotation about the central axis

See also
GetHeight example (Page 2222)
GetHeight example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2521

ANSI-C function descriptions


4.3 Internal functions

GetRoundCornerHeight
Function
Specifies the radius of the rounded corner of a rectangle vertically.

Syntax
long int GetRoundCornerHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Vertical radius of the rounded corner of a rectangle

See also
GetHeight example (Page 2222)
GetHeight example

GetRoundCornerWidth
Function
Specifies the radius of the rounded corner of a rectangle horizontally.

Syntax
long int GetRoundCornerWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2522

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Horizontal radius of the corner of the rounded corner of a rectangle

See also
GetWidth example (Page 2251)
GetWidth example

GetStartAngle
Function
Specifies the start angle of circle and ellipse segments and circle and elliptical arcs.

Syntax
long int GetStartAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Start angle of circle and ellipse segments as well as circle and elliptical arcs

See also
GetHeight example (Page 2222)
GetHeight example

GetTop
Function
Specifies the Y position of the upper left corner of the rectangle framing an object.

Syntax
long int GetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2523

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Current Y value of the upper left corner of the rectangle framing an object

See also
GetTop example (Page 2250)
GetTop example

GetWidth
Function
Specifies the width of the rectangle framing an object.

Syntax
long int GetWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Width of the rectangle framing an object
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

2524

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetWidth example (Page 2251)
GetWidth example

GetZeroPoint
Function
When using bar objects, it indicates the zero point.

Syntax
long int GetZeroPoint(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Zero point for bar objects

See also
GetHeight example (Page 2222)
GetHeight example

i_o
i_o - short description
The various properties affecting input and output values can be modified or called in using the
functions in the i_o group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2525

ANSI-C function descriptions


4.3 Internal functions

GetAssignments
Function
Assignment of text to the value range of lists

Syntax
char* GetAssignments(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
The assignment of text to the value range depends on the list type.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
List types (Page 2288)
List types

GetAssumeOnExit
Function
Specifies for I/O fields whether the entered value is assumed upon exiting the field.

Syntax
BOOL GetAssumeOnExit(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2526

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Value application upon exiting the field.
FALSE
No value application upon exiting the field.

GetAssumeOnFull
Function
Specifies for I/O fields whether the entered value is assumed on completion of input.

Syntax
BOOL GetAssumeOnFull(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Value application on completion of input.
FALSE
No value application on completion of input.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2527

ANSI-C function descriptions


4.3 Internal functions

GetBitNumber
Function
Specifies the relevant bit in the output value for the "bit" list type.

Syntax
long int GetBitNumber(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Indication of the relevant bit in the output value for the "bit" list type

See also
GetHiddenInput example (Page 2222)
List types (Page 2288)
List types
GetHiddenInput example

GetClearOnError
Function
Specifies for I/O fields whether deletion of the content in case of input errors is activated.

Syntax
BOOL GetClearOnError(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

2528

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
TRUE
Deletion of the content in case of input errors is activated
FALSE
Deletion of the content in case of input errors is not activated

GetClearOnNew
Function
Specifies for I/O fields whether deletion of the content on new input is activated.

Syntax
BOOL GetClearOnNew(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Deletion of the content on new input is activated.
FALSE
Deletion of the content on new input is not activated.

GetDataFormat
Function
Specifies the data type of the field content for I/O fields.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2529

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetDataFormat(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Data type of the field content as numeric value

See also
GetHiddenInput example (Page 2222)
I/O field, data type of the field content (Page 2283)
GetHiddenInput example
I/O field, data type of the field content

GetHiddenInput
Function
Specifies whether hidden input is activated for I/O fields.

Syntax
BOOL GetHiddenInput(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2530

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Hidden input is activated
FALSE
Hidden input is not activated

See also
GetHiddenInput example (Page 2222)
GetHiddenInput example

GetInputValueChar
Function
Specifies the input value in the data type "char" for I/O fields.

Syntax
char* GetInputValueChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to the input value in the data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2531

ANSI-C function descriptions


4.3 Internal functions

GetInputValueDouble
Function
Specifies the input value in the data type "double" for I/O fields.

Syntax
double GetInputValueDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Input value in the data type "double"

GetListType
Function
Specifies the list type for the "text list" object.

Syntax
long int GetListType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
List type for the "text list" object

2532

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetHiddenInput example (Page 2222)
List types (Page 2288)
GetHiddenInput example
List types

GetNumberLines
Function
Specifies the number of visible lines for the "text list" object.

Syntax
long int GetNumberLines(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of visible lines for the "text list" object
Note
If the amount of configured text is larger than the number of visible lines, the "text list" object
receives a vertical scroll bar.

See also
GetHiddenInput example (Page 2222)
GetHiddenInput example

GetOutputFormat
Function
Specifies the output format for I/O fields.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2533

ANSI-C function descriptions


4.3 Internal functions

Syntax
char* GetOutputFormat(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Pointer to the output format.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
I/O field, data type of the field content (Page 2283)
I/O field, output format (Page 2282)
I/O field, data type of the field content
I/O field, output format

GetOutputValueChar
Function
Determines the output value in the data type "char" for I/O fields. This function should only be
used if the field content of the I/O field is of the "string" data type.

Syntax
char* GetOutputValueChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

2534

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Pointer to the output value in the data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

GetOutputValueDouble
Function
Determines the output value in the data type "double" for I/O fields. This function should only
be used if the field content of the I/O field is not of the "string" data type.

Syntax
double GetOutputValueDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Output value in the data type "double"

See also
GetOutputValueDouble example (Page 2226)
GetOutputValueDouble example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2535

ANSI-C function descriptions


4.3 Internal functions

Limits
Limits - short description
The various properties affecting limit values can be modified or called in using the functions
in the Limits group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetAlarmHigh
Function
Specifies the upper alarm limit for bar objects.

Syntax
double GetAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Upper alarm limit for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

2536

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetAlarmLow
Function
Specifies the lower alarm limit for bar objects.

Syntax
double GetAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Lower alarm limit for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetCheckAlarmHigh
Function
When using bar objects, it specifies whether the upper alarm limit is monitored.

Syntax
BOOL GetCheckAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2537

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
In case of bar objects the upper alarm limit is monitored.
FALSE
In case of bar objects the upper alarm limit is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckAlarmLow
Function
When using bar objects, it specifies whether the lower alarm limit is monitored.

Syntax
BOOL GetCheckAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower alarm limit is monitored.
FALSE
In case of bar objects the lower alarm limit is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

2538

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetCheckLimitHigh4
Function
When using bar objects, it specifies whether the upper limit value reserve 4 is monitored.

Syntax
BOOL GetCheckLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper limt value reserve 4 is monitored.
FALSE
In case of bar objects the upper limt value reserve 4 is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckLimitHigh5
Function
When using bar objects, it specifies whether the upper limit value reserve 5 is monitored.

Syntax
BOOL GetCheckLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2539

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper limt value reserve 5 is monitored.
FALSE
In case of bar objects the upper limt value reserve 5 is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckLimitLow4
Function
When using bar objects, it specifies whether the lower limit value reserve 4 is monitored.

Syntax
BOOL GetCheckLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limt value reserve 4 is monitored.

2540

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
In case of bar objects the lower limt value reserve 4 is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckLimitLow5
Function
When using bar objects, it specifies whether the lower limit value reserve 5 is monitored.

Syntax
BOOL GetCheckLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limt value reserve 5 is monitored.
FALSE
In case of bar objects the lower limt value reserve 5 is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2541

ANSI-C function descriptions


4.3 Internal functions

GetCheckToleranceHigh
Function
When using bar objects, it specifies whether the upper tolerance limit is monitored.

Syntax
BOOL GetCheckToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper tolerance limit is monitored.
FALSE
In case of bar objects the upper tolerance limit is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckToleranceLow
Function
When using bar objects, it specifies whether the lower tolerance limit is monitored.

Syntax
BOOL GetCheckToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2542

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower tolerance limit is monitored.
FALSE
In case of bar objects the lower tolerance limit is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckWarningHigh
Function
When using bar objects, it specifies whether the upper warning limit is monitored.

Syntax
BOOL GetCheckWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper warning limit is monitored.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2543

ANSI-C function descriptions


4.3 Internal functions
FALSE
In case of bar objects the upper warning limit is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

GetCheckWarningLow
Function
When using bar objects, it specifies whether the lower warning limit is monitored.

Syntax
BOOL GetCheckWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower warning limit is monitored.
FALSE
In case of bar objects the lower warning limit is not monitored.

See also
GetMarker example (Page 2226)
GetMarker example

2544

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetColorAlarmHigh
Function
Specifies the bar color for bar objects upon reaching the upper alarm limit.

Syntax
long int GetColorAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper alarm limit

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetColorAlarmLow
Function
Specifies the bar color for bar objects upon reaching the lower alarm limit.

Syntax
long int GetColorAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2545

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower alarm limit

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetColorLimitHigh4
Function
Specifies the bar color for bar objects upon reaching the upper limit reserve 4.

Syntax
long int GetColorLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper limit reserve 4

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

2546

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetColorLimitHigh5
Function
Specifies the bar color for bar objects upon reaching the upper limit reserve 5.

Syntax
long int GetColorLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper limit reserve 5

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetColorLimitLow4
Function
Specifies the bar color for bar objects upon reaching the lower limit reserve 4.

Syntax
long int GetColorLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2547

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower limit reserve 4

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetColorLimitLow5
Function
Specifies the bar color for bar objects upon reaching the lower limit reserve 5.

Syntax
long int GetColorLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower limit reserve 5

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

2548

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetColorToleranceHigh
Function
Specifies the bar color for bar objects upon reaching the upper tolerance limit.

Syntax
long int GetColorToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper tolerance limit

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetColorToleranceLow
Function
Specifies the bar color for bar objects upon reaching the lower tolerance limit.

Syntax
long int GetColorToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2549

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower tolerance limit

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetColorWarningHigh
Function
Specifies the bar color for bar objects upon reaching the upper warning limit limit.

Syntax
long int GetColorWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the upper warning limit

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

2550

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetColorWarningLow
Function
Specifies the bar color for bar objects upon reaching the lower warning limit.

Syntax
long int GetColorWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the bar color upon reaching the lower warning limit

See also
GetBackColor example (Page 2216)
Color chart (Page 2284)
GetBackColor example
Color chart

GetLimitHigh4
Function
Specifies the upper limit value for reserve 4 for bar objects.

Syntax
double GetLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2551

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
High limit value for reserve 4 for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetLimitHigh5
Function
Specifies the upper limit value for reserve 5 for bar objects.

Syntax
double GetLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
High limit value for reserve 5 for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetLimitLow4
Function
Specifies the low limit value for reserve 4 for bar objects.

2552

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
double GetLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Low limit value for reserve 4 for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetLimitLow5
Function
Specifies the low limit value for reserve 5 for bar objects.

Syntax
double GetLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Low limit value for reserve 5 for bar objects

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2553

ANSI-C function descriptions


4.3 Internal functions

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetLimitMax
Function
Specifies the upper limit value for I/O fields.

Syntax
double GetLimitMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
High limit value for I/O fields

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetLimitMin
Function
Specifies the low limit value for I/O fields.

Syntax
double GetLimitMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2554

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Low limit value for I/O fields

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetMarker
Function
When using bar objects, it specifies whether the limit marker is displayed.

Syntax
BOOL GetMarker(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Limit marker for bar objects is displayed.
FALSE
Limit marker for bar objects is not displayed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2555

ANSI-C function descriptions


4.3 Internal functions

See also
GetMarker example (Page 2226)
GetMarker example

GetToleranceHigh
Function
Specifies the upper tolerance limit for bar objects.

Syntax
double GetToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Upper tolerance limit for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetToleranceLow
Function
Specifies the lower tolerance limit for bar objects.

Syntax
double GetToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2556

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Lower tolerance limit for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetTypeAlarmHigh
Function
Specifies for bar objects whether the upper alarm limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper alarm limit is given in percentages.
FALSE
In case of bar objects the upper alarm limit is given in absolute terms.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2557

ANSI-C function descriptions


4.3 Internal functions

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeAlarmLow
Function
Specifies for bar objects whether the lower alarm limit is given in percentages or absolute terms.

Syntax
BOOL GetTypeAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower alarm limit is given in percentages.
FALSE
In case of bar objects the lower alarm limit is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeLimitHigh4
Function
Specifies for bar objects whether the upper limit reserve 4 is given in percentages or absolute
terms.

2558

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL GetTypeLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper limit reserve 4 is given in percentages.
FALSE
In case of bar objects the upper limit reserve 4 is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeLimitHigh5
Function
Specifies for bar objects whether the upper limit reserve 5 is given in percentages or absolute
terms.

Syntax
BOOL GetTypeLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2559

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
In case of bar objects the upper limit reserve 5 is given in percentages.
FALSE
In case of bar objects the upper limit reserve 5 is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeLimitLow4
Function
Specifies for bar objects whether the lower limit reserve 4 is given in percentages or absolute
terms.

Syntax
BOOL GetTypeLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limit reserve 4 is given in percentages.
FALSE
In case of bar objects the lower limit reserve 4 is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

2560

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetTypeLimitLow5
Function
Specifies for bar objects whether the lower limit reserve 5 is given in percentages or absolute
terms.

Syntax
BOOL GetTypeLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower limit reserve 5 is given in percentages.
FALSE
In case of bar objects the lower limit reserve 5 is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeToleranceHigh
Function
Specifies for bar objects whether the upper tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2561

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper tolerance limit is given in percentages.
FALSE
In case of bar objects the upper tolerance limit is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeToleranceLow
Function
Specifies for bar objects whether the lower tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower tolerance limit is given in percentages.

2562

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
In case of bar objects the lower tolerance limit is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetTypeWarningHigh
Function
Specifies for bar objects whether the upper warning limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the upper warning limit is given in percentages.
FALSE
In case of bar objects the upper warning limit is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2563

ANSI-C function descriptions


4.3 Internal functions

GetTypeWarningLow
Function
Specifies for bar objects whether the lower warning limit is given in percentages or absolute
terms.

Syntax
BOOL GetTypeWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
In case of bar objects the lower warning limit is given in percentages.
FALSE
In case of bar objects the lower warning limit is given in absolute terms.

See also
GetMarker example (Page 2226)
GetMarker example

GetWarningHigh
Function
Specifies the upper warning limit for bar objects.

Syntax
double GetWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2564

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Upper warning limit for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

GetWarningLow
Function
Specifies the lower warning limit for bar objects.

Syntax
double GetWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Lower warning limit for bar objects

See also
GetAlarmHigh example (Page 2215)
GetAlarmHigh example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2565

ANSI-C function descriptions


4.3 Internal functions

link
Link - short description
A tag link property can be created or called in using the functions in the Link group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetLink
Function
Specifies the current tag connection of object properties.

Syntax
BOOL GetLink(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, LPLINKINFO *pLink);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Object property
pLink
Pointer to a structure of the type: LINKINFO

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2566

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Structure definition LINKINFO (Page 2297)
GetLink example (Page 2224)
GetLink example
LINKINFO structure definition

miscs
Miscs - short description
The properties of objects can be modified or called in using the functions in the Miscs group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetAdaptBorder
Function
Specifies for static texts, I/O fields, check boxes and radio boxes whether the border of the
field is to be dynamically adapted to the text size.

Syntax
BOOL GetAdaptBorder(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Border is adapted

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2567

ANSI-C function descriptions


4.3 Internal functions
FALSE
Border is not adapted

See also
GetVisible example (Page 2251)
GetVisible example

GetAdaptPicture
Function
Specifies for picture windows whether the picture is to be adapted to the window size.

Syntax
BOOL GetAdaptPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture is adapted
FALSE
Picture is not adapted

See also
GetVisible example (Page 2251)
GetVisible example

2568

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetAdaptSize
Function
Specifies for picture windows whether the window is to be adapted.

Syntax
BOOL GetAdaptSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Window is adapted
FALSE
Window is not adapted

See also
GetVisible example (Page 2251)
GetVisible example

GetAverage
Function
When using bar objects, it specifies whether value averaging is activated.

Syntax
BOOL GetAverage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2569

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Averaging is activated for bar objects
FALSE
Averaging is not activated for bar objects

See also
GetVisible example (Page 2251)
GetVisible example

GetBoxType
Function
Specifies the field type (input field, output field, input/output field) for I/O fields.

Syntax
long int GetBoxType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Field type of an I/O field

2570

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
I/O field, field type (Page 2284)
I/O field, field type

GetCaption
Function
Specifies whether a picture or application window has a title.

Syntax
BOOL GetCaption(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture/application window has a title
FALSE
Picture/application window has no title

See also
GetVisible example (Page 2251)
GetVisible example

GetCloseButton
Function
When using a picture window, it specifies whether the window can be closed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2571

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL GetCloseButton(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture window can be closed
FALSE
Picture window cannot be closed

See also
GetVisible example (Page 2251)
GetVisible example

GetColorChangeType
Function
When using bar objects, it specifies whether the color change upon reaching a limit value only
affects a bar segment or the entire bar.

Syntax
BOOL GetColorChangeType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2572

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Color change applies to the bar sagment
FALSE
Color change applies to the entire bar

See also
GetVisible example (Page 2251)
GetVisible example

GetCursorControl
Function
Specifies whether cursor control is activated for I/O fields.

Syntax
BOOL GetCursorControl(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Cursor control for I/O fields is enabled.
FALSE
Cursor control for I/O fields is disabled.

See also
GetVisible example (Page 2251)
GetVisible example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2573

ANSI-C function descriptions


4.3 Internal functions

GetCursorMode
Function
Specifies whether the cursor mode for the picture is alpha cursor or tab order cursor.

Syntax
BOOL GetCursorMode(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Cursor mode for the picture is "Alpha-cursor"
FALSE
Cursor mode for the picture is "tab order cursor"

See also
GetVisible example (Page 2251)
GetVisible example

GetEditAtOnce
Function
Specifies whether the "Immediate input" property is activated for I/O fields.

Syntax
BOOL GetEditAtOnce(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2574

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
"Immediate input" property is activated
FALSE
"Immediate input" property is deactivated

See also
GetVisible example (Page 2251)
GetVisible example

GetExtendedOperation
Function
Specifies whether the "Extended operation" property is activated for slider objects.

Syntax
BOOL GetExtendedOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
"Extended operation" property is activated

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2575

ANSI-C function descriptions


4.3 Internal functions
FALSE
"Extended operation" property is deactivated

See also
GetVisible example (Page 2251)
GetVisible example

GetHotkey
Function
Specifies the key combination for check boxes.

Syntax
long int GetHotkey(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Key code for key combinations for check boxes

GetHysteresis
Function
When using bar objects, it specifies whether the display appears with or without hysteresis.

Syntax
BOOL GetHysteresis(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2576

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Display with hysteresis for bar objects
FALSE
Display without hysteresis for bar objects

See also
GetVisible example (Page 2251)
GetVisible example

GetHysteresisRange
Function
Specifies the hysteresis value in the display for bar objects.

Syntax
double GetHysteresisRange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Hysteresis in the display for bar objects

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2577

ANSI-C function descriptions


4.3 Internal functions

GetLanguageSwitch
Function
Specifies fot the "Text list" object whether the assignment texts are to be stored in the text
library or in the object itself.

Syntax
BOOL GetLanguageSwitch(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Assignment texts are stored in the text library
FALSE
Assignment texts are stored in the text list object

See also
GetVisible example (Page 2251)
GetVisible example

GetLastChange
Function
Specifies the date when the picture was last changed.

Syntax
char* GetLastChange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2578

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Date of the last change of the picture.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetPictureName example (Page 2228)
GetPictureName example

GetMax
Function
Specifies the maximum value for bar and slider objects.

Syntax
double GetMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Maximum value for bar and slider objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2579

ANSI-C function descriptions


4.3 Internal functions

GetMaximizeButton
Function
Specifies for picture or application windows whether the window can be maximized.

Syntax
BOOL GetMaximizeButton(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture or application window can be maximized
FALSE
Picture or application window cannot be maximized

See also
GetVisible example (Page 2251)
GetVisible example

GetMin
Function
Specifies the minimum value for bar and slider objects.

Syntax
double GetMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2580

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Minimum value for bar and slider objects

GetMoveable
Function
Specifies for picture or application windows whether the window can be moved.

Syntax
BOOL GetMoveable(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture or application window is movable
FALSE
Picture or application window is not movable

See also
GetVisible example (Page 2251)
GetVisible example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2581

ANSI-C function descriptions


4.3 Internal functions

GetOffsetLeft
Function
Specifies the horizontal picture distance from the left window border for picture windows.

Syntax
long int GetOffsetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Horizontal picture distance from the left window border for picture windows

GetOffsetTop
Function
Specifies the vertical picture distance from the upper window border for picture windows.

Syntax
long int GetOffsetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Vertical picture distance from the upper window border for picture windows

2582

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetOnTop
Function
Specifies for picture or application windows whether the window is always in the foreground.

Syntax
BOOL GetOnTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture or application window is always in the foreground
FALSE
Picture or application window can be overlapped by other windows.

See also
GetVisible example (Page 2251)
GetVisible example

GetOperation
Function
Specifies whether the object can be operated.

Syntax
BOOL GetOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2583

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Object is operable
FALSE
Object is not operable
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetVisible example (Page 2251)
GetVisible example

GetOperationMessage
Function
Specifies for I/O fields, check boxes, radio boxes or sliders whether a message is output
following operation.

Syntax
BOOL GetOperationMessage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2584

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Upon operation a message is issued
FALSE
Upon operation no message is issued

See also
GetVisible example (Page 2251)
GetVisible example

GetOperationReport
Function
Specifies for all objects except application and picture windows and OLE control whether the
reason for the operation is logged.

Syntax
BOOL GetOperationReport(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Reason for the operation is logged.
FALSE
Reason for the operation is not logged.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2585

ANSI-C function descriptions


4.3 Internal functions

See also
GetVisible example (Page 2251)
GetVisible example

GetPasswordLevel
Function
Specifies the authorization level for the operation of the object for all objects except application
and picture windows and OLE control.

Syntax
long int GetPasswordLevel(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Authorization level for the operation of the object
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

GetPictureName
Function
Returns the name of the picture currently displayed in the picture window.

Syntax
char* GetPictureName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2586

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Name of the picture window

Return value
Pointer to the name of the currently displayed picture
Note
If both parameters are NULL, a pointer appears indicating the name of the basic screen.

See also
GetPictureName example (Page 2228)
GetPictureName example

GetProcess
Function
Specifies the default setting value for the process value to be displayed for bar and slider
objects.
Specifies the selected fields for check boxes and radio boxes.

Syntax
double GetProcess(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2587

ANSI-C function descriptions


4.3 Internal functions

Return value
For bar and slider objects: Default setting value for the process value to be displayed
For check and radio boxes: In a 32-bit word each field is represented by a bit (field 1
corrsponds to the bit value 0). Selected fields are marked by a set bit. Non-existing are
assigned 0.

GetScrollBars
Function
Specifies for picture windows whether the window has a scroll bar.

Syntax
BOOL GetScrollBars(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Picture window has a scroll bar
FALSE
Picture window has no scroll bar

See also
GetVisible example (Page 2251)
GetVisible example

GetServerName
Function
Specifies the default setting for the process value to be displayed for OLE control and OLE
object.

2588

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
char* GetServerName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Name of the object (OLE control and OLE object) under which it is registered in WINDOWS.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetPictureName example (Page 2228)
GetPictureName example

GetSizeable
Function
Specifies for application or picture windows whether the window size can be changed.

Syntax
BOOL GetSizeable(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2589

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Application or picture window is sizeable
FALSE
Application or picture window is not sizeable

See also
GetVisible example (Page 2251)
GetVisible example

GetSmallChange
Function
Specifies the number of steps for slider objects by which the slider is shifted by a mouse click.

Syntax
long int GetSmallChange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Number of steps by which the slider is shifted by a mouse click

GetTagPrefix
Function
Returns the tag prefix of a picture window.

Syntax
char* GetTagPrefix(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2590

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Tag prefix of the picture window.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetTagPrefix example (Page 2244)
GetTagPrefix example

GetTrend
Function
When using bar objects, it specifies whether the trend display is activated.

Syntax
BOOL GetTrend(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2591

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Trend display is activated for a bar object
FALSE
Trend display is not activated for a bar object

See also
GetVisible example (Page 2251)
GetVisible example

GetUpdateCycle
Function
Specifies the update cycle for the entire picture.

Syntax
long int GetUpdateCycle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the update cycle

See also
Structure definition LINKINFO (Page 2297)
Structure definition LINKINFO

2592

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetVisible
Function
Specifies whether the object is displayed.

Syntax
BOOL GetVisible(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Object is displayed
FALSE
Object is not displayed
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
GetVisible example (Page 2251)
GetVisible example

GetWindowBorder
Function
Specifies for application or picture windows whether the object is displayed with a border.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2593

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL GetWindowBorder(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Application or picture window is displayed with a border.
FALSE
Application or picture window is displayed without a border.

See also
GetVisible example (Page 2251)
GetVisible example

GetZeroPointValue
Function
Specifies the absolute value of the zero point for bar objects.

Syntax
double GetZeroPointValue(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2594

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Absolute value of the zero point for the bar display

GetZoom
Function
Specifies the scaling factor for picture windos.

Syntax
long int GetZoom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Scaling factor of a picture window

ole_control
OLE_control - short description
The functions in the ole_Control group can only be used with OCX slider objects.
Various OCX slider object properties and settings can be modified or called in using these
functions.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2595

ANSI-C function descriptions


4.3 Internal functions

GetPosition
Function
Specifies the position of the slider for OCX slider objects.

Syntax
long int GetPosition(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Slider position of the OCX slider object as numeric value

See also
GetPosition example (Page 2229)
GetPosition example

GetRangeMax
Function
Specifies the adjustment range "Max" for OCX slider objects.

Syntax
long int GetRangeMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2596

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Adjustment range "Max" of the OCX slider object as numeric value

See also
GetRangeMax example (Page 2231)
GetRangeMax example

GetRangeMin
Function
Specifies the adjustment range "Min" for OCX slider objects.

Syntax
long int GetRangeMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Adjustment range "Min" of the OCX slider object as numeric value

See also
GetRangeMin example (Page 2232)
GetRangeMin example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2597

ANSI-C function descriptions


4.3 Internal functions

pictures
Pictures - short description
Various properties of pictures of graphic objects and round buttons can be modified or called
in using the functions in the Pictures group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetPicDeactReferenced
Function
Specifies whether the picture for the "deactivated" status is referenced for round buttons.

Syntax
BOOL GetPicDeactReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The picture assigned to the "deactivated" status was not stored in the object.
FALSE
The picture assigned to the "deactivated" status was stored in the object.

GetPicDeactTransparent
Function
Specifies the transparent color for the "deactivated" status of round buttons.

2598

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetPicDeactTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the transparent color for the "deactivated" status
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
GetBackColor example (Page 2216)
GetBackColor example
Color chart

GetPicDeactUseTransColor
Function
Specifies whether the transparent color for the "deactivated" status is used for round buttons.

Syntax
BOOL GetPicDeactUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2599

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Transparent color for "deactivated" status is used
FALSE
Transparent color for "deactivated" status is not used

GetPicDownReferenced
Function
Specifies whether the picture for the "On/pressed" status is referenced for round buttons.

Syntax
BOOL GetPicDownReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The picture assigned to the "On/pressed" status was not stored in the object.
FALSE
The picture assigned to the "On/pressed" status was stored in the object.

GetPicDownTransparent
Function
Specifies the transparent color for the "On/pressed" status of round buttons.

Syntax
long int GetPicDownTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2600

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the transparent color for the "On/pressed" status
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
GetPictureDown example (Page 2227)
Color chart
GetPictureDown example

GetPicDownUseTransColor
Function
Specifies whether the transparent color for the "On/pressed" status is used for round buttons.

Syntax
BOOL GetPicDownUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2601

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Transparent color for "On/pressed" status is used
FALSE
Transparent color for "On/pressed" status is not used

GetPicReferenced
Function
When using graphic objects, it specifies whether the picture is referenced.

Syntax
BOOL GetPicReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The assigned picture was not stored in the object.
FALSE
The assigned picture was stored in the object.

GetPicTransColor
Function
Specifies the transparent color for a background picture for graphic objects.

Syntax
long int GetPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

2602

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the background picture of a graphic object
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
GetBackColor example (Page 2216)
GetBackColor example
Color chart

GetPictureDeactivated
Function
Specifies the picture name for the "deactivated" status of round buttons.

Syntax
char* GetPictureDeactivated(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture name for "deactivated" status.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2603

ANSI-C function descriptions


4.3 Internal functions
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

GetPictureDown
Function
Specifies the picture name for the "On/pressed" status of round buttons.

Syntax
char* GetPictureDown(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture name for the "On/pressed" status.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

2604

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetPictureDown example (Page 2227)
GetPictureDown example

GetPictureUp
Function
Specifies the picture name for the "Off/not pressed" status of round buttons.

Syntax
char* GetPictureUp(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Picture name for the "Off/not pressed" status.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
GetPictureUp example (Page 2229)
GetPictureUp example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2605

ANSI-C function descriptions


4.3 Internal functions

GetPicUpReferenced
Function
Specifies whether the picture for the "Off/not pressed" status is referenced for round buttons.

Syntax
BOOL GetPicUpReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The picture assigned to the "Off/not pressed" status was not stored in the object.
FALSE
The picture assigned to the "Off/not pressed" status was stored in the object.

GetPicUpTransparent
Function
Specifies the transparent color for the "Off/not pressed" status of round buttons.

Syntax
long int GetPicUpTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2606

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Numeric value defining the transparent color for the "Off/not pressed" status
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
GetBackColor example (Page 2216)
GetBackColor example
Color chart

GetPicUpUseTransColor
Function
Specifies whether the transparent color for the "Off/not pressed" status is used for round
buttons.

Syntax
BOOL GetPicUpUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Transparent color for "Off/not pressed" status is used
FALSE
Transparent color for "Off/not pressed" status is not used

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2607

ANSI-C function descriptions


4.3 Internal functions

GetPicUseTransColor
Function
When using graphic objects, it specifies whether the transparent color is used for a background
picture.

Syntax
BOOL GetPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Transparent color is used for a background picture.
FALSE
Transparent color is not used for a background picture.

property
Property - short description
The properties of objects for which there are no direct functions can be modified or called in
using the functions in the Property group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2608

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetPropBOOL
Function
Specifies the current status of a property of the data type "BOOL".

Syntax
BOOL GetPropBOOL(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property

Return value
Value of the attribute in the data type "BOOL"

See also
GetPropBOOL example (Page 2230)
GetPropBOOL example

GetPropChar
Function
Specifies the current status of a property of the data type "char".

Syntax
char* GetPropChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2609

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property

Return value
Pointer to a character string containing the value of the object property.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetPropChar example (Page 2231)
GetPropChar example

GetPropDouble
Function
Specifies the current status of a property of the data type "double".

Syntax
double GetPropDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2610

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszPropertyName
Name of the object property

Return value
Value of the attribute in the data type "double"

GetPropWord
Function
Specifies the current status of a property of the data type "long".

Syntax
long GetPropWord(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property

Return value
Value of the attribute in the type "long"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2611

ANSI-C function descriptions


4.3 Internal functions

state
State - short description
The properties of status displays can be modified or called in using the functions in the State
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetBasePicReferenced
Function
Specifies whether the basic picture is referenced for the status display.

Syntax
BOOL GetBasePicReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The basic picture was not stored in the object.
FALSE
The basic picture was stored in the object.

GetBasePicTransColor
Function
Specifies the transparent color of the basic picture for the status display.

2612

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetBasePicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Transparent color of the basic picture as numeric value
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
GetBackColor example (Page 2216)
GetBackColor example
Color chart

GetBasePicture
Function
Specifies the basic picture name fur the status display.

Syntax
char* GetBasePicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2613

ANSI-C function descriptions


4.3 Internal functions

Return value
Basic picture name for the status display.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

GetBasePicUseTransColor
Function
When using the status display, it specifies whether the transparent color is used for the basic
picture.

Syntax
BOOL GetBasePicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Transparent color is used for the basic picture.
FALSE
Transparent color is not used for the basic picture.

GetFlashFlashPicture
Function
Specifies whether the flash picture of the status display is animated dynamically or statically.

2614

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL GetFlashFlashPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The flash picture is animated dynamically.
FALSE
The flash picture is animated statically.

GetFlashPicReferenced
Function
Specifies whether the flash picture is referenced for the status display.

Syntax
BOOL GetFlashPicReferenced(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The flash picture was not stored in the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2615

ANSI-C function descriptions


4.3 Internal functions
FALSE
The flash picture was stored in the object.

GetFlashPicTransColor
Function
Specifies the transparent color of the flash picture for the status display.

Syntax
long int GetFlashPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Transparent color of the flash picture as numeric value
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
GetBackColor example (Page 2216)
GetBackColor example
Color chart

GetFlashPicture
Function
Specifies the flash picture name for the status display.

2616

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
char* GetFlashPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash picture name (file name of the graphic).
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

GetFlashPicUseTransColor
Function
When using the status display, it specifies whether the transparent color is used for the flash
picture.

Syntax
BOOL GetFlashPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2617

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Transparent color is used for the flash picture.
FALSE
Transparent color is not used for the flash picture.

GetFlashRateFlashPic
Function
Specifies the flash frequency of the flash picture for the status display.

Syntax
long int GetFlashRateFlashPic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Flash frequency of a flash picture as numeric value
Note
Since the flashing is performed by means of software engineering, the precise frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time etc.).

See also
Flash frequencies (Page 2282)
GetFlashRateFlashPic example (Page 2220)
Flash frequencies
GetFlashRateFlashPic example

2618

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetIndex
Function
Specifies the index of the current position in a polygon or polygon line.
Specifies the index of the current field for check boxes and radio boxes.

Syntax
long int GetIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Index of the current point or field

style
Style - short description
Various properties affecting the appearance of objects can be modified or called in using the
functions in the Style group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

GetBackBorderWidth
Function
Specifies the frame width of 3D frames and slider objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2619

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetBackBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value for the frame width of 3D frames and slider objects

See also
GetBorderStyle example (Page 2216)
GetBorderStyle example

GetBorderEndStyle
Function
Specifies the type of line end.

Syntax
long int GetBorderEndStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Type of line end as numeric value

2620

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetBorderStyle example (Page 2216)
Line end style (Page 2287)
GetBorderStyle example
Line style

GetBorderStyle
Function
Specifies the line or border style.

Syntax
long int GetBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the line or border style

See also
GetBorderStyle example (Page 2216)
Line styles (Page 2287)
GetBorderStyle example
Line styles

GetBorderWidth
Function
Specifies the line or border line width.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2621

ANSI-C function descriptions


4.3 Internal functions

Syntax
long int GetBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Line or border line width as numeric value

See also
GetBorderStyle example (Page 2216)
GetBorderStyle example

GetBoxAlignment
Function
Specifies the arrangement of controls (left or right justified) in check boxes or radio boxes.

Syntax
long int GetBoxAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the arrangement of controls in check boxes or radio boxes

2622

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetBorderStyle example (Page 2216)
Text alignment (Page 2289)
GetBorderStyle example
Text alignment

GetFillStyle
Function
Specifies the type of fill pattern.

Syntax
long int GetFillStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Type of fill pattern as numeric value
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
Fill pattern (Page 2286)
GetFillStyle example (Page 2218)
Fill pattern
GetFillStyle example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2623

ANSI-C function descriptions


4.3 Internal functions

GetFillStyle2
Function
Specifies the bar fill pattern for a bar graph.

Syntax
long int GetFillStyle2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Bar fill pattern as numeric value

See also
Fill pattern (Page 2286)
GetFillStyle example (Page 2218)
GetFillStyle example
Fill pattern

GetItemBorderStyle
Function
Specifies the dividing line style for the "text list" object.

Syntax
long int GetItemBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name

2624

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name

Return value
Dividing line style for the "text list" object

See also
GetBorderStyle example (Page 2216)
Line styles (Page 2287)
GetBorderStyle example
Line styles

GetItemBorderWidth
Function
Specifies the dividing line width for the "text list" object.

Syntax
long int GetItemBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
Numeric value defining the dividing line width for the "text list" object

See also
GetBorderStyle example (Page 2216)
GetBorderStyle example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2625

ANSI-C function descriptions


4.3 Internal functions

GetPressed
Function
Specifies for buttons or round buttons whether the switch setting is "pressed" or "not pressed".

Syntax
BOOL GetPressed(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Switch setting is "pressed"
FALSE
Switch setting is "not pressed"

GetToggle
Function
Specifies for buttons or round buttons whether the switch is latchable or not.

Syntax
BOOL GetToggle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2626

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
Switch is latchable
FALSE
Switch is not latchable

GetWindowsStyle
Function
Specifies whether buttons are to be displayed in Windows style.

Syntax
BOOL GetWindowsStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
Button is displayed in the usual Windows fashion.
FALSE
The apperance of the button is defined by the user.

4.3.4.3

set

axes
Axes - short description
The functions in the Axes group can only be used with bar graph objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2627

ANSI-C function descriptions


4.3 Internal functions
This function can be used to modify or query various bar graph object properties.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAlignment
Function
When using bar objects, it indicates whether the text is to the right or left of the bar.

Syntax
BOOL SetAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAlignment);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAlignment
Text alignment
TRUE Text is to the right of the bar
FALSE Text is to the left of the bar

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2628

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetScaling example (Page 2265)
SetScaling example

SetAxisSection
Function
When using bar objects, it specifies the axis section, i.e. the difference between the values of
two neighboring axis labels.

Syntax
BOOL SetAxisSection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dAxisSection);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dAxisSection
Axis section

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)

SetExponent
Function
Sets the axis label display for bar objects (exponential/decimal).
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2629

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetExponent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bExponent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bExponent
Axis labeling
TRUE Axis label in exponential form
FALSE Axis label in decimal form

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

SetLeftComma
Function
When using bar objects, it specifies the number of integers in the axis label.

Syntax
BOOL SetLeftComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lLeftComma);

2630

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lLeftComma
Number of integers

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

SetLongStrokesBold
Function
When using bar objects, it specifies whether the main division lines are bold or regular.

Syntax
BOOL SetLongStrokesBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bLongStrokesBold);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bLongStrokesBold
Main division lines on the bar graph scale
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2631

ANSI-C function descriptions


4.3 Internal functions
TRUE bold
FALSE normal

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

SetLongStrokesOnly
Function
When using bar objects, it specifies whether intermediate or only main division lines are used
on the scale.

Syntax
BOOL SetLongStrokesOnly(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bLongStrokesOnly);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bLongStrokesOnly
Only main division lines yes/no

Return value
TRUE
The function has been completed without any errors.

2632

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

SetLongStrokesSize
Function
When using bar objects, it specifies the length of the main division lines on the bar graph scale.

Syntax
BOOL SetLongStrokesSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lLongStrokesSize);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lLongStrokesSize
Length of the main division marks in pixels

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2633

ANSI-C function descriptions


4.3 Internal functions

SetRightComma
Function
When using bar objects, it specifies the number of decimal places in the axis label.

Syntax
BOOL SetRightComma(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRightComma);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRightComma
Number of decimal places

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

SetScaleTicks
Function
When using bar objects, it specifies the scale marks as number of scale sections. A scale
section is a part of the scale bounded by two main tick marks.

2634

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetScaleTicks(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lScaleTicks);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lScaleTicks
Number of scale sections

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the number of scale sections is given as 0, the bar object itself calculates a suitable scale
unit.

See also
SetScaling example (Page 2265)
SetScaling example

SetScaling
Function
Switches the bar graph scale of bar objects on or off.

Syntax
BOOL SetScaling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bScaling);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2635

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bScaling
Scale on/off.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetScaling example (Page 2265)
SetScaling example

SetScalingType
Function
When using bar objects, it specifies the type of bar scaling.

Syntax
BOOL SetScalingType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lScalingType);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lScalingType
Type of bar scaling as numeric value

2636

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Bar Scaling (Page 2282)
SetScaling example (Page 2265)
SetScaling example
Bar scaling

color
Color - short description
The various color properties of objects can be modified or queried using the functions in the
Color group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBackColor
Function
Sets the background color of the object.

Syntax
BOOL SetBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColor);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2637

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
lBackColor
Background color of the object as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetBackColor2
Function
Sets the bar color for bar objects.

Syntax
BOOL SetBackColor2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColor2);

Parameters
lpszPictureName
Picture name

2638

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
lBackColor2
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetBackColor3
Function
Sets the bar background color for bar objects.

Syntax
BOOL SetBackColor3(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColor3);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackColor3
Numeric value defining the bar background color

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2639

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetBackColorBottom
Function
Sets the background color of the slider objects at the bottom right.

Syntax
BOOL SetBackColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackColorBottom);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackColorBottom
Numeric value defining the background color of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2640

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetBackColorTop
Function
Sets the background color of the slider objects at the top left.

Syntax
BOOL SetBackColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBackColorTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackColorTop
Numeric value defining the background color of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2641

ANSI-C function descriptions


4.3 Internal functions

SetBorderBackColor
Function
Sets the background color of the lines or borders.

Syntax
BOOL SetBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderBackColor
Background color of the lines or borders

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetBorderColor
Function
Sets the color of the lines or borders.

2642

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderColor
Numeric value defining the color of lines or borders

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetBorderColorBottom
Function
Sets the 3D border color at the bottom.

Syntax
BOOL SetBorderColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBorderColorBottom);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2643

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderColorBottom
Numeric value defining the 3-D border color at the bottom

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetBorderColorTop
Function
Sets the 3D border color at the top.

Syntax
BOOL SetBorderColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderColorTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2644

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lBorderColorTop
Numeric value defining the 3-D border color at the top

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetButtonColor
Function
Sets the button color of slider objects.

Syntax
BOOL SetButtonColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lButtonColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lButtonColor
Numeric value defining the button color of slider objects

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2645

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorBottom
Function
When using slider objects, it sets the color of the bottom limit.

Syntax
BOOL SetColorBottom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorBottom);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorBottom
Numeric value defining the color of the bottom limit of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2646

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetColorTop
Function
When using slider objects, it sets the color of the top limit.

Syntax
BOOL SetColorTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorTop
Numeric value defining the color of the top limit of slider objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2647

ANSI-C function descriptions


4.3 Internal functions

SetFillColor
Function
Sets the color of the fill pattern.

Syntax
BOOL SetFillColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFillColor
Numeric value of the fill color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

2648

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetForeColor
Function
Sets the font color.

Syntax
BOOL SetForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lForeColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lForeColor
Numeric value defining the font color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetItemBorderBackColor
Function
Sets the background color of the separating line for the "text list" object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2649

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetItemBorderBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lItemBorderBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderBackColor
Background color of the dividing line as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetItemBorderColor
Function
Sets the color of the dividing line for the "text list" object.

Syntax
BOOL SetItemBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lItemBorderColor);

2650

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderColor
Numeric value defining the dividing line color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetScaleColor
Function
Sets the scale color for bar objects.

Syntax
BOOL SetScaleColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lScaleColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2651

ANSI-C function descriptions


4.3 Internal functions
lScaleColor
Numeric value of the scale color for bar objects

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetSelBGColor
Function
Sets the background color of the selected entry for the "text list" object.

Syntax
BOOL SetSelBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lSelBGColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lSelBGColor
Numeric value defining the background color in the selected entry

2652

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetSelTextColor
Function
Sets the font color of a selected entry for the "text list" object.

Syntax
BOOL SetSelTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lSelTextColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lSelTextColor
Numeric value defining the font color in the selected entry

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2653

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetTrendColor
Function
Sets the trend color for bar objects.

Syntax
BOOL SetTrendColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lTrendColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lTrendColor
Numeric value defining the trend color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

2654

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetUnselBGColor
Function
Sets the background color of non-selected entries for the "text list" object.

Syntax
BOOL SetUnselBGColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lUnselBGColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lUnselBGColor
Numeric value defining the background color for non-selected entries

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetUnselTextColor
Function
Sets the font color of non-selected entries for the "text list" object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2655

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetUnselTextColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lUnselTextColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lUnselTextColor
Numeric value defining the font color for non-selected entries

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

fill
Fill - short description
The functions in the Fill group control the dynamic filling of objects.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2656

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetFilling
Function
Activates or deactivates dynamic filling with background color.

Syntax
BOOL SetFilling(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bFilling);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFilling
Dynamic filling with background color on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFilling example (Page 2256)
SetFilling example

SetFillingIndex
Function
Sets the fill level.

Syntax
BOOL SetFillingIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillingIndex);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2657

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFillingIndex
Fill level as a numeric value (0 - 100)

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFillingIndex example (Page 2257)
SetFillingIndex example

flash
Flash - short description
The various flashing properties can be modified or called in using the functions in the Flash
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBackFlashColorOff
Function
Sets the background flash color for the deactivated status.

2658

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetBackFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackFlashColorOff);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackFlashColorOff
Background flash color for the deactivated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetFlashBackColorOn example (Page 2258)
Color chart
SetFlashBackColorOn example

SetBackFlashColorOn
Function
Sets the background flash color for the activated status.

Syntax
BOOL SetBackFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackFlashColorOn);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2659

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackFlashColorOn
Background flash color for the activated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetFlashBackColorOn example (Page 2258)
Color chart
SetFlashBackColorOn example

SetBorderFlashColorOff
Function
Sets the border or line flashing color for the deactivated status.

Syntax
BOOL SetBorderFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lBorderFlashColorOff);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2660

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lBorderFlashColorOff
Border or line flashing color for the deactivated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFlashBackColorOn example (Page 2258)
Color chart (Page 2284)
Color chart
SetFlashBackColorOn example

SetBorderFlashColorOn
Function
Sets the border or line flashing color for the activated status.

Syntax
BOOL SetBorderFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lBorderFlashColorOn);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderFlashColorOn
Border or line flashing color for the activated status as a numeric value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2661

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetFlashBackColorOn example (Page 2258)
Color chart
SetFlashBackColorOn example

SetFlashBackColor
Function
Activates or deactivates background flashing.

Syntax
BOOL SetFlashBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashBackColor
Flashing background on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2662

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetFlashBackColor example (Page 2257)
SetFlashBackColor example

SetFlashBorderColor
Function
Activates or deactivates flashing of the border or line.

Syntax
BOOL SetFlashBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashBorderColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashBorderColor
Flashing of the border or line on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFlashBackColor example (Page 2257)
Color chart

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2663

ANSI-C function descriptions


4.3 Internal functions

SetFlashForeColor
Function
Activates or deactivates font flashing.

Syntax
BOOL SetFlashForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashForeColor);

Parameters
lpszPictureName
Picture name

lpszObjectName
Object name
bFlashForeColor
Flashing of the font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFlashBackColor example (Page 2257)
SetFlashBackColor example

SetFlashRateBackColor
Function
Sets the flash frequency of the background.

2664

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetFlashRateBackColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lFlashRateBackColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashRateBackColor
Flash frequency of the background

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Flash frequencies (Page 2282)
SetFlashBackColor example (Page 2257)
SetFlashBackColor example
Flash frequencies

SetFlashRateBorderColor
Function
Sets the flash frequency of the line or border.

Syntax
BOOL SetFlashRateBorderColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lFlashRateBorderColor);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2665

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashRateBorderColor
Flash frequency of the line or border

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Flash frequencies (Page 2282)
SetFlashBackColor example (Page 2257)
SetFlashBackColor example
Flash frequencies

SetFlashRateForeColor
Function
Sets the flash frequency of the font.

Syntax
BOOL SetFlashRateForeColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lFlashRateForeColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2666

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lFlashRateForeColor
Flash frequency of the font

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Flash frequencies (Page 2282)
SetFlashBackColor example (Page 2257)
Flash frequencies
SetFlashBackColor example

SetForeFlashColorOff
Function
Sets the font flash color for the deactivated status.

Syntax
BOOL SetForeFlashColorOff(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lForeFlashColorOff);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lForeFlashColorOff
Font flash color for the deactivated status as a numeric value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2667

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetFlashBackColorOn example (Page 2258)
SetFlashBackColorOn example
Color chart

SetForeFlashColorOn
Function
Sets the font flash color for the activated status.

Syntax
BOOL SetForeFlashColorOn(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lForeFlashColorOn);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lForeFlashColorOn
Font flash color for the activated status as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2668

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetFlashBackColorOn example (Page 2258)
SetFlashBackColorOn example
Color chart

focus
Focus - short description
Using the functions in the Focus group, it is possible to set the focus or poll which object has
the focus.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

Set_Focus
Function
Sets the focus on the specified object.

Syntax
BOOL Set_Focus(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2669

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

See also
SetFocus example (Page 2258)
SetFocus example

font
Font - short description
The various properties affecting text can be modified or called in using the functions in the
Font group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAlignmentLeft
Function
Sets the horizontal text alignment (left, centered, right).

Syntax
BOOL SetAlignmentLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lAlignmentLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lAlignmentLeft
Horizontal text alignment as a numeric value

2670

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Text alignment (Page 2289)
SetFontSize example (Page 2259)
Text alignment
SetFontSize example

SetAlignmentTop
Function
Sets the vertical text alignment (top, centered, bottom).

Syntax
BOOL SetAlignmentTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lAlignmentTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lAlignmentTop
Vertical text alignment as a numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2671

ANSI-C function descriptions


4.3 Internal functions

See also
Text alignment (Page 2289)
SetFontSize example (Page 2259)
Text alignment
SetFontSize example

SetFontBold
Function
Switches the bold font on or off.

Syntax
BOOL SetFontBold(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFontBold);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFontBold
Bold font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontBold example (Page 2259)
SetFontBold example

2672

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetFontItalic
Function
Switches the italic font on or off.

Syntax
BOOL SetFontItalic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFontItalic);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFontItalic
Italic font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontBold example (Page 2259)
SetFontBold example

SetFontName
Function
Sets a font.

Syntax
BOOL SetFontName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szFontName);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2673

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szFontName
Pointer to name of font

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetText example (Page 2272)
SetText example

SetFontSize
Function
Sets the font size.

Syntax
BOOL SetFontSize(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFontSize);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFontSize
Font Size

2674

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontSize example (Page 2259)
SetFontSize example

SetFontUnderline
Function
Switches the underlined font on or off.

Syntax
BOOL SetFontUnderline(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFontUnderline);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFontUnderline
Underlined font on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2675

ANSI-C function descriptions


4.3 Internal functions

See also
SetFontBold example (Page 2259)
SetFontBold example

SetOrientation
Function
Defines the text orientation (vertical/horizontal).

Syntax
BOOL SetOrientation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bOrientation);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOrientation
Text orientation
TRUE vertical
FALSE Horizontal

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetFontBold example (Page 2259)
SetFontBold example

2676

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetText
Function
Sets the value of the "text" property for objects like static text, check box or radio box.

Syntax
BOOL SetText(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char* szText);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szText
Pointer to a text

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
In case of check and radio boxes the element to be changed must be defined with the
SetIndex function before actually activating this function.

See also
SetText example (Page 2272)
SetText example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2677

ANSI-C function descriptions


4.3 Internal functions

geometry
Geometry - short description
The size, position and other geometrical properties of objects can be modified or called in using
the functions in the Geometry group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetActualPointLeft
Function
Sets the X value for the current point of a polygon or polygon line.

Syntax
BOOL SetActualPointLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lActualPointLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lActualPointLeft
X value for the current point of a polygon or polygon line

Return value
TRUE
The function has been completed without any errors.

2678

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
The current point of the polygon can be set using the SetIndex function.

See also
SetLeft example (Page 2260)
SetLeft example

SetActualPointTop
Function
Sets the Y value for the current point of a polygon or polygon line.

Syntax
BOOL SetActualPointTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lActualPointTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lActualPointTop
Y value for the current point of a polygon or polygon line

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2679

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
The current point of the polygon can be set using the SetIndex function.

See also
SetTop example (Page 2273)
SetTop example

SetBoxCount
Function
Sets the number of fields in a check box or radio box.

Syntax
BOOL SetBoxCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBoxCount);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBoxCount
Number of fields in a check box or radio box.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2680

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetDirection
Function
Sets the bar direction for bar objects.

Syntax
BOOL SetDirection(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lDirection);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lDirection
Numeric value defining the bar direction

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Bar direction (Page 2281)
SetTop example (Page 2273)
SetTop example
Bar direction

SetEndAngle
Function
Sets the end angle of circle and ellipse segments and circle and elliptical arcs.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2681

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetEndAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lEndAngle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lEndAngle
End angle of circle and ellipse segments as well as circle and ellipse arcs

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetTop example (Page 2273)
SetTop example

SetHeight
Function
Sets the height of the rectangle framing an object.

Syntax
BOOL SetHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lHeight);

Parameters
lpszPictureName
Picture name

2682

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
lHeight
Height of the framing rectangle

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
SetHeight example (Page 2259)
SetHeight example

SetLeft
Function
Sets the X value of the upper left corner of the rectangle framing an object

Syntax
BOOL SetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lLeft
X value of the upper left corner of the framing rectangle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2683

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetLeft example (Page 2260)
SetLeft example

SetPointCount
Function
Sets the number of corners of a polygon or in a polygon line.

Syntax
BOOL SetPointCount(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPointCount);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPointCount
Number of corner points

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2684

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetLeft example (Page 2260)
SetLeft example

SetRadius
Function
Sets the radius of a circle, circle segment or arc.

Syntax
BOOL SetRadius(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lRadius);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRadius
Radius

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2259)
SetHeight example

SetRadiusHeight
Function
Sets the radius of an ellipse, ellipse segment or elliptical arc in vertical direction.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2685

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetRadiusHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRadiusHeight);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRadiusHeight
Radius in vertical direction

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2259)
SetHeight example

SetRadiusWidth
Function
Sets the radius of an ellipse, ellipse segment or elliptical arc in horizontal direction.

Syntax
BOOL SetRadiusWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRadiusWidth);

Parameters
lpszPictureName
Picture name

2686

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
lRadiusWidth
Radius in horizontal direction

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetWidth example (Page 2273)
SetWidth example

SetReferenceRotationLeft
Function
Sets the X value of the rotation reference (central axis about which the object can be rotated)
for lines, polygons and polylines.

Syntax
BOOL SetReferenceRotationLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lReferenceRotationLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lReferenceRotationLeft
X value of the rotation reference

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2687

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetLeft example (Page 2260)
SetLeft example

SetReferenceRotationTop
Function
Sets the Y value of the rotation reference (central axis about which the object can be rotated)
for lines, polygons and polylines.

Syntax
BOOL SetReferenceRotationTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lReferenceRotationTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lReferenceRotationTop
Y value of the rotation reference

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2688

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetTop example (Page 2273)
SetTop example

SetRotationAngle
Function
Sets the angle of rotation about the central axis for lines, polygons and polylines.

Syntax
BOOL SetRotationAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRotationAngle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRotationAngle
Angle of rotation

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetLeft example (Page 2260)
SetLeft example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2689

ANSI-C function descriptions


4.3 Internal functions

SetRoundCornerHeight
Function
Specifies the radius of the rounded corner of a rectangle vertically.

Syntax
BOOL SetRoundCornerHeight(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lRoundCornerHeight);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRoundCornerHeight
Vertical radius

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2259)
SetHeight example

SetRoundCornerWidth
Function
Specifies the radius of the rounded corner of a rectangle horizontally.

Syntax
BOOL SetRoundCornerWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lRoundCornerWidth);

2690

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRoundCornerWidth
Horizontal radius

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetWidth example (Page 2273)
SetWidth example

SetStartAngle
Function
Sets the start angle of circle and ellipse segments and circle and elliptical arcs.

Syntax
BOOL SetStartAngle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lStartAngle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lStartAngle
Starting angle
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2691

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHeight example (Page 2259)
SetHeight example

SetTop
Function
Sets the Y value of the upper left corner of the rectangle framing an object.

Syntax
BOOL SetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lTop);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lTop
Y value of the upper left corner of the framing rectangle

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2692

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetTop example (Page 2273)
SetTop example

SetWidth
Function
Sets the width of the rectangle framing an object.

Syntax
BOOL SetWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lWidth
Width of the framing rectangle

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
SetWidth example (Page 2273)
SetWidth example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2693

ANSI-C function descriptions


4.3 Internal functions

SetZeroPoint
Function
Sets the zero point for bar objects.

Syntax
BOOL SetZeroPoint(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lZeroPoint);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lZeroPoint
Zero point

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetTop example (Page 2273)
SetTop example

2694

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

i_o
i_o - short description
The various properties affecting input and output values can be modified or called in using the
functions in the i_o group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAssumeOnExit
Function
Specifies for I/O fields whether the entered value is assumed upon exiting the field.

Syntax
BOOL SetAssumeOnExit(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAssumeOnExit);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAssumeOnExit
Value application upon exiting the field yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2695

ANSI-C function descriptions


4.3 Internal functions

See also
SetHiddenInput example (Page 2260)
SetHiddenInput example

SetAssumeOnFull
Function
Specifies for I/O fields whether the entered value is assumed on completion of input.

Syntax
BOOL SetAssumeOnFull(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAssumeOnFull);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAssumeOnFull
Value application on completion of input yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHiddenInput example (Page 2260)
SetHiddenInput example

2696

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetBitNumber
Function
Sets the relevant bit in the output value for the "bit" list type.

Syntax
BOOL SetBitNumber(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBitNumber);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBitNumber
Relevant bit in the output value for the "bit" list type

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
List types (Page 2288)
List types

SetClearOnError
Function
Specifies for I/O fields whether deletion of the content in case of input errors is activated.

Syntax
BOOL SetClearOnError(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bClearOnError);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2697

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bClearOnError
Deletion of the entry in case of input errors yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHiddenInput example (Page 2260)
SetHiddenInput example

SetClearOnNew
Function
Specifies the deletion of the content in case of new inputs for I/O fields.

Syntax
BOOL SetClearOnNew(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bClearOnNew);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bClearOnNew
Deletion of content in case of new input yes/no

2698

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetHiddenInput example (Page 2260)
SetHiddenInput example

SetHiddenInput
Function
Controls the hidden input for I/O fields.

Syntax
BOOL SetHiddenInput(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bHiddenInput);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bHiddenInput
Hidden input yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2699

ANSI-C function descriptions


4.3 Internal functions

See also
SetHiddenInput example (Page 2260)
SetHiddenInput example

SetNumberLines
Function
Sets the number of visible lines lines for the "text list" object.

Syntax
BOOL SetNumberLines(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lNumberLines);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lNumberLines
Number of visible lines

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the amount of configured text is larger than the number of visible lines, the "text list" object
receives a vertical scroll bar.

2700

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetOutputValueChar
Function
Sets a pointer to the output value for I/O fields

Syntax
BOOL SetOutputValueChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szOutputValueChar);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szOutputValueChar
Pointer to the output value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetOutputValueDouble
Function
Sets the output value for I/O fields.

Syntax
BOOL SetOutputValueDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
double dOutputValueDouble);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2701

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dOutputValueDouble
Output value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetOutputValueDouble example (Page 2262)
SetOutputValueDouble example

Limits
Limits - short description
The various properties affecting limit values can be modified or called in using the functions
in the Limits group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAlarmHigh
Function
Sets the upper alarm limit for bar objects.

2702

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dAlarmHigh
Upper alarm limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetAlarmLow
Function
Sets the lower alarm limit for bar objects.

Syntax
BOOL SetAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dAlarmLow);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2703

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
dAlarmLow
Lower alarm limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetCheckAlarmHigh
Function
Controls the monitoring of the upper alarm limit for bar objects.

Syntax
BOOL SetCheckAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckAlarmHigh
Monitoring yes/no

2704

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckAlarmLow
Function
Controls the monitoring of the lower alarm limit for bar objects.

Syntax
BOOL SetCheckAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckAlarmLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckAlarmLow
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2705

ANSI-C function descriptions


4.3 Internal functions

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckLimitHigh4
Function
Controls the monitoring of the upper limit value reserve 4 for bar objects.

Syntax
BOOL SetCheckLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitHigh4
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

2706

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetCheckLimitHigh5
Function
Controls the monitoring of the upper limit value reserve 5 for bar objects.

Syntax
BOOL SetCheckLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitHigh5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitHigh5
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckLimitLow4
Function
Controls the monitoring of the lower limit value reserve 4 for bar objects.

Syntax
BOOL SetCheckLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitLow4);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2707

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitLow4
Monitoring yes/no.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckLimitLow5
Function
Controls the monitoring of the lower limit value reserve 5 for bar objects.

Syntax
BOOL SetCheckLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCheckLimitLow5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckLimitLow5
Monitoring yes/no

2708

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckToleranceHigh
Function
Controls the monitoring of the upper tolerance limit for bar objects.

Syntax
BOOL SetCheckToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckToleranceHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckToleranceHigh
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2709

ANSI-C function descriptions


4.3 Internal functions

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckToleranceLow
Function
Controls the monitoring of the lower tolerance limit for bar objects.

Syntax
BOOL SetCheckToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckToleranceLow
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

2710

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetCheckWarningHigh
Function
Controls the monitoring of the upper warning limit for bar objects.

Syntax
BOOL SetCheckWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckWarningHigh
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetCheckWarningLow
Function
Controls the monitoring of the lower warning limit for bar objects.

Syntax
BOOL SetCheckWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bCheckWarningLow);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2711

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCheckWarningLow
Monitoring yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetColorAlarmHigh
Function
Sets the bar color for bar objects upon reaching the upper alarm limit.

Syntax
BOOL SetColorAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorAlarmHigh
Numeric value defining the bar color

2712

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetColorAlarmLow
Function
Sets the bar color for bar objects upon reaching the lower alarm limit.

Syntax
BOOL SetColorAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorAlarmLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorAlarmLow
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2713

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorLimitHigh4
Function
Sets the bar color for bar objects upon reaching the upper limit reserve 4.

Syntax
BOOL SetColorLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitHigh4
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

2714

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetColorLimitHigh5
Function
Sets the bar color for bar objects upon reaching the upper limit reserve 5.

Syntax
BOOL SetColorLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitHigh5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitHigh5
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorLimitLow4
Function
Sets the bar color for bar objects upon reaching the lower limit reserve 4.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2715

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetColorLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitLow4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitLow4
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorLimitLow5
Function
Sets the bar color for bar objects upon reaching the lower limit reserve 5.

Syntax
BOOL SetColorLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lColorLimitLow5);

2716

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorLimitLow5
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetColorToleranceHigh
Function
Sets the bar color for bar objects upon reaching the upper tolerance limit.

Syntax
BOOL SetColorToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorToleranceHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2717

ANSI-C function descriptions


4.3 Internal functions
lColorToleranceHigh
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorToleranceLow
Function
Sets the bar color for bar objects upon reaching the lower tolerance limit.

Syntax
BOOL SetColorToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorToleranceLow
Numeric value defining the bar color

2718

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorWarningHigh
Function
Sets the bar color for bar objects upon reaching the upper warning limit.

Syntax
BOOL SetColorWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorWarningHigh
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2719

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetColorWarningLow
Function
Sets the bar color for bar objects upon reaching the lower warning limit.

Syntax
BOOL SetColorWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lColorWarningLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lColorWarningLow
Numeric value defining the bar color

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

2720

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetLimitHigh4
Function
Sets the high limit value for reserve 4 for bar objects.

Syntax
BOOL SetLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitHigh4
High limit value for reserve 4

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetLimitHigh5
Function
Sets the high limit value for reserve 5 for bar objects.

Syntax
BOOL SetLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitHigh5);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2721

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitHigh5
High limit value for reserve 5

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetLimitLow4
Function
Sets the low limit value for reserve 4 for bar objects.

Syntax
BOOL SetLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitLow4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitLow4
Low limit value for reserve 4

2722

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetLimitLow5
Function
Sets the low limit value for reserve 5 for bar objects.

Syntax
BOOL SetLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitLow5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitLow5
Low limit value for reserve 5

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2723

ANSI-C function descriptions


4.3 Internal functions

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetLimitMax
Function
Sets the high limit value for I/O fields.

Syntax
BOOL SetLimitMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitMax);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitMax
High limit value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

2724

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetLimitMin
Function
Sets the low limit value for I/O fields.

Syntax
BOOL SetLimitMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dLimitMin);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dLimitMin
Lower limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetMarker
Function
Controls the limit marker display for bar objects.

Syntax
BOOL SetMarker(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bMarker);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2725

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bMarker
Limit marker on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetToleranceHigh
Function
Sets the upper tolerance limit for bar objects.

Syntax
BOOL SetToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dToleranceHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dToleranceHigh
Upper tolerance limit

2726

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetToleranceLow
Function
Sets the lower tolerance limit for bar objects.

Syntax
BOOL SetToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dToleranceLow
Lower tolerance limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2727

ANSI-C function descriptions


4.3 Internal functions

See also
SetAlarmHigh example (Page 2254)
SetAlarmHigh example

SetTypeAlarmHigh
Function
Specifies for bar objects whether the upper alarm limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeAlarmHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeAlarmHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeAlarmHigh
Upper alarm limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

2728

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetTypeAlarmLow
Function
Specifies for bar objects whether the lower alarm limit is given in percentages or absolute terms.

Syntax
BOOL SetTypeAlarmLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeAlarmLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeAlarmLow
Lower alarm limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeLimitHigh4
Function
Specifies for bar objects whether the upper limit for reserve 4 is given in percentages or
absolute terms.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2729

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetTypeLimitHigh4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitHigh4);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

bTypeLimitHigh4
High limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeLimitHigh5
Function
Specifies for bar objects whether the upper limit for reserve 5 is given in percentages or
absolute terms.

Syntax
BOOL SetTypeLimitHigh5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitHigh5);

2730

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeLimitHigh5
High limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeLimitLow4
Function
Specifies for bar objects whether the lower limit for reserve 4 is given in percentages or absolute
terms.

Syntax
BOOL SetTypeLimitLow4(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitLow4);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2731

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
bTypeLimitLow4
Low limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeLimitLow5
Function
Specifies for bar objects whether the lower limit for reserve 5 is given in percentages or absolute
terms.

Syntax
BOOL SetTypeLimitLow5(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeLimitLow5);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeLimitLow5
Low limit

2732

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeToleranceHigh
Function
Specifies for bar objects whether the high tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeToleranceHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bTypeToleranceHigh);

Parameter
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeToleranceHigh
High tolerance limit
TRUE Specification in percent
FALSE Absolute specification

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2733

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeToleranceLow
Function
Specifies for bar objects whether the lower tolerance limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeToleranceLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bTypeToleranceLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeToleranceLow
Lower tolerance limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.

2734

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeWarningHigh
Function
Specifies for bar objects whether the upper warning limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeWarningHigh
Upper warning limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2735

ANSI-C function descriptions


4.3 Internal functions

See also
SetMarker example (Page 2261)
SetMarker example

SetTypeWarningLow
Function
Specifies for bar objects whether the lower warning limit is given in percentages or absolute
terms.

Syntax
BOOL SetTypeWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bTypeWarningLow);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTypeWarningLow
Lower warning limit
TRUE Specification in percent
FALSE Absolute specification

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

2736

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetWarningHigh
Function
Sets the upper warning limit for bar objects.

Syntax
BOOL SetWarningHigh(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dWarningHigh);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dWarningHigh
Upper warning limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

SetWarningLow
Function
Sets the lower warning limit for bar objects.

Syntax
BOOL SetWarningLow(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dWarningLow);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2737

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dWarningLow
Lower warning limit

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetMarker example (Page 2261)
SetMarker example

link
Link - short description
A tag link property can be created or called in using the functions in the Link group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetLink
Function
Creating a tag connection of object properties

2738

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetLink(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, LPLINKINFO *pLink);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
pLink
Pointer to a structure of the type: LINKINFO

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition LINKINFO (Page 2297)
SetLink example (Page 2261)
LINKINFO structure definition
SetLink example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2739

ANSI-C function descriptions


4.3 Internal functions

miscs
Miscs - short description
The properties of objects can be modified or called in using the functions in the Miscs group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetAverage
Function
Controls the averaging of bar objects.

Syntax
BOOL SetAverage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bAverage);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bAverage
Averaging yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2740

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetVisible example (Page 2273)
SetVisible example

SetBoxType
Function
Specifies the field type (input field, output field, input/output field) for an I/O object.

Syntax
BOOL SetBoxType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBoxType);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBoxType
Field type

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
I/O field, field type (Page 2284)
I/O field, field type

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2741

ANSI-C function descriptions


4.3 Internal functions

SetColorChangeType
Function
When using bar objects, it defines whether the color change upon reaching a limit value only
affects a bar segment or the entire bar.

Syntax
BOOL SetColorChangeType(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bColorChangeType);

Parameter
lpszPictureName
Picture name
lpszObjectName
Object name
bColorChangeType
Type of color change
TRUE Color change applies to a segment
FALSE Color change applies to the entire bar

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2273)
SetVisible example

SetCursorControl
Function
Sets the cursor control for I/O fields.

2742

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetCursorControl(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCursorControl);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCursorControl
Cursor control on/off

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2273)
SetVisible example

SetCursorMode
Function
Sets the cursor control for pictures.

Syntax
BOOL SetCursorMode(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bCursorMode);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2743

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bCursorMode
Cursor Mode
TRUE Tab order cursor
FALSE Alpha-Cursor

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Example - SetCursorMode (Page 2256)
SetCursorMode example

SetEditAtOnce
Function
Specifies whether the "Immediate input" property is activated for I/O fields.

Syntax
BOOL SetEditAtOnce(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bEditAtOnce);

Parameters
lpszPictureName
Picture name

2744

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
bEditAtOnce
Immediate input yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2273)
SetVisible example

SetExtendedOperation
Function
Controls the "Extended operation" property of slider objects.

Syntax
BOOL SetExtendedOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bExtendedOperation);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bExtendedOperation
Extended operation yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2745

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2273)
SetVisible example

SetHysteresis
Function
When using bar objects, it specifies whether the display appears with or without hysteresis.

Syntax
BOOL SetHysteresis(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bHysteresis);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bHysteresis
Display with/without hysteresis

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2746

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetVisible example (Page 2273)
SetVisible example

SetHysteresisRange
Function
Sets the hysteresis value in the display for bar objects.

Syntax
BOOL SetHysteresisRange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dHysteresisRange);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dHysteresisRange
Hysteresis value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetMax
Function
Sets the maximum value for bar and slider objects.

Syntax
BOOL SetMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double dMax);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2747

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dMax
Maximum value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetMin
Function
Sets the minimum value for bar and slider objects.

Syntax
BOOL SetMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double dMin);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dMin
Minimum value

Return value
TRUE
The function has been completed without any errors.

2748

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

SetOffsetLeft
Function
Sets the horizontal picture distance from the left window border for picture windows.

Syntax
BOOL SetOffsetLeft(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lOffsetLeft);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lOffsetLeft
Picture distance

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetOffsetTop
Function
Sets the vertical picture distance from the upper window border for picture windows.

Syntax
BOOL SetOffsetTop(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lOffsetTop);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2749

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lOffsetTop
Picture distance

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetOperation
Function
Controls the operability of the objects.

Syntax
BOOL SetOperation(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bOperation);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOperation
Object operable, yes/no

2750

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

See also
SetVisible example (Page 2273)
SetVisible example

SetOperationMessage
Function
Controls the output of a message when operating the objects "I/O field", "Check box", "Radio
box" and "Slider".

Syntax
BOOL SetOperationMessage(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bOperationMessage);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOperationMessage
Message output for yes/no operation

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2751

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

See also
SetVisible example (Page 2273)
SetVisible example

SetOperationReport
Function
Controls the logging of the operating reason for all objects except application and picture
windows and OLE control.

Syntax
BOOL SetOperationReport(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bOperationReport);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bOperationReport
Logging operating reason yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

2752

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetVisible example (Page 2273)
SetVisible example

SetPasswordLevel
Function
Defines the authorization level for operating objects for all objects except application and
picture windows and OLE control.

Syntax
BOOL SetPasswordLevel(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPasswordLevel);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPasswordLevel
Authorization level

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2753

ANSI-C function descriptions


4.3 Internal functions

SetPictureName
Function
Sets the name of the picture, which should be shown in a picture window or in a graphic object.

Syntax
BOOL SetPictureName(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureName);

Parameters
lpszPictureName
Picture name
lpszObjectName
Name of the picture window or graphic object
szPictureName
Pointer to the picture name

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetPictureName example (Page 2262)
SetPictureName example

SetProcess
Function
Specifies the default setting of the value to be displayed for bar and slider objects.
Sets the selected fields for check boxes and radio boxes.

2754

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetProcess(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dProcess);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dProcess
In case of bar and slider objects, this value is used in Runtime when the associated tag
cannot be connected or updated when a picture is started.
For check boxes and radio boxes the selected fields are specified. In the 32-bit word each
field is represented by a bit (field 1 corrsponds to the bit value 0). Selected fields are marked
by a set bit. Non-existing are assigned 0.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetSmallChange
Function
Sets the number of steps for slider objects by which the slider is shifted by a mouse click.

Syntax
BOOL SetSmallChange(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lSmallChange);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2755

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
lSmallChange
Number of setting steps

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetTagPrefix
Function
This function sets the tag prefix of a picture window:
In a picture window the "temperature" tag is requested on an object. If a "Motor1." tag prefix
is assigned to the picture window, the tag "Motor1.Temperature" is requested.
The setting of the tag prefix only becomes effective when newly supplying the picture name.
This means you must either set the prefix before picture selection or newly supply the picture
name if the picture is not changed.

Syntax
BOOL SetTagPrefix(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,char*
szTagPrefix);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szTagPrefix
Tag prefix to be set

2756

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the tag prefix is set for a picture window, the tag prefix is added to all tags contained in the
picture to be displayed. This also applies if the request takes place in a function. If a tag needs
to be read without the tag prefix, you must add "@NOTP::" to the tag name.
Using a tag prefix greatly simplifies the picture module technology.

See also
SetTagPrefix example (Page 2269)
SetTagPrefix example

SetTrend
Function
Controls the trend display for bar objects.

Syntax
BOOL SetTrend(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bTrend);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bTrend
Trend display yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2757

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetVisible example (Page 2273)
SetVisible example

SetVisible
Function
Controls the display of an object.

Syntax
BOOL SetVisible(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bVisible);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bVisible
Object display yes/no

Return value
TRUE
The function has been completed without any errors.

2758

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
NULL.

See also
SetVisible example (Page 2273)
SetVisible example

SetZeroPointValue
Function
Sets the absolute value of the zero point for bar objects.

Syntax
BOOL SetZeroPointValue(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, double
dZeroPointValue);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
dZeroPointValue
Absolute value of the zero point

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2759

ANSI-C function descriptions


4.3 Internal functions

SetZoom
Function
Sets the scaling factor for a picture window.

Syntax
BOOL SetZoom(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lZoom);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lZoom
Scaling factor

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

ole_control
OLE_control - short description
The functions in the ole_Control group can only be used with OCX slider objects.
Various OCX slider object properties and settings can be modified or called in using these
functions.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2760

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetPosition
Function
Sets the slider position of the OCX slider object.

Syntax
BOOL SetPosition(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPosition);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPosition
Slider position of the OCX slider object

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetPosition example (Page 2263)
SetPosition example

SetRangeMax
Function
Defines the adjustment range "Max" of the OCX slider object.

Syntax
BOOL SetRangeMax(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRangeMax);
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2761

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRangeMax
Adjustment range "Max" of the OCX slider object

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetRangeMax example (Page 2264)
SetRangeMax example

SetRangeMin
Function
Defines the adjustment range "Min" of the OCX slider object.

Syntax
BOOL SetRangeMin(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lRangeMin);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lRangeMin
Adjustment range "Min" of the OCX slider object

2762

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetRangeMin example (Page 2264)
SetRangeMin example

pictures
Pictures - short description
Various properties of pictures of graphic objects and round buttons can be modified or called
in using the functions in the Pictures group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetPicDeactTransparent
Function
Sets the transparent color for the "deactivated" status of a round button.

Syntax
BOOL SetPicDeactTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lPicDeactTransparent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2763

ANSI-C function descriptions


4.3 Internal functions
lPicDeactTransparent
Transparent color for "deactivated" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetPicDeactUseTransColor
Function
Controls the transparent color for the "deactivated" status of a round button.

Syntax
BOOL SetPicDeactUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicDeactUseTransColor);

Parameter
lpszPictureName
Picture name
lpszObjectName
Object name
bPicDeactUseTransColor
Transparent color yes/no

2764

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetPicDownTransparent
Function
Sets the transparent color for the "On/pressed" status of a round button.

Syntax
BOOL SetPicDownTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
long int lPicDownTransparent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPicDownTransparent
Transparent color for "On/pressed" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2765

ANSI-C function descriptions


4.3 Internal functions

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetPicDownUseTransColor
Function
Controls the transparent color for the "On/pressed" status of a round button.

Syntax
BOOL SetPicDownUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicDownUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPicDownUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetPicTransColor
Function
Sets the transparent color of the background picture of a graphic object.

2766

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lPicTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPicTransColor
Transparent color of the background picture

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetPictureDeactivated
Function
Specifies the picture name for the "deactivated" status of a round button.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2767

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetPictureDeactivated(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureDeactivated);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szPictureDeactivated
Picture name for "deactivated" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
SetPictureDown example (Page 2262)
SetPictureDown example

SetPictureDown
Function
Specifies the picture name for the "On/pressed" status of a round button.

Syntax
BOOL SetPictureDown(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureDown);

2768

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
szPictureDown
Picture name for "On/pressed" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
SetPictureDown example (Page 2262)
SetPictureDown example

SetPictureUp
Function
Specifies the picture name for the "Off/not pressed" status of a round button.

Syntax
BOOL SetPictureUp(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, char*
szPictureUp);

Parameters
lpszPictureName
Picture name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2769

ANSI-C function descriptions


4.3 Internal functions
lpszObjectName
Object name
szPictureUp
Picture name for "Off/not pressed" status

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Bitmap files (*.bmp, *.dib) as well as metafiles (*.emf, *.wmf) can be integrated.

See also
SetPictureUp example (Page 2263)
SetPictureUp example

SetPicUpTransparent
Function
Sets the transparent color for the "Off/not pressed" status of a round button.

Syntax
BOOL SetPicUpTransparent(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lPicUpTransparent);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lPicUpTransparent
Transparent color for "Off/not pressed" status

2770

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetPicUpUseTransColor
Function
Controls the transparent color for the "Off/not pressed" status of a round button.

Syntax
BOOL SetPicUpUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicUpUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPicUpUseTransColor
Transparent color yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2771

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetPicUseTransColor
Function
Controls the transparent color of the background picture of a graphic object.

Syntax
BOOL SetPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bPicUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPicUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2772

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

property
Property - short description
The properties of objects for which there are no direct functions can be modified or called in
using the functions in the Property group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetPropBOOL
Function
Sets a property with the value "bValue".

Syntax
BOOL SetPropBOOL(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, BOOL bValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
bValue
Value in BOOL data format

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2773

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

See also
SetPropBOOL example (Page 2263)

SetPropChar
Function
Sets a property with the value the pointer "szValue" points to.

Syntax
BOOL SetPropChar(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, char* szValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
szValue
Pointer to the value

Return value
TRUE
The function has been completed without any errors.

2774

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

See also
GetPropChar example (Page 2231)

SetPropDouble
Function
Sets a property with the value "dValue".

Syntax
BOOL SetPropDouble(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, double dValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
dValue
Value in "double" data format

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2775

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

SetPropWord
Function
Sets a property with the value "IValue".

Syntax
BOOL SetPropWord(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR
lpszPropertyName, long lValue)

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lpszPropertyName
Name of the object property
lValue
Value in "long" data format

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called for the picture object, set the parameter lpszObjectName = NULL.

2776

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

state
State - short description
The properties of status displays can be modified or called in using the functions in the State
group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBasePicTransColor
Function
Sets the transparent color of the basic picture for the status display.

Syntax
BOOL SetBasePicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBasePicTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBasePicTransColor
Transparent color of the basic picture

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2777

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
Color chart
SetBackColor example

SetBasePicUseTransColor
Function
Controls the transparent color of the basic picture for the status display.

Syntax
BOOL SetBasePicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bBasePicUseTransColor);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bBasePicUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2778

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetFlashFlashPicture
Function
Specifies whether the flash picture of the status display is animated dynamically or statically.

Syntax
BOOL SetFlashFlashPicture(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bFlashFlashPicture);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashFlashPicture
Type of flash picture
TRUE dynamically animated flash picture
FALSE statically animated flash picture

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetFlashPicTransColor
Function
Sets the transparent color of the flash picture for a status display.

Syntax
BOOL SetFlashPicTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lFlashPicTransColor);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2779

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashPicTransColor
Transparent color of the flash picture

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
This function only applies to Bitmap graphics (*.bmp).

See also
Color chart (Page 2284)
SetBackColor example (Page 2254)
SetBackColor example
Color chart

SetFlashPicUseTransColor
Function
Controls the transparent color of the flash picture for a status display.

Syntax
BOOL SetFlashPicUseTransColor(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName,
BOOL bFlashPicUseTransColor);

2780

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bFlashPicUseTransColor
Transparent color yes/no

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetFlashRateFlashPic
Function
Sets the flash frequency of the flash picture for a status display.

Syntax
BOOL SetFlashRateFlashPic(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lFlashRateFlashPic);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lFlashRateFlashPic
Flash frequency of the flash picture

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2781

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
Since the flashing is performed by means of software engineering, the precise frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time etc.).

See also
Flash frequencies (Page 2282)
SetFlashRateFlashPic example (Page 2258)
Flash frequencies

SetIndex
Function
Sets the index of a polygon or polyline thus defining the current object point.

Syntax
BOOL SetIndex(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int lIndex);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lIndex
Index value

2782

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

style
Style - short description
Various properties affecting the appearance of objects can be modified or called in using the
functions in the Style group.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

SetBackBorderWidth
Function
Sets the frame width of 3D frames and slider objects.

Syntax
BOOL SetBackBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long
int lBackBorderWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBackBorderWidth
Frame width in pixels

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2783

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetBorderStyle example (Page 2255)
SetBorderStyle example

SetBorderEndStyle
Function
Sets the type of line end.

Syntax
BOOL SetBorderEndStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderEndStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderEndStyle
Type of line end as numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2784

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Line end style (Page 2287)
SetBorderEndStyle example (Page 2255)
SetBorderEndStyle example
Line style

SetBorderStyle
Function
Sets the line or border style.

Syntax
BOOL SetBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderStyle
Numeric value defining the line or border style

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Line styles (Page 2287)
SetBorderStyle example (Page 2255)
SetBorderStyle example
Line styles

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2785

ANSI-C function descriptions


4.3 Internal functions

SetBorderWidth
Function
Sets the line or border line width.

Syntax
BOOL SetBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBorderWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBorderWidth
Line width or border line width

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
SetBorderStyle example (Page 2255)
SetBorderStyle example

SetBoxAlignment
Function
Defines the arrangement of controls (left or right justified) in check boxes or radio boxes.

Syntax
BOOL SetBoxAlignment(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lBoxAlignment);

2786

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lBoxAlignment
Arrangement of controls

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Element alignment in check boxes and radio boxes (Page 2284)
SetBorderStyle example (Page 2255)
SetBorderStyle example
Element alignment in check boxes and radio boxes

SetFillStyle
Function
Sets the type of fill pattern.

Syntax
BOOL SetFillStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2787

ANSI-C function descriptions


4.3 Internal functions
lFillStyle
Type of fill pattern as numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.
Note
If the function is called in relation to the entire picture, set the parameter lpszObjectName =
ZERO.

See also
Fill pattern (Page 2286)
SetFillStyle example (Page 2257)
Fill pattern
SetFillStyle example

SetFillStyle2
Function
Sets the bar fill pattern for a bar graph.

Syntax
BOOL SetFillStyle2(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lFillStyle2);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name

2788

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lFillStyle2
Bar fill pattern as numeric value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Fill pattern (Page 2286)
SetFillStyle example (Page 2257)
Fill pattern
SetFillStyle example

SetItemBorderStyle
Function
Sets the dividing line style for the "text list" object.

Syntax
BOOL SetItemBorderStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lItemBorderStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderStyle
Numeric value defining the dividing line style

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2789

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Line styles (Page 2287)
SetBorderStyle example (Page 2255)
Line styles
SetBorderStyle example

SetItemBorderWidth
Function
Sets the dividing line width for the "text list" object.

Syntax
BOOL SetItemBorderWidth(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, long int
lItemBorderWidth);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
lItemBorderWidth
Numeric value defining the dividing line width

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

2790

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetBorderStyle example (Page 2255)
SetBorderStyle example

SetPressed
Function
Specifies for buttons or round buttons whether the switch setting is "pressed" or "not pressed".

Syntax
BOOL SetPressed(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bPressed);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bPressed
Switch setting of the button
TRUE Switch setting "pressed"
FALSE Switch setting "not pressed"

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetToggle
Function
Specifies for buttons or round buttons whether the switch is latchable or not.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2791

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetToggle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL bToggle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bToggle
Switch latchable/not latchable

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

SetWindowsStyle
Function
Specifies whether buttons are to be displayed in Windows style.

Syntax
BOOL SetWindowsStyle(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, BOOL
bWindowStyle);

Parameters
lpszPictureName
Picture name
lpszObjectName
Object name
bWindowStyle
"Windows style" on/off

2792

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenHomePicture
Function
Opens the entered start picture.

Syntax
BOOL OpenHomePicture();

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenNextPicture
Function
WinCC saves the names of the pictures opened by the user during runtime as well as the
sequence in which these pictures were opened.
The maximum number of picture names saved this way can be set in the WinCC Explorer in
the computer properties on the "Graphics Runtime" tab under "picture buffer size".
The OpenNextPicture function now opens the picture which was opened before the last call
of OpenPrevPicture.

Syntax
BOOL OpenNextPicture();

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2793

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenPrevPicture
Function
WinCC saves the names of the pictures opened by the user during runtime as well as the
sequence in which these pictures were opened.
The maximum number of picture names saved this way can be set in the WinCC Explorer in
the computer properties on the "Graphics Runtime" tab under "picture buffer size".
The OpenPrevPicture function now opens the picture which was opened before the currently
open picture.

Syntax
BOOL OpenPrevPicture();

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

OpenStoredPicture
Function
Opens the picture saved with the StorePicture function.

Syntax
BOOL OpenStoredPicture();

2794

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

StorePicture
Function
Saves the current picture which can then be opened with the OpenStoredPicture function.

Syntax
BOOL StorePicture();

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

4.3.5

tag

4.3.5.1

tag - short description


Tags can be set or called in using the functions from the tag group.

GetTag or GetTagWait?
Process tags that are called with GetTag are put in an image. Since updating and reading the
image is done in two separate procedures, the GetTag call is not directly influenced by the
coupling. It can therefore be executed quicker and more independently than a GetTagWait
retrieval.
With GetTagWait, process tags that have been requested are not accepted in the image. A
GetTagWait retrieval reads the value explicitly from the AS. This always includes the send and
return path through the coupling and the response time of the AS. During this runtime, the
processing of the C actions is blocked and the time required for the retrieval cannot be
estimated. If multiple tags are read, the time is added.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2795

ANSI-C function descriptions


4.3 Internal functions
A GetTagWait call is required if
fast write/read procedures are to be synchronized
a value is read explicitly from the AS
or a registration is to be avoided in the image deliberately.
The GetTagWait call is to be avoided in cyclic C-Actions, this is the main reason for
performance problems.

SetTag or SetTagWait?
The SetTag retrieval distributes a write job without waiting for confirmation from the AS.
The SetTagWait retrieval distributes a write job and waits for confirmation from the AS. This
always includes the send and return path through the coupling and the response time of the
AS. During this runtime, the processing of the C actions is blocked and the time required for
the retrieval cannot be estimated. If multiple tags are written, the time is added.
A SetTagWait call is set to guarantee that the value has been written before the C-Action is
processed any further. The SetTagWait call in cyclic C actions is to be avoided.
Note
The difference between GetTag and GetTagWait also exists for internal tags. The difference
is not quite so serious here however, since no coupling comes into play. To synchronize fast
write/read procedures, the respective wait function is to be used with internal tags as well.
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.3.5.2

get

Functionality of the GetTag functions


GetTagXXX
By calling the function the tag is logged on and, from that moment, polled cyclically from the
AS. The cycle for the registration depends on the trigger (see following description). For
GetTagXXX calls, the value that is available in WinCC is sent. For Close Picture, the tag actions
are ended again.
The call is marked by the following:
The value is read from the tag image by WinCC.
The call is faster in comparison to GetTagXXXWait (except for the first call which generally
takes longer because the value from the PLC must be read out and logged on).

2796

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
The duration of the call does not depend on the bus-load or on the AS.
The function does not deliver any information on the status of the tags

Note
If a tag is requested in a Global Script action, it remains registered throughout the enter
Runtime of WinCC.
In Callback functions, the respective GetTagXXXWait function must be used.
Behavior in actions with tag trigger (recommended):
All of the tags contained in the tag trigger are already known with Open Picture and are
registered with the defined monitoring time.
Since all tags are requested at once, the best possible optimization can be targeted from the
channel. If a tag is requested with GetTagXXX() within a C-Action, which is contained in the
trigger, the value already exists and is sent directly to the call (high-performance).
Registering tags in actions with tag trigger
As the tags are already known when the picture is selected, they can be transmitted in a job
to the Data Manager and so be registered collectively to the channel.

Note
If a tag is requested, which is not in the trigger, then the behavior is the same as with the
default trigger.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2797

ANSI-C function descriptions


4.3 Internal functions
Behavior in actions with default trigger:
tags are registered with half of the cycle time with the first call. For every other call, the value
is present.
Registering tags in actions with default trigger and event trigger
Only when the individual actions are executed is it identified which tags are needed in the
picture. As a result, the tags are registered to the channel in a large number of single jobs.
When a picture with cyclic actions is selected, the continual reorganization may place a heavy
strain on communications.
Example: The channel supports custom cycle creation. Usually cycles are created by the
channel directly from the AS. The resources for these cycles are limited by the AS. As a result,
the channel stops the current jobs for this cycle and reconfigures the cycle on the AS.

2798

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
Behavior in event triggered actions:
The tag is registered in the "upon change" mode with the first call. Process tags that are
registered in the "upon change" mode correspond with a cyclic read job with a cycle time of
1s.
Note
If a value is requested by GetTagXXX() by a mouse click for example, the tag is accepted in
the tag image. The tag is requested cyclically from the AS as of this point in time and therefore
increases the basic load.
To avoid this increase in basic loading, the value can be requested by GetTagXXXWait().
The call GetTagXXXWait() causes a higher communication load one time but the tag is not
added to the tag image.

GetTagXXXWait
The function returns the current value. The tag is not registered cyclically, the value is
requested from the AS one time only.
The call is marked by the following:
The value is read explicitly from the AS.
The call, compared with GetTagXXX, takes longer.
The duration of the call does not depend on the bus-load or on the AS.
The function does not deliver any information on the status of the tags.

GetTagXXXState
The function GetTagXXXState has the same features as GetTagXXX, it also sends the function
information on the status of the tags. Since the status is always delivered internally, there is
no performance difference to GetTagXXX.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2799

ANSI-C function descriptions


4.3 Internal functions

GetTagXXXStateWait
The function GetTagXXXStateWait has the same features as GetTagXXXWait, additionally it
sends the function information on the status of the tags. Since the status is always delivered
internally, there is no performance difference to GetTagXXXWait.
The difference between functions GetTagXXXStateWait and GetTagXXXState corresponds
with the difference between GetTagXXXWait and GetTagXXX. Since the value is explicitly
read from the AS for process tags, the value and the status can be more current than for
GetTagXXXState.

GetTagXXXStateQC
The function GetTagXXXStateQC has the same features as GetTagXXXState. The function
also delivers information on the quality code of the tag.

GetTagXXXStateQCWait
The function GetTagXXXStateQCWait has the same features as GetTagXXXStateWait. The
function also delivers information on the quality code of the tag.

GetTagMultiWait
The function GetTagMultiWait has the same features as GetTagXXXWait. However, it allows
the request for more tags in a job. Therefore, the read requests in the direction of the AS can
be optimized in most cases so that only one request will be given to the AS.

GetTagMultiStateWait
The function GetTagMultiStateWait has the same features as GetTagMultiWait, additionally it
sends the function information on the statuses of the tags.

GetTagMultiStateQCWait
The function GetTagMultiStateQCWait has the same features as GetTagMultiStateWait. The
function also delivers information on the quality codese of the tags.

state
wait
getTagBitStateWait
Function
Determines the value of a tag of data type "Binary tag". The value is read explicitly from the
AS. The status of the tag is also returned.

2800

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL GetTagBitStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "BOOL"

See also
Tag statuses (Page 2289)
GetTagBitStateWait example (Page 2237)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTagBitStateWait example
GetTag functions, function principle

GetTagByteStateWait
Function
Determines the value of a tag of data type "unsigned 8 bit". The value is read explicitly from
the AS. The status of the tag is also returned.

Syntax
BYTE GetTagByteStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2801

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "BYTE"

See also
Tag statuses (Page 2289)
GetTagWordStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateWait example

GetTagCharStateWait
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The value is read
explicitly from the AS. The status of the tag is also returned.

Syntax
char* GetTagCharStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)

2802

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
{
.......
}

See also
Functionality of the GetTag functions (Page 2095)
Tag statuses (Page 2289)
Beispiel GetTagCharStateWait (Page 2239)
GetTagCharStateWait example
GetTag functions, function principle
Tag states

GetTagDoubleStateWait
Function
Determines the value of a tag of data type "64-bit floating point value". The value is read
explicitly from the AS. The status of the tag is also returned.

Syntax
double GetTagDoubleStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "double"

See also
Tag statuses (Page 2289)
GetTagFloatStateWait example (Page 2241)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateWait example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2803

ANSI-C function descriptions


4.3 Internal functions
GetTag functions, function principle
Tag states

GetTagDWordStateWait
Function
Determines the value of a tag of data type "unsigned 32 bit". The value is read explicitly from
the AS. The status of the tag is also returned.

Syntax
DWORD GetTagDWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "DWORD"

See also
Tag statuses (Page 2289)
GetTagWordStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagWordStateWait example
GetTag functions, function principle
Tag states

GetTagFloatStateWait
Function
Determines the value of a tag of data type "32-bit floating point value". The value is read
explicitly from the AS. The status of the tag is also returned.

2804

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
float GetTagFloatStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "float"

See also
Tag statuses (Page 2289)
GetTagFloatStateWait example (Page 2241)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateWait example
Tag states
GetTag functions, function principle

GetTagMultiStateWait
Function
The values and states of several tags are established and stored in the corresponding
addresses in the specified format. The values are read explicitly from the AS.
The function must transfer a DWORD array whose members contain the individual tag states
after the function is invoked. The size of the array must be selected so that sufficient memory
space is available for these statuses.

Syntax
BOOL GetTagMultiStateWait(DWORD* pdwState, const char* pFormat)

Parameters
pdwState
Field in which the tag statuses are stored.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2805

ANSI-C function descriptions


4.3 Internal functions
pFormat
Format description for all requested tags and for each tag name and address of the value

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2285)
Tag statuses (Page 2289)
GetTagMultiStateWait example (Page 2242)
Functionality of the GetTag functions (Page 2095)
Tag states
Format descriptors
GetTag functions, function principle
GetTagMultiStateWait example

GetTagRawStateWait
Function
Determines the value of a tag of data type "Raw data type". The value is read explicitly from
the AS. The status of the tag is also returned.

Syntax
BOOL GetTagRawStateWait(Tag Tag_Name, BYTE pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag

2806

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
GetTagRawStateWait example (Page 2245)
Functionality of the GetTag functions (Page 2095)
GetTagRawStateWait example
GetTag functions, function principle
Tag states

GetTagSByteStateWait
Function
Determines the value of a tag of data type "signed 8 bit". The value is read explicitly from the
AS. The status of the tag is also returned.

Syntax
signed char GetTagSByteStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2807

ANSI-C function descriptions


4.3 Internal functions

Return value
The value of the tag in the data type "signed char"

See also
Tag statuses (Page 2289)
GetTagSByteStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateWait example
GetTag functions, function principle
Tag states

GetTagSDWordStateWait
Function
Determines the value of a tag of data type "signed 32 bit". The value is read explicitly from the
AS. The status of the tag is also returned.

Syntax
long GetTagSDWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "long"

See also
Tag statuses (Page 2289)
GetTagSByteStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateWait example

2808

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
GetTag functions, function principle
Tag states

GetTagSWordStateWait
Function
Determines the value of a tag of data type "signed 16 bit". The value is read explicitly from the
AS. The status of the tag is also returned.

Syntax
short GetTagSWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "short"

See also
Functionality of the GetTag functions (Page 2095)
Tag statuses (Page 2289)
GetTagSByteStateWait example (Page 2247)
GetTagSByteStateWait example
GetTag functions, function principle
Tag states

GetTagWordStateWait
Function
Determines the value of a tag of data type "unsigned 16 bit". The value is read explicitly from
the AS. The status of the tag is also returned.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2809

ANSI-C function descriptions


4.3 Internal functions

Syntax
WORD GetTagWordStateWait(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "WORD"

See also
Tag statuses (Page 2289)
GetTagWordStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
GetTagWordStateWait example
GetTag functions, function principle
Tag states

GetTagBitState
Function
Determines the value of a tag of data type "Binary tag". The status of the tag is also returned.

Syntax
BOOL GetTagBitState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

2810

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Value of the tag in the data type "BOOL"

See also
Tag statuses (Page 2289)
GetTagBitStateWait example (Page 2237)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTagBitStateWait example
GetTag functions, function principle

GetTagByteState
Function
Determines the value of a tag of data type "unsigned 8 bit". The status of the tag is also returned.

Syntax
BYTE GetTagByteState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "BYTE"

See also
Tag statuses (Page 2289)
GetTagWordStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2811

ANSI-C function descriptions


4.3 Internal functions
GetTag functions, function principle
GetTagWordStateWait example

GetTagCharState
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The status of the
tag is also returned.

Syntax
char* GetTagCharState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
Tag statuses (Page 2289)
Beispiel GetTagCharStateWait (Page 2239)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagCharStateWait example

2812

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetTagDoubleState
Function
Determines the value of a tag of data type "64-bit floating point value". The status of the tag
is also returned.

Syntax
double GetTagDoubleState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "double"

See also
Tag statuses (Page 2289)
GetTagFloatStateWait example (Page 2241)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagFloatStateWait example

GetTagDWordState
Function
Determines the value of a tag of data type "unsigned 32 bit". The status of the tag is also
returned.

Syntax
DWORD GetTagDWordState(Tag Tag_Name, PDWORD lp_dwstate);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2813

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "DWORD"

See also
Tag statuses (Page 2289)
GetTagWordStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateWait example

GetTagFloatState
Function
Determines the value of a tag of data type "32-bit floating point value". The status of the tag
is also returned.

Syntax
float GetTagFloatState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

2814

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Value of the tag in the data type "float"

See also
GetTagFloatStateWait example (Page 2241)
Tag statuses (Page 2289)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateWait example
Tag states
GetTag functions, function principle

GetTagRawState
Function
Determines the value of a tag of data type "Raw data type". The status of the tag is also
returned.

Syntax
BOOL GetTagRawState(Tag Tag_Name, BYTE* pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2815

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
GetTagRawStateWait example (Page 2245)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagRawStateWait example

GetTagSByteState
Function
Determines the value of a tag of data type "signed 8 bit". The status of the tag is also returned.

Syntax
signed char GetTagSByteState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
The value of the tag in the data type "signed char"

See also
Tag statuses (Page 2289)
GetTagSByteStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states

2816

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
GetTag functions, function principle
GetTagSByteStateWait example

GetTagSDWordState
Function
Determines the value of a tag of data type "signed 32 bit". The status of the tag is also returned.

Syntax
long GetTagSDWordState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "long"

See also
Tag statuses (Page 2289)
GetTagSByteStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateWait example

GetTagSWordState
Function
Determines the value of a tag of data type "signed 16 bit". The status of the tag is also returned.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2817

ANSI-C function descriptions


4.3 Internal functions

Syntax
short GetTagSWordState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "short"

See also
Tag statuses (Page 2289)
GetTagSByteStateWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateWait example

GetTagWordState
Function
Determines the value of a tag of data type "unsigned 16 bit". The status of the tag is also
returned.

Syntax
WORD GetTagWordState(Tag Tag_Name, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2818

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
Value of the tag in the data type "WORD"

See also
Tag statuses (Page 2289)
GetTagWordStateWait example (Page 2249)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateWait example

stateqc
wait
GetTagBitStateQCWait
Function
Determines the value of a tag of data type "Binary tag". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

Syntax
BOOL GetTagBitStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2819

ANSI-C function descriptions


4.3 Internal functions
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "BOOL".

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
Tag states
GetTagWordStateQCWait example

GetTagByteStateQCWait
Function
Determines the value of a tag of data type "unsigned 8 bit". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
BYTE GetTagByteStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "BYTE".

2820

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagWordStateQCWait example
Tag states
GetTag functions, function principle

GetTagCharStateQCWait
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The value is read
explicitly from the AS. In addition, the status and the quality code of the tags are returned.

Syntax
char* GetTagCharStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2821

ANSI-C function descriptions


4.3 Internal functions

See also
Tag statuses (Page 2289)
GetTagCharStateQCWait example (Page 2238)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagCharStateQCWait example

GetTagDoubleStateQCWait
Function
Determines the value of a tag of data type "64-bit floating point value". The value is read
explicitly from the AS. In addition, the status and the quality code of the tags are returned.

Syntax
double GetTagDoubleStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "double".

See also
Tag statuses (Page 2289)
GetTagFloatStateQCWait example (Page 2240)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle

2822

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
Tag states
GetTagFloatStateQCWait example

GetTagDWordStateQCWait
Function
Determines the value of a tag of data type "unsigned 32 bit". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
DWORD GetTagDWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "DWORD".

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2823

ANSI-C function descriptions


4.3 Internal functions

GetTagFloatStateQCWait
Function
Determines the value of a tag of data type "32-bit floating point value". The value is read
explicitly from the AS. In addition, the status and the quality code of the tags are returned.

Syntax
float GetTagFloatStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "float".

See also
Tag statuses (Page 2289)
GetTagFloatStateQCWait example (Page 2240)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagFloatStateQCWait example

GetTagMultiStateQCWait
Function
The values, states and quality codes are determined for several tags and are stored in the
respective addresses in the specified format. The values are read explicitly from the AS.

2824

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
The function must be provided with two DWORD arrays, the member of which contains the
states and quality codes of the individual tags after the function has been called. The size of
the arrays must be selected so that sufficient memory space is available for these statuses.

Syntax
BOOL GetTagMultiStateQCWait(DWORD* pdwState, DWORD* pdwQualityCode, const char*
pFormat)

Parameters
pdwState
Field in which the status of the individual tags is stored after the function has been completed.
pdwQualityCode
Field in which the quality codes of the individual tags is stored after the function has been
completed.
pFormat
Format description for all requested tags and for each tag name and address of the value.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2285)
Tag statuses (Page 2289)
GetTagMultiStateQCWait example (Page 2241)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagMultiStateQCWait example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2825

ANSI-C function descriptions


4.3 Internal functions

GetTagRawStateQCWait
Function
Determines the value of a tag of data type "Raw data type". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
BOOL GetTagRawStateQCWait(Tag Tag_Name, BYTE pValue, DWORD size, PDWORD
lp_dwstate, PDWORD pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
pValue
Pointer to a byte field containing the value of the raw data tag.
size
Size of the byte field in bytes.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
GetTagRawStateQCWait example (Page 2245)
Functionality of the GetTag functions (Page 2095)

2826

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
Tag states
GetTag functions, function principle
GetTagRawStateQCWait example

GetTagSByteStateQCWait
Function
Determines the value of a tag of data type "signed 8 bit". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

Syntax
signed char GetTagSByteStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "signed char".

See also
Tag statuses (Page 2289)
GetTagSByteStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateQCWait example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2827

ANSI-C function descriptions


4.3 Internal functions

GetTagSDWordStateQCWait
Function
Determines the value of a tag of data type "signed 32 bit". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

Syntax
long GetTagSDWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "long".

See also
Tag statuses (Page 2289)
GetTagSByteStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateQCWait example

GetTagSWordStateQCWait
Function
Determines the value of a tag of data type "signed 16 bit". The value is read explicitly from the
AS. In addition, the status and the quality code of the tags are returned.

2828

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
short GetTagSWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "short".

See also
Tag statuses (Page 2289)
GetTagSByteStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagSByteStateQCWait example

GetTagValueStateQCWait
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value. The value is read explicitly from the AS. In addition, the status
and the quality code of the tags are returned.

Syntax
BOOL GetTagValueStateQCWait(LPDM_VARKEY lpdmVarKey,
LPDM_VAR_UPDATE_STRUCTEX lpdmresult, LPCMN_ERROR lpdmError);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2829

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCTEX"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2293)
Structure definition DM_VAR_UPDATE_STRUCTEX (Page 2295)
Structure definition DM_VARKEY (Page 2296)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
CMN_ERROR structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
DM_VARKEY structure definition

GetTagWordStateQCWait
Function
Determines the value of a tag of data type "unsigned 16 bit". The value is read explicitly from
the AS. In addition, the status and the quality code of the tags are returned.

Syntax
WORD GetTagWordStateQCWait(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

2830

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "WORD".

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

GetTagBitStateQC
Function
Determines the value of a tag of data type "Binary tag". In addition, the status and the quality
code of the tags are returned.

Syntax
BOOL GetTagBitStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2831

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "BOOL".

See also
Tag statuses (Page 2289)
GetTagBitStateQC example (Page 2236)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagBitStateQC example

GetTagByteStateQC
Function
Determines the value of a tag of data type "unsigned 8 bit". In addition, the status and the
quality code of the tags are returned.

Syntax
BYTE GetTagByteStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

2832

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Value of the tag in the data type "BYTE".

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

GetTagCharStateQC
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". In addition, the
status and the quality code of the tags are returned.

Syntax
char* GetTagCharStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Pointer to the value of the tag in data type "char".
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2833

ANSI-C function descriptions


4.3 Internal functions
if(pszValue != NULL)
{
.......
}

See also
Tag statuses (Page 2289)
GetTagCharStateQCWait example (Page 2238)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagCharStateQCWait example

GetTagDoubleStateQC
Function
Determines the value of a tag of data type "64-bit floating point value". In addition, the status
and the quality code of the tags are returned.

Syntax
double GetTagDoubleStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "double".

2834

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
GetTagFloatStateQCWait example (Page 2240)
Tag statuses (Page 2289)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateQCWait example
Tag states
GetTag functions, function principle

GetTagDWordStateQC
Function
Determines the value of a tag of data type "unsigned 32 bit". In addition, the status and the
quality code of the tags are returned.

Syntax
DWORD GetTagDWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "DWORD".

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2835

ANSI-C function descriptions


4.3 Internal functions
GetTagWordStateQCWait example
GetTag functions, function principle
Tag states

GetTagFloatStateQC
Function
Determines the value of a tag of data type "32-bit floating point value". In addition, the status
and the quality code of the tags are returned.

Syntax
float GetTagFloatStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "float".

See also
GetTagFloatStateQCWait example (Page 2240)
Tag statuses (Page 2289)
Functionality of the GetTag functions (Page 2095)
GetTagFloatStateQCWait example
Tag states
GetTag functions, function principle

2836

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetTagRawStateQC
Function
Determines the value of a tag of data type "Raw data type". In addition, the status and the
quality code of the tags are returned.

Syntax
BOOL GetTagRawStateQC(Tag Tag_Name, BYTE* pValue, DWORD size, PDWORD
lp_dwstate, PDWORD pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
pValue
Pointer to a byte field containing the value of the raw data tag.
size
Size of the byte field in bytes.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
GetTagRawStateQCWait example (Page 2245)
Functionality of the GetTag functions (Page 2095)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2837

ANSI-C function descriptions


4.3 Internal functions
GetTagRawStateQCWait example
GetTag functions, function principle
Tag states

GetTagSByteStateQC
Function
Determines the value of a tag of data type "signed 8 bit". In addition, the status and the quality
code of the tags are returned.

Syntax
signed char GetTagSByteStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "signed char".

See also
Tag statuses (Page 2289)
GetTagSByteStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateQCWait example
Tag states
GetTag functions, function principle

2838

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetTagSDWordStateQC
Function
Determines the value of a tag of data type "signed 32 bit". In addition, the status and the quality
code of the tags are returned.

Syntax
long GetTagSDWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tags in the data type "long".

See also
Tag statuses (Page 2289)
GetTagSByteStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateQCWait example
GetTag functions, function principle
Tag states

GetTagSWordStateQC
Function
Determines the value of a tag of data type "signed 16 bit". In addition, the status and the quality
code of the tags are returned.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2839

ANSI-C function descriptions


4.3 Internal functions

Syntax
short GetTagSWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "short".

See also
Tag statuses (Page 2289)
GetTagSByteStateQCWait example (Page 2247)
Functionality of the GetTag functions (Page 2095)
GetTagSByteStateQCWait example
GetTag functions, function principle
Tag states

GetTagValueStateQC
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value. In addition, the status and the quality code of the tags are
returned.

Syntax
BOOL GetTagValueStateQC(LPDM_VARKEY lpdmVarKey,
LPDM_VAR_UPDATE_STRUCTEX lpdmresult, LPCMN_ERROR lpdmError);

2840

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCTEX"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2293)
Structure definition DM_VAR_UPDATE_STRUCTEX (Page 2295)
Structure definition DM_VARKEY (Page 2296)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
DM_VARKEY structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

GetTagWordStateQC
Function
Determines the value of a tag of data type "unsigned 16 bit". In addition, the status and the
quality code of the tags are returned.

Syntax
WORD GetTagWordStateQC(Tag Tag_Name, PDWORD lp_dwstate, PDWORD
pdwQualityCode);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2841

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
Name of the tag.
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.
pdwQualityCode
Pointer to a DWORD in which the quality code of the tag is stored after the function is complete.

Return value
Value of the tag in the data type "WORD".

See also
Tag statuses (Page 2289)
GetTagWordStateQCWait example (Page 2248)
Functionality of the GetTag functions (Page 2095)
Tag states
GetTag functions, function principle
GetTagWordStateQCWait example

wait
GetTagBitWait
Function
Determines the value of a tag of data type "Binary tag". The value is read explicitly from the
AS.

Syntax
BOOL GetTagBitWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

2842

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
Value of the tag in the data type "BOOL"

See also
GetTagBit example (Page 2235)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagBit example

GetTagByteWait
Function
Determines the value of a tag of data type "unsigned 8 bit". The value is read explicitly from
the AS.

Syntax
BYTE GetTagByteWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "BYTE"

See also
GetTagWord example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagWord example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2843

ANSI-C function descriptions


4.3 Internal functions

GetTagCharWait
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag". The value is read
explicitly from the AS.

Syntax
char* GetTagCharWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Pointer to a character string containing the value of the tag.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetTagChar example (Page 2237)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagChar example

GetTagDoubleWait
Function
Determines the value of a tag of data type "64-bit floating point value". The value is read
explicitly from the AS.

Syntax
double GetTagDoubleWait(Tag Tag_Name);

2844

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "double"

See also
GetTagFloat example (Page 2239)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagFloat example

GetTagDWordWait
Function
Determines the value of a tag of data type "unsigned 32 bit". The value is read explicitly from
the AS.

Syntax
DWORD GetTagDWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "DWORD"

See also
Functionality of the GetTag functions (Page 2095)
GetTagWord example (Page 2248)
GetTagWord example
GetTag functions, function principle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2845

ANSI-C function descriptions


4.3 Internal functions

GetTagFloatWait
Function
Determines the value of a tag of data type "32-bit floating point value". The value is read
explicitly from the AS.

Syntax
float GetTagFloatWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "float"

See also
GetTagFloat example (Page 2239)
Functionality of the GetTag functions (Page 2095)
GetTagFloat example
GetTag functions, function principle

GetTagMultiWait
Function
The values of several tags are established and stored in the corresponding addresses in the
specified format. The value is read explicitly from the AS. The memory for the tag value is
created by the function with SysMalloc.

Syntax
BOOL GetTagMultiWait(const char* pFormat,...)

Parameters
pFormat
Format description for all requested tags and for each tag name and address of the value

2846

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2285)
GetTagMultiWait example (Page 2243)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagMultiWait example
Format descriptors

GetTagRawWait
Function
Determines the value of a tag of data type "Raw data type". The value is read explicitly from
the AS.

Syntax
BOOL GetTagRawWait(Tag Tag_Name , BYTE pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

Return value
TRUE
The function has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2847

ANSI-C function descriptions


4.3 Internal functions
FALSE
An error has occurred.

See also
Functionality of the GetTag functions (Page 2095)
GetTagRaw example (Page 2244)
GetTag functions, function principle
GetTagRaw example

GetTagSByteWait
Function
Determines the value of a tag of data type "signed 8 bit". The value is read explicitly from the
AS.

Syntax
signed char GetTagSByteWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
The value of the tag in the data type "signed char"

See also
GetTagSByte example (Page 2246)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagSByte example

GetTagSDWordWait
Function
Determines the value of a tag of data type "signed 32 bit". The value is read explicitly from the
AS.

2848

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
long GetTagSDWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "long"

See also
GetTagSByte example (Page 2246)
Functionality of the GetTag functions (Page 2095)
GetTagSByte example
GetTag functions, function principle

GetTagSWordWait
Function
Determines the value of a tag of data type "signed 16 bit". The value is read explicitly from the
AS.

Syntax
short GetTagSWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "short"

See also
GetTagSByte example (Page 2246)
Functionality of the GetTag functions (Page 2095)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2849

ANSI-C function descriptions


4.3 Internal functions
GetTagSByte example
GetTag functions, function principle

GetTagValueWait
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value. The value is read explicitly from the AS.

Syntax
BOOL GetTagValueWait(LPDM_VARKEY lpdmVarKey, LPDM_VAR_UPDATE_STRUCT
lpdmresult, LPCMN_ERROR lpdmError);

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCT"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2293)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2294)
Structure definition DM_VARKEY (Page 2296)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
DM_VARKEY structure definition

2850

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

GetTagWordWait
Function
Determines the value of a tag of data type "unsigned 16 bit". The value is read explicitly from
the AS.

Syntax
WORD GetTagWordWait(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "WORD"

See also
GetTagWord example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

GetTagBit
Function
Determines the value of a tag of data type "Binary tag".

Syntax
BOOL GetTagBit(Tag Tag_Name);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2851

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "BOOL"

See also
GetTagBit example (Page 2235)
Functionality of the GetTag functions (Page 2095)
GetTagBit example
GetTag functions, function principle

GetTagByte
Function
Determines the value of a tag of data type "unsigned 8 bit".

Syntax
BYTE GetTagByte(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "BYTE"

See also
GetTagWord example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

2852

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

GetTagChar
Function
Determines the value of a tag of data type "8-bit text tag" or "16-bit text tag".

Syntax
char* GetTagChar(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Pointer to a character string containing the value of the tag.
The return value must be checked for validity to prevent a null pointer exception, e.g. with the
function "GetText()":
pszValue = GetText(lpszPictureName,"Text1");
if(pszValue != NULL)
{
.......
}

See also
GetTagChar example (Page 2237)
Functionality of the GetTag functions (Page 2095)
GetTagChar example
GetTag functions, function principle

GetTagDateTime
Function
Determines the value of a tag of data type "Date/Time".

Syntax
SYSTEMTIME GetTagDateTime(Tag Tag_Name);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2853

ANSI-C function descriptions


4.3 Internal functions

Parameter
Tag_Name
Name of the tag

Return value
Value of the tag in the data type "Date/Time".

GetTagDouble
Function
Determines the value of a tag of data type "64-bit floating point value".

Syntax
double GetTagDouble(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "double"

See also
GetTagFloat example (Page 2239)
Functionality of the GetTag functions (Page 2095)
GetTagFloat example
GetTag functions, function principle

GetTagDWord
Function
Determines the value of a tag of data type "unsigned 32 bit".

Syntax
DWORD GetTagDWord(Tag Tag_Name);

2854

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "DWORD"

See also
GetTagWord example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

GetTagFloat
Function
Determines the value of a tag of data type "32-bit floating point value".

Syntax
float GetTagFloat(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "float".

See also
GetTagFloat example (Page 2239)
Functionality of the GetTag functions (Page 2095)
GetTagFloat example
GetTag functions, function principle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2855

ANSI-C function descriptions


4.3 Internal functions

GetTagRaw
Function
Determines the value of a tag of data type "Raw data type".

Syntax
BOOL GetTagRaw(Tag Tag_Name, BYTE* pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
GetTagRaw example (Page 2244)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
GetTagRaw example

GetTagSByte
Function
Determines the value of a tag of data type "signed 8 bit".

2856

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
signed char GetTagSByte(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
The value of the tag in the data type "signed char"

See also
GetTagSByte example (Page 2246)
Functionality of the GetTag functions (Page 2095)
GetTagSByte example
GetTag functions, function principle

GetTagSDWord
Function
Determines the value of a tag of data type "signed 32 bit".

Syntax
long GetTagSDWord(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "long"

See also
GetTagSByte example (Page 2246)
Functionality of the GetTag functions (Page 2095)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2857

ANSI-C function descriptions


4.3 Internal functions
GetTagSByte example
GetTag functions, function principle

GetTagSWord
Function
Determines the value of a tag of data type "signed 16 bit".

Syntax
short GetTagSWord(Tag Tag_Name);

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "short"

See also
GetTagSByte example (Page 2246)
Functionality of the GetTag functions (Page 2095)
GetTagSByte example
GetTag functions, function principle

GetTagValue
Function
Enables the transfer of a value in the form of a variant. Establishes the pointer to the result
structure containing the value.

Syntax
BOOL GetTagValue(LPDM_VARKEY lpdmVarKey, LPDM_VAR_UPDATE_STRUCT
lpdmresult, LPCMN_ERROR lpdmError);

2858

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmresult
Pointer to the value from data type "DM_VAR_UPDATE_STRUCT"
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function has been completed without any errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2293)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2294)
Structure definition DM_VARKEY (Page 2296)
Functionality of the GetTag functions (Page 2095)
GetTag functions, function principle
DM_VARKEY structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

GetTagWord
Function
Determines the value of a tag of data type "unsigned 16 bit".

Syntax
WORD GetTagWord(Tag Tag_Name);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2859

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag

Return value
Value of the tag in the data type "WORD"

See also
GetTagWord example (Page 2248)
Functionality of the GetTag functions (Page 2095)
GetTagWord example
GetTag functions, function principle

4.3.5.3

set

Principle of the SetTag functions


SetTagXXX
The SetTagXXX function assigns the job a value to write and returns immediately to the caller.
In this case, the system does not wait until value is actually written.
The call is marked by the following:
The call is fast.
The caller does not know when the value is actually written.
The function provides no information on the state of the write job.

SetTagXXXWait
The function SetTagXXXWait assigns the job of writing a value and will first return to the caller
when the value has actually been written.
The call is marked by the following:
The call takes longer in comparison to SetTagXXX. The duration is also dependent on the
channel and AS, amongst other things.
The value is written after the call.
The function provides no information on the state of the write job.

2860

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetTagXXXState
The function SetTagXXXState has the same features as SetTagXXX; plus the function returns
information regarding the status of the write request.
Since the status is always provided internally, there is no performance difference compared
to SetTagXXX.

SetTagXXXStateWait
The function SetTagXXXStateWait has the same features as SetTagXXXWait; plus the
function returns information regarding the status of the write request.
Since the status is always provided internally, there is no performance difference compared
to SetTagXXXWait.
The difference between the functions SetTagXXXStateWait and SetTagXXXState
corresponds to the difference between SetTagXXXWait and SetTagXXX.
Note, that certain statuses can only be generated when the write process has been completed.

SetTagMultiWait
The SetTagMultiWait function has the same features as SetTagXXXWait. It also offers the
option of granting several write jobs in a single job.

state
wait
SetTagBitStateWait
Function
Sets the value of a tag of data type "Binary tag". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagBitStateWait(Tag Tag_Name, short value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2861

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "short"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagBitStateWait (Page 2265)
Tag states
SetTagBitStateWait example

SetTagByteStateWait
Function
Sets the value of a tag of the data type "unsigned 8 Bit". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagByteStateWait(Tag Tag_Name, BYTE value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2862

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "BYTE"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagWordStateWait (Page 2272)
Tag states
SetTagWordStateWait example

SetTagCharStateWait
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag". The function is ended
after the AS has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagCharStateWait(Tag Tag_Name, LPSTR value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2863

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "LPSTR"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagCharStateWait example (Page 2266)
Tag states
SetTagCharStateWait example

SetTagDoubleStateWait
Function
Defines the value of a tag of the data type "64-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagDoubleStateWait(Tag Tag_Name, double value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2864

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "double"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagFloatStateWait example (Page 2267)
Tag states
SetTagFloatStateWait example

SetTagDWordStateWait
Function
Sets the value of a tag of the data type "unsigned 32 Bit". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagDWordStateWait(Tag Tag_Name, DWORD value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2865

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "DWORD"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagWordStateWait (Page 2272)
Tag states
SetTagWordStateWait example

SetTagFloatStateWait
Function
Defines the value of a tag of the data type "32-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagFloatStateWait(Tag Tag_Name, float value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

2866

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "float"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagFloatStateWait example (Page 2267)
Tag states
SetTagFloatStateWait example

SetTagMultiStateWait
Function
Sets the values of several tags. The function is ended after the AS has acknowledged
acceptance of the value.
The function must transfer a DWORD array whose members contain the individual tag states
after the function is invoked. The size of the array must be selected so that sufficient memory
space is available for these statuses.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagMultiStateWait(DWORD* pdwState, const char* pFormat,...)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2867

ANSI-C function descriptions


4.3 Internal functions

Parameters
pdwState
Field in which the tag statuses are stored.
pFormat
Format description for all requested tags and for each tag name and value.
FormatdescriberEXAMPLES_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagMultiStateWait example (Page 2268)
Tag states
SetTagMultiStateWait example

SetTagRawStateWait
Function
Sets the value of a tag of the data type "Raw data type". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagRawStateWait(Tag Tag_Name, BYTE pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag

2868

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagRawStateWait example (Page 2270)
Tag states
SetTagRawStateWait example

SetTagSByteStateWait
Function
Sets the value of a tag of the data type "signed 8 bit". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagSByteStateWait(Tag Tag_Name, signed char value, PDWORD lp_dwstate);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2869

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagSByteStateWait (Page 2271)
Tag states
SetTagSByteStateWait example

SetTagSDWordStateWait
Function
Sets the value of a tag of the data type "signed 32 bit". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagSDWordStateWait(Tag Tag_Name, long value, PDWORD lp_dwstate);

2870

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagSByteStateWait (Page 2271)
SetTagSByteStateWait example
Tag states

SetTagSWordStateWait
Function
Sets the value of a tag of the data type "signed 16 bit". The function is ended after the AS has
acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagSWordStateWait(Tag Tag_Name, short value, PDWORD lp_dwstate);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2871

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagSByteStateWait (Page 2271)
Tag states
SetTagSByteStateWait example

SetTagWordStateWait
Function
Sets the value of a tag of the data type "unsigned 16 Bit". The function is ended after the AS
has acknowledged acceptance of the value. The status of the tag is also returned.
Principle of the SetTag
functionsEXAMPLE_INTERNAL_FUNCTIONS_TAG_STATEWAIT_23_130

Syntax
BOOL SetTagWordStateWait(Tag Tag_Name, WORD value, PDWORD lp_dwstate);

2872

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "WORD"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. To do this, the
tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagWordStateWait (Page 2272)
SetTagWordStateWait example
Tag states

SetTagBitState
Function
Sets the value of a tag of data type "Binary tag". The status of the tag is also returned.

Syntax
BOOL SetTagBitState(Tag Tag_Name, short int value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2873

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "short int"
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagBitStateWait (Page 2265)
Principle of the SetTag functions (Page 2159)
Tag states
SetTagBitStateWait example
SetTag functions, function principle

SetTagByteState
Function
Sets the value of a tag of the data type "unsigned 8 Bit". The status of the tag is also returned.

Syntax
BOOL SetTagByteState(Tag Tag_Name, BYTE value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "BYTE"

2874

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagWordStateWait (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
Tag states
SetTagWordStateWait example

SetTagCharState
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag". The status of the
tag is also returned.

Syntax
BOOL SetTagCharState(Tag Tag_Name, LPSTR value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "LPSTR"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2875

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagCharStateWait example (Page 2266)
Principle of the SetTag functions (Page 2159)
Tag states
SetTag functions, function principle
SetTagCharStateWait example

SetTagDoubleState
Function
Defines the value of a tag of the data type "64-bit floating point value". The status of the tag is
also returned.

Syntax
BOOL SetTagDoubleState(Tag Tag_Name, double value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "double"

2876

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagFloatStateWait example (Page 2267)
Principle of the SetTag functions (Page 2159)
Tag states
SetTag functions, function principle
SetTagFloatStateWait example

SetTagDWordState
Function
Sets the value of a tag of the data type "unsigned 32 Bit". The status of the tag is also returned.

Syntax
BOOL SetTagDWordState(Tag Tag_Name, DWORD value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "DWORD"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2877

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagWordStateWait (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWordStateWait example
Tag states
SetTag functions, function principle

SetTagFloatState
Function
Defines the value of a tag of the data type "32-bit floating point value". The status of the tag is
also returned.

Syntax
BOOL SetTagFloatState(Tag Tag_Name, float value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "float"

2878

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
SetTagFloatStateWait example (Page 2267)
Principle of the SetTag functions (Page 2159)
SetTagFloatStateWait example
Tag states
SetTag functions, function principle

SetTagRawState
Function
Sets the value of a tag of the data type "Raw data type". The status of the tag is also returned.

Syntax
BOOL SetTagRawState(Tag Tag_Name, BYTE* pValue, DWORD size, PDWORD
lp_dwstate);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2879

ANSI-C function descriptions


4.3 Internal functions
size
Size of the byte field in bytes
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
GetTagRaw example (Page 2244)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
Tag states
GetTagRaw example

SetTagSByteState
Function
Sets the value of a tag of the data type "signed 8 bit". The status of the tag is also returned.

Syntax
BOOL SetTagSByteState(Tag Tag_Name, signed char value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"

2880

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagSByteStateWait (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTagSByteStateWait example
SetTag functions, function principle
Tag states

SetTagSDWordState
Function
Sets the value of a tag of the data type "signed 32 bit". The status of the tag is also returned.

Syntax
BOOL SetTagSDWordState(Tag Tag_Name, long value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2881

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagSByteStateWait (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTagSByteStateWait example
SetTag functions, function principle
Tag states

SetTagSWordState
Function
Sets the value of a tag of the data type "signed 16 bit". The status of the tag is also returned.

Syntax
BOOL SetTagSWordState(Tag Tag_Name, short value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

2882

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagSByteStateWait (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTagSByteStateWait example
SetTag functions, function principle
Tag states

SetTagWordState
Function
Sets the value of a tag of the data type "unsigned 16 Bit". The status of the tag is also returned.

Syntax
BOOL SetTagWordState(Tag Tag_Name, WORD value, PDWORD lp_dwstate);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2883

ANSI-C function descriptions


4.3 Internal functions
lp_dwstate
Pointer to a DWORD in which the status of the tag is stored after the function has been
completed.

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors. For this purpose,
the tag status must be evaluated.
FALSE
An error has occurred.

See also
Tag statuses (Page 2289)
Beispiel SetTagWordStateWait (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWordStateWait example
Tag states
SetTag functions, function principle

wait
SetTagBitWait
Function
Sets the value of a tag of data type "Binary tag". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagBitWait(Tag Tag_Name, short value);

Parameter
Tag_Name
Name of the tag

2884

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
Value
Value of the tag in the data type "short"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagBit example (Page 2265)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagBit example

SetTagByteWait
Function
Sets the value of a tag of the data type "unsigned 8 Bit". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagByteWait(Tag Tag_Name, BYTE value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "BYTE"

Return value
TRUE
The function itself has been completed without any errors.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2885

ANSI-C function descriptions


4.3 Internal functions
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagWord example

SetTagCharWait
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag". The function is ended
after the AS has acknowledged acceptance of the value.

Syntax
BOOL SetTagCharWait(Tag Tag_Name, LPSTR value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "LPSTR"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

2886

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
Principle of the SetTag functions (Page 2159)
SetTagChar example (Page 2266)
SetTag functions, function principle
SetTagChar example

SetTagDoubleWait
Function
Defines the value of a tag of the data type "64-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value.

Syntax
BOOL SetTagDoubleWait(Tag Tag_Name, double value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "double"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagFloat example (Page 2267)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagFloat example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2887

ANSI-C function descriptions


4.3 Internal functions

SetTagDWordWait
Function
Sets the value of a tag of the data type "unsigned 32 Bit". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagDWordWait(Tag Tag_Name, DWORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "DWORD"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagFloatWait
Function
Defines the value of a tag of the data type "32-bit floating point value". The function is ended
after the AS has acknowledged acceptance of the value.

2888

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetTagFloatWait(Tag Tag_Name, float value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "float"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagFloat example (Page 2267)
Principle of the SetTag functions (Page 2159)
SetTagFloat example
SetTag functions, function principle

SetTagMultiWait
Function
The values of several tags are set in the specified format. The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagMultiWait(const char* pFormat,...)

Parameters
pFormat
Format description for all requested tags and for each tag name and value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2889

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Format descriptors (Page 2285)
SetTagMultiWait example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
Format descriptors
SetTagMultiWait example

SetTagRawWait
Function
Sets the value of a tag of the data type "Raw data type". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagRawWait(Tag Tag_Name, BYTE pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

2890

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagRaw example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagRaw example

SetTagSByteWait
Function
Sets the value of a tag of the data type "signed 8 bit". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagSByteWait(Tag Tag_Name, signed char value);

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2891

ANSI-C function descriptions


4.3 Internal functions

See also
SetTagSByte example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagSByte example

SetTagSDWordWait
Function
Sets the value of a tag of the data type "signed 32 bit". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagSDWordWait(Tag Tag_Name, long value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Principle of the SetTag functions (Page 2159)
SetTagSByte example (Page 2271)
SetTag functions, function principle
SetTagSByte example

2892

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetTagSWordWait
Function
Sets the value of a tag of the data type "signed 16 bit". The function is ended after the AS has
acknowledged acceptance of the value.

Syntax
BOOL SetTagSWordWait(Tag Tag_Name, short value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTagSByte example
SetTag functions, function principle

SetTagValueWait
Function
Enables the transfer of a value in the form of a variant and sets the pointer to the value of the
data type "Variant". The function is ended after the AS has acknowledged acceptance of the
value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2893

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetTagValueWait(LPDM_VARKEY lpdmVarKey, LPVARIANT lpdmValue, PDWORD
dwState, LPCMN_ERROR lpdmError);

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmValue
Pointer to the value of data type "Variant". A description of the data type VARIANT can be
found in the associated documentation.
dwState
Tag status which is returned after the function has been run.
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Structure definition CMN_ERROR (Page 2293)
Tag statuses (Page 2289)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2294)
Structure definition DM_VARKEY (Page 2296)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
DM_VARKEY structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
CMN_ERROR structure definition

2894

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

SetTagWordWait
Function
Sets the value of a tag of the data type "unsigned 16 Bit". The function is ended after the AS
has acknowledged acceptance of the value.

Syntax
BOOL SetTagWordWait(Tag Tag_Name, WORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "WORD"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagBit
Function
Sets the value of a tag of data type "Binary tag".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2895

ANSI-C function descriptions


4.3 Internal functions

Syntax
BOOL SetTagBit(Tag Tag_Name, short int value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short int"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Principle of the SetTag functions (Page 2159)
SetTagBit example (Page 2265)
SetTagBit example
SetTag functions, function principle

SetTagByte
Function
Sets the value of a tag of the data type "unsigned 8 Bit".

Syntax
BOOL SetTagByte(Tag Tag_Name, BYTE value);

Parameters
Tag_Name
name of the tag

2896

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
value
Value of the tag in the data type "BYTE"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagChar
Function
Sets the value of a tag of the data type " 8-bit text tag" or "16-bit text tag".

Parameter
Tag_Name
Name of the tag
Value
Value of the tag in the data type "LPSTR"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2897

ANSI-C function descriptions


4.3 Internal functions

See also
SetTagChar example (Page 2266)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagChar example

SetTagDateTime
Function
Sets the value of a tag of data type "Date/Time".

Syntax
BOOL SetTagDateTime(Tag Tag_Name, SYSTEMTIME value);

Parameter
Tag_Name
Name of the tag
value
Value of the tag in the data type "Date/Time".

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

SetTagDouble
Function
Defines the value of a tag of the data type "64-bit floating point value".

Syntax
BOOL SetTagDouble(Tag Tag_Name, double value);

2898

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "double"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagFloat example (Page 2267)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagFloat example

SetTagDWord
Function
Sets the value of a tag of the data type "unsigned 32 Bit".

Syntax
BOOL SetTagDWord(Tag Tag_Name, DWORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "DWORD"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2899

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

SetTagFloat
Function
Defines the value of a tag of the data type "32-bit floating point value".

Syntax
BOOL SetTagFloat(Tag Tag_Name, float value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "float"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

2900

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

See also
SetTagFloat example (Page 2267)
Principle of the SetTag functions (Page 2159)
SetTagFloat example
SetTag functions, function principle

SetTagRaw
Function
Sets the value of a tag of the data type "Raw data type".

Syntax
BOOL SetTagRaw(Tag Tag_Name, BYTE* pValue, DWORD size);

Parameters
Tag_Name
name of the tag
pValue
The pointer to a byte field which contains the value of the raw data tag
size
Size of the byte field in bytes

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagRaw example (Page 2269)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagRaw example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2901

ANSI-C function descriptions


4.3 Internal functions

SetTagSByte
Function
Sets the value of a tag of the data type "signed 8 bit".

Syntax
BOOL SetTagSByte(Tag Tag_Name, signed char value);

Parameters
Tag_Name
name of the tag
value
The value of the tag in the data type "signed char"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTag functions, function principle
SetTagSByte example

SetTagSDWord
Function
Sets the value of a tag of the data type "signed 32 bit".

Syntax
BOOL SetTagSDWord(Tag Tag_Name, long value);

2902

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "long"

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTagSByte example
SetTag functions, function principle

SetTagSWord
Function
Sets the value of a tag of the data type "signed 16 bit".

Syntax
BOOL SetTagSWord(Tag Tag_Name, short value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "short"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2903

ANSI-C function descriptions


4.3 Internal functions
size
Size of the byte field in bytes

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagSByte example (Page 2271)
Principle of the SetTag functions (Page 2159)
SetTagSByte example
SetTag functions, function principle

SetTagValue
Function
Enables the transfer of a value in the form of a variant and sets the pointer to the value of the
data type "Variant".

Syntax
BOOL SetTagValue(LPDM_VARKEY lpdmVarKey, LPVARIANT lpdmValue, PDWORD
dwState, LPCMN_ERROR lpdmError);

Parameters
lpdmVarKey
Pointer to a structure of the data type "DM_VARKEY"
lpdmValue
Pointer to the value of data type "Variant". A description of the data type VARIANT can be
found in the associated documentation.
dwState
Tag status which is returned after the function has been run.

2904

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions
lpdmError
Pointer to the structure which contains the error description

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
Principle of the SetTag functions (Page 2159)
Structure definition CMN_ERROR (Page 2293)
Tag statuses (Page 2289)
Structure definition DM_VAR_UPDATE_STRUCT (Page 2294)
Structure definition DM_VARKEY (Page 2296)
SetTag functions, function principle
CMN_ERROR structure definition
DM_VAR_UPDATE_STRUCTEX structure definition
DM_VARKEY structure definition

SetTagWord
Function
Sets the value of a tag of the data type "unsigned 16 Bit".

Syntax
BOOL SetTagWord(Tag Tag_Name, WORD value);

Parameters
Tag_Name
name of the tag
value
Value of the tag in the data type "WORD"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2905

ANSI-C function descriptions


4.3 Internal functions

Return value
TRUE
The function itself has been completed without any errors.
However, no test is made as to whether the tag could be written without errors.
FALSE
An error has occurred.

See also
SetTagWord example (Page 2272)
Principle of the SetTag functions (Page 2159)
SetTagWord example
SetTag functions, function principle

4.3.6

WinCC

4.3.6.1

WinCC - short description


The functions of the WinCC group allow to define various setting in Runtime.
The functions of the System subgroup can be used to influence WinCC Runtime.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

2906

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

4.3.6.2

system

DeactivateRTProject
Function
Deactivates the activated project.
Note
If Runtime is exited on a server or client this applies only to the respective computer.
An activated project for which the WinCC Explorer has not been started must be closed with
the internal function "ExitWinCC".
If the activated project was exited with the internal function "DeactivateRTProject" the WinCC
project remains open in the background. To close this project, the WinCC Explorer must be
opened and then be closed by means of the menu commands "File" > "Exit".

Syntax
BOOL DeactivateRTProject();

Return value
TRUE
The function has been completed without any errors.

FALSE
An error has occurred.

See also
DeactivateRTProject example (Page 2215)
DeactivateRTProject example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2907

ANSI-C function descriptions


4.3 Internal functions

ExitWinCC
Function
Deactivates Runtime and exits WinCC on the computer executing the function.
Note
If Runtime is exited on a server or client this applies only to the respective computer.
An activated project for which the WinCC Explorer has not been started must be closed with
the internal function "ExitWinCC".
If the activated project was exited with the internal function "DeactivateRTProject" the WinCC
project remains open in the background. To close this project, the WinCC Explorer must be
opened and then be closed by means of the menu commands "File" > "Exit".

Syntax
BOOL ExitWinCC ();

Return value
TRUE
The function has been completed without any errors.

FALSE
An error has occurred.

See also
ExitWinCC example (Page 2215)
ExitWinCC example

GetLanguage
Function
Determines the current Runtime language.

Syntax
DWORD GetLanguage();

2908

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Return value
The current Runtime language with the associated language identifier is returned.
Note
You can find a comprehensive "Language code" table in the "Basic Principles of VBScript"
documentation under the index entry "Language code".

See also
GetLanguage example (Page 2223)
GetLanguage example

InquireLanguage
Function
Determines all languages configured in the text library for the runtime.
Use dWCount to specify where the number of determined language IDs is to be stored.

Syntax
DWORD* InquireLanguage(DWORD* dwCount);

Parameters
dwCount
Pointer to the number of determined language IDs

Return value
The configured languages with the associated language identifiers are returned.
Note
You can find a comprehensive "Language code" table in the "Basic Principles of VBScript"
documentation under the index entry "Language code".

See also
InquireLanguage example (Page 2252)
InquireLanguage example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2909

ANSI-C function descriptions


4.3 Internal functions

SetLanguage
Function
Changes the language setting in Runtime.

Syntax
BOOL SetLanguage(DWORD dwLocaleID);

Parameters
dwLocaleID
Language ID of the language to be set

Return value
TRUE
The function has been completed without any errors.

FALSE
An error has occurred.

See also
Language ID (Page 2288)
SetLanguage example (Page 2260)
SetLanguage example
Language IDs

4.3.6.3

FillDiagnoseInTags

Function
Activates or deactivates the storage of diagnostic information in tags.
As filling the tags is an additional load for the system, it should only be activated temporarily
for diagnostic information.

2910

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

Syntax
void FillDiagnoseInTags(BOOL bfill);

Parameters
bFill
Storage of diagnostic information in tags on/off
TRUE Activate supply of diagnostic tags
FALSE Deactivate supply of diagnostic tags

Diagnostic tags of GlobalScript


@SCRIPT_COUNT_TAGS
This tag contains the current number of tags requested via Script.
@SCRIPT_COUNT_REQUEST_IN_QUEUES
This tag contains the current number of jobs.
@SCRIPT_COUNT_ACTIONS_IN_QUEUES
This tag contains the current number of actions.

4.3.6.4

GetServerTagPrefix

Function
To be able to access tags of the respective server from a WinCC client in a distributed system,
the tag names must be supplemented with the server prefix.
If the tags are accessed by means of the functions GetTagxx or SetTagxx, the required addition
is made by the script control.
If WinCC API functions are used for accessing, the tag names have to be supplemented by
the user. The GetServer TagPrefix function provides the required prefixes.
One pointer each of the "char" type to ServerPrefix, TagPrefix and WindowPrefix is returned.
The user must neither change the memory (also no strcat) nor release it.

Syntax
void GetServerTagPrefix(char** ppszServerPrefix, char** ppszTagPrefix, char**
ppszWindowPrefix);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2911

ANSI-C function descriptions


4.3 Internal functions

Parameters
ppszServerPrefix
Pointer to a pointer referring to the server prefix
ppszTagPrefix
Pointer to a pointer referring to the tag prefix
ppszWindowPrefix
Pointer to a pointer referring to the window prefix

See also
GetServerTagPrefix example (Page 2234)
GetServerTagPrefix example

4.3.6.5

TraceText

Function
The value defined in <Parameter> is recorded in APDiag if the specified diagnostic level has
been reached.

Syntax
void TraceText(DWORD dwTraceLevel, char* pszFormat, <Parameter>);

Parameters
dwTraceLevel
Diagnostic level
pszFormat
Output format (according to printf function)
<Parameter>
Value to be reported
Note
The parameterization dialog for this function provides the selection of tags, graphic objects
and pictures.

2912

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.3 Internal functions

4.3.6.6

TraceTime

Function
The value defined in <Parameter> is recorded in APDiag if the specified diagnostic level has
been reached.
In addition, the time since the AP start of diagnosis is output in milliseconds to enable
performance measurements.

Syntax
void TraceTime(DWORD dwTraceLevel, char* pszFormat, <Parameter>);

Parameters
dwTraceLevel
Diagnostic level
pszFormat
Output format (according to printf function)
<Parameter>
Value to be reported
Note
The parameterization dialog for this function provides the selection of tags, graphic objects
and pictures.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2913

ANSI-C function descriptions


4.4 Examples

4.4

Examples

4.4.1

Examles - A to G

4.4.1.1

AcknowledgeMessage example

{
//Acknowledge the AlarmLogging message which is selected
AcknowledgeMessage(GetTagWord("U08i_MsgNr"));
}

Specify the message number to be acknowledged. It is read from a tag.

4.4.1.2

AXC_OnBtnMsgFirst example

{
// jump to the first message in the WinCC Alarm Control
AXC_OnBtnMsgFirst("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnMsgFirst function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.4.1.3

Beispiel AXC_OnBtnMsgLast

{
// jump to the last message in the WinCC Alarm Control
AXC_OnBtnMsgLast("gs_alarm_00","Control1");

2914

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

Parameters of the AXC_OnBtnMsgLast function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

4.4.1.4

AXC_OnBtnScroll example

{
// activate/deactivate the scroll function
AXC_OnBtnScroll("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnScroll function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

4.4.1.5

AXC_OnBtnSinglAckn example

{
// acknowledge the active message
AXC_OnBtnSinglAckn("gs_alarm_00","Control1");
}

Parameters of the AXC_OnBtnSinglAckn function:


"gs_alarm_00" is the name of the picture in which WinCC Alarm Control was configured.
Control1 is the object name of the WinCC Alarm Control.

4.4.1.6

AXC_SetFilter example

{
BOOL ret;
MSG_FILTER_STRUCT Filter;
CMN_ERROR Error;
//Reset the filter struct

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2915

ANSI-C function descriptions


4.4 Examples

memset( &Filter, 0, sizeof( MSG_FILTER_STRUCT ) );


//Set the filter name
strcpy( Filter.szFilterName, "Control1");
// Choose selection elements
Filter.dwFilter = MSG_FILTER_NR_FROM | MSG_FILTER_NR_TO;
// Message number
Filter.dwMsgNr[0]
// Message number
Filter.dwMsgNr[1]

from
= 2;
to
= 2;

ret = AXC_SetFilter("gs_alarm_00","Control1",&Filter,&Error);
}

1. Name the filter.


2. Select the filter type.
3. Specify the filter criteria.
4. Set the filter.

Note
The filter type and the filter criteria are to be adapted, all other filter types are described in
the filter structure.

4.4.1.7

DeactivateRTProject example

{
//deactivate the runtime
DeactivateRTProject ();
}

This function deactivates WinCC Runtime.

4.4.1.8

ExitWinCC example

{
//exit wincc
ExitWinCC ();
}

2916

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

This function exits WinCC.

4.4.2

Examples - GetAlarmHigh to GetPropChar

4.4.2.1

GetAlarmHigh example

{
double dAlarmHigh;
//Get the Alarm High Limit
dAlarmHigh = GetAlarmHigh(lpszPictureName,"Bar1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetAlarmHigh:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
1. Read out the upper alarm limit and temporarily store it in dAlarmHigh.
2. Executing user-defined code for processing return values.

4.4.2.2

GetBackColor example

{
long int bk_color;
//Get the background color
bk_color = GetBackColor(lpszPictureName,"StatischerText1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetBackColor:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2917

ANSI-C function descriptions


4.4 Examples

1. Read out the current background color and temporarily store it in bk_color.
2. Executing user-defined code for processing return values.

4.4.2.3

GetBorderStyle example

{
long int lstyle;
//Get the current border style
lstyle = GetBorderStyle(lpszPictureName,"Rectangle1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetBorderStyle:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out the current line style of the object and temporarily store it in lstyle.
2. Executing user-defined code for processing return values.

4.4.2.4

GetFilling example

{
BOOL bfilling;
//Get the actual state of dynamic filling
bfilling = GetFilling(lpszPictureName,"Rectangle1");
if(bfilling)
{
// User defined code if the
// dynamic filling is activated
...
}
Else
{
// User defined code if the
// dynamic filling is deactivated
...

2918

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

}
}

Parameters of the function GetFilling:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out whether dynamic filling is activated or not and temporary store in bfilling.
2. Executing user-defined code, depending on the return value of the function.

4.4.2.5

GetFillingIndex example

{
long int filling_index;
//Get the actual filling index of the object
filling_index = GetFillingIndex(lpszPictureName,"Rectangle1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the function GetFillingIndex:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out the current fill level of the object and temporarily store it in filling_index.
2. Executing user-defined code for processing return values.

4.4.2.6

GetFillStyle example

{
long int lstyle;
//Get the current fill style
lstyle = GetFillStyle(lpszPictureName,"Rectangle1");
//User defined code where the
//user can do something with the return value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2919

ANSI-C function descriptions


4.4 Examples

...
}

Parameters of the function GetFillStyle:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
1. Read out the current fill pattern of the object and temporarily store it in lstyle.
2. Executing user-defined code for processing return values.

4.4.2.7

GetFlashBackColor example

{
BOOL bflash_col;
//Get if the flashing is on or off
bflash_col = GetFlashBackColor(lpszPictureName,"Group1");
if(bflash_col)
{
// User defined code if the
// flashing is activated
...
}
Else
{
// User defined code if the
// flashing is deactivated
...
}
}

Parameters of the function GetFlashBackColor:


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
1. Read out whether flashing of the background color is activated or not and temporary store
in bflash_col.
2. Executing user-defined code, depending on the return value of the function.

2920

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

4.4.2.8

GetFlashBackColorOn example

{
long int flashcol_on;
//Get the BackFlashColor
flashcol_on = GetBackFlashColorOn(lpszPictureName,"Group1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetBackFlashColorOn function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
1. Read out the background flash color for the "On" status of the obvject and and temporarily
store it in flashcol_on.
2. Executing user-defined code for processing return values.

4.4.2.9

GetFlashRateFlashPic example

{
long lFlashRate;
//Get the flashrate
lFlashRate = GetFlashRateFlashPic(lpszPictureName,"StatusDisplay1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetFlashRateFlashPic function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Status display1" is the name of the object.
1. Read out the flash frequency of the object and temporarily store it in lFlashRate.
2. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2921

ANSI-C function descriptions


4.4 Examples

4.4.2.10

GetFocus example

{
char* pszValue = NULL;
char szValue[_MAX_PATH+1];

//Get the Object which has the focus


pszValue = Get_Focus();
//Copy the string
if(pszValue != NULL)
{
strncpy(szValue,pszValue,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

1. Read out on which object the focus is and temporarily store in pszValue.
2. If a valid value has been returned, store the return value of the function in the local string
szValue. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

4.4.2.11

GetFontBold example

{
BOOL bbold;
//Get if the text is bold
bbold = GetFontBold(lpszPictureName,"StaticText1");
if(bbold)
{
// User
// font
...
}
Else
{
// User
// font
...
}
}

2922

defined code if the


is bold

defined code if the


is not bold

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
Parameters of the GetBackColor function
"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
1. Read out whether the text is in bold or not and temporarily store in bbold.
2. Executing user-defined code, depending on the return value of the function.

4.4.2.12

GetFontSize example

{
long int fontsize;
//Get the actual Font size
fontsize = GetFontSize(lpszPictureName,"StaticText1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetFontSize function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
1. Read out the current font size and temporarily store it in fontsize.
2. Executing user-defined code for processing return values.

4.4.2.13

GetHeight example

{
long lHeight;
//Get the height of the object
lHeight = GetHeight(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetHeight function:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2923

ANSI-C function descriptions


4.4 Examples
"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
1. Read out the current height of the object and temporarily store it in lHeight.
2. Executing user-defined code for processing return values.

4.4.2.14

GetHiddenInput example

{
BOOL bHiddenInput;
//Get the state of hidden input
bHiddenInput = GetHiddenInput(lpszPictureName,"IOField1");
if(bHiddenInput)
{
// User defined
// hidden input
...
}
Else
{
// User defined
// hidden input
...
}
}

code if the
is activated

code if the
is activated

Parameters of the GetHiddenInput function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
1. Read out whether the text is in bold or not and temporarily store in bHiddenInput.
2. Executing user-defined code, depending on the return value of the function.

4.4.2.15

GetLanguage example

{
DWORD rt_language;
//Get the current language
rt_language = GetLanguage ();

2924

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

//User defined code where the


//user can do something with the return value
...
}

1. Read out the current Runtime language and temporarily store it in rt_language.
2. Executing user-defined code for processing return values.

4.4.2.16

GetLeft example

{
long lPos;
//Get the x-position of the object
lPos = GetLeft(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetLeft function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
1. Read out the current X position of the object and temporarily store it in lPos.
2. Executing user-defined code for processing return values.

4.4.2.17

GetLink example

{
LINKINFO linkinfo;
//Get the linked Tag
GetLink(lpszPictureName,"Bar1","Process",&linkinfo);
// linkinfo.szLinkName is the tag name
// linkinfo.dwCycle is the update cycle
// linkinfo.LinkType is the type of the connection

//User defined code where the

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2925

ANSI-C function descriptions


4.4 Examples

//user can do something with the return value


...
}

Parameters of the GetLink function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"Process" is the property connected to a tag.
"&linkinfo" is the address of the linkinfo structure.
1. Fills the passed linkinfo structure with the tag connection information.
2. Executing user-defined code, depending on the return value of the function.

4.4.2.18

GetLinkedVariable example

{
char* pszVarName = NULL;
char szVarName[_MAX_PATH+1];
//Get the TagName
pszVarName = GetLinkedVariable("gs_stand_graph_00","StaticText6","Visible");
//Copy the string
if (strcmp (pszVarName,"")!= 0)
{
strncpy(szVarName,pszVarName,_MAX_PATH);
}
else printf("Attribute 'visible' is not made dynamic\r\n");
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetLinkedVariable function:


"gs_stand_graph_00" is the name of the picture in which the object was configured.
"StaticText6" is the name of the object.
"Visible" is the property connected to a tag.
1. Temporarily store the return value of the GetLinkedVariable function in pszVarName.

2926

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
2. If a valid value has been returned, store the return value in szVarName. A maximum of
_MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

4.4.2.19

GetLocalPicture example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the Local Picture
pszPicName = GetLocalPicture(lpszPictureName);
//Copy the string
if (pszPicName != NULL)
{
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

1. Temporarily store the return value of the GetLocalPicture function in pszPicName.


2. If a valid value has been returned, store the return value in szPicName. A maximum of
_MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

4.4.2.20

GetMarker example

{
BOOL bmarker;
//Get the state of the Marker
bmarker = GetMarker(lpszPictureName,"Bar1");
if(bmarker)
{
// User defined code if the
// marker is activated
...
}
Else
{
// User defined code if the
// marker is deactivated
...

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2927

ANSI-C function descriptions


4.4 Examples

}
}

Parameters of the GetMarker function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
1. Read out whether the marker is displayed or not and temporarily store in bmarker.
2. Executing user-defined code, depending on the return value of the function.

4.4.2.21

GetOutputValueDouble example

{
double doutput;
//Get the output value of IO Field 1
doutput = GetOutputValueDouble(lpszPictureName,"IOField1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetOutputValueDouble function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
1. Read out the output value and temporarily store it in doutput.
2. Executing user-defined code for processing return values.

4.4.2.22

GetParentPicture example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the parent picture
pszPicName = GetParentPicture(lpszPictureName);
//Copy the string

2928

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

if (pszPicName != NULL)
{
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

1. Temporarily store the return value of the GetParentPicture function in pszPicName.


2. If a valid value has been returned, store the return value in szPicName. A maximum of
_MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

4.4.2.23

GetPictureDown example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the current picture name
pszPicName = GetPictureDown(lpszPictureName,"Roundbutton1");
if (pszPicName != NULL)
{
//Copy the string
strncpy(szPicName,pszPicName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetPictureDown function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
1. Read out the picture name of the picture displayed in round button 1 and temporarily store
it in pszPicName.
2. If a valid value has been returned, store the return value of the function in the local string
szPicName. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2929

ANSI-C function descriptions


4.4 Examples

4.4.2.24

GetPictureName example

{
char* pszPictureName = NULL;
char szPictureName[_MAX_PATH + 1];
//Get the current PictureName
pszPictureName = GetPictureName(lpszPictureName,"GraphicObject1");
if(pszPictureName != NULL)
{
//copy the string
strncpy(szPictureName,pszPictureName,_MAX_PATH);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetPictureName function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
1. Read out the picture name of the picture displayed in graphic object 1 and temporarily store
it in pszPictureName.
2. If a valid value has been returned, store the return value of the function in the local string
szPictureName. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

4.4.2.25

GetPictureUp example

{
char* pszPicName = NULL;
char szPicName[_MAX_PATH+1];
//Get the current picture name
pszPicName = GetPictureUp(lpszPictureName,"Roundbutton1");
if (pszPicName != NULL)
{
//Copy the string
strncpy(szPicName,pszPicName,_MAX_PATH);
}

2930

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

//User defined code where the


//user can do something with the return value
...
}

Parameters of the GetPictureUp function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
1. Read out the picture name of the picture displayed in round button 1 and temporarily store
it in pszPicName.
2. If a valid value has been returned, store the return value of the function in the local string
szPicName. A maximum of _MAX_PATH characters is stored.
3. Executing user-defined code for processing return values.

4.4.2.26

GetPosition example

{
long int lpos;
//Get the actual position of the Slider
lpos = GetPosition(lpszPictureName,"Control1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetPosition function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
1. Read out the current slider position and temporarily store it in lpos.
2. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2931

ANSI-C function descriptions


4.4 Examples

4.4.2.27

GetPropBOOL example

{
BOOL bProp;
//Get the property Visible
bProp = GetPropBOOL("gs_graph_eafield","IOField1","Visible");
if(bProp)
{
// User defined code if the
// object is visible
...
}
else
{
// User defined code if the
// object is not visible
...
}
}

Parameters of the GetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"Visible" is the object property.
1. Read out whether the object is visible or not and temporarily store in bProp.
2. Executing user-defined code, depending on the return value of the function.

4.4.2.28

GetPropChar example

{
char* pszProp = NULL;
char szProp[14];
//Get the property Tooltiptext
pszProp = GetPropChar("lpszPictureName","EAFeld1","Tooltiptext");
if(pszProp != NULL)
{
//Copy the string
strncpy(szProp,pszProp,13);
}
//User defined code where the
//user can do something with the return value

2932

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

...
}

Parameters of the GetPropChar function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"Tooltiptext" is the object property.
1. Read out the tooltip text of the object and temporarily store it in pszProp.
2. If a valid value has been returned, store the return value of the function in the local string
szProp. A maximum of 13 characters is stored.
3. Executing user-defined code for processing return values.

4.4.3

Examples - GetRangeMax to GetWidth

4.4.3.1

GetRangeMax example

{
long int lrange;
//Get the upper scale Limit
lrange = GetRangeMax(lpszPictureName,"Control1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetRangeMax function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
1. Read out the current upper limit of the object and temporarily store it in lrange.
2. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2933

ANSI-C function descriptions


4.4 Examples

4.4.3.2

GetRangeMin example

{
long int lrange;
//Get the lower scale Limit
lrange = GetRangeMin(lpszPictureName,"Control1");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetRangeMin function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
1. Read out the current lower limit of the object and temporarily store it in lrange.
2. Executing user-defined code for processing return values.

4.4.3.3

Beispiel GetScaling

{
BOOL bscaling;
//Get the Scaling state
bscaling = GetScaling(lpszPictureName,"Bar1");
if (bscaling)
{
// User defined code
// bar object has an
...
}
Else
{
// User defined code
// bar object has no
...
}
}

if the
additional scale

if the
additional scale

Parameters of the GetScaling function:


"lpszPictureName" is the name of the picture in which the object was configured.

2934

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
"Bar1" is the name of the object.
1. Read out whether the scale of the bar is displayed or not and temporarily store in bscaling.
2. Executing user-defined code, depending on the return value of the function.

4.4.3.4

GetServerTagPrefix example

{
char* pszServerPrefix;
char* pszTagPrefix;
char* pszWindowPrefix;
int nServerPrefixLen = 0;
int nTagPrefixLen = 0;
int nTagLen = 0;
char myTagName[MAX_DM_VAR_NAME+1];
//Initialize the return value
memset(myTagName,0,MAX_DM_VAR_NAME + 1);
//Get the serverprefix the tagprefix and the windowprefix
GetServerTagPrefix(&pszServerPrefix, &pszTagPrefix, &pszWindowPrefix);
//If a serverprefix exists
if (pszServerPrefix)
{
//Get the length of the string
nServerPrefixLen = strlen(pszServerPrefix);
}
Else
{
printf("No server prefix was returned.");
return;
}
//If a tagprefix exists
if (pszTagPrefix)
{
//Get the length of the string
nTagPrefixLen = strlen(pszTagPrefix);
}
//Get the length of the tag
nTagLen = strlen("TagName");
//Check if the lenght of the
//ServerPrefix+TagPrefix+VarName + the double points < MAX_DM_VAR_NAME)
if (nServerPrefixLen + nTagPrefixLen + nTagLen+2 < MAX_DM_VAR_NAME)
{
sprintf(myTagName,"%s::%s%s",pszServerPrefix,pszTagPrefix,"TagName");
//User defined code where the

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2935

ANSI-C function descriptions


4.4 Examples

//user can do something with the return value


...
}
Else
{
printf("The resulting string is too long.");
return;
}
}

1. Initialize the myTagName tag.


2. Read out the server prefix, the tag prefix and the window prefix.
3. If no server prefix has been returned, a text ist output and the function is terminated.
4. If a server prefix has been returned, determine its length and temporarily store it in
nServerPrefixLen.
5. If a tag prefix has been returned, determine its length and temporarily store it in TagPrefixLen.
6. Determine the length of the tag name and temporarily store it in nVarLen.
7. If the length permitted for tag names is exceeded a text is output and the function is
terminated.
8. If the length permitted for tag names is not exceeded, the tag name required for a client
environment is compiled.
9. Executing user-defined code for processing return values.

4.4.3.5

GetServerTagPrefix example

{
char* pszServerPrefix;
char* pszTagPrefix;
char* pszWindowPrefix;
//Get the serverprefix and the tagprefix
GetServerTagPrefix(&pszServerPrefix, &pszTagPrefix, &pszWindowPrefix);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetServerTagPrefix function:


"pszServerPrefix" is the tag which is written into the server prefix.
"pszTagPrefix" is the tag which is written into the tag prefix.
"pszWindowrPrefix" is the tag which is written into the window prefix.

2936

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

1. Read out the server prefix, the tag prefix and the window prefix.
2. The pszServerPrefix tag contains the returned server prefix.
3. The pszTagPrefix tag contains the returned tag prefix.
4. The pszWindowPrefix tag contains the returned window prefix.
5. Executing user-defined code for processing return values.

4.4.3.6

GetTagBit example

{
BOOL bstate;
//Get the current state of the tag
bstate = GetTagBit("gs_tag_bit");
if(bstate)
{
// User defined
// value of the
...
}
else
{
// User defined
// value of the
...
}
}

code if the
tag is true

code if the
tag is false

Parameters of the GetTagBit function


"gs_tag_bit" is the name of the tag.
1. Read out the value of the tag and temporarily store it in bstate.
2. Executing user-defined code, depending on the return value of the function.

4.4.3.7

GetTagBitStateQC example

{
DWORD dwState;
DWORD dwQC;

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2937

ANSI-C function descriptions


4.4 Examples

BOOL bValue;
dwState = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
bValue = GetTagBitStateQCWait("gs_tag_bit",&dwState,&dwQC);
//Create a string
if (bValue)
{
// User defined
// value of the
...
}
else
{
// User defined
// value of the
...
}
}

which includes the tag value

code if the
tag is true

code if the
tag is false

Parameters of the GetTagBitStateQC function:


"gs_tag_bit" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in bValue. The function puts the tag
status in dwState and the quality code in dwQC.
2. Executing user-defined code, depending on the return value of the function.

4.4.3.8

GetTagBitStateWait example

{
DWORD dwstate;
BOOL bValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
bValue = GetTagBitStateWait("gs_tag_bit",&dwstate);
//Create a string which includes the tag value
if (bValue)
{

2938

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

// User defined code if the


// value of the tag is true
...
}
else
{
// User defined code if the
// value of the tag is false
...
}
}

Parameters of the GetTagBitStateWait function:


"gs_tag_bit" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in bstate. The function puts the tag
status in dwstate.
2. Executing user-defined code, depending on the return value of the function.

4.4.3.9

GetTagChar example

{
char* pszValue = NULL;
char szValue[13];
//Get the current value of the tag
pszValue = GetTagChar("gs_tag_char");
if(pszValue != NULL)
{
//Copy the string
strncpy(szValue,pszValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagChar function:


"gs_tag_char" is the name of the tag.
1. Reading the value of the tag and temporarily storing in pszValue.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2939

ANSI-C function descriptions


4.4 Examples
2. If a valid value has been returned, store the return value of the function in the local string
szValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

4.4.3.10

GetTagCharStateQCWait example

{
DWORD dwState;
DWORD dwQC;
char* pszRetValue = NULL;
char szRetValue[13];
dwState = 0xFFFFFFFF;
//Get the tag value
pszRetValue = GetTagCharStateQCWait("gs_tag_char",&dwState, &dwQC);
if (pszRetValue != NULL)
{
//Copy the string
strncpy(szRetValue,pszRetValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagCharStateQCWait function:


"gs_tag_char" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in pszRetValue. The function puts the
tag status in dwState and the quality code in dwQC.
2. If a valid value has been returned, store the return value of the function in the local string
szRetValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

4.4.3.11

Beispiel GetTagCharStateWait

{
DWORD dwstate;
char szValue[11];

2940

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

char* pszRetValue = NULL;


char szRetValue[13];
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
pszRetValue = GetTagCharStateWait("gs_tag_char",&dwstate);
if (pszRetValue != NULL)
{
//Copy the string
strncpy(szRetValue,pszRetValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagCharStateWait function:


"gs_tag_char" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in pszRetValue. The function puts the
tag status in dwstate.
2. If a valid value has been returned, store the return value of the function in the local string
szRetValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

4.4.3.12

GetTagFloat example

{
float fValue;
//Get the current value of the tag
fValue = GetTagFloat("gs_tag_float");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagFloat function:


"gs_tag_float" is the name of the tag.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2941

ANSI-C function descriptions


4.4 Examples
1. Read out the value of the tag and temporarily store it in fValue.
2. Executing user-defined code for processing return values.

4.4.3.13

GetTagFloatStateQCWait example

{
DWORD dwState;
DWORD dwQC;
float fValue;
dwState = 0xFFFFFFFF;
//Get the tag value
fValue = GetTagFloatStateQCWait("gs_tag_float",&dwState, &dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagFloatStateQCWait function:


"gs_tag_float" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in fValue. The function puts the tag
status in dwState and the quality code in dwQC.
2. Executing user-defined code for processing return values.

4.4.3.14

GetTagFloatStateWait example

{
DWORD dwstate;
float fValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
fValue = GetTagFloatStateWait("gs_tag_float",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

2942

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

Parameters of the GetTagFloatStateWait function:


"gs_tag_float" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in fValue. The function puts the tag
status in dwstate.
2. Executing user-defined code for processing return values.

4.4.3.15

GetTagMultiStateQCWait example

{
#define DATA_SIZE 5
DWORD dwState[DATA_SIZE];
DWORD dwQC[DATA_SIZE];
//define all Datas
BOOL lValue1;
long lValue2 ;
char* szValue3;
double dblValue4 ;
WORD lValue5 ;

//Set the tags


GetTagMultiStateQCWait(dwState,dwQC,"%d%d%s%f%d",
"gs_tag_bit",&lValue1,
"gs_tag_SByte",&lValue2,
"gs_tag_char",&szValue3,
"gs_tag_float",&dblValue4,
"gs_tag_word",&lValue5);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagMultiStateWait function:


"dwState" is the DWord-Array, in which the tag statuses are stored.
"dwQC" is the DWord-Array, in which the quality codes are stored.
"%d%d%s%f%d" are the type descriptions of the tags to be read.
"gs_tag_bit" is the tag to be read.
"&lValue1" is the address of the tags in which the value of the tags gs_tag_bit should be stored.
"gs_tag_SByte" is the tag to be read.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2943

ANSI-C function descriptions


4.4 Examples
"&lValue2" is the address of the tags in which the value of the tags gs_tag_SByte should be
stored.
The other parameters are to be handled in the same way as those described previously.
1. Creating a DWord-Array with the required size (Number of tags).
2. Reading and storing the values of the tags. The value of the tags gs_tag_bit is stored
temporarily in lValue1. The value of the tags gs_tag_SByte is stored temporarily in lValue2,
etc.
3. Executing user-defined code for processing return values.

4.4.3.16

GetTagMultiStateWait example

{
#define DATA_SIZE 5
DWORD dwData[DATA_SIZE];
//define all Datas
BOOL lValue1;
long lValue2 ;
char* szValue3;
double dblValue4 ;
WORD lValue5 ;

//Set the tags


GetTagMultiStateWait(dwData,"%d%d%s%f%d",
"gs_tag_bit",&lValue1,
"gs_tag_SByte",&lValue2,
"gs_tag_char",&szValue3,
"gs_tag_float",&dblValue4,
"gs_tag_word",&lValue5);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagMultiStateWait function:


"dwData" is the DWord-Array, in which the tag statuses are stored.
"%d%d%s%f%d" are the type descriptions of the tags to be read.
"gs_tag_bit" is the tag to be read.
"&lValue1" is the address of the tags in which the value of the tags gs_tag_bit should be stored.
"gs_tag_SByte" is the tag to be read.
"&lValue2" is the address of the tags in which the value of the tags gs_tag_SByte should be
stored.

2944

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
The other parameters are to be handled in the same way as those described previously.
1. Creating a DWord-Array with the required size (Number of tags).
2. Reading and storing the values of the tags. The value of the tags gs_tag_bit is stored
temporarily in lValue1. The value of the tags gs_tag_SByte is stored temporarily in lValue2,
etc.
3. Executing user-defined code for processing return values.

4.4.3.17

GetTagMultiWait example

DWORD dwVar1Value;
char* szVar2Value;
//Memory for the tag value is
//created by teh function with SysMalloc
double dbVar3Value;
BOOL ok;
ok=GetTagMultiWait("%d%s%f", "Ernie_word", &dwVar1Value,
"Ernie_char", &szVar2Value,
"Ernie_double", &dbVar3Value);
printf("Word %d, String %s, Double %f\r\n",
dwVar1Value, szVar2Value, dbVar3Value);

4.4.3.18

GetTagPrefix example

{
char* pszTagPrefix = NULL;
char szTagPrefix[7];
//Get the current tag prefix
pszTagPrefix = GetTagPrefix(lpszPictureName,"PicWindow1");
if(pszTagPrefix != NULL)
{
//Copy the string
strncpy(szTagPrefix,pszTagPrefix,6);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagPrefix function:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2945

ANSI-C function descriptions


4.4 Examples
"lpszPictureName" is the name of the picture in which the object was configured.
"PictureWindow1" is the name of the object.
1. Read out the current tag prefix of picture window 1 and temporarily store it in pszTagPrefix.
2. If a valid value has been returned, store the return value of the function in the local string
szTagPrefix. A maximum of 6 characters is stored.
3. Executing user-defined code for processing return values.

4.4.3.19

GetTagRaw example

{
#define DATA_SIZE 3
BYTE byData[DATA_SIZE];
//Get the current values of the tag
GetTagRaw("gs_tag_raw",byData,DATA_SIZE);
//Use the values received in the array byData
...
}

Parameters of the GetTagRaw function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array in which the values of the raw data tags will be stored.
"DATA_SIZE" is the number of values that will be read.
1. Reading the values of the tags and temporarily storing in byData.
2. Executing user-defined code for processing return values.

4.4.3.20

GetTagRawStateQCWait example

{
#define DATA_SIZE 3
DWORD dwState;
DWORD dwQC;
BYTE byData[DATA_SIZE];
dwState = 0xFFFFFFFF;

2946

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

//Get the values of the tag


GetTagRawStateQCWait("gs_tag_raw",byData,DATA_SIZE,&dwState,&dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagRawStateQCWait function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array in which the values of the raw data tags will be stored.
"DATA_SIZE" is the number of values that will be read.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Reading the values of the tags and temporarily storing in byData.
2. Executing user-defined code for processing return values.

4.4.3.21

GetTagRawStateWait example

{
#define DATA_SIZE 3
DWORD dwstate;
BYTE byData[DATA_SIZE];
char szValue[11];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Get the values of the tag
//dwstate is the tag state
GetTagRawStateWait("gs_tag_raw",byData,DATA_SIZE,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagRawStateWait function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array in which the values of the raw data tags will be stored.
"DATA_SIZE" is the number of values that will be read.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2947

ANSI-C function descriptions


4.4 Examples
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Reading the values of the tags and temporarily storing in byData.
2. Executing user-defined code for processing return values.

4.4.3.22

GetTagSByte example

{
long lValue;
//Get the current value of the tag
lValue = GetTagSByte("gs_tag_SByte");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagSByte function:


"gs_tag_SByte" is the name of the tag.
1. Read the value of the tag and temporarily store it in lValue.
2. Executing user-defined code for processing return values.

4.4.3.23

GetTagSByteStateQCWait example

{
DWORD dwState;
DWORD dwQC;
long lValue;
dwState = 0xFFFFFFFF;
//Get the tag value
lValue = GetTagSByteStateQCWait("gs_tag_SByte",&dwState, &dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagSByteStateQCWait function:

2948

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
"gs_tag_SByte" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read the value of the tag and temporarily store it in lValue. The function puts the tag status
in dwState and the quality code in dwQC.
2. Executing user-defined code for processing return values.

4.4.3.24

GetTagSByteStateWait example

{
DWORD dwstate;
long lValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
lValue = GetTagSByteStateWait("gs_tag_SByte",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagSByteStateWait function:


"gs_tag_SByte" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read the value of the tag and temporarily store it in lValue. The function puts the tag status
in dwstate.
2. Executing user-defined code for processing return values.

4.4.3.25

GetTagWord example

{
WORD wValue;
//Get the current value of the tag
wValue = GetTagWord("gs_tag_word");
//User defined code where the
//user can do something with the return value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2949

ANSI-C function descriptions


4.4 Examples

...
}

Parameters of the GetTagWord function:


"gs_tag_word" is the name of the tag.
1. Read out the value of the tag and temporarily store it in wValue.
2. Executing user-defined code for processing return values.

4.4.3.26

GetTagWordStateQCWait example

{
DWORD dwState;
DWORD dwQC;
WORD wValue;
dwState = 0xFFFFFFFF;
//Get the tag value
wValue = GetTagWordStateQCWait("gs_tag_word",&dwState, &dwQC);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTagWordStateQCWait function:


"gs_tag_word" is the name of the tag.
"&dwState" is the address of the tags in which the tag status is to be stored.
"&dwQC" is the address of the tag in which the quality code is to be stored.
1. Read out the value of the tag and temporarily store it in wValue. The function puts the tag
status in dwState and the quality code in dwQC.
2. Executing user-defined code for processing return values.

4.4.3.27

GetTagWordStateWait example

{
DWORD dwstate;
WORD wValue;

2950

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
wValue = GetTagWordStateWait("gs_tag_word",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of then GetTagWordStateWait function:


"gs_tag_word" is the name of the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Read out the value of the tag and temporarily store it in wValue. The function puts the tag
status in dwstate.
2. Executing user-defined code for processing return values.

4.4.3.28

GetText example

{
char* pszValue = NULL;
char szValue[13];
//Get the Text which is actually set
pszValue = GetText(lpszPictureName,"StaticText1");
if(pszValue != NULL)
{
//Copy the string
strncpy(szValue,pszValue,12);
}
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetText function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
1. Read out the text in the object StaticText1 and temporarily store it in pszValue.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2951

ANSI-C function descriptions


4.4 Examples
2. If a valid value has been returned, store the return value of the function in the local string
szValue. A maximum of 12 characters is stored.
3. Executing user-defined code for processing return values.

4.4.3.29

GetTop example

{
long lPos;
//Get the y-Position of the Object
lPos = GetTop(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetTop function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
1. Read out the current Y position of the object and temporarily store it in lPos.
2. Executing user-defined code for processing return values.

4.4.3.30

GetVisible example

{
BOOL bVisible;
//Get the visibility
bVisible = GetVisible(lpszPictureName,"GraphicObject1");
if(bVisible)
{
// User defined code if the
// object is visible
...
}
else
{
// User defined code if the
// object is not visible
...
}
}

2952

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

Parameters of the GetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
1. Read out whether the object is visible or not and temporarily store in bVisible.
2. Executing user-defined code, depending on the return value of the function.

4.4.3.31

GetWidth example

{
long lWidth;
//Get the width of the object
lWidth = GetWidth(lpszPictureName,"WinCCLogo");
//User defined code where the
//user can do something with the return value
...
}

Parameters of the GetWidth function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
1. Read out the current width of the object and temporarily store it in lWidth.
2. Executing user-defined code for processing return values.

4.4.4

Examples - H to S

4.4.4.1

InquireLanguage example

{
DWORD count;
DWORD* language;
int i;
//Count the installed languages
language = InquireLanguage(&count);

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2953

ANSI-C function descriptions


4.4 Examples

printf("##################### INQUIRE LANGUAGE ####################");


//Print out the count of languages
printf ( "\r\nCount Languages=%d\r\n", count );
//print out which languages are installed
for (i=1;i<=count; i++)
{
printf ("\r\n%d.language=%x", i,*language++);
}
}

1. Determine the languages configured for the runtime. In language the language IDs are
temporarily stored. In count the number of languages is temporarily stored.
2. The number of determined languages is output.
3. All determined language IDs are displayed.

4.4.4.2

ProgramExecute example

{
//start the program calc.exe
ProgramExecute("C:\\Winnt\\system32\\calc.exe");
}

As parameter the file is to be specified with its path.

4.4.4.3

ResetFilter example

{
BOOL ret;
MSG_FILTER_STRUCT Filter;
CMN_ERROR Error;
//delete the whole Filter struct
memset( &Filter, 0, sizeof( MSG_FILTER_STRUCT ) );
//set an empty filter struct
AXC_SetFilter("gs_alarm_00","Control1",&Filter,&Error);
}

1. Delete the filter structure.


2. Write empty values into the filter structure.

2954

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

4.4.4.4

RPTJobPreview example

{
//Start the print preview of the specified print job
RPTJobPreview("Documentation Text Library");
}

Parameters of the "RPTJobPreview" function:


"Documentation Text Library" is the name of the print job.

4.4.4.5

RPTJobPrint example

{
//Print the specified print job out
RPTJobPrint("@Text library (compact)");
}

Parameters of the RPTJobPrint function:


@Text library (compact) is the name of the print job.

4.4.4.6

SysMalloc example

char* main(...);
{
char* returnwert;
char text[17];
returnwert=SysMalloc(17);
strcpy(returnwert,&text[0];
return returnwert;
}

4.4.5

Examples - SetAlarmHigh to SetPropChar

4.4.5.1

SetAlarmHigh example

{
//Set the upper limit for the warning
SetAlarmHigh(lpszPictureName,"Bar1",3.0);
}

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2955

ANSI-C function descriptions


4.4 Examples

Parameters of the SetAlarmHigh funtion:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"3.0" is the value to which the upper alarm limit will be set.

4.4.5.2

SetBackColor example

{
//Set the back color blue
SetBackColor(lpszPictureName,"StaticText1",CO_BLUE);
}

Parameters of the SetBackColor function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"CO_BLUE" is the constant for the color "Blue".
Note
Instead of using the constant for the color value you may also specify the color by means of
a hexadecimal value.

4.4.5.3

SetBorderEndStyle example

{
SetBorderEndStyle(lpszPictureName,"Line", (2|393216));
}

Sets the left line end as filled arrow and the right one as filled circle. The left line end is stored
in the two lower bytes, the right line end in the two upper bytes. The parameters are transferred
by means of numeric values.

Example of setting the line ends with symbolic names

{
SetBorderEndStyle(lpszPictureName,"Line", (LE_FULL_ARROW|(LE_FULL_CIRCLE <<16));
}

2956

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

Sets the left line end as filled arrow and the right one as filled circle. The left line end is stored
in the two lower bytes, the right line end in the two upper bytes. To address the right line end
the symbolic designation "LE_FULL_CIRCLE" is moved by 2 bytes or 16 bit into the two upper
bytes.

4.4.5.4

SetBorderStyle example

{
//Change the Border style
SetBorderStyle(lpszPictureName,"Rectangle1",3);
}

Parameters of the SetBorderStyle function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"3" is the line style which is set for the object.

4.4.5.5

SetColorAlarmHigh example

{
//Set the Color for the alarm high limit to red
SetColorAlarmHigh(lpszPictureName,"Bar1",CO_RED);
}

Parameters of the SetColorAlarmHigh function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"CO_RED" is the constant for the color red.
Note
Instead of using the constant for the color value you may also specify the color by means of
a hexadecimal value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2957

ANSI-C function descriptions


4.4 Examples

4.4.5.6

Example - SetCursorMode

{
//Set the Cursor Mode to Alpha cursor
SetCursorMode(lpszPictureName,"GraphikObjekt1",FALSE);
}

Parameters of the SetCursorMode function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
"FALSE" signifies: Cursor mode "Alpha-Cursor" is set.

4.4.5.7

SetFilling example

{
//Set the dynamic filling true
SetFilling(lpszPictureName,"Rectangle1",TRUE);
}

Parameters of the SetFilling function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"TRUE" means: Activating dynamic filling.

4.4.5.8

SetFillingIndex example

{
//Set the Filling of Rectangle1 to 10
SetFillingIndex(lpszPictureName,"Rectangle1",10);
}

Parameters of the SetFillingIndex function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"10" is the fill level which is assigned to the object.

2958

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

4.4.5.9

SetFillStyle example

{
//Change the fill style
SetFillStyle(lpszPictureName,"Rectangle1",196617);
}

Parameters of the SetFillStyle function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Rectangle1" is the name of the object.
"196617" is the fill pattern (brick wall) which is set for the object.

4.4.5.10

SetFlashBackColor example

{
//Set the flashing to True
SetFlashBackColor(lpszPictureName,"Group1",TRUE);
}

Parameters of the SetFlashBackColor function


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.
"TRUE" means: Activating flashing of the background color.

4.4.5.11

SetFlashBackColorOn example

{
//Set the Flash color for the state on to red
SetBackFlashColorOn(lpszPictureName,"Group1",CO_RED);
}

Parameters of the SetBackFlashColorOn function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Group1" is the name of the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2959

ANSI-C function descriptions


4.4 Examples
"CO_Red" is the constant for the color "Red".
Note
Instead of using the constant for the color value you may also specify the color by means of
a hexadecimal value.

4.4.5.12

SetFlashRateFlashPic example

{
//Set the flash rate to 0
SetFlashRateFlashPic(lpszPictureName,"Statusdisplay1",0);
}

Parameters of the SetFlashRateFlashPic function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Status display1" is the name of the object.
"0" is the flash frequency of the object.

4.4.5.13

SetFocus example

{
//Set the Focus on the Object Button 1
Set_Focus(lpszPictureName,"Button1");
}

Parameters of the Set_Focus function


"lpszPictureName" is the name of the picture in which the object was configured.
"Button1" is the name of the object on which the focus is set.

4.4.5.14

SetFontBold example

{
//Set the displayed Text bold
SetFontBold(lpszPictureName,"StatischerText1",TRUE);
}

Parameters of the SetFontBold function:

2960

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"TRUE" means: The text is written in bold face.

4.4.5.15

SetFontSize example

{
//Set Font Size to 12
SetFontSize(lpszPictureName,"StaticText1",12);
}

Parameters of the SetFontSize function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"12" is the font size to which the text is set.

4.4.5.16

SetHeight example

{
//Set the height of the object to 100
SetHeight(lpszPictureName,"WinCCLogo",100);
}

Parameters of the SetHeight function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"100" is the height to which the object is set.

4.4.5.17

SetHiddenInput example

{
//Set the hidden input true
SetHiddenInput(lpszPictureName,"IOField1",TRUE);
}

Parameters of the SetHiddenInput function:


WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2961

ANSI-C function descriptions


4.4 Examples
"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"TRUE" means: Activating the hidden input.

4.4.5.18

SetLanguage example

{
//German
SetLanguage(0x0407);
}

The Runtime language is set to German.

4.4.5.19

SetLeft example

{
//Set the x-position to 0
SetLeft(lpszPictureName,"WinCCLogo",0);
}

Parameters of the SetLeft function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"0" is the X position to which the object is set.

4.4.5.20

SetLink example

{
LINKINFO linkinfo;
//Set the link type
linkinfo.LinkType = 1;
//Set the update cycle
linkinfo.dwCycle = 0;
//set the Structmember
strcpy(linkinfo.szLinkName, "U08i_link_00");

2962

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

//Set the connection to the tag


SetLink(lpszPictureName,"Bar1","Process",&linkinfo);
}

Parameters of the SetLink function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"Process" is the property connected to a tag.
"&linkinfo" is the address of the linkinfo structure.
1. Set the connection type for the process property to direct connection.
2. Set the update cycle to "Upon change".
3. Set the tag name to U08i_link_00.

4.4.5.21

SetMarker example

{
//Set the marker visible
SetMarker(lpszPictureName,"Bar1",TRUE);
}

Parameters of the SetMarker function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"TRUE" means: The marker is displayed.

4.4.5.22

SetOutputValueDouble example

{
//Set the output value of the IO field to 55.5
SetOutputValueDouble(lpszPictureName,"IOField1",55.5);
}

Parameters of the SetOutputValueDouble function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2963

ANSI-C function descriptions


4.4 Examples
"55.5" is the value which is output.

4.4.5.23

SetPictureDown example

{
//Set the picture name to activated.bmp
SetPictureDown(lpszPictureName,"Roundbutton1","activated.bmp");
}

Parameters of the SetPictureDown function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.
"activated.bmp" is the picture name of the picture to be displayed in round button 1.

4.4.5.24

SetPictureName example

{
//Set the picture name cool_man.bmp
SetPictureName(lpszPictureName,"GraphicObject1","cool_man.bmp");
}

Parameters of the SetPictureName function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
"cool_man.bmp" is the picture name of the picture to be displayed in graphic object 1.

4.4.5.25

SetPictureUp example

{
//Set the picture name to deactivated.bmp
SetPictureUp(lpszPictureName,"Roundbutton1","deactivated.bmp");
}

Parameters of the SetPictureUp function:


"lpszPictureName" is the name of the picture in which the object was configured.
"RoundButton1" is the name of the object.

2964

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
"deactivated.bmp" is the picture name of the picture to be displayed in round button 1.

4.4.5.26

SetPosition example

{
//Set the Slider Position to 30
SetPosition(lpszPictureName,"Control1",30);
}

Parameters of the SetPosition function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
"30" is the position to which the slider is to be set.

4.4.5.27

SetPropBOOL example

{
//Set the visibility TRUE
SetPropBOOL("lpszPictureName","EAFeld1","Visible",TRUE);
}

Parameters of the SetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"TRUE" means: The object is intended to be visible.

4.4.5.28

SetPropChar example

{
//Set the property Tooltiptext
SetPropChar("gs_graph_eafield","IOField1","ToolTipText","Tooltiptext1 ");
}

Parameters of the SetPropChar function:


"lpszPictureName" is the name of the picture in which the object was configured.
"IOField1" is the name of the object.
"Tooltiptext" is the object property.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2965

ANSI-C function descriptions


4.4 Examples
"Tooltiptext 1" is the value to which the property is to be set.

4.4.6

Examples - SetRangeMax to SetWidth

4.4.6.1

SetRangeMax example

{
//Set the Upper Scale Limit
SetRangeMax(lpszPictureName,"Control1",80);
}

Parameters of the SetRangeMax function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
"80" is the upper limit to be assigned to the object.

4.4.6.2

SetRangeMin example

{
//Set the lower Scale Limit
SetRangeMin(lpszPictureName,"Control1",0);
}

Parameters of the SetRangeMin function:


"lpszPictureName" is the name of the picture in which the object was configured.
"Control1" is the name of the object.
"0" is the lower limit to be assigned to the object.

4.4.6.3

SetScaling example

{
//Set the Scaling Visible
SetScaling(lpszPictureName,"Bar1",TRUE);
}

2966

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples
Parameters of the SetScaling function:
"lpszPictureName" is the name of the picture in which the object was configured.
"Bar1" is the name of the object.
"TRUE" means: Making the scaling visible.

4.4.6.4

SetTagBit example

{
//Set the tag to true
SetTagBit("gs_tag_bit",TRUE);
}

Parameters of the SetTagBit function:


"gs_tag_bit" is the name of the tag.
"TRUE" is the value to be written to the tag.

4.4.6.5

Beispiel SetTagBitStateWait

{
DWORD dwstate;
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the value of the tag to TRUE
//dwstate is the tag state
SetTagBitStateWait("gs_tag_bit",TRUE,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagBitStateWait function:


"gs_tag_bit" is the name of the tag.
"TRUE" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2967

ANSI-C function descriptions


4.4 Examples

4.4.6.6

SetTagChar example

{
//Set the tag to Example text
SetTagChar("gs_tag_char","Example Text");
}

Parameters of the SetTagChar function:


"gs_tag_char" is the name of the tag.
"Example text" is the value to be written to the tag.

4.4.6.7

SetTagCharStateWait example

{
DWORD dwstate;
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to Example Text
//dwstate is the tag state
SetTagCharStateWait("gs_tag_char","Example Text",&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagCharStateWait function:


"gs_tag_char" is the name of the tag.
"Example text" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

4.4.6.8

SetTagFloat example

{
//Set the tag to 55.4711

2968

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

SetTagFloat("gs_tag_float",55.4711);
}

Parameters of the SetTagFloat function:


"gs_tag_float" is the name of the tag.
"55.4711" is the value to be written to the tag.

4.4.6.9

SetTagFloatStateWait example

{
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to 55.4711
//dwstate is the tag state
SetTagFloatStateWait("gs_tag_float",55.4711,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagFloatStateWait function:


"gs_tag_float" is the name of the tag.
"55.4711" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

4.4.6.10

SetTagMultiStateWait example

{
#define DATA_SIZE 5
DWORD dwData[DATA_SIZE];
//define all tags
BOOL lValue1;

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2969

ANSI-C function descriptions


4.4 Examples

long lValue2 ;
char szValue3[_MAX_PATH];
float lValue4;
char lValue5;
// Fill the tags with the values
// you want to set into the WinCC tags
...
//Set the WinCC tags
SetTagMultiStateWait(dwData,"%d%d%s%f%d","gs_tag_bit",lValue1,
"gs_tag_SByte",lValue2,
"gs_tag_char",szValue3,
"gs_tag_float",lValue4,
"gs_tag_word",lValue5);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagMultiStateWait function:


"dwData" is the DWord-Array, in which the tag statuses are stored.
"%d%d%s%f%d" are the type descriptions of the tags to be written.
"gs_tag_bit" is the WinCC tag to be written.
"lValue1" is the tag to whose value the WinCC tag gs_tag_bit is to be set.
"gs_tag_SByte" is the WinCC tag to be written.
"&lValue2" is the tag to whose value the WinCC tag gs_tag_SByte is to be set.
The other parameters are to be handled in the same way as those described previously.
1. Creating a DWord-Array with the required size (Number of tags).
2. Creating tags whose values are to be written to the WinCC tags.
3. Writing the values of the previously created and filled tags to the WinCC tags.l
4. Executing user-defined code for processing return values.

4.4.6.11

SetTagMultiWait example

BOOL ok;
ok=SetTagMultiWait("%d%s%f", "Ernie_word", 16,
"Ernie_char", "Hello World",
"Ernie_double", 55.4711);

2970

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

4.4.6.12

SetTagPrefix example

{
//Set the TagPrefix to Struct1.
SetTagPrefix(lpszPictureName,"PicWindow1","Struct1.");
//Set the picture name again to update the tag prefix
SetPictureName(lpszPictureName,"PicWindow1","gs_graph_eafield");
}

Parameters of the SetTagPrefix function:


"lpszPictureName" is the name of the picture in which the object was configured.
"PictureWindow1" is the name of the object.
"Struct1." is the tag prefix to be set at picture window 1.
1. Set the tag prefix of the object "PictureWindow1" to "Struct1.".
2. Reset the name of the picture shown in the picture window to make the tag prefix setting
effective.

4.4.6.13

SetTagRaw example

{
#define DATA_SIZE 3
BYTE byData[DATA_SIZE];
// Fill the Byte array with the values
// you want to set into the raw data tag
...
//Set the tag to the default values
SetTagRaw("gs_tag_raw",byData,DATA_SIZE);
}

Parameters of the SetTagRaw function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array whose values are written to the raw data tags.
"DATA_SIZE" is the number of values that will be written.
1. Creating a BYTE-Array with the required size (size of the raw data tag).
2. Filling the BYTE-Array with the values to be written.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2971

ANSI-C function descriptions


4.4 Examples
3. Writing the values of the BYTE-Array to the raw data tag.

4.4.6.14

SetTagRawStateWait example

{
#define DATA_SIZE 3
BYTE byData[DATA_SIZE];
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
// Fill the Byte array with the values
// you want to set into the raw data tag
...
//Set the tag to the default values
//dwstate is the tag state
SetTagRawStateWait("gs_tag_raw",byData,DATA_SIZE,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagRawStateWait function:


"gs_tag_raw" is the name of the tag.
"byData" is the byte array whose values are written to the raw data tags.
"DATA_SIZE" is the number of values that will be written.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Creating a BYTE-Array with the required size (size of the raw data tag).
2. Filling the BYTE-Array with the values to be written.
3. Writing the values of the BYTE-Array to the raw data tag.
4. Executing user-defined code for processing return values.

4.4.6.15

SetTagSByte example

{
//Set the tag to 50
SetTagSByte("gs_tag_SByte",50);

2972

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

Parameters of the SetTagSByte function:


"gs_tag_SByte" is the name of the tag.
"50" is the value to be written to the tag.

4.4.6.16

Beispiel SetTagSByteStateWait

{
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to 50
//dwstate is the tag state
SetTagSByteStateWait("gs_tag_SByte",50,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagSByteStateWait:


"gs_tag_SByte" is the name of the tag.
"50" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

4.4.6.17

SetTagWord example

{
//Set the tag to 50
SetTagWord("gs_tag_word",50);
}

Parameters of the SetTagWord function:


WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

2973

ANSI-C function descriptions


4.4 Examples
"gs_tag_word" is the name of the tag.
"50" is the value to be written to the tag.

4.4.6.18

Beispiel SetTagWordStateWait

{
DWORD dwstate;
char szValue[9];
//Load dwState with default values
dwstate = 0xFFFFFFFF;
//Set the tag to 50
//dwstate is the tag state
SetTagWordStateWait("gs_tag_word",50,&dwstate);
//User defined code where the
//user can do something with the return value
...
}

Parameters of the SetTagWordStateWait funtion:


"gs_tag_word" is the name of the tag.
"50" is the value to be written to the tag.
"&dwstate" is the address of the tags in which the tag status is to be stored.
1. Setting the tags to the specified value.
2. Executing user-defined code for processing return values.

4.4.6.19

SetText example

{
//Set the text Example Text on the StaticText field
SetText(lpszPictureName,"StaticText1","Example Text");
}

Parameters of the SetText function:


"lpszPictureName" is the name of the picture in which the object was configured.
"StaticText1" is the name of the object.
"ExampleText" is the text which is to be output.

2974

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

4.4.6.20

SetTop example

{
//Set the y-position to 0
SetTop(lpszPictureName,"WinCCLogo",140);
}

Parameters of the SetTop function:


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"140" is the Y position to which the object is set.

4.4.6.21

SetVisible example

{
//Set the Object visible
SetVisible(lpszPictureName,"GraphicObject1",TRUE);
}

Parameters of the SetVisible function:


"lpszPictureName" is the name of the picture in which the object was configured.
"GraphicObject1" is the name of the object.
"TRUE" means: The object is intended to be visible.

4.4.6.22

SetWidth example

{
//Set the width of the object to 400
SetWidth(lpszPictureName,"WinCCLogo",400);
}

Parameters of the SetWidth function


"lpszPictureName" is the name of the picture in which the object was configured.
"WinCCLogo" is the name of the object.
"400" is the width to which the object is set.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2975

ANSI-C function descriptions


4.4 Examples

4.4.7

Examples - T to Z

4.4.7.1

TlgGetNumberOfColumns example

{
char text[5];
long int columns
//get number of Columns
columns = GetNumberOfColumns("TableControl_01");
//convert long int to char
sprintf(text,"%d",columns);
//set text on TextField5
SetText(lpszPictureName,"StaticText5",text);
}

Parameters of the TlgGetNumberOfColumns function:


"TableControl_01" is the name of the WinCC Table Control.
1. Temporarily store the return value of the TlgGetNumberofColumns in columns.
2. Temporarily store the return value in the text string.
3. Output the return value to a static text field.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.4.7.2

TlgGetNumberOfColumns example

{
char text[5];
long int columns
//get number of Columns
columns = GetNumberOfColumns("TableControl_01");

2976

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

//convert long int to char


sprintf(text,"%d",columns);
//set text on TextField5
SetText(lpszPictureName,"StaticText5",text);
}

Parameters of the TlgGetNumberOfColumns function:


"TableControl_01" is the name of the WinCC Table Control.
1. Temporarily store the return value of the TlgGetNumberofColumns in columns.
2. Temporarily store the return value in the text string.
3. Output the return value to a static text field.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.4.7.3

TlgGetNumberOfRows example

{
char text[5];
long int rows;
//get number of rows
rows = TlgGetNumberOfRows("TableControl_01");
//convert long int to char
sprintf(text,"%d",rows);
//set text on TextField5
SetText(lpszPictureName,"StaticText5",text);
}

Parameters of the TlgGetNumberOfRows function:


TableControl_01 is the name of the WinCC Table Control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2977

ANSI-C function descriptions


4.4 Examples

1. Temporarily store the return value of the TlgGetNumberofRows in rows.


2. Temporarily store the return value in the text string.
3. Output the return value to a static text field.

4.4.7.4

TlgGetRulerTimeTrend example

{
SYSTEMTIME systime;
WORD wHour;
WORD wMin;
WORD wSec;
char szTime[10];
//Get the current systemtime
systime = TlgGetRulerTimeTrend("TrendControl_01",0);
//Get the hour
wHour = systime.wHour;
//Get the minute
wMin = systime.wMinute;
//Get the second
wSec = systime.wSecond;
//
sprintf(szTime,"%d:%d:%d",wHour,wMin,wSec);
//output the variable name
SetText(lpszPictureName,"StaticText7",szTime);
}

1. Read out the current system time.


2. Read out hour, minute and second from the SYSTEMTIME structure.
3. Create a string containing the time.
4. Output the current time.

4.4.7.5

TlgGetRulerVariableNameTrend example

{
char* pszVarName = NULL;
char szVarName[20];

2978

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

//Get the ruler variable name


pszVarName = TlgGetRulerVariableNameTrend("TrendControl_01",0);
if (pszVarName != NULL)
{
//Copy the string
strncpy(szVarName,pszVarName,19);
}
//output the variable name
SetText(lpszPictureName,"StaticText6",szVarName);
}

Parameters of the TlgGetRulerVariableNameTrend function:


"TrendControl_01" is the name of the WinCC Trend Control.
"0" is the number of the trend.
1. Temporarily store the return value of the TlgGetRulerVariableNameTrend function in
pszVarName.
2. If a valid value has been returned, copy the return value to szVarName.
3. Output the return value to a static text field.
Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.4.7.6

TlgTrendWindowPressOpenDlgButton example

{
//Opens the Property Dialog
TlgTrendWindowPressOpenDlgButton("TrendControl_01");
}

Parameters of the TlgTrendWindowPressOpenDlgButton function:


"TrendControl_01" is the window title of WinCC Trend Control.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2979

ANSI-C function descriptions


4.4 Examples

4.4.7.7

TlgTrendWindowPressStartStopButton example

{
//start/stop the actualization
TlgTrendWindowPressStartStopButton("TrendControl_01");
}

Parameters of the TlgTrendWindowPressStartStopButton function:


"TrendControl_01" is the window title of WinCC Trend Control.

Note
Various examples are offered for the function descriptions. For functions with a similar syntax,
a selected function is used as a template in the example. This example must be adapted as
well.

4.4.7.8

TlgTrendWindowPressZoomInButton example

{
//zoom in
TlgTrendWindowPressZoomInButton("TrendControl_01");
}

Parameters of the TlgTrendWindowPressZoomInButton function:


"TrendControl_01" is the window title of WinCC Trend Control.

4.4.7.9

TlgTrendWindowPressZoomOutButton example

{
// zoom out
TlgTrendWindowPressZoomOutButton("TrendControl_01");
}

Parameters of the TlgTrendWindowPressZoomOutButton function:


"TrendControl_01" is the window title of WinCC Trend Control.

2980

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

4.4.8

Examples of WinCC controls

4.4.8.1

How to add elements to a WinCC OnlineTrendControl

Introduction
In the following example, insert value columns with properties in an empty WinCC
OnlineTableControl and link the columns to archive tags.

Prerequisite
An archive is created in the "Tag Logging Editor" with three archive tags.
A "WinCC OnlineTableControl" with the name "Control2" is inserted in the process picture
in the Graphics Designer.
A button is inserted in the Graphics Designer. You have configured, for example, the event
"mouse click" with a C action and the following script for the button.

Example

//enable BackColor
SetPropBOOL(lpszPictureName, "Control2", "UseColumnBackColor",TRUE);
//add new TimeColumn and assign column length
SetPropChar(lpszPictureName, "Control2", "TimeColumnAdd", "myRefTimeColumn");
SetPropWord(lpszPictureName, "Control2", "TimeColumnLength", 20);
//add new ValueColumn and assign properties
SetPropChar(lpszPictureName, "Control2", "ValueColumnAdd", "myValueTable1");
SetPropWord(lpszPictureName, "Control2", "ValueColumnProvider", 1);
SetPropChar(lpszPictureName, "Control2", "ValueColumnTagName", "Process value archive\
\PDL_ZT_1");
SetPropWord(lpszPictureName, "Control2", "ValueColumnBackColor", RGB(255,255,255));
SetPropChar(lpszPictureName, "Control2", "ValueColumnTimeColumn", "myRefTimeColumn");
//add new ValueColumn and assign properties
SetPropChar(lpszPictureName, "Control2", "ValueColumnAdd", "myValueTable2");
SetPropWord(lpszPictureName, "Control2", "ValueColumnProvider", 1);
SetPropChar(lpszPictureName, "Control2", "ValueColumnTagName", "Process value archive\
\PDL_ZT_2");
SetPropWord(lpszPictureName, "Control2", "ValueColumnBackColor", RGB(0,255,255));
SetPropChar(lpszPictureName, "Control2", "ValueColumnTimeColumn", "myRefTimeColumn");
//add new ValueColumn and assign properties
SetPropChar(lpszPictureName, "Control2", "ValueColumnAdd", "myValueTable3");
SetPropWord(lpszPictureName, "Control2", "ValueColumnProvider", 1);
SetPropChar(lpszPictureName, "Control2", "ValueColumnTagName", "Process value archive\
\PDL_ZT_3");
SetPropWord(lpszPictureName, "Control2", "ValueColumnBackColor", RGB(255,255,0));

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2981

ANSI-C function descriptions


4.4 Examples

SetPropChar(lpszPictureName, "Control2", "ValueColumnTimeColumn", "myRefTimeColumn");

Result

4.4.8.2

How to add elements to a WinCC OnlineTrendControl

Introduction
In the following example you insert the Trend Window, Value Axis, Time Axis and Trends
elements into an empty WinCC OnlineTrendControl.

Prerequisite
An archive is created in the "Tag Logging Editor" with three archive tags.
A "WinCC OnlineTrendControl" with the name "Control2" is inserted in the process picture
in the Graphics Designer.
A button is inserted in the Graphics Designer. You have configured, for example, the event
"mouse click" with a C action and the following script for the button.

Example

//create reference to new window, time and value axis


SetPropChar(lpszPictureName, "Control2", "TrendWindowAdd", "myWindow");
SetPropChar(lpszPictureName, "Control2", "TimeAxisAdd", "myTimeAxis");
SetPropChar(lpszPictureName, "Control2", "ValueAxisAdd", "myValueAxis");
//assign time and value axis to the window
SetPropChar(lpszPictureName, "Control2", "TimeAxisTrendWindow", "myWindow");

2982

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.4 Examples

SetPropChar(lpszPictureName, "Control2", "ValueAxisTrendWindow", "myWindow");


//add new trend and assign properties
SetPropChar(lpszPictureName, "Control2",
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
\PDL_ZT_1");
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
//add new trend and assign properties
SetPropChar(lpszPictureName, "Control2",
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
\PDL_ZT_2");
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
//add new trend and assign properties
SetPropChar(lpszPictureName, "Control2",
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
\PDL_ZT_3");
SetPropWord(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",
SetPropChar(lpszPictureName, "Control2",

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

"TrendAdd", "myTrend1");
"TrendProvider", 1);
"TrendTagName", "Process value archive\
"TrendColor", RGB(255,0,0));
"TrendTrendWindow", "myWindow");
"TrendTimeAxis", "myTimeAxis");
"TrendValueAxis", "myValueAxis");

"TrendAdd", "myTrend2");
"TrendProvider", 1);
"TrendTagName", "Process value archive\
"TrendColor", RGB(0,255,0));
"TrendTrendWindow", "myWindow");
"TrendTimeAxis", "myTimeAxis");
"TrendValueAxis", "myValueAxis");

"TrendAdd", "myTrend3");
"TrendProvider", 1);
"TrendTagName", "Process value archive\
"TrendColor", RGB(0,0,255));
"TrendTrendWindow", "myWindow");
"TrendTimeAxis", "myTimeAxis");
"TrendValueAxis", "myValueAxis");

2983

ANSI-C function descriptions


4.5 Lists

4.5

Lists

4.5.1

Bar direction

Bar direction Numeric value

4.5.2

Up

bottom

left

right

Bar Scaling

Numeric
value

Bar Scaling

Linear (same weighting)

Logarithmic (low values emphasized)

Negative logarithmic (high values emphasized)

Automatic (linear)

Tangential (high and low values emphasized)

Square (high values emphasized)

Cubic (high values strongly emphasized)

4.5.3

2984

Flash frequencies

Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.5 Lists

Note
Since the flashing is performed by means of software engineering, the flash frequency is both
system-dependent and hardware-bound (number of objects, processor speed, RAM size,
update time etc.).
The information in the table is therefore only for orientation purposes.

4.5.4

I/O field, output format


The display of numeric values output into an I/O field is controlled by a format specification.
A format indication consists of one or several formatting characters. The valid formatting
characters and their meaning are listed in the following table:
Charact Meaning
ers

Note

Positive numbers are displayed


with signs

Always in the first position of the format specification


May only appear once in the format specification

0(ZER
O)

Leading and ending zeros are


output.

Always following s
If s is missing, it is in the first position
May only appear once in the format specification

Specifies the position of a digit in


the number to be output

May appear in the format indication as often as required.

,
(comm
a)

Position of the decimal point

Returns the number in exponential


form

Always at the last position of the format specification

Example:
Numb Format
er

Representation

123,4
55

999,999

123,455

123,4
55

999,99

123,46

123,4
55

9999,9999 123,4550

123,4
55

s09999.99 +0123,4550
99

123,4
55

9.99999e

1.23455e+002

If the decimal point is left out in the format specification the decimal places are not displayed
and the number is rounded to an integer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2985

ANSI-C function descriptions


4.5 Lists
If fewer decimal positions are provided in the format specification than the number actually
has, only the decimal places specified in the format specification are output.
The number is rounded correspondingly.
If the number has more places before the decimal point than specified in the format
specification, three asterisks (***) are output which means that the number cannot be displayed
in this format.

4.5.5

4.5.6

4.5.7

I/O field, data type of the field content

Data type

Numeric value

Binary

decimal

string

hexadeci
mal

I/O field, field type

Type

Numeric value

Edition

Input

Output and
input

Element alignment in check boxes and radio boxes

Alignment Numeric value

2986

left

right

-1

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.5 Lists

4.5.8

Color chart
The 16 primary colors are:
Color

Color value
(Hex)

symbolic constant

Red

0x000000F
F

CO_RED

Dark red

0x00000080 CO_DKRED

Green

0x0000FF0
0

Dark green

0x00008000 CO_DKGREEN

Blue

0x00FF000
0

Dark blue

0x00800000 CO_DKBLUE

Cyan

0x00FFFF0
0

Dark cyan

0x00808000 CO_DKCYAN

Yellow

0x0000FFF
F

Dark yellow

0x00008080 CO_DKYELLOW

Magenta

0x00FF00F
F

CO_GREEN

CO_BLUE

CO_CYAN

CO_YELLOW

CO_MAGENTA

Dark magenta

0x00800080 CO_DKMAGENTA

Light gray

0x00C0C0C CO_LTGRAY
0

Gray

0x00808080 CO_DKGRAY

Black

0x00000000 CO_BLACK

White

0x00FFFFF
F

CO_WHITE

Note
The symbolic constants are externally predefined by #define and provied by WinCC.

4.5.9

Format descriptors
For format descriptors the following type is expected:
%d = DWORD / Int
%f = double
%s = char*
It is also possible e.g. to read a text tag with %d if provisions are made that the value can be
mapped in a DWORD.
The following provision makes sure the value can be mapped:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2987

ANSI-C function descriptions


4.5 Lists
Variab Form
le
at

C-tag

Bit

DWORD / long int signed

%d

Byte

%d

DWORD / long int signed

SByte

%d

DWORD / long int signed

Word

%d

DWORD / long int signed

SWor
d

%d

DWORD / long int signed

DWor
d

%d

DWORD / long int signed

SDWo %d
rd

DWORD / long int signed

Float

%f

double

Doubl
e

%f

double

Char

%s

char*

Note
If a "DWORD," for which the 32nd bit is set, is to be read, a format descriptor must be used
for unsigned integers (%u).

4.5.10

Fill pattern
Fill pattern

Value

Transparent

65536

Solid

Fill pattern

2988

Value

Fill pattern

Value

Fill pattern

Value

1048576

196611

196627

1048577

196612

196628

1048578

196613

196629

1048579

196614

196630

1048832

196615

196631

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.5 Lists
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

1048833

196616

196632

1048834

196617

196633

1048835

196618

196634

131072

196619

196635

131073

196620

196636

131074

196621

196637

131075

196622

196638

131076

196623

196639

196608

196624

196640

196609

196625

196641

196610

196626

196642

Note
The "Solid" fill pattern fills the object with the set background color.

4.5.11

Line styles

Line style

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

symbolic name

Value

LS_SOLID

LS_DASH

LS_DOT

LS_DASHDOT

2989

ANSI-C function descriptions


4.5 Lists
Line style

hidden

4.5.12

symbolic name

Value

LS_DASHDOT
DOT

LS_INVISIBLE

Line end style

Line end

symbolic name

Value for the left line ends

Value for the right line ends

LE_NO

LE_HOLLOW_ARROW

65536

LE_FULL_ARROW

131072

LE_CFULL_ARROW

196608

LE_LINE

262144

LE_HOLLOW_CIRCLE

327680

LE_FULL_CIRCLE

393216

Note
From a line width > 5 the line end "empty circle" is displayed as filled circle.

4.5.13

List types

List type

Numeric value

decimal

Binary

bit

2990

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.5 Lists

4.5.14

Language ID
WinCC only supports the SUBLANG_DEFAULT languages of Windows.

symbolic name

Value
(hexadecimal)

LANG_ARABIC

0x0401

LANG_AFRIKAANS

0x0436

LANG_ALBANIAN

0x041C

Abbreviation

LANG_BASQUE

0x042D

LANG_BULGARIAN

0x0402

LANG_BYELORUSSIAN

0x0423

LANG_CATALAN

0x0403

LANG_CHINESE

0x0404

LANG_CROATIAN

0x041A

LANG_CZECH

0x0405

CSY

LANG_DANISH

0x0406

DAN

LANG_DUTCH

0x0413

NLD

LANG_ENGLISH

0x0409

ENU

LANG_ESTONIAN

0x0425

LANG_FAEROESE

0x0438

LANG_FARSI

0x0429

LANG_FINNISH

0x040B

FIN

LANG_FRENCH

0x040C

FRA

LANG_GERMAN

0x0407

DEU

LANG_GREEK

0x0408

LANG_HEBREW

0x040D

LANG_HUNGARIAN

0x040E

HUN

LANG_ICELANDIC

0x040F

ISL

LANG_INDONESIAN

0x0421

LANG_ITALIAN

0x0410

LANG_JAPANESE

0x0411

LANG_KOREAN

0x0412

ITA

LANG_LATVIAN

0x0426

LANG_LITHUANIAN

0x0427

LANG_NORWEGIAN

0x0414

NOR

LANG_POLISH

0x0415

PLK

LANG_PORTUGUESE

0x0416

PTB

LANG_ROMANIAN

0x0418

LANG_RUSSIAN

0x0419

RUS

LANG_SLOVAK

0x041B

SKY

LANG_SLOVENIAN

0x0424

LANG_SORBIAN

0x042E

LANG_SPANISH

0x040A

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ESP

2991

ANSI-C function descriptions


4.5 Lists
symbolic name

Value
(hexadecimal)

Abbreviation

LANG_SWEDISH

0x041D

SVE

LANG_THAI

0x041E

LANG_TURKISH

0x041F

LANG_UKRAINIAN

0x0422

4.5.15

TRK

Text alignment

Horizon
tal

Alignmen Numeric value


t
left

centered

right

Vertica Alignmen Numeric value


l
t

4.5.16

2992

Up

centered

bottom

Tag statuses

Value
(decimal)

Value
(hexdecimal)

Meaning

0x0000

No error

0x0001

Connection to partner not established

0x0002

Handshake error

0x0004

Network module defective

0x0008

Configured upper limit exceeded

16

0x0010

Configured lower limit exceeded

32

0x0020

Format upper limit exceeded

64

0x0040

Format lower limit exceeded

128

0x0080

Conversion error

256

0x0100

Tag initialization value

512

0x0200

Tag replacement value

1024

0x0400

Channel addressing error

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.5 Lists
Value
(decimal)

Value
(hexdecimal)

Meaning

2048

0x0800

Tag not found or not available

4096

0x1000

Access to tag not permitted

8192

0x2000

Timeout, no check-back message from the channel

16384

0x4000

Server not available.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2993

ANSI-C function descriptions


4.6 Structure definitions

4.6

Structure definitions

4.6.1

Structure definition CCAPErrorExecute

typedef struct {
DWORD dwCurrentThreadID;
DWORD dwErrorCode1;
DWORD dwErrorCode2;
BOOL bCycle;
char* szApplicationName;
char* szFunctionName;
char* szTagName;
LPVOID lpParam;
DWORD dwParamSize;
DWORD dwCycle;
CMN_ERROR* pError;
} CCAPErrorExecute;

Thread ID of the current thread


Error code 1
Error code 2
cycle/acycle
Name of the application
Name of the function
Name of the tag
Pointer to the action stack
Size of the action stack
Cycle of the variable
Pointer to CMN_ERROR

Members
The meaning of the individual error IDs and the structure elements depending on them are
specified in the following table:

1007001

Action requires exception

1007001

Exception when
accessing the return
result

1007001

4097

Stack overflow while


executing the action

1007001

4098

The action contains a


division by 0

1007001

4099

The action contains an


access to a non-existing
symbol

1007001

4100

The action contains an


access violation

1007004

2994

Function is not known

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.6 Structure definitions
1007005

Action does not include a


P code.

1007005

Incorrect function name

1007005

Return value type is


invalid

1007005

32768ff

Ciss Compiler error when


loading the action

1007006

1007006

1007006

Tag cannot be returned in


the desired format

1007006

Tag returns status


violation, status present
in
CMN_ERROR.dwError1

1007007

Error in PDLRTGetProp

1007007

Error in PDLRTSetProp

1007007

Error with DM call

Tag is not defined


Tag timeout

Error structure
The OnErrorExecute function uses the error structure to evaluate or to output error messages,
if marked by an "x" in the pError column.

See also
Structure definition CMN_ERROR (Page 2293)

4.6.2

Structure definition CCAPTime

typedef struct {
DWORD dwCurrentThreadID;
DWORD dwCode;
BOOL bCycle;
char* szApplicationName;
char* szFunctionName;
LPVOID lpParam;
DWORD dwParamSize;
double dblTime;
DWORD dwFlags;
} CCAPTime;

ThreadID of the current Thread


Code
cycle/acycle
Name of the Application
Name of the Function
Pointer to the Action-Stack
size of the Action-Stack
flags

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2995

ANSI-C function descriptions


4.6 Structure definitions

Members
dwCode
The structure element dwCode provides information on calling OnTime:
dwCode = 113

Call with time definition for each action

dwCode = 114

Call with time monitoring for each action

dwFlags
The structure element dwFlags provides information on the output type:
dwFlags = TRUE

The results are output to a file

dwFlags = FALSE

The results are output to the diagnostics window

4.6.3

Structure definition CMN_ERROR

struct CMNERRORSTRUCT {
DWORD
dwError1,
DWORD
dwError2,
DWORD
dwError3,
DWORD
dwError4,
DWORD
dwError5;
TCHAR
szErrorText[MAX_ERROR_LEN];
}
CMN_ERROR

Description
The extended error structure contains the error code and an error text for the error that has
occurred. Each application can use the error structure to evaluate or to output error messages.

Members
dwError1 .. dwError5
These entries can be used in any way by the API functions.
The API descriptions inform about the values the respective entries contain in case of an error.
If not specified otherwise, the error codes are present in dwError1.

2996

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.6 Structure definitions
szErrorText
Buffer for the text description of the error cause
The content is determined from the resources and therefore language-dependent.

4.6.4

Structure definition DM_TYPEREF

typedef struct {
DWORD dwType;
DWORD dwSize;
char szTypeName[MAX_DM_TYPE_NAME + 1];
}
DM_TYPEREF;

Members
dwType
Specifies the tag type
DM_VARTYPE_BIT

Binary tag

DM_VARTYPE_SBYTE

Signed 8-bit value

DM_VARTYPE_BYTE

Unsigned 8-bit value

DM_VARTYPE_SWORD

Signed 16-bit value

DM_VARTYPE_WORD

Unsigned 16-bit value

DM_VARTYPE_SDWORD

Signed 32-bit value

DM_VARTYPE_DWORD

Unsigned 32-bit value

DM_VARTYPE_FLOAT

Floating-point number 32-bit IEEE 754

DM_VARTYPE_DOUBLE

Floating-point number 64-bit IEEE 754

DM_VARTYPE_TEXT_8

Text tag, 8-bit font

DM_VARTYPE_TEXT_16

Text tag, 16-bit font

DM_VARTYPE_RAW

Raw data type

DM_VARTYPE_STRUCT

Structure tag

DM_VARTYPE_TEXTREF

Text reference tag

dwSize
Specifies the length of the data type in bytes.
szTypeName
In the case of structure tags, contains the name of the structure type

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2997

ANSI-C function descriptions


4.6 Structure definitions

4.6.5

Structure definition DM_VAR_UPDATE_STRUCT

typedef struct {
DM_TYPEREF dmTypeRef;
DM_VARKEY dmVarKey;
VARIANT dmValue;
DWORD dwState;
}
DM_VAR_UPDATE_STRUCT;

Members
dmTypeRef
Contains information on the tag type. For performance reasons, nothing is entered into this
structure in case of cyclic requirements.
dmVarKey
Specifies the tags to be edited.
dmValue
Tag value
Upon access to the value of the VARIANT a ".u." has to be inserted between the name of the
VARIANT and the name of the member.
Example:
// Supply variant
myVariant.vt = VT_I4;
myVariant.u.lVal = 233;
A description of the data type VARIANT can be found in the associated documentation. The
VARIANT dmValue must be initialized with VariantInit() before first use and enabled again with
VariantClear(&dmValue) after use. For this reason, the structure
DM_VAR_UPDATE_STRUCT must not be deleted with ZeroMemory() or memset().
dwState
Identifies the tag status.

See also
Tag statuses (Page 2289)
Structure definition DM_VARKEY (Page 2296)
Structure definition DM_TYPEREF (Page 2293)

2998

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.6 Structure definitions

4.6.6

Structure definition DM_VAR_UPDATE_STRUCTEX

typedef struct {
DM_TYPEREF dmTypeRef;
DM_VARKEY dmVarKey;
VARIANT dmValue;
DWORD dwState;
DWORD dwQualityCode;
}
DM_VAR_UPDATE_STRUCTEX;

Members
dmTypeRef
Contains information on the tag type. For performance reasons, nothing is entered into this
structure in case of cyclic requirements.
dmVarKey
Specifies the tags to be edited.
dmValue
Tag value
Upon access to the value of the VARIANT a ".u." has to be inserted between the name of the
VARIANT and the name of the member.
Example:
// Supply variant
myVariant.vt = VT_I4;
myVariant.u.lVal = 233;
A description of the data type VARIANT can be found in the associated documentation. The
VARIANT dmValue must be initialized with VariantInit() before first use and enabled again with
VariantClear(&dmValue) after use. For this reason, the structure
DM_VAR_UPDATE_STRUCTEX must not be deleted with ZeroMemory() or memset().
dwState
Identifies the tag status.
dwQualityCode
Identifies the tag quality code.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

2999

ANSI-C function descriptions


4.6 Structure definitions

See also
Tag statuses (Page 2289)
Structure definition DM_VARKEY (Page 2296)
Structure definition DM_TYPEREF (Page 2293)

4.6.7

Structure definition DM_VARKEY

typedef struct {
DWORD dwKeyType;
DWORD dwID;
char szName[ MAX_DM_VAR_NAME + 1 ];
LPVOID lpvUserData;
}
DM_VARKEY;

Members
dwKeyType
Defines whether the tag is to be addressed by a key ID or by its name.
DM_VARKEY_ID Specification via key ID
DM_VARKEY_NAME Specification via tag name
dwID
Contains the key ID of the tags if dwKeyType is set accordingly
szName
Contains the name of the tag if dwKeyType is set accordingly
lpvUserData
Pointer to application-specific data

4.6.8

Structure definition LINKINFO

typedef struct {
LINKTYPE LinkType;
DWORD dwCycle;
TCHAR szLinkName[256];
}
LINKINFO;

3000

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.6 Structure definitions

Members
LinkType
LinkType are enumeration constants defined in the "Trigger.h" file. They are to be integrated
into your script with the #include "Trigger.h" command and the corresponding enumeration
constants.
BUBRT_LT_NOLINK

no shortcut

BUBRT_LT_VARIABLE_DIRECT

direct tag

BUBRT_LT_VARIABLE_INDIRECT

indirect tag

BUBRT_LT_ACTION

C action

BUBRT_LT_ACTION_WIZARD

Dynamic Dialog

BUB_LT_DIRECT_CONNECTION

Direct connection

BUBRT_LT_ACTION_WIZARD_INPROC

Dynamic Dialog

For the function SetLink only the enumeration constants BUBRT_LT_VARIABLE_DIRECT and
BUBRT_LT_VARIABLE_INDIRECT may be used. The function GetLink allows to return all
listed enumeration constants.

dwCycle
Update cycle time
dwCycle

Update Cycle

255

Picture cycle

235

Window Cycle

Upon change

250ms

500 ms

1s

2s

5s

10s

1min

5min

10min

10

1h

11-15

User cycle 1-5

szLinkName
Tag name

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3001

ANSI-C function descriptions


4.6 Structure definitions

4.6.9

Structure definition MSG_FILTER_STRUCT

typedef struct {
CHAR
szFilterName[MSG_MAX_TEXTLEN+1];
WORD
dwFilter;
SYSTEMTIME st[2];
DWORD
dwMsgNr[2];
DWORD
dwMsgClass;
DWORD
dwMsgType[MSG_MAX_CLASS];
DWORD
dwMsgState;
WORD
wAGNr[2];
WORD
wAGSubNr[2];
DWORD
dwArchivMode;
char
szTB[MSG_MAX_TB][
MSG_MAX_TB_CONTENT+1]
DWORD
dwTB;
Double
dPValue[MSG_MAX_PVALUE][2];
DWORD
dwPValue[2];
DWORD
dwMsgCounter[2];
DWORD
dwQuickSelect;
}
MSG_FILTER_STRUCT;

Description
In this structure the filter criteria are specified.

Members
dwFilter
The filter conditions are defined by means of the following constants from the file "m_global.h":

3002

MSG_FILTER_DATE_FROM

Date from

MSG_FILTER_DATE_TO

Date to

MSG_FILTER_TIME_FROM

Time from

MSG_FILTER_TIME_TO

Time to

MSG_FILTER_NR_FROM

Message number from

MSG_FILTER_NR_TO

Message number to

MSG_FILTER_CLASS

Message classes

MSG_FILTER_STATE

Message status

MSG_FILTER_AG_FROM

AS number from

MSG_FILTER_AG_TO

AS number to

MSG_FILTER_AGSUB_FROM

AG subnumber from

MSG_FILTER_AGSUB_TO

AG subnumber to

MSG_FILTER_TEXT

Message texts

MSG_FILTER_PVALUE

Process values

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.6 Structure definitions

MSG_FILTER_COUNTER_FROM

Internal message counter from

MSG_FILTER_COUNTER_TO

Internal message counter to

MSG_FILTER_PROCESSMSG

Process messages

MSG_FILTER_SYSMSG

System messages

MSG_FILTER_BEDMSG

Operator messages

MSG_FILTER_DATE

Date from to

MSG_FILTER_TIME

Time from to

MSG_FILTER_NR

Message number from to

MSG_FILTER_VISIBLEONLY

Display visible messages

MSG_FILTER_HIDDENONLY

Display hidden messages

st
Date/time from - to
Where st[0] is the start time (from), st[1] the end time (to)
Assign these fields for the filter criteria: MSG_FILTER_DATE, MSG_FILTER_DATE_FROM,
MSG_FILTER_DATE_TO, MSG_FILTER_TIME, MSG_FILTER_TIME_FROM or
MSG_FILTER_TIME_TO
If a current time is needed for the transfer of a SYSTEMTIME parameter the function
GetLocalTime is to be used instead of GetSystemTime. As a rule there is a significant time
difference between these two functions.
dwMsgNr
Message number from - to
Where dwMsgNr[0] is the start no. (from), dwMsgNr[1] the end no. (to)
Assign these fields for the filter criteria: MSG_FILTER_NR, MSG_FILTER_NR_FROM or
MSG_FILTER_NR_TO
dwMsgClass
Message classes bit-coded.
Assign this field for the filter criterion: MSG_FILTER_CLASS
dwMsgType
Message type per message class, bit-coded
Assign this field for the filter criterion: MSG_FILTER_CLASS
dwMsgState
Message status bit-coded.
Assign this field for the filter criterion: MSG_FILTER_STATE
wAGNr
AGNr from - to

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3003

ANSI-C function descriptions


4.6 Structure definitions
Assign these fields for the filter criteria: MSG_FILTER_AG_FROM or MSG_FILTER_AG_TO
wAGSubNr
AGSubNr from - to
Assign this field for the filter criteria: MSG_FILTER_AGSUB_FROM or
MSG_FILTER_AGSUB_TO
dwArchivMode
Archiving / logging
Must be assigned 0.
szTB
Texts of the text blocks
Assign these fields for the filter criterion: MSG_FILTER_TEXT
dwTB
Active text blocks (from - to, bit-coded)
Assign this field for the filter criterion: MSG_FILTER_TEXT
dPValue
Process values from - to
Assign these fields for the filter criterion: MSG_FILTER_PVALUE
dwPValue
Active process values (from - to, bit-coded)
Assign this field for the filter criterion: MSG_FILTER_PVALUE
dwMsgCounter
Internal message counter from - to
Assign these fields for the filter criteria: MSG_FILTER_COUNTER_FROM,
MSG_FILTER_COUNTER_TO
dwQuickSelect
Quick selection for hour, day, month
The parameter is reserved for future upgrades and must be preset to 0.
Assign this field for the filter criterion: MSG_FILTER_QUICKSELECT
LOWORD type:
MSG_FILTER_QUICK_MONTH

Quick selection last n months

MSG_FILTER_QUICK_DAYS

Quick selection last n days

MSG_FILTER_QUICK_HOUR

Quick selection last n hours

HIWORD number: 1...n

3004

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

ANSI-C function descriptions


4.6 Structure definitions
The end time of the quick selection refers to the current system time of the local computer.
The start time is calucalted back n * ( months, days, hours ).

4.6.10

Structure definition MSG_RTDATA_STRUCT

typedef struct {
DWORD
DWORD
SYSTEMTIME
DWORD
DWORD
DWORD
WORD
WORD
double
MSG_TEXTVAL_STRUCT
}
MSG_RTDATA_STRUCT;

dwMsgState;
dwMsgNr;
stMsgTime;
dwTimeDiff;
dwCounter;
dwFlags;
wPValueUsed;
wTextValueUsed;
dPValue[MSG_MAX_PVALUE];
mtTextValue[MSG_MAX_PVALUE];

Members
dwMsgState
Message status
MSG_STATE_COME

0x00000001

Message came in

MSG_STATE_GO

0x00000002

Message went out

MSG_STATE_QUIT

0x00000003

Message acknowledged

MSG_STATE_LOCK

0x00000004

Message locked

MSG_STATE_UNLOCK

0x00000005

Message unlocked

MSG_STATE_QUIT_SYSTEM

0x00000010

Message acknowledged by system

MSG_STATE_QUIT_EMERGENCY

0x00000011

Emergency acknowledgement

MSG_STATE_QUIT_HORN

0x00000012

Horn acknowledgement

MSG_STATE_COMEGO

0x00000013

Message came in and went out, only display in message list

MSG_STATE_UPDATE

0x00010000

Bit for message update

MSG_STATE_RESET

0x00020000

Bit for message reset

MSG_STATE_SUMTIME

0x00040000

Bit active for daylight savings time

MSG_STATE_INSTANCE

0x00080000

Bit for instance message (n messages of a no.)

dwMsgNr
Message number
stMsgTime
Date/Time: Telegram time depending on the calling function

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3005

ANSI-C function descriptions


4.6 Structure definitions
dwTimeDiff
Duration coming/Telegram time in seconds
dwCounter
Internal message counter
dwFlags
Message flags in the database
MSG_FLAG_SUMTIME

0x00000001

Daylight savings time active

MSG_FLAG_COMMENT

0x00000002

Message has comments

MSG_FLAG_ARCHIV

0x00000004

Archiving

MSG_FLAG_PROTOCOL

0x00000008

Logging

MSG_FLAG_TEXTVALUES

0x00000010

Message has values accompanying the text

MSG_FLAG_TIMEINVALID

0x00000020

Bit for invalid date/time stamp

MSG_FLAG_INSTANCE

0x00000040

Instance message identification (185269)

wPValueUsed
Process values used, bit-coded. Every bit may only be set in one of the two structure elements
"wPValueUsed" or "wTextValueUsed". An accompanying value may either be a number or a
text.
wTextValueUsed
text values used, bit-coded. Every bit may only be set in one of the two structure elements
"wPValueUsed" or "wTextValueUsed". An accompanying value may either be a number or a
text.

3006

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.1

Automated configuration

Contents
You can use VBA to automate configuration in Graphics Designer. This comprises:
Adaptation of the Graphics Designer
Editing of pictures
Editing of objects
Dynamizing with VBA
Access to external applications
A VBA editor is available for this purpose in the "Graphics Designer" editor.
This chapter contains
a brief introduction on how to use VBA in WinCC,
basic information on using VBA in Graphics Designer and
reference to the VBA object model in Graphics Designer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3007

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC

5.2

Introduction: Using VBA in WinCC

5.2.1

Introduction: Using VBA in WinCC

Introduction
You have a VBA editor available in Graphics Designer which allows you to configure pictures
automatically. The VBA editor is identical to the one from the products in the Microsoft Office
family. You can make direct use of your VBA programming experience.

Principle
With VBA you extend the functionality of the Graphics Designer and automate configuring.
You may use VBA in Graphics Designer as follows, including:
Creating user-defined menus and toolbars
Creating and editing Standard, Smart and Windows objects
Adding dynamics to properties of pictures and objects
Configuring actions in pictures and objects
Accessing products that support VBA (e.g. products in the MS Office family)
A description of the VBA object model for the Graphics Designer is provided in this
documentation in the section under "VBA Reference".

See also
Organizing VBA Code in a WinCC Project (Page 3011)
VBA Reference (Page 3126)
VBA in the Graphics Designer (Page 3017)
Executing VBA Macros in Graphics Designer (Page 3015)
Differentiation: Using VBA (Page 3010)

5.2.2

Differentiation: Using VBA

Introduction
You can use VBA exclusively for configuration and functional enhancement in the Graphics
Designer. The following indicates where there are better options available for efficient
configuration or where VBA cannot be used.

3008

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC

VB and C Scripts
VB and C scripts are active only at runtime and are used to dynamize picture and object
properties as well as in action configuration.

Dynamic Wizards
The dynamic wizards are not replaced by VBA. However, VBA allows you to enhance the
functionality of the dynamic wizards with ease.

ODK
ODK comprises function calls that enable access to all the functionality of WinCC both in the
configuration system and in runtime. In contrast to ODK, VBA offers simple object-oriented
access to the objects of the Graphics Designer.

See also
VBA in the Graphics Designer (Page 3017)
Executing VBA Macros in Graphics Designer (Page 3015)
Organizing VBA Code in a WinCC Project (Page 3011)
Introduction: Using VBA in WinCC (Page 3008)

5.2.3

Organizing VBA Code in a WinCC Project

Introduction
You organize the VBA code for your WinCC project in the VBA editor. This is where you specify
whether the VBA code is to be available in only one picture, in the entire project or in all projects.
Depending on where you place the VBA code, the term used to refer to the code is:
global VBA code,
project-specific VBA code or
picture-specific VBA code.
Note
A picture in the Graphics Designer is known as a "document" in the VBA object model.

The VBA editor


To start the VBA editor in the Graphics Designer, press <ALT+F11> or choose "Tools" >
"Macros" > "Visual Basic Editor". If you have not yet opened a picture in the Graphics Designer,
you can only edit the global or project-specific VBA code.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3009

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC
The global and project-specific data and all open pictures are displayed in the VBA editor's
Project Explorer:

Global VBA code (1)


Refers to VBA code that you write to the "GlobalTemplateDocument" in the VBA editor. This
VBA code is saved in the "@GLOBAL.PDT" file, which is located in the WinCC installation
directory.
The VBA code that you put in the "GlobalTemplateDocument" is the code that you want to be
made available in all WinCC projects on your computer. If you need the VBA code on a different
computer, use the export and import functions in the VBA editor.
A WinCC computer uses only the @GLOBAL.PDT stored locally in the WinCC installation
directory (\Siemens\WinCC\Templates).
Note
When you perform an update installation, your global "@Global.pdt" template is saved in the
"@Global.sav" backup file. The backup file is saved in the \Siemens\WinCC\Templates
directory. Your VBA code from the old global template is not automatically applied to the new
global template.

3010

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC
Applying the VBA Code from the Old Global Template:
In order to apply the VBA code from the old template after an update installation, proceed as
follows:
1. If you have already entered VBA code into the new global template, open the VBA editor
in the Graphics Designer and copy the VBA code.
2. Close WinCC.
3. Open the \Siemens\WinCC\Templates directory in Windows Explorer.
4. Delete the new global template "@Global.pdt".
5. Rename the "@Global.sav" backup file to "@Global.pdt".
6. If you have already copied VBA code from the new global template, open the VBA editor
in the Graphics Designer and insert the copied VBA code.
The VBA code from your old global template is available again.
Project-specific VBA code (2)
Refers to VBA code that you write to the "ProjectTemplateDocument" in the VBA editor. This
VBA code is saved in the @"PROJECT.PDT" file, which is located in the root directory of each
WinCC project.
The "@PROJECT.PDT" file has a reference to the "@GLOBAL.PDT" file. Functions and
procedures which you have saved in the "@GLOBAL.PDT" file can be called up directly in the
"ProjectTemplateDocument".
The "ProjectTemplateDocument" is where you put VBA code that you want to use in all pictures
in the open project. If you need the VBA code on a different computer, use the export and
import functions in the VBA editor.
You can open and edit the "@PROJECT.PDT" file in the same way as a PDL file. This will
allow you to use the "@PROJECT.PDT" file as a template: For example, you may create there
the basic picture of your system which will then be automatically transferred into each new
PDL file of the project. Picture properties such as layers or zoom are not copied to the PDL
file, nor is the VBA code.
Picture-specific VBA code (3)
Refers to VBA code that you write to the document "This Document" relating to the
corresponding picture in the VBA editor. This VBA code is saved as a PDL file together with
the picture.
The PDL file has a reference to the "@PROJECT.PDT" file. Functions and procedures which
you have saved in the "@PROJECT.PDT" file can be called up directly from the PDL file.
However, you do not have access to functions or procedures that are stored in the
"@GLOBAL.PDT" file.
Note
You can create modules, class modules and user forms in each document.
You can protect the VBA code of a module against unauthorized access by setting a
password. To do this, select the "Tools" > "VBAObject Properties" menu item in the VBA
editor.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3011

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC

Special features during the execution of VBA macros


For the execution of VBA macros, the following applies: Initially picture-specific VBA code is
executed, followed by project-specific VBA code. If therefore you call a VBA macro that is
contained for example both in the picture and in the project-specific VBA code, only the VBA
macro from the picture is executed. This has the effect of preventing VBA macros and functions
from being executed twice, which otherwise can lead to errors.
In connection with event handling the forwarding of events is activated by default. You can
prevent events from being forwarded if you want to respond to an event in the picture-specific
VBA code only.
Additional information on this topic is given under "Event Handling".

Testing with the Debugger


You can test your VB scripts at runtime with the VBA editor's debugger. You may find additional
information in the help system of the VBA editor.

See also
Event Handling (Page 3105)
VBA in the Graphics Designer (Page 3017)
Executing VBA Macros in Graphics Designer (Page 3015)
How to export and import VBA code (Page 3014)

5.2.4

How to export and import VBA code

Principle
In the VBA editor you can import and export VBA code, enabling you to transfer it to another
computer. References to procedures and functions which you call within the project are
therefore retained.
Note
When you import VBA code you must enter references to external libraries manually after
the import process, on the target computer.

Procedure
Exporting VBA code
1. In the VBA editor's Project Explorer, select the module, whose VBA code you want to export.
2. Choose the "File" > "Export File menu command".

3012

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC
3. Select the path and enter the file name.
4. Click "Save".
The VBA code is exported to a file. The file type depends on the module from which the VBA
code was exported.
Importing VBA code
1. In the VBA editor's Project Explorer, select the document into which you want to import the
VBA code.
2. Choose the menu option "File" > "Import File".
3. Select the file and click "Open" in order to import the VBA code as "ThisDocument" into the
"Class Modules" folder.
4. In the "Class Modules" folder, open the document "ThisDocument" and copy the VBA code
into the document in the required project.

See also
Organizing VBA Code in a WinCC Project (Page 3009)

5.2.5

Executing VBA Macros in Graphics Designer

Introduction
Three possibilities are available to you for executing VBA macros in the Graphics Designer:
Event Handling
User-defined menu or toolbar
VBA editor

Event Handling
Predefined events (such as the opening of a picture) can occur in the Graphics Designer, the
active picture or the component library, to which you can respond with VBA event handlers.
These events occur only during configuring in the Graphics Designer and have nothing to do
with the events of action configuring.
In this example, a brief message is to be issued when a picture is opened. The "Opened event"
is used for this:

Private Sub Document_Opened(CancelForwarding As Boolean)


MsgBox ("Picture was opened!")
End Sub

Further information on the subject of event handling is provided under "Event handling" and
"Events".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3013

VBA for Automated Configuration


5.2 Introduction: Using VBA in WinCC

User-defined menu or toolbar


VBA allows you to create user-defined menus and toolbars in the Graphics Designer. You can
assign a VBA macro to each user-defined menu entry or icon; this macro is then executed
when you click on the menu entry or the icon. This way you can extend the functionality of the
Graphics Designer to suit your requirements.
Further information on the creation of user-defined menus and toolbars is provided under
"Creating your own menus and toolbars".

VBA editor
You can start a VBA macro in the VBA editor by pressing <F5>. If you press <F8>, you can
execute a VBA macro step by step.

See also
VBA Reference (Page 3126)
Event Handling (Page 3105)
Creating Customized Menus and Toolbars (Page 3023)
VBA in the Graphics Designer (Page 3017)
Organizing VBA Code in a WinCC Project (Page 3009)
Introduction: Using VBA in WinCC (Page 3008)

3014

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3

VBA in the Graphics Designer

5.3.1

VBA in the Graphics Designer

Introduction
You use VBA in the Graphics Designer in order to automate frequently recurring steps during
configuring. You can create user-defined menus and toolbars in order to make it easier to
execute the VBA macros that you have created.
Basically, in the Graphics Designer you can replace all configuring work that you would
otherwise perform with the mouse with VBA macros. This applies in particular to the GUI (layers
and zoom) and the editing of objects in pictures including dynamics.

Adapting the Graphics Designer with VBA


The Graphics Designer is represented by the Application object in VBA. With VBA you can
carry out configuring in the Graphics Designer in several languages, create user-defined
menus and toolbars and access the component library.

Editing Pictures with VBA


A picture in the Graphics Designer is represented by the Document object.
With VBA you can access the properties of the picture and edit settings for layers and the
zoom factors. As well as this you can create picture-specific menus and toolbars. These are
only visible, however, for as long as the picture is active.

Editing Objects with VBA


An object in the picture is represented by the HMIObject object. With VBA you can create and
delete objects and access the object properties. For example, with VBA you can very quickly
create a large number of objects with identical properties for your plant display.

Creating Dynamics with VBA


VBA enables you to add dynamics to properties and events of pictures and objects.

Event Handling
With VBA you can respond to events that occur in the Graphics Designer or in a picture, for
example when you insert a new object into a picture. You use event handling in order to execute
VBA macros in certain program situations.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3015

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Access to external applications


You can use VBA to access programs which support VBA, for example products in the
Microsoft Office family. This means that you have an opportunity to read values from an Excel
table and then assign them to object properties.

Note
Access to applications that were compiled with .net
You need to recompile applications that were compiled with .net to enable access to VBA in
Graphics Designer.

See also
Editing Pictures with VBA (Page 3049)
SymbolLibrary Object (Page 3442)
HMIObject Object (Page 3359)
Document Object (Page 3321)
Application Object (Page 3284)
Accessing External Applications with VBA (Page 3108)
Event Handling (Page 3105)
Creating Dynamics with VBA (Page 3081)
Editing Objects with VBA (Page 3055)
Adapting the Graphics Designer with VBA (Page 3019)
Introduction: Using VBA in WinCC (Page 3008)

3016

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.2

Adapting the Graphics Designer with VBA

5.3.2.1

Adapting the Graphics Designer with VBA

Introduction
In VBA the Application object represents the Graphics Designer:

Access to the component library


VBA gives you full access to the component library. You can extend the component library
with VBA by for example creating and deleting folders or copying objects and inserting them
into a picture.

User-defined menus and toolbars


You can create user-defined menus and toolbars in order to execute VBA macros in the
Graphics Designer. In this way you can extend the functionality of the Graphics Designer to
suit your particular requirements.

Language-dependent configuring
With VBA you can carry out configuring in the Graphics Designer in more than one language.
You therefore have access to the language-dependent object properties and you can create
the user-defined menus and toolbars in different languages.

See also
Editing Pictures with VBA (Page 3049)
Accessing the component library with VBA (Page 3042)
Creating Customized Menus and Toolbars (Page 3023)
Language-Dependent Configuration with VBA (Page 3020)
VBA in the Graphics Designer (Page 3015)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3017

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.2.2

Language-Dependent Configuration with VBA

Introduction
With VBA you can carry out configuring in the Graphics Designer for several different
languages. This gives you access to the language-dependent properties of objects in the
Graphics Designer, while you can also make the user-defined menus and toolbars available
in different languages. In VBA, foreign-language texts are stored in a list of the
"LanguageTexts" type. The settings for language-dependent fonts are stored in a list of the
"LanguageFonts" type.
Further information about language-dependent configuring is also provided in the WinCC
documentation "Setting up multilingual projects".

User interface language


You can only switch to a different desktop language in WinCC, not with VBA. When you switch
desktop language in WinCC, the "DesktopLanguageChanged" event is triggered. You can
adapt the user-defined menus and toolbars to suit the user, for example, by replacing languagedependent tool icons.
The following objects and the associated language-dependent properties react to the switching
of the user interface language:
FolderItem Object
Menu object and MenuItem object
ToolbarItem Object
Further information about the desktop language is provided in the WinCC documentation
"Setting up multilingual projects" under "Language terms in WinCC".
As of WinCC V7.3, VBA is installed in all languages that you have selected in the WinCC setup.
When you open the "VBA" editor in the Graphics Designer, the "VBA" editor opens in the same
user interface language as the Graphics Designer.

Project language
You can change the configuring language with VBA using the "CurrentDataLanguage"
property.
In this example the configuring language is changed to "English":

Sub ChangeCurrentDataLanguage()
'VBA1
Application.CurrentDataLanguage = 1033
MsgBox "The Data language has been changed to english"
Application.CurrentDataLanguage = 1031
MsgBox "The Data language has been changed to german"
End Sub

All language-dependent properties, such as ToolTipText, are affected by the change.

3018

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Configuring for more than one language in VBA


There are two possible ways for you to carry out configuring for several languages with VBA.
Language switching: Text properties of objects.
Text language lists: Text properties of user-defined menus and toolbars, and objects.
Language change
You can change the language-dependent properties (e.g., "Text") of objects with VBA. To do
this, assign the text to the corresponding property and then change the configuring language
in order to assign the text in the other language.
LanguageTexts listing
You can save the multilingual texts for the respective object directly in the associated listing
of the "LanguageTexts" type. To do this, enter the language ID for the language and the
associated text.
The list of language codes is available in the WinCC documentation (Index > Language Code).
In this example a German label and an English label are assigned to the button "myButton":

Sub AddLanguagesToButton()
'VBA2
Dim objLabelText As HMILanguageText
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'Set defaultlabel:
objButton.Text = "Default-Text"
'
'Add english label:
Set objLabelText = objButton.LDTexts.Add(1033, "English Text")
'Add german label:
Set objLabelText = objButton.LDTexts.Add(1031, "German Text")
End Sub

See also
LanguageTexts Object (Listing) (Page 3371)
LanguageFonts Object (Listing) (Page 3368)
How to assign help texts to menus and toolbars (Page 3035)
How to create menus in multiple languages (Page 3029)
VBA Reference (Page 3126)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3019

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.2.3

Creating Customized Menus and Toolbars

Configuring Menus and Toolbars


Introduction
You can "liven up" user-defined menus and toolbars so that they respond to certain program
situations in the Graphics Designer. For example, if an icon is not available because no object
is selected, you can gray out the icon. A check mark before a menu item can indicate, for
example, whether a selection is activated.
The following illustration shows you the configuration possibilities, using the example of a userdefined menu:

Active (yes/no) (1)


Activates the entry or dims it. You can use the "Enabled" property for user-defined menus,
menu items and icons:

'VBA13
Application.ActiveDocument.CustomMenus(1).MenuItems(1).Enabled = False

Marked with check mark (yes/no) (2)


Marks the menu item with a check mark. You can only use the "Checked" property for userdefined menu items:

'VBA14
Application.ActiveDocument.CustomMenus(1).MenuItems(2).Checked = True

Shortcut (3)
Defines a key combination for a menu item or an icon. You can only use the "Shortcut" property
for user-defined menu items and icons:

'VBA15
Application.ActiveDocument.CustomMenus(1).MenuItems(3).Shortcut = "Ctrl+G"

3020

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Visible (yes/no) (4)
Displays or hides the item. You can use the "Visible" property for user-defined menus, menu
items and toolbars and for their icons:

'VBA16
Application.ActiveDocument.CustomMenus(1).MenuItems(4).Visible = False

Creating Customized Menus and Toolbars


User-defined menus and toolbars in the Graphics Designer
You can use the following user-defined menus and toolbars in the Graphics Designer to run
VBA macros:
User-defined menus and toolbars are always visible when the Graphics Designer is open.
You should use application-specific menus and toolbars when the VBA macros that are to
be executed from them have to be accessible at all times.
Picture-specific menus and toolbars are linked to a specific picture and remain visible for
as long as the picture is active. You should use picture-specific menus and toolbars when
the VBA macros used there are relevant only for that particular picture.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3021

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Positioning of user-defined menus and toolbars


In the case of user-defined menus, the "Position" parameter determines the final positioning
in the menu bar:

Application-specific menus (1) are always positioned to the right of the "Windows" menu in the
Graphics Designer, while picture-specific menus (2) are always positioned to the left of the
"Help" menu in the Graphics Designer.
However, application-specific toolbars are not treated as "preferred". In this case, the
positioning is determined by the order in which you insert the toolbars. Toolbars are positioned
below the Graphics Designer toolbar.

Properties of user-defined menus and toolbars


In the case of user-defined menus and toolbars you can use hyphens to divide entries, for
example according to certain categories. As well as this you can also create submenus in a
user-defined menu.
The following configuration options are available to you for user-defined menus and toolbars
and their entries:
Visible (yes/no): Displays or hides the item (visible property).
Active (yes/no): Activates the entry or dims it (enabled property).
Marked with check mark (yes/no) - only available for menu command (Checked property).
Shortcut: Key combination for calling a menu command (ShortCut property).

3022

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Statustext: Text that is displayed in the status bar (StatusText property).
Tooltip text - only available for an icon (ToolTipText property).
You can hide a menu command, for example, if the macro cannot be executed at a certain
time. In this way you can prevent inadvertent wrong operation.
You can create all texts and labels of user-defined menus and toolbars in multiple languages
so that the user-defined menus and toolbars can also react to a language change.

See also
How to assign VBA macros to menus and toolbars (Page 3038)
How to assign help texts to menus and toolbars (Page 3035)
How to Add a New Icon to the Toolbar (Page 3033)
How to Create an Application-specific Toolbar (Page 3031)
How to create menus in multiple languages (Page 3029)
How to add a new menu entry to a menu (Page 3027)
How to Create Picture-specific Menus and Toolbars (Page 3050)
How to Create a New Application-Specific Menu (Page 3025)
Configuring Menus and Toolbars (Page 3020)
Executing VBA Macros in Graphics Designer (Page 3013)

How to Create a New Application-Specific Menu


Introduction
Application-specific menus remain visible even when all pictures in Graphics Designer are
closed. You can use the Started event, for example, in order to insert an application-specific
menu at an early stage.
Position the VBA code either
in the "GlobalTemplateDocument" if you want the menu to be available in all projects, or
in the "ProjectTemplateDocument" if you want the menu to be available in the current
project.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3023

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To create a user-defined menu in the Graphics Designer, you can for example insert a
"CreateApplicationMenus()" procedure in the document. In this example, two user-defined
menus are created:
Sub CreateApplicationMenus()
'VBA3
'Declaration of menus...:
Dim objMenu1 As HMIMenu
Dim objMenu2 As HMIMenu
'
'Add menus. Parameters are "Position", "Key" und "DefaultLabel":
Set objMenu1 = Application.CustomMenus.InsertMenu(1, "AppMenu1",
"App_Menu_1")
Set objMenu2 = Application.CustomMenus.InsertMenu(2, "AppMenu2",
"App_Menu_2")
End Sub
4. Start the procedure with <F5>.

Result
The two menus "App_Menu_1" and "App_Menu_2" are inserted to the right of the "Window"
menu:

See also
Creating Customized Menus and Toolbars (Page 3021)
InsertMenu Method (Page 3227)
How to assign VBA macros to menus and toolbars (Page 3038)
How to assign help texts to menus and toolbars (Page 3035)

3024

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
How to create menus in multiple languages (Page 3029)
How to add a new menu entry to a menu (Page 3027)
Configuring Menus and Toolbars (Page 3020)
Organizing VBA Code in a WinCC Project (Page 3009)

How to add a new menu entry to a menu


Requirements
You must have created the user-defined menu first.

Introduction
You can insert three different types of menu items in the user-defined menu:
Menu entry: To call VBA macros.
Separator line: For clearer design of user-defined menu.
Submenu: Same as user-defined menu (e.g. command structuring).
The "Position" parameter determines the order of the menu items within the user-defined
menu.
The "Key" parameter is a unique identification of the menu item. This parameter is used if you
use the "MenuItemClicked" event for calling VBA macros.

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3025

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To create menu items in a previously created user-defined menu, you can for example
insert an "InsertMenuItems()" procedure in the document. In this example a number of menu
items are created in the user-defined menu "App_Menu_1":
Sub InsertMenuItems()
'VBA4
Dim objMenu1 As HMIMenu
Dim objMenu2 As HMIMenu
Dim objMenuItem1 As HMIMenuItem
Dim objSubMenu1 As HMIMenuItem
'Create Menu:
Set objMenu1 = Application.CustomMenus.InsertMenu(1, "AppMenu1",
"App_Menu_1")
'Next lines add menu-items to userdefined menu.
'Parameters are "Position", "Key" and DefaultLabel:
Set objMenuItem1 = objMenu1.MenuItems.InsertMenuItem(1,
"mItem1_1", "App_MenuItem_1")
Set objMenuItem1 = objMenu1.MenuItems.InsertMenuItem(2,
"mItem1_2", "App_MenuItem_2")
'
'Adds seperator to menu ("Position", "Key")
Set objMenuItem1 = objMenu1.MenuItems.InsertSeparator(3,
"mItem1_3")
'
'Adds a submenu into a userdefined menu
Set objSubMenu1 = objMenu1.MenuItems.InsertSubMenu(4, "mItem1_4",
"App_SubMenu_1")
'
'Adds a menu-item into a submenu
Set objMenuItem1 = objSubMenu1.SubMenu.InsertMenuItem(5,
"mItem1_5", "App_SubMenuItem_1")
Set objMenuItem1 = objSubMenu1.SubMenu.InsertMenuItem(6,
"mItem1_6", "App_SubMenuItem_2")
End Sub
4. Start the procedure with <F5>.

Result
The "InsertMenuItems()" procedure inserts the menu "App_Menu_1" with these menu items:

3026

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

See also
InsertSeparator Method (Page 3230)
InsertSubmenu Method (Page 3231)
InsertMenu Method (Page 3227)
How to assign VBA macros to menus and toolbars (Page 3038)
How to assign help texts to menus and toolbars (Page 3035)
How to create menus in multiple languages (Page 3029)
How to Create a New Application-Specific Menu (Page 3023)
Configuring Menus and Toolbars (Page 3020)
Creating Customized Menus and Toolbars (Page 3021)

How to create menus in multiple languages


Introduction
You can create a user-defined menu that responds to a change of language. To do this you
need to define the necessary number of labels in other languages for the menu and for each
menu item.
The foreign-language label comprises the language ID (LCID) and the foreign-language text
(DisplayName).
The list of language codes is available in the WinCC documentation (Index > Language Code).

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3027

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To define multilingual labels for a user-defined menu, you can for example insert a
"MultipleLanguagesForAppMenu1()" procedure in the document. In this example English
labels are defined for the "App_Menu_1" menu:
Sub InsertMenuItems()
'VBA5
'Execute this procedure first
Dim objMenu1 As HMIMenu
Dim objMenu2 As HMIMenu
Dim objMenuItem1 As HMIMenuItem
Dim objSubMenu1 As HMIMenuItem
'Insert Menu:
Set objMenu1 = Application.CustomMenus.InsertMenu(1, "AppMenu1",
"App_Menu_1")
'Next lines inserts menu-items to userdefined menu.
'parameters are "Position", "Key" and DefaultLabel:
Set objMenuItem1 = objMenu1.MenuItems.InsertMenuItem(1,
"mItem1_1", "App_MenuItem_1")
Set objMenuItem1 = objMenu1.MenuItems.InsertMenuItem(2,
"mItem1_2", "App_MenuItem_2")
'
'Inserts seperator into menu ("Position", "Key")
Set objMenuItem1 = objMenu1.MenuItems.InsertSeparator(3,
"mItem1_3")
'
'Inserts a submenu into a userdefined menu
Set objSubMenu1 = objMenu1.MenuItems.InsertSubMenu(4, "mItem1_4",
"App_SubMenu_1")
'
'Inserts a menu-item into a submenu
Set objMenuItem1 = objSubMenu1.SubMenu.InsertMenuItem(5,
"mItem1_5", "App_SubMenuItem_1")
Set objMenuItem1 = objSubMenu1.SubMenu.InsertMenuItem(6,
"mItem1_6", "App_SubMenuItem_2")
End Sub
Sub MultipleLanguagesForAppMenu1()
'
execute this procedure after "InsertMenuItems()" was run
'Object "objLanguageTextMenu1" contains the
'foreign-language labels for the menu
Dim objLanguageTextMenu1 As HMILanguageText
'
'Object "objLanguageTextMenu1Item" contains the
'foreign-language labels for the menu-items
Dim objLanguageTextMenuItem1 As HMILanguageText
Dim objMenu1 As HMIMenu
Dim objSubMenu1 As HMIMenuItem
Set objMenu1 = Application.CustomMenus("AppMenu1")
Set objSubMenu1 =
Application.CustomMenus("AppMenu1").MenuItems("mItem1_4")
'
'Inserts foreign-language label into a menu:
'("Add(LCID, DisplayName)" method:

3028

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Set objLanguageTextMenu1 = objMenu1.LDLabelTexts.Add(1033,
"English_App_Menu_1")
'
'Inserts foreign-language label into a menuitem:
Set objLanguageTextMenuItem1 =
objMenu1.MenuItems("mItem1_1").LDLabelTexts.Add(1033, "My first
menu item")
'
'Adds a foreign-language label into a submenu:
Set objLanguageTextMenuItem1 =
objSubMenu1.SubMenu.Item("mItem1_5").LDLabelTexts.Add(1033, "My
first submenu item")
End Sub
4. Start the procedure with <F5>.

Result
If you now switch the configuring language to English, certain items in the user-defined menu
are shown in English.

See also
LanguageTexts Object (Listing) (Page 3371)
LDLabelTexts Property (Page 3654)
How to assign VBA macros to menus and toolbars (Page 3038)
How to assign help texts to menus and toolbars (Page 3035)
How to add a new menu entry to a menu (Page 3025)
How to Create a New Application-Specific Menu (Page 3023)
Configuring Menus and Toolbars (Page 3020)
Creating Customized Menus and Toolbars (Page 3021)
Language-Dependent Configuration with VBA (Page 3018)

How to Create an Application-specific Toolbar


Introduction
Application-specific toolbars remain visible even when all pictures in the Graphics Designer
are closed.
Position the VBA code either
in the "GlobalTemplateDocument" if you want the toolbar to be available in all projects, or
in the "ProjectTemplateDocument" if you want the toolbar to be available in the current
project.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3029

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To create a user-defined toolbar in the Graphics Designer, you can for example insert a
"CreateApplicationToolbars()" procedure in the document. In this example two user-defined
toolbars are created:
Sub CreateApplicationToolbars()
'VBA6
'Declare toolbar-objects...:
Dim objToolbar1 As HMIToolbar
Dim objToolbar2 As HMIToolbar
'
'Add the toolbars with parameter "Key"
Set objToolbar1 = Application.CustomToolbars.Add("AppToolbar1")
Set objToolbar2 = Application.CustomToolbars.Add("AppToolbar2")
End Sub
4. Start the procedure with <F5>.

Result
The two toolbars are inserted beneath the Graphics Designer toolbars.

See also
Add Method (CustomToolbars Listing) (Page 3170)
How to assign VBA macros to menus and toolbars (Page 3038)
How to assign help texts to menus and toolbars (Page 3035)
How to Add a New Icon to the Toolbar (Page 3033)
Configuring Menus and Toolbars (Page 3020)
Creating Customized Menus and Toolbars (Page 3021)

3030

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

How to Add a New Icon to the Toolbar


Requirement
You must have created the user-defined toolbar first.

Introduction
You can insert two different types of objects in the user-defined toolbar:
Symbol: To call VBA macros.
Separator line: For clearer design of user-defined toolbars.
The "Position" parameter determines the order of the icons within the user-defined toolbar.
The "Key" parameter is a unique identification of the icon. This parameter is used if you use
the "ToolbarItemClicked" event for calling VBA macros.

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3031

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To create icons in a previously created user-defined toolbar, you can for example insert an
"InsertToolbarItems()" procedure in the document. In this example, two icons separated by
a separator line are created in the user-defined toolbar "AppToolbar1":
Sub InsertToolbarItems()
'VBA7
Dim objToolbar1 As HMIToolbar
Dim objToolbarItem1 As HMIToolbarItem
'
'Add a new toolbar:
Set objToolbar1 = Application.CustomToolbars.Add("AppToolbar1")
'Adds two toolbar-items to the toolbar
'("InsertToolbarItem(Position, Key, DefaultToolTipText)"-Methode):
Set objToolbarItem1 =
objToolbar1.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "First
Symbol-Icon")
Set objToolbarItem1 =
objToolbar1.ToolbarItems.InsertToolbarItem(3, "tItem1_2", "Second
Symbol-Icon")
'
'Adds a seperator between the two toolbar-items
'("InsertSeparator(Position, Key)"-Methode):
Set objToolbarItem1 = objToolbar1.ToolbarItems.InsertSeparator(2,
"tSeparator1_3")
End Sub
4. Start the procedure with <F5>.

Result
The "InsertToolbarItems()" procedure adds a toolbar with two icons, separated by a dividing
line, to the Graphics Designer toolbars:

Note
Use the icon property in order to specify a graphic (*.ICO format) for a tool icon.

3032

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

See also
Creating Customized Menus and Toolbars (Page 3021)
Icon Property (Page 3631)
InsertSeparator Method (Page 3230)
InsertToolbarItem Method (Page 3233)
How to assign VBA macros to menus and toolbars (Page 3038)
How to assign help texts to menus and toolbars (Page 3035)
How to Create an Application-specific Toolbar (Page 3029)
Configuring Menus and Toolbars (Page 3020)

How to assign help texts to menus and toolbars


Requirements
You must have created the user-defined menu or the user-defined toolbar first.

Introduction
When the configuring engineer moves the mouse over a user-defined menu item or over a
user-defined icon, you can provide additional help text to explain the functionality in more detail:
You can define a help text for user-defined menu items and icons; the help text is displayed
in the status bar.
For user-defined icons, the default option is to create the help text as a tooltip.
You can also define status texts and tooltip texts for other languages.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3033

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To assign a status text to a user-defined menu item, you can for example insert an
"AddStatusTextsToAppMenu1()" procedure in the document. In this example one status
text in German and one in English is assigned to the first menu item in the previously created
"AppMenu1" menu:
Sub AddStatusTextsToAppMenu1()
'VBA8
Dim objMenu1 As HMIMenu
'
'Object "objStatusTextMenuItem1" contains foreign-language texts
Dim objStatusTextMenuItem1 As HMILanguageText
Set objMenu1 = Application.CustomMenus("AppMenu1")
'
'Assign a statustext to a menuitem:
objMenu1.MenuItems("mItem1_1").StatusText = "Statustext the first
menuitem"
'
'Assign a foreign statustext to a menuitem:
Set objStatusTextMenuItem1 =
objMenu1.MenuItems("mItem1_1").LDStatusTexts.Add(1033, "This is
my first status text in English")
End Sub

3034

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
4. To assign status and foreign-language tool tip text to a user-defined icon on the toolbar,
insert a "AddStatusAndTooltipTextsToAppToolbar1()" procedure in the document, for
example. In this example, the first icon on the toolbar created is assigned a status text
(German/English) and an English tool tip text:
Sub AddStatusAndTooltipTextsToAppToolbar1()
'VBA9
Dim objToolbar1 As HMIToolbar
'
'Variable "StatusTextToolbarItem1" for foreign statustexts
Dim objStatusTextToolbarItem1 As HMILanguageText
'
'Variable "TooltipTextToolbarItem1 for foreign tooltiptexts
Dim objTooltipTextToolbarItem1 As HMILanguageText
Set objToolbar1 = Application.CustomToolbars("AppToolbar1")
'
'Assign a statustext to a toolbaritem:
objToolbar1.ToolbarItems("tItem1_1").StatusText = "Statustext fr
das erste Symbol-Icon"
'
'Assign a foreign statustext to a toolbaritem:
Set objStatusTextToolbarItem1 =
objToolbar1.ToolbarItems("tItem1_1").LDStatusTexts.Add(1033,
"This is my first status text in English")
'
'Assign a foreign tooltiptext to a toolbaritem:
Set objTooltipTextToolbarItem1 =
objToolbar1.ToolbarItems("tItem1_1").LDTooltipTexts.Add(1033,
"This is my first tooltip text in English")
End Sub
5. Start the procedure with <F5>.

Results
The status text is displayed when you move the mouse pointer over the user-defined menu
item or the icon.

See also
LDTooltipTexts Property (Page 3658)
LDStatusTexts Property (Page 3656)
LanguageTexts Object (Listing) (Page 3371)
Add Method (Page 3168)
How to assign VBA macros to menus and toolbars (Page 3038)
How to Add a New Icon to the Toolbar (Page 3031)
How to add a new menu entry to a menu (Page 3025)
Configuring Menus and Toolbars (Page 3020)
Creating Customized Menus and Toolbars (Page 3021)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3035

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

How to assign VBA macros to menus and toolbars


Introduction
There are two possible ways for you to assign VBA macros to user-defined menus and toolbars:
You can use either the VBA event handlers "MenuItemClicked" and "ToolbarItemClicked"
or
"Macro" property.
Note
You will find the VBA code for creating the required user-defined menus and toolbars in
this documentation under "Adding a New Menu Item to a Menu" and "Adding a New Icon
to a Toolbar".

Procedure
Assigning a VBA macro with a VBA event handler
Note
You will find further information on VBA event handlers in this documentation under "Event
Handling".
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To start a VBA macro via the VBA event handlers, use the "MenuItemClicked" or
"ToolbarItemClicked" event:
4. Insert the VBA code from the "VBA10" table.
5. Start the procedure with <F5>.

3036

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Assigning a VBA Macro using the "Macro" property
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To start a VBA macro via the Macro property, assign the VBA macro to each menu item or
icon. In the following example, a user-defined menu with two menu entries is created, which
retrieve two different VBA macros:
The VBA code of the following VBA11 example depends on the file type. The VBA code is
added as an example for a PDL and a PDT file. Both cases can be distinguished in the
following manner:
PDL file:
The VBA code in a PDL file is only executed when this PDL file is being displayed.
PDT file:
The VBA code in a PDT file is always executed when the Graphics Designer is open.
4. Insert the VBA code from the "VBA11" table. Sample code for PDL file or "VBA821: Sample
code for PDT file".
You can call the following two procedures via the menu items in the user-defined menu
"DocMenu1":
5. Insert the VBA code from the "VBA12" table.
6. Start the procedure with <F5>.
The following tables show the VBA codes for the example:

Start VBA via event handler (VBA10)

Option Explicit
'VBA10
'The next declaration has to be placed in the module section
Dim WithEvents theApp As grafexe.Application

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3037

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Private Sub SetApplication()


'This procedure has to be executed (with "F5") first
Set theApp = grafexe.Application
End Sub
Private Sub theApp_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)
Dim objClicked As HMIMenuItem
Dim varMenuItemKey As Variant
Set objClicked = MenuItem
'
'"varMenuItemKey" contains the value of parameter "Key"
'from clicked menu-item
varMenuItemKey = objClicked.Key
Select Case varMenuItemKey
Case "mItem1_1"
MsgBox "The first menuitem was clicked!"
End Select
End Sub
Private Sub theApp_ToolbarItemClicked(ByVal ToolbarItem As IHMIToolbarItem)
Dim objClicked As HMIToolbarItem
Dim varToolbarItemKey As Variant
Set objClicked = ToolbarItem
'
'"varToolbarItemKey" contains the value of parameter "Key"
'from clicked toolbar-item
varToolbarItemKey = objClicked.Key
Select Case varToolbarItemKey
Case "tItem1_1"
MsgBox "The first symbol-icon was clicked!"
End Select
End Sub

Creating a menu (VBA11: Sample code for PDL file)

Sub CreateDocumentMenusUsingMacroProperty()
'VBA11
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1",
"Doc_Menu_1")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1",
"First Menuitem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2",
"Second Menuitem")
'
'Assign a VBA-macro to every menu item
With ActiveDocument.CustomMenus("DocMenu1")
.MenuItems("dmItem1_1").Macro = "TestMacro1"
.MenuItems("dmItem1_2").Macro = "TestMacro2"
End With
End Sub

3038

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Creating a menu (VBA821: Sample code for PDT file)

Sub CreateDocumentMenusUsingMacroProperty()
'VBA821
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Set objDocMenu = Application.CustomMenus.InsertMenu(1, "DocMenu1",
"Doc_Menu_1")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1",
"First Menuitem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2",
"Second Menuitem")
'
'Assign a VBA-macro to every menu item
With Application.CustomMenus("DocMenu1")
.MenuItems("dmItem1_1").Macro = "TestMacro1"
.MenuItems("dmItem1_2").Macro = "TestMacro2"
End With
End Sub

Macros for user-defined menu entries (VBA12)

Sub TestMacro1()
'VBA12
MsgBox "TestMacro1 was executed"
End Sub
Sub TestMacro2()
MsgBox "TestMacro2 was executed"
End Sub

See also
Macro Property (Page 3673)
ToolbarItemClicked Event (Page 3163)
MenuItemClicked Event (Page 3157)
How to Add a New Icon to the Toolbar (Page 3031)
How to add a new menu entry to a menu (Page 3025)
Event Handling (Page 3105)
Executing VBA Macros in Graphics Designer (Page 3013)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3039

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.2.4

Accessing the component library with VBA

Accessing the component library with VBA


Introduction
The component library contains a large selection of ready-made objects which you can use to
design your screens efficiently. The component library consists of a global library and a projectrelated library:
The "Global Library" contains prepared objects that are supplied with WinCC. The objects
are filed in folders, sorted according to subjects, such as valves, motors, cables and many
others.
The "Project Library" contains neither objects nor folders when you have created a new
project. You can create objects which you need only in this particular project in the "Project
Library".
VBA gives you full access to the component library: You can create and delete folders and
save objects in the component library or insert them into pictures.

Access to the component library with VBA

The component library is represented in VBA by the "SymbolLibraries" listing. The listing
contains two elements, which represent the "Global Library" and the "Project Library". The
"FolderItems" listing contains elements, which represent folders as well as objects.
Note
To address an object in the "SymbolLibraries" listing you use either the index number or the
internal name.
You can find out the internal name by clicking the right mouse button on the relevant object
in the component library and then choosing the "Copy path" command in the pop-up menu.
The path to the object within the component library is then copied to the clipboard.

3040

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer




Global Library (1)


The "Global Library" is the first element in the SymbolLibraries listing, which you address using
index number "1". You address the "Project Library" using index number "2".
Access to the "Global Library" with VBA:

'VBA17
Application.SymbolLibraries(1)

Folder (2)
A folder in the component library contains either other folders or the objects of a particular
subject area. In VBA a folder corresponds to the "FolderItem" object and its type is "Folder".
The folders are contained in the "FolderItems" listing. With VBA you can create a new folder
or delete an existing one, and add an object to the folder via the clipboard.
Access to the "Plant Components" folder with VBA:

'VBA18
Application.SymbolLibraries(1).FolderItems("Folder2")

Object (3)
In VBA an object corresponds to the "FolderItem" object and its type is "Item". The objects are
contained in the "Folder" listing. With VBA you can delete an object or copy it to the clipboard.
Access to the "PC" object with VBA:

'VBA19
Application.SymbolLibraries(1).FolderItems("Folder2").Folder("Folder2").Folder.Item("Objec
t1").DisplayName

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3041

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Creating or deleting folders in the component library


Use the following methods to create or delete folders:
"AddFolder(DefaultName)" Method: Creates a new folder in the components library. A
newly created folder receives the internal name "FolderX", where "X" stands for a
consecutive number.
"Delete()" Method: Deletes an existing folder (including all folders and objects that it
contains) from the component library.

Inserting or deleting an object in the component library


You can copy objects within the component library (for example from the "Global Library" to
the "Project Library"), insert an object from a picture into the component library or delete an
object from the component library:
Methoden "CopyToClipboard()" und "AddFromClipboard()": Copies an object to the
clipboard within the component library.
"AddItem(DefaultName, pHMIObject)" method: Copies an existing object in the picture into
a folder in the component library.
"Delete()" Method: Deletes an object.

Finding an object or folder in the component library


Use the "FindByDisplayName("DisplayName") method to search for an object or folder. The
specified display name is dependent on which language is currently set. The search ends with
the first occurrence of the object or folder that you are looking for.

Inserting an object into a picture from the component library


Use the "CopyToClipboard()" and "PasteClipboard()" methods to insert an object from the
component library into the current picture.

See also
CopyToClipboard Method (Page 3203)
PasteClipboard Method (Page 3245)
GetItemByPath Method (Page 3225)
FindByDisplayName Method (Page 3220)
Delete Method (Page 3210)
AddItem Method (Page 3183)
AddFromClipboard Method (Page 3180)
AddFolder Method (Page 3179)
SymbolLibrary Object (Page 3442)
SymbolLibraries Object (Listing) (Page 3441)

3042

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
How to paste an object from the object library into a picture with VBA (Page 3047)
How to edit the component library with VBA (Page 3045)

How to edit the component library with VBA


Introduction
Here you will find the following instructions for editing the component library with VBA:
Creating a new folder
Copying an object within the component library
Copying an object from the active picture into the component library
Deleting an object from the component library

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To create a new folder in the component library, you can for example insert an
"AddNewFolderToProjectLibrary()" procedure in the document. In this example the folder
"My folder" is created:
Sub AddNewFolderToProjectLibrary()
'VBA20
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
'
'("AddFolder(DefaultName)"-Methode):
objProjectLib.FolderItems.AddFolder ("Custom Folder")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3043

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
4. In order to copy an object from the "global library" to the "library project", insert a
"CopyObjectFromGlobalLibraryToProjectLibrary()" procedure in the document, for
example. In this example, the object "Object1" is copied:
Sub CopyObjectFromGlobalLibraryToProjectLibrary()
'VBA21
Dim objGlobalLib As HMISymbolLibrary
Dim objProjectLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
Set objProjectLib = Application.SymbolLibraries(2)
'
'Copies object "PC" from the "Global Library" into the clipboard
objGlobalLib.FolderItems("Folder2").Folder("Folder2").Folder.Item(
"Object1").CopyToClipboard
'
'The folder "Custom Folder" has to be available
objProjectLib.FolderItems("Folder1").Folder.AddFromClipBoard
("Copy of PC/PLC")
End Sub
5. In order to copy an object from the active picture to the "Project Library", insert a procedure
like "AddObjectFromPictureToProjectLibrary()" into document. In this example, the object
"Circle1" is created in the active picture and then copied to the folder "Folder1":
Sub AddObjectFromPictureToProjectLibrary()
'VBA22
Dim objProjectLib As HMISymbolLibrary
Dim objCircle As HMICircle
Set objProjectLib = Application.SymbolLibraries(2)
'
'Insert new object "Circle1"
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1",
"HMICircle")
'
'The folder "Custom Folder" has to be available
'("AddItem(DefaultName, pHMIObject)"-Methode):
objProjectLib.FolderItems("Folder1").Folder.AddItem "ProjectLib
Circle", ActiveDocument.HMIObjects("Circle1")
End Sub
6. To delete an object from the component library, insert a "DeleteObjectFromProjectLibrary()"
procedure in the document, for example. In this example the previously created folder
"Folder1" is deleted:
Sub DeleteObjectFromProjectLibrary()
'VBA23
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
'
'The folder "Custom Folder" has to be available
"Delete" Method:
objProjectLib.FolderItems("Folder1").Delete
End Sub
7. Start the procedure with <F5>.

3044

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

See also
SymbolLibrary Object (Page 3442)
SymbolLibraries Object (Listing) (Page 3441)
PasteClipboard Method (Page 3245)
Delete Method (Page 3210)
CopyToClipboard Method (Page 3203)
AddItem Method (Page 3183)
AddFromClipboard Method (Page 3180)
AddFolder Method (Page 3179)
How to paste an object from the object library into a picture with VBA (Page 3047)
Accessing the component library with VBA (Page 3040)

How to paste an object from the object library into a picture with VBA
Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3045

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To insert an object from the "Global Library" into the active picture, you can for example
insert a "CopyObjectFromGlobalLibraryToActiveDocument()" procedure in the document.
In this example the object "Object1" is inserted
Sub CopyObjectFromGlobalLibraryToActiveDocument()
'VBA24
Dim objGlobalLib As HMISymbolLibrary
Dim objHMIObject As HMIObject
Dim iLastObject As Integer
Set objGlobalLib = Application.SymbolLibraries(1)
'
'Copy object "PC" from "Global Library" to clipboard
objGlobalLib.FolderItems("Folder2").Folder("Folder2").Folder.Item(
"Object1").CopyToClipboard
'
'Get object from clipboard and add it to active document
ActiveDocument.PasteClipboard
'
'Get last inserted object
iLastObject = ActiveDocument.HMIObjects.Count
Set objHMIObject = ActiveDocument.HMIObjects(iLastObject)
'
'Set position of the object:
With objHMIObject
.Left = 40
.Top = 40
End With
End Sub
4. Start the procedure with <F5>.

See also
PasteClipboard Method (Page 3245)
CopyToClipboard Method (Page 3203)
How to edit the component library with VBA (Page 3043)
Accessing the component library with VBA (Page 3040)

3046

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.3

Editing Pictures with VBA

5.3.3.1

Editing Pictures with VBA

Introduction
Pictures visualize the process to be executed and observed. They display the important
process steps or plant parts and present the production process in a schematic manner. In
VBA the picture is represented by the Document object.

Picture-specific menus and toolbars


In contrast with the application-specific menus and toolbars, the picture-specific menus and
toolbars are coupled to a specific picture. The picture-specific menus and toolbars remain
visible for as long as the picture is active.
You should use picture-specific menus and toolbars when the called VBA macros are only
used in that picture.

Layers
You can access the layers in the Graphics Designer with VBA. Each layer is represented by
the Layer object. By changing the properties of the Layer object you can specify among other
things the layer names and the zoom settings.
You control the visibility of the RT layers via the Document object. You control the visibility of
the CS layers via the View object.

Copies of the picture


You can create copies of a picture with VBA in order to display different views of a picture. The
copy of a picture is represented in VBA by the View object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3047

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
In the properties of the View object you can among other things set the zoom factor and specify
which picture section is to be displayed.
Note
If you want to run VBA code in a picture saved in WinCC V7.0 SP1 under WinCC V7.0, you
need to deactivate the "CCHMIDotNetObj 1.0 Type Library" in the VBA Editor under "Tools
> References".
The VBA program will then be executed within the usual functional scope of WinCC V7.0. In
this case, you cannot use the new functions of WinCC V7.0 SP1.

See also
Editing a Copy of a Picture with VBA (Page 3053)
How to Create Picture-specific Menus and Toolbars (Page 3050)
Editing Layers with VBA (Page 3052)
Editing Objects with VBA (Page 3055)
Adapting the Graphics Designer with VBA (Page 3017)

5.3.3.2

How to Create Picture-specific Menus and Toolbars

Introduction
Picture-specific menus and toolbars are linked to a specific picture and remain visible for as
long as the You should use picture-specific menus and toolbars when the VBA macros used
there are relevant only for that particular picture.

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor").
2. Open the document "ThisDocument" in the Project Explorer:

3048

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To create a picture-specific menu, you can for example insert a "CreateDocumentMenus()"
procedure in the document "ThisDocument":
Sub CreateDocumentMenus()
'VBA25
'Declare menuobjects:
Dim objMenu1 As HMIMenu
Dim objMenu2 As HMIMenu
'Insert Menus ("InsertMenu"-Methode) with
'Parameters - "Position", "Key", "DefaultLabel":
Set objMenu1 = ActiveDocument.CustomMenus.InsertMenu(1,
"DocMenu1", "Doc_Menu_1")
Set objMenu2 = ActiveDocument.CustomMenus.InsertMenu(2,
"DocMenu2", "Doc_Menu_2")
End Sub
4. In order to create a picture-specific toolbar, insert a procedure like
"CreateDocumentToolbars()" into the document "ThisDocument":
Sub CreateDocumentToolbars()
'VBA26
'Declare required number of toolbarobjects:
Dim objToolbar1 As HMIToolbar
Dim objToolbar2 As HMIToolbar
'
'Insert toolbars ("Add"-Methode) with
'Parameter - "Key":
Set objToolbar1 = ActiveDocument.CustomToolbars.Add("DocToolbar1")
Set objToolbar2 = ActiveDocument.CustomToolbars.Add("DocToolbar2")
End Sub
5. Always start the procedure with <F5>.

See also
Add Method (CustomToolbars Listing) (Page 3170)
InsertMenu Method (Page 3227)
How to assign VBA macros to menus and toolbars (Page 3036)
How to assign help texts to menus and toolbars (Page 3033)
How to Add a New Icon to the Toolbar (Page 3031)
How to create menus in multiple languages (Page 3027)
How to add a new menu entry to a menu (Page 3025)
Creating Customized Menus and Toolbars (Page 3021)
Configuring Menus and Toolbars (Page 3020)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3049

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.3.3

Editing Layers with VBA

Introduction
You can arrange objects in 32 layers in the Graphics Designer. The layers are differentiated
according to CS layers and RT layers so that the visibility of the layers in the picture (CS) and
in runtime (RT) can be controlled separately. In VBA a layer is represented by the Layer object:

In the Graphics Designer the lowest layer is "Layer 0". To give back the lowest layer with VBA,
use the index "1":
ActiveDocument.Layers(1)

Using the Layer object


You use the Layer object in order to specify the minimum and maximum zoom for a layer and
to assign a name. In the following example the settings for the lowest layer are configured in
the active picture:

Sub ConfigureSettingsOfLayer
'VBA27
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'Configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
End Sub

Controlling the visibility of CS and RT layers


You control the visibility of the CS layers via the View object. Use the Document object in order
to determine which layers are to be displayed or hidden in runtime. You can control the visibility
of the CS and RT layers with the following methods:
Methode "IsCSLayerVisible(Index)": Checks whether the specified CS layer is displayed.
Methode "SetCSLayerVisible(Index, Val)": Shows or hides the specified CS layer.
Use the IsRTLayerVisible and SetRTLayerVisible methods for the RT layers in the same way.

3050

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

See also
IsRTLayerVisible Method (Page 3235)
SetRTLayerVisible Method (Page 3263)
SetCSLayerVisible Method (Page 3260)
IsCSLayerVisible Method (Page 3234)
Layers Object (Listing) (Page 3373)
Editing Pictures with VBA (Page 3047)
Language-Dependent Configuration with VBA (Page 3018)

5.3.3.4

Editing a Copy of a Picture with VBA

Introduction
You can create copies of a picture with VBA in order to display different views of a picture.
Each view is shown in a separate window. The copy of a picture is represented in VBA by the
View object:

In the properties of the View object you can among other things set the zoom factor and specify
which picture section is to be displayed.

Creating a copy of a picture


Use the Add method to create a copy of the specified picture. In this example a copy of the
active picture is created and activated:

Sub CreateAndActivateView()
'VBA28
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3051

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Editing a copy of a picture


You can edit each copy of a screen as follows:
Adjust zoom factor: Use the zoom property.
Specify picture zoom area: Specify the picture section: use the "ScrollPosX" and
"ScrollPosY" properties to specify the picture zoom area using the scroll bars.
Showing and Hiding CS layers: You can use the SetCSLayerVisible(Index) method for
example to show or hide the specified layer. You can select the layer on which you want
to edit the objects with the ActiveLayer property.
In the following example a copy of the active picture is created and activated. The zoom factor
is set to 150% and the position of the scrollbars is changed:

Sub SetZoomAndScrollPositionInActiveView()
'VBA29
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
With objView
.Activate
.ScrollPosX = 40
.ScrollPosY = 10
.Zoom = 150
End With
End Sub

See also
Add Method (Views Listing) (Page 3175)
ScrollPosY Property (Page 3757)
ScrollPosX Property (Page 3756)
ActiveLayer Property (Page 3474)
View Object (Page 3468)
SetCSLayerVisible Method (Page 3260)
IsCSLayerVisible Method (Page 3234)
Activate Method (Page 3167)
Editing Layers with VBA (Page 3050)
Editing Pictures with VBA (Page 3047)

3052

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.4

Editing Objects with VBA

5.3.4.1

Editing Objects with VBA

Access to objects in the Graphics Designer

In VBA all object types of the current picture are contained in the "HMIObjects" listing. They
are not divided according to object type (Standard, Smart, Windows and Controls objects) as
in the Graphics Designer. With VBA you can therefore run through all objects in one or more
pictures with a loop.
When you have selected objects in the picture, these objects are contained in the "Selection"
listing. Use the "HMIDefaultObjects" listing if you want to change the default settings of the
properties of an object.
To address an object in a picture with VBA, use either the object name, e.g.
"ActiveDocument.HMIObjects("Circle1"), or the index number. "
ActiveDocument.HMIObjects(1)" references for example the first object in the active picture.

Editing objects with VBA


You have the following possibilities for editing objects with VBA:
Create a new object in a picture
Delete an existing object
Copy an existing object
Group existing objects or cancel the grouping
Search for objects
Display or change object properties
When you insert a new object into a picture with VBA, the object behaves in the same way as
if you double-clicked it in the Graphics Designer object palette.
The object is given the predefined property values and is inserted in the top left-hand corner
of the picture.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3053

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Access to the object properties is dependent on how you created the object. Two examples
illustrate this:
Example 1:
In this example a circle of the type "HMIObject" is inserted into the current picture. You can
use a VBA object of the "HMIObject" type or all objects in the Graphics Designer. However,
you have to address individual properties of the respective object explicitly via the
"Properties(Index)" property:

Sub AddObject()
'VBA30
Dim objObject As HMIObject
Set objObject = ActiveDocument.HMIObjects.AddHMIObject("CircleAsHMIObject", "HMICircle")
'
'standard-properties (e.g. the position) are available every time:
objObject.Top = 40
objObject.Left = 40
'
'non-standard properties can be accessed using the Properties-collection:
objObject.Properties("FlashBackColor") = True
End Sub

Example 2:
In this example a circle of the type "HMICircle" is inserted into the current picture. In contrast
with Example 1 you can only use the "objCircle" object for objects of the "HMICircle" type,
however:

Sub AddCircle()
'VBA31
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("CircleAsHMICircle", "HMICircle")
'
'The same as in example 1, but here you can set/get direct the
'specific properties of the circle:
objCircle.Top = 80
objCircle.Left = 80
objCircle.FlashBackColor = True
End Sub

See also
LanguageFonts Object (Listing) (Page 3368)
VBA Reference (Page 3126)
Underlined Property (Page 3801)
Size Property (Page 3764)
Parent Property (Page 3710)
LanguageID Property (Page 3645)

3054

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Italic Property (Page 3638)
Family Property (Page 3589)
Bold Property (Page 3515)
Application Property (Page 3486)

5.3.4.2

Default objects, Smart objects, Windows objects and Tube objects

Default objects, Smart objects, Windows objects and Tube objects


Introduction
You use the Standard, Smart and Windows objects to design your pictures. In the Graphics
Designer, these objects are available in the "Default" selection window:

VBA enables you to access these objects in all pictures in your project. If, for example, you
want to change the background color of all circles in a project with several pictures, you can
do this with a VBA macro.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3055

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Paste Object into Picture


Use the "AddHMIObject(ObjectName, ProgID)" method to insert a new object in a picture.
ObjectName" stands for the name of the object (e.g. "my Circle"), and "ProgID" for the VBA
object designation (e.g. "HMICircle"):

Sub AddCircle()
'VBA32
'Creates object of type "HMICircle"
Dim objCircle As HMICircle
'
'Add object in active document
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("My Circle", "HMICircle")
End Sub

Edit Object
VBA gives you access to all object properties, which you can edit via the object's properties
dialog. You can change and output object properties, and select objects in the picture. If you
have not selected an object, you can use the following methods:
"Find()" method: Searches for an object in the "HMIObjects" listing
"Delete()" Method: Deletes an HMIObject object.
If you have selected objects, you can edit them via the "Selection" listing with the following
methods, among others:
"AlignLeft()", "AlignRight()", "AlignTop()", "AlignBottom()": These methods align objects.
"CreateGroup()", "CreateCustomizedObject()": These methods create a group object or
customized object.
"DeselectAll()" method: Cancels the selection of all objects

Remove VBA:references with "Nothing"


Always remove the references used for the Controls, the standard objects, and for the
document after you closed the document. For this purpose, set the objects to "Nothing". The
following example shows the code for a Control:
Public Sub DrawNewControl
Const strFct = "CreatePdls"
Dim objControl As HMIObject
Dim objDoc As Document
On Local Error GoTo errorhandler
'open the document
Set objDoc =
grafexe.Application.Documents.Open(grafexe.Application.ApplicationDa
taPath & "PDL1.pdl", hmiOpenDocumentTypeInvisible)
'create new object
Set objControl = objDoc.HMIObjects.AddActiveXControl("Control1",
"CCAxUserArchiveControl.AxUserArchiveControl.1")
If objControl Is Nothing Then
GoTo errorhandler

3056

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
End If
'doing something with the control
'......
'delete reference to new control
Set objControl = Nothing
'saving PDL and deleting reference to it
objDoc.Save
objDoc.Close
Set objDoc = Nothing
Exit Sub
' errorhandler
errorhandler:
If MsgBox("Error occurred" & vbNewLine & "Yes - resume next" &
vbNewLine & "No - stop script", vbOKCancel + vbCritical, strFct) =
vbOK Then
Resume Next
End If
End Sub

See also
Parent Property (Page 3710)
Item Property (Page 3639)
Count Property (Page 3562)
Application Property (Page 3486)

How to edit Default objects, Smart objects, Windows objects and Tube objects
Introduction
Here you will find the following instructions for editing Standard, Smart and Windows objects:
Define properties of a specific object
Define properties of a nonspecific object
Select an object in the active picture
Find objects in the active picture
Delete object

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3057

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. Open the document "ThisDocument" in the Project Explorer:

3. To define the properties of a specific object type (e.g. "HMICircle"), you can for example
insert an "EditDefinedObjectType()" procedure in the document "ThisDocument". In this
example a circle is inserted in the active picture and its line weight and color are modified:
Sub EditDefinedObjectType()
'VBA33
Dim objCircle As HMICircle
Set objCircle =
ActiveDocument.HMIObjects.AddHMIObject("myCircleAsCircle",
"HMICircle")
With objCircle
'direct calling of objectproperties available
.BorderWidth = 4
.BorderColor = RGB(255, 0, 255)
End With
End Sub
4. To change the properties of a nonspecific object type ("HMIObject"), insert a
"EditHMIObject()" procedure in the document "ThisDocument", for example. In this example
a circle is inserted in the active picture and its line weight and color are modified:
Sub EditHMIObject()
'VBA34
Dim objObject As HMIObject
Set objObject =
ActiveDocument.HMIObjects.AddHMIObject("myCircleAsObject",
"HMICircle")
With objObject
'Access to objectproperties only with property "Properties":
.Properties("BorderWidth") = 4
.Properties("BorderColor") = RGB(255, 0, 0)
End With
End Sub

3058

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
5. To select an object in the current picture, insert a "SelectObject()" procedure in the
document "ThisDocument", for example. In this example, a circle will be inserted in the
active picture and selected:
Sub SelectObject()
'VBA35
Dim objObject As HMIObject
Set objObject =
ActiveDocument.HMIObjects.AddHMIObject("mySelectedCircle",
"HMICircle")
ActiveDocument.HMIObjects("mySelectedCircle").Selected = True
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3059

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
6. To search for an object in the current picture, insert a "FindObjectsByName()",
"FindObjectsByType()," or "FindObjectsByProperty()" procedure in the document
"ThisDocument", for example. In this example, objects containing the string "Circle" in their
name are searched for:
Sub FindObjectsByName()
'VBA36
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
'
'Wildcards (?, *) are allowed
Set colSearchResults =
ActiveDocument.HMIObjects.Find(ObjectName:="*Circle*")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "Objectname: " &
strName
Next objMember
End Sub
In this example a search is run in the active picture for objects of the type "HMICircle":
Sub FindObjectsByType()
'VBA37
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
Set colSearchResults =
ActiveDocument.HMIObjects.Find(ObjectType:="HMICircle")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "Objektname: " &
strName
Next objMember
End Sub
In this example a search is run in the active picture for objects with the property "BackColor":
Sub FindObjectsByProperty()
'VBA38
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
Set colSearchResults =
ActiveDocument.HMIObjects.Find(PropertyName:="BackColor")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "Objectname: " &
strName
Next objMember

3060

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
End Sub
7. To delete an object, you can for example insert a "DeleteObject()" procedure in the
document "ThisDocument". In this example the first object in the active picture will be
deleted.
Sub DeleteObject()
'VBA39
'Delete first object in active document:
ActiveDocument.HMIObjects(1).Delete
End Sub
8. Start the procedure with <F5>.

See also
Find Method (Page 3219)
Delete Method (Page 3210)
AddHMIObject Method (Page 3182)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
Editing Objects with VBA (Page 3053)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3061

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

OLE Objects
Introduction
You can use VBA to insert OLE Elements into a picture. The OLE Element belongs to the
Smart objects. In the Graphics Designer, the object is available in the "Default" selection
window:

Paste OLE Element in Picture


Use the "AddOLEControl(ObjectName, ServerName, [CreationType], [UseSymbol]) method
to insert an OLE Element into a picture. ObjectName" stands for the object name, and
"ServerName" for the application that is to be contained in the OLE Element. The

3062

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
"ServerName" parameter corresponds to the object type in the "object insertion dialog. The
last two parameters are optional and represent the possible settings" in the dialog displayed:

6HUYHU1DPH

You will find further information on the parameters in this documentation under "AddOLEObject
method".
In the following example an OLE Element containing a Wordpad document will be inserted
into the active picture:

Sub AddOLEObjectToActiveDocument()
'VBA40
Dim objOLEObject As HMIOLEObject
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("MS Wordpad Document1",
"Wordpad.Document.1")
End Sub

The OLEObject object is added to the "HMIObjects" listing as the last element and inherits the
properties of the HMIObject object.

See also
OLEObject Object (Page 3393)
AddOLEObject Method (Page 3184)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3063

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

ActiveX controls
Introduction
You can use VBA to insert ActiveX controls into a picture. In the Graphics Designer, you can
find the ActiveX controls supplied with WinCC in the "Controls" selection window:

Further information is provided under "AddActiveXControl method" in this documentation and


under "Working with controls" in the WinCC documentation.

Integrating standard ActiveX controls


As well as the ActiveX controls supplied with WinCC, you can insert all standard ActiveX
controls registered in the operating system into a picture. This means that you also have the
option of using ActiveX controls that you have programmed yourself in your pictures. A list of
the standard ActiveX controls tested with WinCC is given in the WinCC documentation.

Inserting an ActiveX control into a picture


Use the "AddActiveXControl(ObjectName, ProgID)" method to insert a new ActiveX control
into a picture. ObjectName" stands for the name of the ActiveX control (e.g. "WinCC Gauge"),
and "ProgID" for the VBA object designation (e.g. "XGauge.XGauge.1"):

Sub AddActiveXControl()
'VBA41

3064

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Dim objActiveXControl As HMIActiveXControl


Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",
"XGAUGE.XGaugeCtrl.1")
End Sub

The ActiveXControl object is added to the "HMIObjects" listing as the last element and inherits
the properties of the HMIObject object.

Access to the properties of the ActiveX control


You must address the object-specific properties of the ActiveX control via the
"Properties(Index)" property. You can find out which properties a ActiveX control possesses
from the "Object Properties" dialog in the Graphics Designer or from the Properties listing:

Sub AddActiveXControl()
'VBA42
Dim objActiveXControl As HMIActiveXControl
Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge2",
"XGAUGE.XGaugeCtrl.1")
'
'move ActiveX-control:
objActiveXControl.Top = 40
objActiveXControl.Left = 60
'
'Change individual property:
objActiveXControl.Properties("BackColor").value = RGB(255, 0, 0)
End Sub

Restricted access to background graphics of Controls


The background graphic cannot be configured in VBA for the following Controls:
Control

Attribute

WinCC Digital/Analog Clock Control

Background graphic

WinCC Gauge Control

Background picture
Frame picture

WinCC Push Button Control

PictureSelected
PictureUnselected

WinCC slider control

Background picture
Slider picture

See also
ActiveXControl Object (Page 3275)
AddActiveXControl Method (Page 3176)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3065

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)

.Net controls
Introduction
You can use VBA to insert .Net controls into a picture. In the Graphics Designer, you can find
the .Net controls in the "Controls" selection window.
Additional information is provided under "AddDotNetControl method" in this documentation
and under "Creating process pictures > Working with controls > .Net controls" in the WinCC
documentation.

Inserting a .Net control into a picture


Use the "AddDotNetControl(ObjectName, ControlType, InGAC, AssemblyInfo)" method to
insert a new .Net control into a picture. "ObjectName" represents the name of the .Net control.
"ControlType" shows the name space of the object. If "InGAC" is "TRUE", the object is
registered in the Global Assembly Cache and the associated information is available in
"AssemblyInfo".

Sub AddDotNetControl()
'VBA851
Dim DotNetControl As HMIDotNetControl
Set DotNetControl = ActiveDocument.HMIObjects.AddDotNetControl("MyVBAControl",
"System.Windows.Forms.Label", True,"Assembly=System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089")
End Sub

The .Net control object is added to the "HMIObjects" listing as an element and inherits the
properties of the HMIObject object.

Access to the properties of the .Net control


You can find out which properties a .Net control has from the "Object Properties > Control
Properties" dialog in Graphics Designer.

WPF controls
Introduction
You can use VBA to insert WPF controls into a picture. In the Graphics Designer, you can find
the WPF controls in the "Controls" selection window.
Additional information is provided under "AddWPFControl method" in this documentation and
under "Creating process pictures > Working with controls > WPF controls" in the WinCC
documentation.

3066

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Inserting a WPF control into a picture


Use the "AddWPFControl(ObjectName, ControlType, InGAC, AssemblyInfo)" method to insert
a new WPF control into a picture. "ObjectName" represents the name of the .Net control.
"ControlType" shows the name space of the object. If "InGAC" is "TRUE", the object is
registered in the Global Assembly Cache and the associated information is available in
"AssemblyInfo".

Sub AddWPFControl()
'VBA852
Dim WPFControl As HMIWPFControl
Set WPFControl = ActiveDocument.HMIObjects.AddWPFControl("MyWPFVBAControl",
"WinCCWPFControl.TestControl", False, "Assembly=Z:\TestControl\WinCCWPFControl.dll")
End Sub

The ActiveXControl object is added to the "HMIObjects" listing as an element and inherits the
properties of the HMIObject object.

Access to the properties of the WPF control


You can find out which properties a WPF control has from the "Object Properties > Control
Properties" dialog in Graphics Designer.

5.3.4.3

Group Objects

Group Objects
Introduction
With VBA you can create a group object from selected objects in the Graphics Designer. You
can add objects to the group object, or remove objects, without having to ungroup the group
object itself. You have unrestricted access to the object properties of the individual objects in
the group object. You can also ungroup a group object again, or delete it entirely.
The following object types cannot be part of a group object:
CustomizedObject (Customized object)
ActiveXControl
OLEObject
Further information regarding group objects can be found in the WinCC documentation under
"Group Object".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3067

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Creating a group object


To create a group object, select the objects that you want to be part of the group object in the
Graphics Designer. The selected objects are then contained in the "Selection" listing. You
create the group with the "CreateGroup()" method:

Sub CreateGroup()
'VBA43
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "myGroup"
End Sub

The group object is inserted at the end of the "HMIObjects" listing. The objects that are
contained in the group object retain their index numbers and continue to be available in the
"HMIObjects" listing.
The objects in the group object are also included in the "GroupedHMIObjects" listing, although
the index numbers are reassigned.
Give the group object a name (objGroup.Name = "My Group") so that you can uniquely identify
it. If you do not assign a name, the group object is given the default designation for the group
object (e.g. "Group1").
The group object has the same properties as the objects of the "Object" type.

Editing a group object


You can edit a group object as follows:
Methode "Add(Index)": Adds a new object to the group object.
Methode "Remove(Index)": Removes a object from the group object.
"UnGroup()" method: Ungroups the group object (ungroup).
"Delete()" Method: Deletes the group object and the objects that it contains.

3068

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Editing objects in a group object


Use the "GroupedHMIObjects" listing in order to select an object in the group object. In order
to access its object property you must access the name of the object property via the
"Properties" property, for example:

Sub ModifyPropertyOfObjectInGroup()
'VBA44
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("myGroup")
objGroup.GroupedHMIObjects(1).Properties("BorderColor") = RGB(255, 0, 0)
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
GroupedObjects Object (Listing) (Page 3355)
Ungroup Method (Page 3267)
Remove Method (Page 3248)
Delete Method (Page 3210)
Add Method (GroupedObjects Listing) (Page 3172)
How to Edit Objects in Group Objects Using VBA (Page 3074)
How to Edit the Group Objects Using VBA (Page 3071)
Editing Objects with VBA (Page 3053)
VBA in the Graphics Designer (Page 3015)

How to Edit the Group Objects Using VBA


Requirements
You must have created at least two graphic objects in the Graphics Designer and you must
have selected them.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3069

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor").
2. Open the document "ThisDocument" in the Project Explorer:

3. To create a group object from selected objects, you can for example insert a
"CreateGroup()" procedure in the document "ThisDocument". In this example the group
object "My Group" is created from a number of objects.
Sub CreateGroup()
'VBA45
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle",
"HMICircle")
Set objRectangle =
ActiveDocument.HMIObjects.AddHMIObject("sRectangle",
"HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
'The name identifies the group-object
objGroup.ObjectName = "My Group"
End Sub

3070

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
4. To add an object to the "My Group" group object, insert a "AddObjectToGroup()" procedure
in the document "ThisDocument", for example. In this example, an ellipse is added to the
"My Group" group object:
Sub AddObjectToGroup()
'VBA46
Dim objGroup As HMIGroup
Dim objEllipseSegment As HMIEllipseSegment
'Adds new object to active document
Set objEllipseSegment =
ActiveDocument.HMIObjects.AddHMIObject("EllipseSegment",
"HMIEllipseSegment")
Set objGroup = ActiveDocument.HMIObjects("My Group")
'Adds the object to the group
objGroup.GroupedHMIObjects.Add ("EllipseSegment")
End Sub
5. To remove an object from the "My Group" group object, insert a
"RemoveObjectFromGroup()" procedure in the document "ThisDocument", for example. In
this example the first object will be removed from the "My Group" group object:
Sub RemoveObjectFromGroup()
'VBA47
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("My Group")
'delete first object of the group-object
objGroup.GroupedHMIObjects.Remove (1)
End Sub
6. To ungroup the "My Group" group object again, insert a procedure "UnGroup()" into the
document "ThisDocument". In this example, the "My Group" group object is ungrouped:
Sub UnGroup()
'VBA48
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("My Group")
objGroup.UnGroup
End Sub
7. To delete the "My Group" group object, insert a procedure "DeleteGroup()" into the
document "ThisDocument". In this example, the "My Group" group object is deleted,
together with the objects it contains:
Sub DeleteGroup()
'VBA49
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("My Group")
objGroup.Delete
End Sub
8. Always start the procedure with <F5>.

See also
Ungroup Method (Page 3267)
Remove Method (Page 3248)
Delete Method (Page 3210)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3071

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
CreateGroup Method (Page 3208)
Add Method (GroupedObjects Listing) (Page 3172)
SelectedObjects object (Listing) (Page 3428)
GroupedObjects Object (Listing) (Page 3355)
Group Object (Page 3350)
How to Edit Objects in Group Objects Using VBA (Page 3074)
Group Objects (Page 3067)
Editing Objects with VBA (Page 3053)
VBA in the Graphics Designer (Page 3015)

How to Edit Objects in Group Objects Using VBA


Introduction
Here you will find the following instructions for editing objects in a group object with VBA:
Editing a property of an object in the group object
Editing a property of all objects in the group object

Requirement
You must have created at least two graphic objects in the Graphics Designer and you must
have grouped them.

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor").
2. Open the document "ThisDocument" in the Project Explorer:

3072

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To edit a property of an object within the group object, you can for example insert a
"ChangePropertiesOfGroupMembers()" procedure into the document "ThisDocument". In
this example the properties of three different objects are modified in the group object "My
Group":
Sub ChangePropertiesOfGroupMembers()
'VBA50
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle",
"HMICircle")
Set objRectangle =
ActiveDocument.HMIObjects.AddHMIObject("sRectangle",
"HMIRectangle")
Set objEllipse =
ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
With objEllipse
.Top = 120
.Left = 120
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "My Group"
'Set bordercolor of 1. object = "red":
objGroup.GroupedHMIObjects(1).Properties("BorderColor") =
RGB(255, 0, 0)
'set x-coordinate of 2. object = "120" :
objGroup.GroupedHMIObjects(2).Properties("Left") = 120
'set x-coordinate of 3. object = "90" :
objGroup.GroupedHMIObjects(3).Properties("Top") = 90
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3073

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
4. To change the properties of all the objects in the group object, insert a
"ChangePropertiesOfAllGroupMembers()" procedure in the document In this example, the
"BorderColor" property of each object in the "My Group" group object is changed. This
example will not work unless you have created the "My Group" group object:
Sub ChangePropertiesOfAllGroupMembers()
'VBA51
Dim objGroup As HMIGroup
Dim iMaxMembers As Integer
Dim iIndex As Integer
Set objGroup = ActiveDocument.HMIObjects("My Group")
iIndex = 1
'
'Get number of objects in group-object:
iMaxMembers = objGroup.GroupedHMIObjects.Count
'
'set linecolor of all objects = "yellow":
For iIndex = 1 To iMaxMembers
objGroup.GroupedHMIObjects(iIndex).Properties("BorderColor") =
RGB(255, 255, 0)
Next iIndex
End Sub
5. Always start the procedure with <F5>.

See also
Properties Object (Listing) (Page 3410)
GroupedObjects Object (Listing) (Page 3355)
Ungroup Method (Page 3267)
Remove Method (Page 3248)
Delete Method (Page 3210)
Add Method (GroupedObjects Listing) (Page 3172)
How to Edit the Group Objects Using VBA (Page 3069)
Group Objects (Page 3067)
Editing Objects with VBA (Page 3053)
VBA in the Graphics Designer (Page 3015)

5.3.4.4

Customized Objects

Customized Objects
Introduction
You can use VBA to create a customized object from selected objects in the Graphics Designer.
In contrast to the group object, in the case of a customized object only those object properties

3074

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
are available which you have selected in the "Configuration Dialog" for the customized object.
It is not possible to configure a customized object with VBA.
Further information regarding customized objects can be found in the WinCC documentation
under "Customized Object".

Creating a customized object with VBA


Use the "CreateCustomizedObject()" method to create a customized object from selected
objects:

Sub CreateCustomizedObject()
'VBA52
Dim objCustomizedObject As HMICustomizedObject
Set objCustomizedObject = ActiveDocument.Selection.CreateCustomizedObject
objCustomizedObject.ObjectName = "My Customized Object"
End Sub

When you apply the "CreateCustomizedObject()" method, the "Configuration Dialog" appears
in which you select the object properties. The customized object that you have created is added
to the "HMIObjects" listing. Give the customized object an appropriate name
(objCustomizedObject.Name = "My Customized Object") so that you can uniquely identify it.
Note
If you open a document as invisible, do not create a user object there with a VBA script.
Program execution will otherwise be interrupted by a configuration dialog.

Editing Customized Objects


You can edit a customized object as follows:
"Destroy" method: Ungroups the customized object.
"Delete" Method: Deletes the customized object and the objects that it contains.

Editing objects in a customized object


Use the "Properties" property to access the selected object properties of the objects contained
in the customized object.

Sub EditCustomizedObjectProperty()
'VBA53
Dim objCustomizedObject As HMICustomizedObject
Set objCustomizedObject = ActiveDocument.HMIObjects(1)
objCustomizedObject.Properties("BackColor") = RGB(255, 0, 0)
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3075

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
If you have selected more than one identical property (for example the background color of a
circle and of a rectangle), these properties will be numbered ("BackColor" and "BackColor1").

See also
HMIObject Object (Page 3359)
CustomizedObject Object (Page 3312)
Destroy Method (Page 3214)
Delete Method (Page 3210)
CreateCustomizedObject Method (Page 3204)
How to Edit a Customized Object with VBA (Page 3078)
How to Edit the Group Objects Using VBA (Page 3069)
Group Objects (Page 3067)
Editing Objects with VBA (Page 3053)

How to Edit a Customized Object with VBA


Introduction
Here you will find the following instructions for editing a customized object with VBA:
Creating a customized object from selected objects
Ungrouping Customized Objects
Deleting a customized object
Note
It is not possible to configure a customized object with VBA.

3076

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor").
2. Open the document "ThisDocument" in the Project Explorer:

3. To create a customized object from selected objects, you can for example insert a
"CreateCustomizedObject()" procedure in the document "ThisDocument". In this example
the customized object "My Customized Object" is created from selected objects:
Sub CreateCustomizedObject()
'VBA54
Dim objCustomizedObject As HMICustomizedObject
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle",
"HMICircle")
Set objRectangle =
ActiveDocument.HMIObjects.AddHMIObject("sRectangle",
"HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objCustomizedObject =
ActiveDocument.Selection.CreateCustomizedObject
'
'*** The "Configurationdialog" started. ***
'*** Configure the costumize-object with the "configurationdialog"
***
'
objCustomizedObject.ObjectName = "My Customized Object"
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3077

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
4. To delete an object, you can for example insert a "DeleteObject()" procedure in the
document "ThisDocument". In this example the customized object "My Customized Object"
created beforehand is deleted again:
Sub DestroyCustomizedObject()
'VBA55
Dim objCustomizedObject As HMICustomizedObject
Set objCustomizedObject = ActiveDocument.HMIObjects("My
Customized Object")
objCustomizedObject.Destroy
End Sub
5. To delete a customized object, you can for example insert a "DeleteCustomizedObject()"
procedure in the document "ThisDocument". In this example the customized object "My
Customized Object" created beforehand is deleted:
Sub DeleteCustomizedObject()
'VBA56
Dim objCustomizedObject As HMICustomizedObject
Set objCustomizedObject = ActiveDocument.HMIObjects("My
Customized Object")
objCustomizedObject.Delete
End Sub
6. Always start the procedure with <F5>.

See also
Destroy Method (Page 3214)
Delete Method (Page 3210)
CreateCustomizedObject Method (Page 3204)
Customized Objects (Page 3074)

3078

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.5

Creating Dynamics with VBA

5.3.5.1

Creating Dynamics with VBA

Introduction
VBA allows you to add dynamics to properties of pictures and objects and to configure eventcontrolled actions. VBA provides you with the ActionDynamic object for this purpose:

The ActionDynamic object represents an interface that is dependent on the object type:
When you configure a dynamic for a property (Property object), the ActionDynamic object
inherits the properties of the ScriptInfo, Trigger and DynamicDialog objects.
When you configure an event-controlled action (Event object), the ActionDynamic object
inherits the properties of the ScriptInfo and DirectConnection objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3079

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Adding dynamics to properties of pictures and objects


VBA enables you to add dynamics to properties of pictures and objects. You can use tags,
scripts or the Dynamic dialog to add dynamics. Using dynamics enables you for example to
configure a color change for an object in runtime when the value of a variable changes.

Configuring event-controlled actions


You can configure event-controlled actions with VBA. An action (script or direct connection) is
triggered then the defined event occurs in runtime. An event may be a change to an object
property, for example, or the clicking of a button.

Editing Triggers
You can edit triggers with VBA. Triggers are required when you use dynamics. They determine
when a dynamic value is updated in runtime. This may occur at regular intervals, for example,
or in the event of a picture change.
When you configure event-controlled actions, the event is the trigger.

See also
Editing Triggers (Page 3102)
Configuring Event-Driven Actions with VBA (Page 3094)
Configuring Dynamics in the Properties of Pictures and Objects (Page 3082)

5.3.5.2

Configuring Dynamics in the Properties of Pictures and Objects

Configuring Dynamics in the Properties of Pictures and Objects


Introduction
VBA enables you to add dynamics to properties of pictures and objects. Dynamic object
properties can be changed as a function of a variable value in Runtime, for example. The
following methods of adding dynamics are possible:
Tag connection
Dynamic dialog
Scripts

3080

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Principle
The following example illustrates the principle of the procedure for adding dynamics to an
object property:

Sub CreateDynamicOnProperty()
'VBA57
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
'
'Create dynamic with type "direct Variableconnection" at the
'property "Radius":
Set objVariableTrigger =
objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVariableDirect, "'NewDynamic1'")
'
'To complete dynamic, e.g. define cycle:
With objVariableTrigger
.CycleType = hmiVariableCycleType_2s
End With
End Sub

Note
Note that a variable is not created simply by specifying the variable name. Use the variable
selection dialog to create the variable.

Tag connection
Use the VariableTrigger object to add a dynamic to a property with a direct or indirect variable
connection. The dynamic property then responds in runtime to a change in value to the
specified variable. To allow this, in VBA you need to specify the variable name (VarName
property) and the cycle (CycleTime property).

Dynamic dialog
Use the DynamicDialog object to add a dynamic to a property with the aid of the Dynamic
dialog. The dynamic property responds in runtime to a variable's value ranges. The following
objects are available for specifying the value range:
AnalogResultInfos-Objekt: Use this object to assign a fixed value to value ranges of a
variable or a script. The fixed value is assigned to the dynamic property when the variable
value or return value of the script is within the specified value range.
BinaryResultInfo Object: Use this object to assign a fixed value to binary value ranges (zero
and non-zero) of a variable or a script. The fixed value is assigned to the dynamic property
when the variable value or return value of the script returns one of the two values.
VariableStateValue Object Use this object to assign a fixed value to the state (e.g. "Upper
limit exceeded") of a specified variable. The fixed value is then allocated to the dynamic
property when the state occurs.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3081

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Scripts
Use the ScriptInfo object to add a dynamic to a property with a C or VB script. The property
with the dynamic reacts to a script in Runtime and is controlled via a trigger. Use the Trigger
object for configuring the trigger.

See also
VariableTrigger Object (Page 3466)
VariableStateValue Object (Page 3463)
Trigger Object (Page 3454)
ScriptInfo Object (Page 3426)
BinaryResultInfo Object (Page 3293)
AnalogResultInfos Object (Listing) (Page 3283)
How to dynamize a property with a VB script (Page 3092)
How to dynamize a property with a C script (Page 3089)
How to dynamize a property with the Dynamic dialog (Page 3086)
How to dynamize a property with a tag connection (Page 3084)
Creating Dynamics with VBA (Page 3079)

How to dynamize a property with a tag connection


Introduction
Here you will find the following instructions for dynamizing a property with tag connection:
Dynamizing a property with direct tag connection
Dynamizing a property with indirect tag connection

3082

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To dynamize an object property with a direct tag connection, you can for example insert an
"AddDynamicAsVariableDirectToProperty()" procedure in the document. "In this example
a circle property "Top" will be made dynamic with the aid of the tag Otto:
Sub AddDynamicAsVariableDirectToProperty()
'VBA58
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1",
"HMICircle")
'Create dynamic at property "Top"
Set objVariableTrigger =
objCircle.Top.CreateDynamic(hmiDynamicCreationTypeVariableDirect,
"Otto")
'
'define cycle-time
With objVariableTrigger
.CycleType = hmiVariableCycleType_2s
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3083

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
4. To dynamize an object property with an indirect tag connection, you can for example insert
an "AddDynamicAsVariableInDirectToProperty"() procedure in the document. "In this
example a circle property Left" will be made dynamic with the aid of the tag "Anton":
Sub AddDynamicAsVariableIndirectToProperty()
'VBA59
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle2",
"HMICircle")
'Create dynamic on property "Left":
Set objVariableTrigger =
objCircle.Left.CreateDynamic(hmiDynamicCreationTypeVariableIndirec
t, "Anton")
'
'Define cycle-time
With objVariableTrigger
.CycleType = hmiVariableCycleType_2s
End With
End Sub
5. Start the procedure with <F5>.

See also
CycleType Property (Page 3570)
VarName Property (Page 3878)
VariableTrigger Object (Page 3466)
CreateDynamic Method (Page 3206)
How to dynamize a property with a VB script (Page 3092)
How to dynamize a property with a C script (Page 3089)
How to dynamize a property with the Dynamic dialog (Page 3086)
Configuring Dynamics in the Properties of Pictures and Objects (Page 3080)
Creating Dynamics with VBA (Page 3079)

How to dynamize a property with the Dynamic dialog


Introduction
You can use the Dynamic dialog to dynamize properties of pictures and objects depending on
certain value ranges or variable states. The following value ranges are available for selection:
Analog
Binary
Bit
Direct

3084

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
With VBA you specify the type of value range with the ResultType property. These instructions
illustrate the addition of dynamics to an object property with analog value ranges. Additional
information dynamization with the dynamic dialog is provided under "DynamicDialog object"
in the VBA reference in this documentation.

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3. To dynamize an object property with the Dynamic dialog, you can for example insert an
"AddDynamicDialogToCircleRadiusTypeAnalog()" procedure in the document. In the
following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned and three analog value ranges will be created:
4. Start the procedure with <F5>.

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA60
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
'
'Create dynamic
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog, "'NewDynamic1'")
'
'Configure dynamic. "ResultType" defines the type of valuerange:
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3085

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

.AnalogResultInfos.ElseCase = 100
End With
End Sub

New VBA method to configure dynamization using the Dynamic Dialog


For optimization reasons, an additional new method has been provided:
CreateDynamicDialog([Code as String], iResultType as Long) as HMIActionDynamic
The parameter "IResultType" has the following constants:
hmiResultTypeDirect = 0
hmiResultTypeAnalog= 1
hmiResultTypeBool = 2
hmiResultTypeBit = 3
In the following example the radius of a circle is given dynamics with the A tag name and a
"ResultType" are assigned to the dynamic dialog.

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA820
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
'Create Object
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("myCircle","HMICircle")
'Create dynamic (Tag "myTest" must exist")
Set objDynDialog = objCircle.Radius.CreateDynamicDialog("'myTest'",0)
End Sub

Initializing a string property


A string property must be initialized before being made dynamic by assigning a text to it. In
the following ToolTipText example, this is done in "objCircle.ToolTipText = "Text".

Sub Dyn()
'VBA823
Dim objCircle As HMICircle
Dim doc As Document
Dim objDynDialog As HMIDynamicDialog
Set doc = ActiveDocument
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle","HMICircle")
objCircle.ObjectName = "Circle1"
objCircle.BorderColor = RGB(255, 0, 0)

3086

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

objCircle.BackColor = RGB(0, 255, 0)


objCircle.ToolTipText = "Text"
Set objDynDialog = objCircle.ToolTipText.CreateDynamic(hmiDynamicCreationTypeDynamicDialog, "'Var'")
End Sub

See also
How to dynamize a property with a tag connection (Page 3082)
ResultType Property (Page 3745)
DynamicDialog Object (Page 3327)
CreateDynamic Method (Page 3206)
How to dynamize a property with a VB script (Page 3092)
How to dynamize a property with a C script (Page 3089)
Configuring Dynamics in the Properties of Pictures and Objects (Page 3080)
Creating Dynamics with VBA (Page 3079)
ToolTipText Property (Page 3786)

How to dynamize a property with a C script


Introduction
When you dynamize a property with a C script, you can assign the C code to the "SourceCode"
property. The C script is compiled in the background. The "Compiled" property returns "True"
when the C code has been successfully compiled.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3087

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3088

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To add dynamics to an object property with a C script, you can for example insert an
"AddDynamicAsCScriptToProperty()" procedure in the document. In this example the
height of a circle is increased by 5 pixels every two seconds in runtime:
Sub AddDynamicAsCSkriptToProperty()
'VBA61
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
Dim strCode As String
strCode = "long lHeight;" & vbCrLf & "int check;" & vbCrLf
strCode = strCode & "GetHeight(""events.PDL"",""myCircle"");" &
vbCrLf
strCode = strCode & "lHeight = lHeight+5;" & vbCrLf
strCode = strCode & "check = SetHeight(""events.PDL"",
""myCircle"", lHeight );"
strCode = strCode & vbCrLf & "//Return-Type: BOOL" & vbCrLf
strCode = strCode & "return check;"
Set objCircle =
ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
'Create dynamic for Property "Height":
Set objCScript =
objCircle.Height.CreateDynamic(hmiDynamicCreationTypeCScript)
'
'set Sourcecode and cycletime:
With objCScript
.SourceCode = strCode
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub
4. Start the procedure with <F5>.

See also
Trigger Property (Page 3791)
ScriptType Property (Page 3753)
SourceCode Property (Page 3768)
CycleType Property (Page 3570)
ScriptInfo Object (Page 3426)
CreateDynamic Method (Page 3206)
How to dynamize a property with a VB script (Page 3092)
How to dynamize a property with the Dynamic dialog (Page 3084)
How to dynamize a property with a tag connection (Page 3082)
Configuring Dynamics in the Properties of Pictures and Objects (Page 3080)
Creating Dynamics with VBA (Page 3079)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3089

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

How to dynamize a property with a VB script


Introduction
When you dynamize a property with a VB script, you can assign the VB code to the
"SourceCode" property. The VB script is compiled in the background. The "Compiled" property
returns "True" if the VB code is syntactically correct.

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3090

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To add dynamics to an object property with a VB script, you can for example insert an
"AddDynamicAsVBScriptToProperty()" procedure in the document. In this example the
radius of a circle is increased by 5 pixels every two seconds in Runtime:
Sub AddDynamicAsVBSkriptToProperty()
'VBA62
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Dim strCode As String
strCode = "Dim myCircle" & vbCrLf & "Set myCircle = "
strCode = strCode &
"HMIRuntime.ActiveScreen.ScreenItems(""myCircle"")"
strCode = strCode & vbCrLf & "myCircle.Radius = myCircle.Radius +
5"
Set objCircle =
ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
'
'Create dynamic of property "Radius":
Set objVBScript =
objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
'
'Set SourceCode and cycletime:
With objVBScript
.SourceCode = strCode
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub
4. Start the procedure with <F5>.

See also
How to dynamize a property with a C script (Page 3087)
Trigger Property (Page 3791)
SourceCode Property (Page 3768)
CycleType Property (Page 3570)
ScriptInfo Object (Page 3426)
CreateDynamic Method (Page 3206)
How to dynamize a property with the Dynamic dialog (Page 3084)
How to dynamize a property with a tag connection (Page 3082)
Configuring Dynamics in the Properties of Pictures and Objects (Page 3080)
Creating Dynamics with VBA (Page 3079)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3091

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.5.3

Configuring Event-Driven Actions with VBA

Configuring Event-Driven Actions with VBA


Introduction
With VBA you can configure actions for pictures and objects which are triggered when
predefined events occur. For example, when the mouse is clicked on an object in Runtime a
C script is called whose return value is used for the dynamics of an object property. The
following methods of adding dynamics are possible:
Direct connection
Scripts
The events that are used for configuring event-controlled actions occur only in Runtime and
have nothing to do with the VBA event handlers.

General Procedure
You use the Events property for configuring event-controlled actions with VBA. The way this
property is used depends on whether you are configuring an action on an object or picture or
a property.
Configuring an action on an object or picture
An action that you configure on a picture or object is triggered when a predefined event occurs,
for example when the object is clicked on with the mouse. You configure an action on an object
with VBA by using the "Events(Index)" property, where "Index" stands for the triggering event:

Sub AddActionToObjectTypeCScript()
'VBA63
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
'Create circle. Click on object executes an C-action
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
'
'Assign a corresponding custom-function to the property "SourceCode":
objCScript.SourceCode = ""
End Sub

Configuring an action on a property


An action that you configure on a property of a picture or object is triggered when the property
value changes. You configure an action on a property with VBA by using the "Events(1)"
property, where the index "1" stands for the event "Upon change":

3092

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Sub AddActionToPropertyTypeCScript()
'VBA64
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
'Create circle. Changing of the Property
'"Radius" should be activate C-Aktion:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
'
'Assign a corresponding custom-function to the property "SourceCode":
objCScript.SourceCode = ""
End Sub

Direct connection
Use the DirectConnection object to configure a direct connection.

Scripts
Use the ScriptInfo object if you want an event to trigger a C or VB action.

See also
How to configure a VB action with VBA on an event (Page 3100)
Events Property (Page 3583)
ScriptInfo Object (Page 3426)
Event Object (Page 3338)
How to configure a C action with VBA on an event (Page 3098)
How to configure a direct connection with VBA (Page 3095)
Event Handling (Page 3105)
Creating Dynamics with VBA (Page 3079)

How to configure a direct connection with VBA


Introduction
These instructions show you how to configure a direct connection on the basis of two object
properties. Further information on the configuring of direct connections with VBA is given in
the VBA reference in this documentation under "AutomationName property" and "ObjectName
property"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3093

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3094

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To configure a direct connection to an object property, you can for example insert an
"AddDirectConnectionToObject()" procedure in the document. In the following example the
X position of "Rectangle_A" is copied to the Y position of "Rectangle_B" in Runtime by
clicking on the button:
Sub DirectConnection()
'VBA65
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDConnection As HMIDirectConnection
'
'Create objects:
Set objRectangleA =
ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A",
"HMIRectangle")
Set objRectangleB =
ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B",
"HMIRectangle")
Set objButton =
ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "SetPosition"
End With
'
'Directconnection is initiated by mouseclick:
Set objDConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectC
onnection)
With objDConnection
'Sourceobject: Property "Top" of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Destinationobject: Property "Left" of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3095

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
End Sub
4. Start the procedure with <F5>.

See also
ObjectName Property (Page 3700)
AutomationName Property (Page 3490)
SourceLink Object (Page 3433)
DestLink Object (Page 3318)
DirectConnection Object (Page 3320)
Configuring Event-Driven Actions with VBA (Page 3092)

How to configure a C action with VBA on an event


Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3096

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To configure a C action on an event with VBA, you can for example insert a
"CreateCActionToClickedEvent()" procedure in the document. In this example a button and
a circle will be inserted in the active picture. In Runtime the height increases every time you
click the button:
Sub CreateCActionToClickedEvent()
'VBA66
Dim objButton As HMIButton
Dim objCircle As HMICircle
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim strCode As String
strCode = "long lHeight;" & vbCrLf & "int check;" & vbCrLf
strCode = strCode & "lHeight = GetHeight (""events.PDL"",
""myCircle"");"
strCode = strCode & vbCrLf & "lHeight = lHeight+5;" & vbCrLf &
"check = "
strCode = strCode & "SetHeight(""events.PDL"",
""myCircle"",lHeight);"
strCode = strCode & vbCrLf & "//Return-Type: Void"
Set objCircle =
ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
Set objButton =
ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircle
.Top = 100
.Left = 100
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "Increase height"
End With
'Configure directconnection:
Set objCScript =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeCScript
)
With objCScript
'
'Note: Replace "events.PDL" with your picturename
.SourceCode = strCode
End With
End Sub
4. Start the procedure with <F5>.

See also
ScriptInfo Object (Page 3426)
Events Object (Listing) (Page 3339)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3097

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
Actions Object (Listing) (Page 3273)
Configuring Event-Driven Actions with VBA (Page 3092)

How to configure a VB action with VBA on an event


Procedure
1. Open the VBA editor in Graphics Designer (<ALT+F11> or "Tools" > "Macros" > "Visual
Basic Editor")
2. In Project Explorer, open the document in which you want to write the VBA code:

3098

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer
3. To configure an event-oriented VB action with VBA, you can for example insert a
"CreateVBActionToClickedEvent()" procedure in the document. In this example a button
and a circle will be inserted in the active picture. In Runtime the radius of the circle enlarges
every time you click the button:
Sub CreateVBActionToClickedEvent()
'VBA67
Dim objButton As HMIButton
Dim objCircle As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Dim strCode As String
strCode = "Dim myCircle" & vbCrLf & "Set myCircle = "
strCode = strCode &
"HMIRuntime.ActiveScreen.ScreenItems(""Circle_VB"")"
strCode = strCode & vbCrLf & "myCircle.Radius = myCircle.Radius +
5"
Set objCircle =
ActiveDocument.HMIObjects.AddHMIObject("Circle_VB", "HMICircle")
Set objButton =
ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircle
.Top = 100
.Left = 100
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 120
.Text = "Increase Radius"
End With
'Define event and assign sourcecode:
Set objVBScript =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScrip
t)
With objVBScript
.SourceCode = strCode
End With
End Sub
4. Start the procedure with <F5>.

See also
Actions Object (Listing) (Page 3273)
ScriptInfo Object (Page 3426)
Events Object (Listing) (Page 3339)
Configuring Event-Driven Actions with VBA (Page 3092)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3099

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.5.4

Editing Triggers

Editing Triggers
Introduction
You use triggers in connection with dynamics for graphics objects and for triggering actions
on object properties. Examples of triggers include:
Tags: When the value of a tag is changed or its limit is exceeded at either extreme
Standard cycle: Cyclic execution of the action. The length of the cycles is selectable
between 250 ms and 1 h. In addition, you can also use customized cycles that you define
yourself.
Picture cycle: A cyclic trigger is used as the trigger. This cycle provides the option of defining
the cycles of all the actions, tag connections and dynamic dialogs used in a picture centrally.
Window Cycle: A cyclic trigger is used as the trigger. This values applies to all actions, tag
links and dynamic dialogs, which were configured with the trigger type "Window cycle".
When you configure an action that responds to an event on a graphics object, the triggering
event is the trigger.

Configuring triggers with VBA


Use the Trigger object to configure a trigger with VBA. If you intend to use a variable as the
trigger, use the VariableTrigger object:

You determine the type of trigger with the Type property. Use the VariableTriggers property
when you configure a variable as the trigger.

See also
Examples of Editing Triggers with VBA (Page 3103)
VariableTrigger Object (Page 3466)
Trigger Object (Page 3454)
ScriptInfo Object (Page 3426)

3100

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Examples of Editing Triggers with VBA


Introduction
The four examples below illustrate how you can create the following triggers with VBA:
Standard cycle
Tag
Picture cycle
Window Cycle
In all of these examples a circle is inserted into the active picture, with the radius of the circle
being dynamized with a VB action.
The procedure for adding dynamics to a property with variable connection is explained under
"Adding dynamics to a property with a variable connection" in this documentation.

Example 1: Standard cycle

Sub DynamicWithStandardCycle()
'VBA68
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_Standard", "HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
.Trigger.Type = hmiTriggerTypeStandardCycle
'"CycleType"-specification is necessary:
.Trigger.CycleType = hmiCycleType_10s
.Trigger.Name = "VBA_StandardCycle"
.SourceCode = ""
End With
End Sub

Example 2: Tag

Sub DynamicWithVariableTriggerCycle()
'VBA69
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3101

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

End Sub

Example 3: Picture cycle

Sub DynamicWithPictureCycle()
'VBA70
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_Picture", "HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
.Trigger.Type = hmiTriggerTypePictureCycle
.Trigger.Name = "VBA_PictureCycle"
.SourceCode = ""
End With
End Sub

Example 4: Window Cycle

Sub DynamicWithWindowCycle()
'VBA71
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_Window", "HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
.Trigger.Type = hmiTriggerTypeWindowCycle
.Trigger.Name = "VBA_WindowCycle"
.SourceCode = ""
End With
End Sub

See also
VariableTrigger Object (Page 3466)
Trigger Object (Page 3454)
ScriptInfo Object (Page 3426)
Editing Triggers (Page 3100)

3102

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

5.3.6

Event Handling

Introduction
In the Graphics Designer, events occur when certain actions are taken (for example when a
picture is opened). You can respond to an event with a predefined VBA event handler in order
to execute instructions.
The events occur only during configuring in the Graphics Designer and are not available in
Runtime. These events must not be confused with the events (e.g. mouse click, property
change) occurring on graphic objects and pictures.
Note
When the Graphics Designer is open, events are also triggered by other editors.
. This applies, for example, to the modification of picture properties in WinCCExplorer. Close
the Graphics Designer when you are making changes to pictures in other editors. This
prevents events from being executed when you do not want them to be.
Note
If you open a picture in Graphics Designer, not only the "DocumentOpened event" of the
active picture but also that of the "Project Template" and of the "Global Template" are
triggered. The VBA code of the "DocumentOpened event" is thereby executed twice.
You must intercept this behavior with the event handler.

General Procedure
In event handling there are events with and without forwarding. You can recognize an event
with forwarding by the presence of the "CancelForwarding" parameter. An event without
forwarding does not have this parameter. When an event occurs, it is sent to the active picture
and then forwarded to the "Global Template".

An event with forwarding is therefore forwarded by default via the document "Project Template"
to the document "Global Template".
Preventing forwarding
You can prevent the forwarding of an event by setting the "CancelForwarding" parameter to
"True" in the VBA event handler:

Sub Document_HMIObjectPropertyChanged(ByVal Property As IHMIProperty, CancelForwarding As


Boolean)
'VBA72
CancelForwarding = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3103

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

MsgBox "Object's property has been changed!"


End Sub

Picture-specific and application-specific events


Quite apart from the information given above about events with and without forwarding, the
Graphics Designer differentiates between picture-specific and application-specific events:
Picture-specific events
Picture-specific events always respond to actions that occur in the active picture in the
Graphics Designer. Such actions include, for example, the changing of object properties or
saving the active picture. You can obtain a list of available picture-specific events by choosing
"Document" in the VBA editor:

Application-specific events
Application-specific events respond to actions that occur in the "Graphics Designer"
application. Such actions include, for example, starting the Graphics Designer or creating an
object in the component library.
To make the application-specific events available, write the following statement in the VBA
editor at the start of the document (preferably the "Project Template" or "Global Template"):
Dim WithEvents <Name> As grafexe.Application
The effect of this statement is that it will now also be possible to select the application-specific
events from the list in the Graphics Designer:

3104

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Example 1: Occurrence of an event with forwarding


The illustration shows the sequence that follows from the occurrence of an event with
forwarding:

Note
There are events which are both picture-specific and application-specific (for example
BeforeDocumentSave). When such an event occurs, the program checks whether the
corresponding application-specific event handler has been defined. The sequence shown
above does not begin until after that.

Example 2: Occurrence of an event without forwarding


The illustration shows the sequence that follows from the occurrence of an event without
forwarding:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3105

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Disabling event handling


You can disable event handling by setting the "DisableVBAEvents" property for the Application
object to "True".

See also
DisableVBAEvents Property (Page 3574)
Organizing VBA Code in a WinCC Project (Page 3009)

5.3.7

Accessing External Applications with VBA

5.3.7.1

Accessing External Applications with VBA

Introduction
You can use VBA to access programs which support VBA, for example products in the
Microsoft Office family. This enables you, for example, to read out values from an MS Excel
worksheet and then assign these to object properties.

Note
No direct usage of Unicode in Excel VBA and Word VBA
Excel VBA and Word VBA supports the use of Unicode characters only by means of
<ChrW(unicode-id) function.

3106

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Registering an external application


You have to integrate an external application in the VBA editor in order to make its object library
available. To do this, select the "References" option in the "Tools" menu in the VBA editor. In
the "References" dialog you can then select the required object library:

Note
You must attach the external application to all projects which you want to be able to access
the external application; do this in the VBA editor Project Explorer.

See also
Example: Accessing MS Excel with VBA (Page 3109)

5.3.7.2

Example: Accessing MS Excel with VBA

Introduction
The following three examples illustrate how to access MS Excel. For these examples to work,
the MS Excel object library must be integrated via a reference.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3107

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

Note
No direct usage of Unicode in Excel VBA and Word VBA
Excel VBA and Word VBA supports the use of Unicode characters only by means of
<ChrW(unicode-id) function.

Example 1
In this example the default object list of the Graphics Designer is exported in an Excel
worksheet. The object properties are taken into account, as is the question of whether
dynamics can be used with these properties. The VBA data type is also displayed.

Sub ExportDefObjListToXLS()
'VBA73
'Microsoft Excel Object Library needs to be referenced
Dim objGDApplication As grafexe.Application
Dim objHMIObject As grafexe.HMIObject
Dim objProperty As grafexe.HMIProperty
Dim objXLS As Excel.Application
Dim objWSheet As Excel.Worksheet
Dim objWBook As Excel.Workbook
Dim rngSelection As Excel.Range
Dim lRow As Long
Dim lRowGroupStart As Long
'define local errorhandler
On Local Error GoTo LocErrTrap
'Set references to the applications Excel and GraphicsDesigner
Set objGDApplication = grafexe.Application
Set objXLS = New Excel.Application
'Create workbook
Set objWBook = objXLS.Workbooks.Add()
objWBook.SaveAs objGDApplication.ApplicationDataPath & "DefaultObjekte.xls"
'Adds new worksheet to the new workbook
Set objWSheet = objWBook.Worksheets.Add
objWSheet.Name = "DefaultObjekte"
lRow = 1
'Every object of the DefaultHMIObjects-collection will be written
'to the worksheet with their objectproperties.
'For better overview the objects will be grouped.
For Each objHMIObject In objGDApplication.DefaultHMIObjects
DoEvents
objWSheet.Cells(lRow, 1).value = objHMIObject.ObjectName
objWSheet.Cells(lRow, 2).value = objHMIObject.Type
lRow = lRow + 1
lRowGroupStart = lRow

3108

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

For Each objProperty In objHMIObject.Properties


'Write displayed name and automationname of property
'into the worksheet
objWSheet.Cells(lRow, 2).value = objProperty.DisplayName
objWSheet.Cells(lRow, 3).value = objProperty.Name
'Write the value of property, datatype and if their dynamicable
'into the worksheet
If Not IsEmpty(objProperty.value) Then _
objWSheet.Cells(lRow, 4).value = objProperty.value
objWSheet.Cells(lRow, 5).value = objProperty.IsDynamicable
objWSheet.Cells(lRow, 6).value = TypeName(objProperty.value)
objWSheet.Cells(lRow, 7).value = VarType(objProperty.value)
lRow = lRow + 1
Next objProperty
'Select and groups the range of object-properties in the worksheet
Set rngSelection = objWSheet.Range(objWSheet.Rows(lRowGroupStart), _
objWSheet.Rows(lRow - 1))
rngSelection.Select
rngSelection.Group
Set rngSelection = Nothing
'Insert empty row
lRow = lRow + 1
Next objHMIObject
objWSheet.Columns.AutoFit
Set objWSheet = Nothing
objWBook.Save
objWBook.Close
Set objWBook = Nothing
objXLS.Quit
Set objXLS = Nothing
Set objGDApplication = Nothing
Exit Sub
LocErrTrap:
MsgBox Err.Description, , Err.Source
Resume Next
End Sub

Example 2
In this example all objects of the active picture are exported to an Excel worksheet. The
properties taken into account are Position X, Position Y, Width, Height and Layer:

Sub ExportObjectListToXLS()
'VBA74
Dim objGDApplication As grafexe.Application
Dim objDoc As grafexe.Document
Dim objHMIObject As grafexe.HMIObject
Dim objProperty As grafexe.HMIProperty
Dim objXLS As Excel.Application
Dim objWSheet As Excel.Worksheet
Dim objWBook As Excel.Workbook
Dim lRow As Long

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3109

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

'Define local errorhandler


On Local Error GoTo LocErrTrap
'Set references on the applications Excel and GraphicsDesigner
Set objGDApplication = grafexe.Application
Set objDoc = objGDApplication.ActiveDocument
Set objXLS = New Excel.Application
'Create workbook
Set objWBook = objXLS.Workbooks.Add()
objWBook.SaveAs objGDApplication.ApplicationDataPath & "Export.xls"
'Create worksheet in the new workbook and write headline
'The name of the worksheet is equivalent to the documents name
Set objWSheet = objWBook.Worksheets.Add
objWSheet.Name = objDoc.Name
objWSheet.Cells(1, 1) = "Objektname"
objWSheet.Cells(1, 2) = "Objekttyp"
objWSheet.Cells(1, 3) = "ProgID"
objWSheet.Cells(1, 4) = "Position X"
objWSheet.Cells(1, 5) = "Position Y"
objWSheet.Cells(1, 6) = "Width"
objWSheet.Cells(1, 7) = "Hhe"
objWSheet.Cells(1, 8) = "Ebene"
lRow = 3
'Every objects will be written with their objectproperties width,
'height, pos x, pos y and layer to Excel. If the object is an
'ActiveX-Control the ProgID will be also exported.
For Each objHMIObject In objDoc.HMIObjects
DoEvents
objWSheet.Cells(lRow, 1).value = objHMIObject.ObjectName
objWSheet.Cells(lRow, 2).value = objHMIObject.Type
If UCase(objHMIObject.Type) = "HMIACTIVEXCONTROL" Then
objWSheet.Cells(lRow, 3).value = objHMIObject.ProgID
End If
objWSheet.Cells(lRow, 4).value = objHMIObject.Left
objWSheet.Cells(lRow, 5).value = objHMIObject.Top
objWSheet.Cells(lRow, 6).value = objHMIObject.Width
objWSheet.Cells(lRow, 7).value = objHMIObject.Height
objWSheet.Cells(lRow, 8).value = objHMIObject.Layer
lRow = lRow + 1
Next objHMIObject
objWSheet.Columns.AutoFit
Set objWSheet = Nothing
objWBook.Save
objWBook.Close
Set objWBook = Nothing
objXLS.Quit
Set objXLS = Nothing
Set objDoc = Nothing
Set objGDApplication = Nothing
Exit Sub
LocErrTrap:
MsgBox Err.Description, , Err.Source
Resume Next

3110

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

End Sub

Example 3
In this example objects are imported from the Excel worksheet created in example 2. The
properties taken into account are Position X, Position Y, Width, Height and Layer:

Sub ImportObjectListFromXLS()
'VBA75
Dim objGDApplication As grafexe.Application
Dim objDoc As grafexe.Document
Dim objHMIObject As grafexe.HMIObject
Dim objXLS As Excel.Application
Dim objWSheet As Excel.Worksheet
Dim objWBook As Excel.Workbook
Dim lRow As Long
Dim strWorkbookName As String
Dim strWorksheetName As String
Dim strSheets As String
'define local errorhandler
On Local Error GoTo LocErrTrap
'Set references on the applications Excel and GraphicsDesigner
Set objGDApplication = Application
Set objDoc = objGDApplication.ActiveDocument
Set objXLS = New Excel.Application
'Open workbook. The workbook have to be in datapath of GraphicsDesigner
strWorkbookName = InputBox("Name of workbook:", "Import of objects")
Set objWBook = objXLS.Workbooks.Open(objGDApplication.ApplicationDataPath &
strWorkbookName)
If objWBook Is Nothing Then
MsgBox "Open workbook fails!" & vbCrLf & "This function is cancled!", vbCritical, "Import
od objects"
Set objDoc = Nothing
Set objGDApplication = Nothing
Set objXLS = Nothing
Exit Sub
End If
'Read out the names of all worksheets contained in the workbook
For Each objWSheet In objWBook.Sheets
strSheets = strSheets & objWSheet.Name & vbCrLf
Next objWSheet
strWorksheetName = InputBox("Name of table to import:" & vbCrLf & strSheets, "Import of
objects")
Set objWSheet = objWBook.Sheets(strWorksheetName)
lRow = 3
'Import the worksheet as long as in actual row the first column is empty.
'Add with the outreaded data new objects to the active document and
'assign the values to the objectproperties

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3111

VBA for Automated Configuration


5.3 VBA in the Graphics Designer

With objWSheet
While (.Cells(lRow, 1).value <> vbNullString) And (Not IsEmpty(.Cells(lRow, 1).value))
'Add the objects to the document as its objecttype,
'do nothing by groups, their have to create before.
If (UCase(.Cells(lRow, 2).value) = "HMIGROUP") Then
Else
If (UCase(.Cells(lRow, 2).value) = "HMIACTIVEXCONTROL") Then
Set objHMIObject = objDoc.HMIObjects.AddActiveXControl(.Cells(lRow,
1).value, .Cells(lRow, 3).value)
Else
Set objHMIObject = objDoc.HMIObjects.AddHMIObject(.Cells(lRow, 1).value, .Cells(lRow,
2).value)
End If
objHMIObject.Left = .Cells(lRow, 4).value
objHMIObject.Top = .Cells(lRow, 5).value
objHMIObject.Width = .Cells(lRow, 6).value
objHMIObject.Height = .Cells(lRow, 7).value
objHMIObject.Layer = .Cells(lRow, 8).value
End If
Set objHMIObject = Nothing
lRow = lRow + 1
Wend
End With
objWBook.Close
Set objWBook = Nothing
objXLS.Quit
Set objXLS = Nothing
Set objDoc = Nothing
Set objGDApplication = Nothing
Exit Sub
LocErrTrap:
MsgBox Err.Description, , Err.Source
Resume Next
End Sub

3112

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.4 AddIns

5.4

AddIns

5.4.1

AddIns

Introduction
An AddIn is a code which cannot be viewed and is stored as a DLL. Addins can make new
functions available by registering the DLL concerned in the operating system and loading
To you as a user, the advantage of addins is that they provide functions which are tailor made
for the associated application. For example if you working on different computers during
configuration and frequently use VBA macros, you can combine these VBA macros in one or
more addins. When you change to a different computer you need only copy the addin and you
can then access the customary functions on the new workstation.
As a developer, you can use the Graphics Designer program library in a development
environment to create MS Visual Studio 6.0 addins, for example, and protect your code from
intrusion.

Addins in the Graphics Designer


In the Graphics Designer you can use all the addins that have been developed for the Graphics
Designer and registered in the operating system of the computer you are using for
configuration.
You can automatically load an addin when you start the Graphics Designer if you frequently
need the functions the addins contain.
When you no longer need the functions of an addin, you can unload it again at any time.

See also
How to Configure an AddIn in the Graphics Designer (Page 3118)
Example: Creating Add Ins (Page 3119)
Linking Add Ins (Page 3115)

5.4.2

Linking Add Ins

Introduction
In the Graphics Designer use the Addin Manager to define the way addins that can be used
in the Graphics Designer will behave on loading.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3113

VBA for Automated Configuration


5.4 AddIns

Requirements
An add-in must be registered in the operating system, e.g. by entering the "regsvr32
filename.dll" command at the input prompt.
To register VBA addins, "Microsoft Visual Basic for Applications" must be installed. The
installation is available in the following ways:
Microsoft Office: During installation of Microsoft Office products, for example MS Excel
or MS Word, Visual Basic for Applications is automatically installed at the same time.
Later installation from Microsoft Office Setup: You can select to only install Visual Basic
for Applications in Microsoft Office Setup with the user-defined installation.
Download of the VBA Runtime environment: Microsoft offers a download of the VBA
Runtime environment at the following links:
- "VBRun60.exe" file for V6.0: http://support.microsoft.com/kb/192461/ (http://
support.microsoft.com/kb/192461/)
- "VBRun60sp6.exe" file for V6.0 SP6: http://support.microsoft.com/kb/290887/ (http://
support.microsoft.com/kb/290887/)
Make sure that the current file "MSAddndr.DLL" is integrated together with the VB6 add-in
DLL. For more detailed information, refer to:
http://support.microsoft.com/kb/192136/ (http://support.microsoft.com/kb/192136/)
http://support.microsoft.com/kb/2792179/ (http://support.microsoft.com/kb/2792179/)
http://support.microsoft.com/kb/957924/ (http://support.microsoft.com/kb/957924/)

3114

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.4 AddIns

Starting AddIn Manager


To start the Addin Manager, go to the Graphics Designer and select the command "Macros >
"AddIn Manager":

Automatically Loading an Addin


If the addin contains new functions that you always need in the Graphics Designer, you can
load the addin automatically when you open the Graphics Designer.
To do this go to the Addin Manager, select the addin and enable the "Load on Startup"
checkbox.
Note
Depending on how the addin is programmed, the function contained in the addin can also be
entered in the menu "Tools > Macros > AddIns". You can then start the function just by clicking
on it.

Manually Loading or Unloading an Addin


You can also load an addin manually if you need its functions for particular purposes only (such
as test routines).
To load or unload an addin manually, go to the Addin Manager, select the addin and enable
the "Loaded/Unloaded" checkbox.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3115

VBA for Automated Configuration


5.4 AddIns

See also
How to Configure an AddIn in the Graphics Designer (Page 3118)
Example: Creating Add Ins (Page 3119)
AddIns (Page 3113)

5.4.3

How to Configure an AddIn in the Graphics Designer

Requirements
An add-in must be registered in the operating system, e.g. by entering the "regsvr32
filename.dll" command at the input prompt.

Procedure
1. Start the Graphics Designer and open the project to which you want to link the addin.
2. To call the Addin Manager, select the menu command "Tools" > "AddIn Manager".
The Addin Manager opens. The "Available Add-Ins" list shows all the addins that are
available, together with their current load status:

3. For each addin define whether it is to be loaded and if so when. To do this select the addin
concerned and enable the appropriate checkbox under "Load Behavior".

3116

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.4 AddIns
4. To unload an addin, select the addin concerned and disable the "Load/Unload" checkbox
under "Load Behavior".
5. Click OK.

Result
Depending how the addin is programmed, the function contained in the addin is either listed
in the "Tools" > "AddIns" menu or reacts to an event handler in the Graphics Designer.
If the addin is started by means of an event handler (e.g. Started Event), the "On Startup"
checkbox should be enabled for the addin.

See also
Linking Add Ins (Page 3113)
AddIns (Page 3113)

5.4.4

Example: Creating Add Ins

5.4.4.1

Example: Creating Add Ins

Introduction
In order to create Addins, this documentation contains an example for Visual Basic 6.0, which
creates a runable Addin for use in the Graphic Designer.

Requirements
MS Visual Studio 6.0 must be installed on the configuration computer.
You should have programming experience if you wish to use the sample code as a basis for
developing addins of your own.

Example: Program Template for Visual Basic 6.0


Use the event handler "AddInInstance_OnConnection" to generate an instance of the Graphics
Designer. In order for the addin to be able to access the Graphics Designer, it is mandatory
to declare the application.

See also
Example: Creating an Add In with Visual Basic 6.0 (Page 3120)
Linking Add Ins (Page 3113)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3117

VBA for Automated Configuration


5.4 AddIns

5.4.4.2

Example: Creating an Add In with Visual Basic 6.0

Introduction
The program code in this example produces a file called "MyAddIn.DLL". So that the add-in
will work in Graphics Designer, you must enable the "Load on Startup" checkbox for this addin in the AddIn Manager of Graphics Designer. For this purpose you can also use the
"LoadOnStartup" function in the add-in.
When you open Graphics Designer the add-in generates a user-defined menu. You can also
use the "Tools" > "AddIns" menu to call the function contained in the add-in.

Requirement
In order to create an executable add-in from the sample code, "MS Visual Studio 6.0" must be
installed on your computer. You must also have referenced "WinCC Graphics Designer 1.0
Type Library" in "MS Visual Studio 6.0":

Procedure
1. Open "MS Visual Studio 6.0" and create a new project. To create a project, go to the "New
Project" dialog, select the "AddIn" entry and click on OK.
2. In Project Explorer, open the "Designer" folder and double click the entry called "Connect".
The "Connect (AddIn Designer)" dialog opens.
3. Under "Application", select the entry for "Graphics Designer" and select the "Initial Behavior
on Loading" for the add-in. Close the "Connect (AddIn Designer)" dialog.

3118

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.4 AddIns
4. In Project Explorer, open the "Designer" folder and use the shortcut menu to select the
command "Display Code" for the "Connect" entry.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3119

VBA for Automated Configuration


5.4 AddIns
5. Replace the entire program code with the following program code:
Option Explicit
'----------------------------------------------------'Member Variables
'----------------------------------------------------'Reference to the add-in connection
Dim WithEvents ThisAddin As grafexe.AddInHook
'Reference to the Graphics Designer Application
Dim WithEvents GrafApp As grafexe.Application
'----------------------------------------------------'WithEvents AddInInstance IDTExtensibility2 (automatic)
'----------------------------------------------------'-----------------------------------------------------'This method connects the add-in to the Graphic Designer
Application
'-----------------------------------------------------Private Sub AddInInstance_OnConnection(ByVal Application As
Object, _
ByVal ConnectMode As
AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object,
custom() As Variant)
On Error GoTo AddInInstance_OnConnection_Error
'-------------------------------------------------------' Hook up to the Graphics Designer application.IAddInHookEvents
interface.
' It is necessary referencing the application this add-in hooks
up to
'-------------------------------------------------------Dim GDApplication As grafexe.Application
Set GDApplication = Application
If (Not GDApplication Is Nothing) Then
'---------------------------------------------------' Explanation on filters ( first parameter to
AddIns.Attach() )
'
' sbAddInFilterExecute : Add-in is not shown in the AddIn
menu
'
(ThisAddin_Execute() is NOT called)
' sbAddInFilterNone
: Add-in is shown in the AddIn menu
and by
'
clicking on the AddIn's menu entry
ThisAddin_Execute()
'
is called (see the figure below)
'-----------------------------------------------------Set ThisAddin =
GDApplication.AddIns.Attach(sbAddInFilterNone, "Create Rectangle")
Set GrafApp = GDApplication
RegisterApplicationMenus
End If

3120

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.4 AddIns

Exit Sub
AddInInstance_OnConnection_Error:
MsgBox Err.Description
End Sub
'-----------------------------------------------------------'This method removes the add-in from VB by event disconnect
'-----------------------------------------------------------Private Sub AddInInstance_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, _
custom() As Variant)
On Error GoTo AddInInstance_OnDisconnection_Error
If (RemoveMode = ext_dm_UserClosed) Then
RemoveApplicationMenus
End If
' ----------------------------------------------------------' Release reference to IAddInHookEvents interface - Important
' ----------------------------------------------------------Set ThisAddin = Nothing
Set GrafApp = Nothing
Exit Sub
AddInInstance_OnDisconnection_Error:
MsgBox Err.Description
End Sub
'---------------------------------------------------------------'This method describes the 2nd way to make add-in functions
available in Graphics Designer
'
'By adding an application menu in Graphics Designer the menu click
events can be catched by
'the MenuItemClicked event from the application object
'---------------------------------------------------------------Private Sub RegisterApplicationMenus()
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Set objDocMenu = GrafApp.CustomMenus.InsertMenu(1, "DocMenu1",
"Doc_Menu_1")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1,
"dmItem1_1", "My first menu entry")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2,
"dmItem1_2", "My second menu entry")
Set objMenuItem = Nothing
Set objDocMenu = Nothing
End Sub
'--------------------------------------------------------------'This method removes the AddIn menus available in Graphics Designer
'---------------------------------------------------------------

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3121

VBA for Automated Configuration


5.4 AddIns
Private Sub RemoveApplicationMenus()
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
For Each objMenuItem In
GrafApp.CustomMenus("DocMenu1").MenuItems
Set objMenuItem = Nothing
Next objMenuItem
GrafApp.CustomMenus("DocMenu1").Delete
Set objMenuItem = Nothing
Set objDocMenu = Nothing
End Sub
Private Sub AddInInstance_Terminate()
' -------------------------------------------------' Release reference to IAddInHookEvents interface - Important
' -------------------------------------------------Set ThisAddin = Nothing
Set GrafApp = Nothing
End Sub
Private Sub GrafApp_MenuItemClicked(ByVal MenuItem As
grafexe.IHMIMenuItem)
Select Case MenuItem.Key
Case "dmItem1_1"
TestCall1
Case "dmItem1_2"
TestCall2
Case Else
Debug.Assert False
End Select
End Sub
'---------------------------------------------------------'You can call both of the following procedures by clicking the menu
command in the "DocMenu1"
'---------------------------------------------------------Sub TestCall1()
Call MsgBox("AddIn Menu: dmItem1_1 Clicked", vbInformation,
"GrafApp_MenuItemClicked")
End Sub
Sub TestCall2()
Call MsgBox("AddIn Menu: dmItem1_2 Clicked", vbInformation,
"GrafApp_MenuItemClicked")
End Sub
'-------------------------------------------------------'Registering an AddInHook creates an object which event
'can be executed by clicking "Extras\Macros\AddIns\<Registered
Name>"
'-------------------------------------------------------Private Sub ThisAddin_Execute()
MsgBox ("AddIn : Execute! Will create a new Rectangle now")

3122

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.4 AddIns
Dim NewShape As HMIObject
Set NewShape =
GrafApp.ActiveDocument.HMIObjects.AddHMIObject("Rectangle1",
"HMIRectangle")
With NewShape
.Top = 40
.Left = 40
.BackColor = 255
End With
MsgBox (NewShape.ObjectName)
End Sub
6. Create the add-in, and load it in the Graphics Designer.

Result
The next time you open it, Graphics Designer contains a user-defined menu titled
"Doc_Menu_1". The menu "Tools > AddIns" contains an entry called "Create Rectangle", which
pastes a rectangle into the active picture:

See also
How to Configure an AddIn in the Graphics Designer (Page 3116)
Example: Creating Add Ins (Page 3117)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3123

VBA for Automated Configuration


5.5 VBA Reference

5.5

VBA Reference

5.5.1

The object model of the Graphics Designer

5.5.1.1

VBA Reference

VBA Object Model


When you click an object name, you are shown a detailed description.
Note
The prefix "HMI" will be omitted from the following descriptions. Note that in the code you
must prefix objects with "HMI", e.g. "HMISymbolLibrary".

3124

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Events Object (Listing) (Page 3339)
SymbolLibraries Object (Listing) (Page 3441)
Actions Object (Listing) (Page 3273)
Application Object (Page 3284)
DataLanguage Object (Page 3315)
DataLanguages Object (Listing) (Page 3316)
Document Object (Page 3321)
Documents Object (Listing) (Page 3324)
Event Object (Page 3338)
HMIDefaultObjects Object (Listing) (Page 3356)
HMIObject Object (Page 3359)
HMIObjects Object (Listing) (Page 3361)
FolderItem Object (Page 3344)
FolderItems Object (Listing) (Page 3345)
VBA Reference: ActionDynamic (Page 3128)
VBA Reference: HMIObjects (Page 3130)
VBA Reference: Languages (Page 3132)
Layer Object (Page 3372)
Layers Object (Listing) (Page 3373)
Menu Object (Page 3380)
Menus Object (Listing) (Page 3382)
MenuItem Object (Page 3384)
MenuItems Object (Listing) (Page 3386)
Properties Object (Listing) (Page 3410)
Toolbar Object (Page 3447)
Toolbars Object (Listing) (Page 3448)
ToolbarItem Object (Page 3450)
ToolbarItems Object (Listing) (Page 3452)
View Object (Page 3468)
Views Object (Listing) (Page 3470)
SelectedObjects object (Listing) (Page 3428)
SymbolLibrary Object (Page 3442)
Property Object (Page 3411)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3125

VBA for Automated Configuration


5.5 VBA Reference

5.5.1.2

VBA Reference: ActionDynamic

VBA Object Model: ActionDynamic


"ActionDynamic" represents the interface port for dynamics and actions such as scripts, the
dynamic dialog, the direct connection and the triggers.
When you click an object name, you are shown a detailed description.

See also
VBA Reference (Page 3124)
AnalogResultInfo Object (Page 3282)
AnalogResultInfos Object (Listing) (Page 3283)
BinaryResultInfo Object (Page 3293)

3126

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
BitResultInfo Object (Page 3294)
Actions Object (Listing) (Page 3273)
DestLink Object (Page 3318)
DirectConnection Object (Page 3320)
DynamicDialog Object (Page 3327)
QualityCodeStateValue Object (Page 3413)
QualityCodeStateValues Object (Listing) (Page 3415)
ScriptInfo Object (Page 3426)
SourceLink Object (Page 3433)
Trigger Object (Page 3454)
VariableStateValue Object (Page 3463)
VariableStateValues Object (Listing) (Page 3464)
VariableTrigger Object (Page 3466)
VariableTriggers Object (Listing) (Page 3467)
ActionType property (Page 3473)
DynamicStateType property (Page 3579)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3127

VBA for Automated Configuration


5.5 VBA Reference

5.5.1.3

VBA Reference: HMIObjects

VBA Object Model: HMIObjects


When you click an object name, you are shown a detailed description.
+0,'HIDXOW2EMHFWV

6HOHFWLRQ

+0,2EMHFWV

+0,2EMHFW

6WDQGDUGREMHFWV

:LQGRZVREMHFWV

6SHFLDOREMHFWV

6PDUWREMHFWV

&LUFOH

%XWWRQ

&XVWRPL]HG2EMHFW

'%DU*UDSK

&LUFOH$UF

&KHFN%R[

*URXS

$FWLYH;&RQWURO

(OOLSVH

2SWLRQ*URXS

(OOLSVH$UF

5RXQG%XWWRQ

(OOLSVH6HJPHQW

6OLGHU

$SSOLFDWLRQ:LQGRZ
*URXS2EMHFWV

%DU*UDSK
&RPER%R[

/LQH

)DFHSODWH2EMHFW

3LH6HJPHQW

7XEHREMHFWV

*UDSKLF2EMHFW

3RO\JRQ

7XEH$UF2EMHFW

*URXS'LVSOD\

3RO\/LQH

7XEH'RXEOH7HH2EMHFW

,2)LHOG

5HFWDQJOH

7XEH7HH2EMHFW

/LVW%R[

5RXQG5HFWDQJOH

7XEH3RO\OLQH

0XOWL/LQH(GLW

6WDWLF7H[W

2/(2EMHFW
3LFWXUH:LQGRZ
6WDWXV'LVSOD\
7H[W/LVW

Object and List


Object
Detail view available.
Multilingual object configuration is possible.
*

3128

Not in DefaultObjects list.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
VBA Reference (Page 3124)
PolyLine Object (Page 3407)
GroupDisplay Object (Page 3352)
3DBarGraph Object (Page 3269)
ActiveXControl Object (Page 3275)
ApplicationWindow Object (Page 3286)
Button Object (Page 3295)
CheckBox Object (Page 3299)
Circle Object (Page 3302)
CircularArc Object (Page 3305)
Line Object (Page 3375)
OLEObject Object (Page 3393)
OptionGroup Object (Page 3395)
PictureWindow Object (Page 3398)
PieSegment Object (Page 3401)
Polygon Object (Page 3404)
Property Object (Page 3411)
Rectangle Object (Page 3417)
RoundButton Object (Page 3420)
RoundRectangle Object (Page 3424)
Slider object (Page 3430)
StaticText Object (Page 3435)
StatusDisplay Object (Page 3438)
TextList Object (Page 3443)
Ellipse Object (Page 3329)
EllipseArc Object (Page 3332)
EllipseSegment Object (Page 3335)
GraphicObject Object (Page 3347)
Group Object (Page 3350)
HMIDefaultObjects Object (Listing) (Page 3356)
HMIObject Object (Page 3359)
HMIObjects Object (Listing) (Page 3361)
IOField Object (Page 3363)
BarGraph Object (Page 3288)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3129

VBA for Automated Configuration


5.5 VBA Reference
GroupedObjects Object (Listing) (Page 3355)
VBA Reference: Languages (Page 3132)
SelectedObjects object (Listing) (Page 3428)
CustomizedObject Object (Page 3312)
FaceplateObject object (Page 3341)
AdvancedAnalogDisplay object (Page 3276)
AdvancedStateDisplay object (Page 3280)

5.5.1.4

VBA Reference: Languages

VBA Object Model: Languages


When you click an object name, you are shown a detailed description.

See also
VBA Reference (Page 3124)
LanguageFont Object (Page 3367)
LanguageFonts Object (Listing) (Page 3368)
LanguageText Object (Page 3370)
LanguageTexts Object (Listing) (Page 3371)

3130

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

5.5.1.5

Events

A-D
Activated event
Description
Occurs when a picture is activated in the Graphics Designer. This happens when you switch
between two pictures, for example.

syntax
Document_Activated(CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when the picture is activated:

Private Sub Document_Activated(CancelForwarding As Boolean)


'VBA76
MsgBox "The document got the focus." & vbCrLf &_
"This event (Document_Activated) is raised by the document itself"
End Sub

See also
VBA Reference (Page 3124)
Event Handling (Page 3103)

BeforeClose Events
Description
Occurs immediately before a picture is closed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3131

VBA for Automated Configuration


5.5 VBA Reference

syntax
Document_BeforeClose(Cancel As Boolean, CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output before the picture is closed:

Private Sub Document_BeforeClose(Cancel As Boolean, CancelForwarding As Boolean)


'VBA77
MsgBox "Event Document_BeforeClose is raised"
End Sub

See also
VBA Reference (Page 3124)

BeforeDocumentClose Event
Description
Occurs immediately before the picture is closed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeDocumentClose(Document As HMIDocument, Cancel
As Boolean)

3132

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that is going to be closed.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before the picture is closed:

Private Sub objGDApplication_BeforeDocumentClose(ByVal Document As IHMIDocument, Cancel As


Boolean)
'VBA78
MsgBox "The document " & Document.Name & " will be closed after press ok"
End Sub

See also
VBA Reference (Page 3124)

BeforeDocumentSave event
Description
Occurs immediately before the picture is saved.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3133

VBA for Automated Configuration


5.5 VBA Reference
objGDApplication_BeforeDocumentSave(Document As HMIDocument, Cancel
As Boolean)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that is going to be closed.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before the picture is closed:

Private Sub objGDApplication_BeforeDocumentSave(ByVal Document As IHMIDocument, Cancel As


Boolean)
'VBA79
MsgBox Document.Name & "-saving will start after press ok."
End Sub

See also
VBA Reference (Page 3124)

BeforeHMIObjectDelete-Ereignis
Description
Occurs immediately before an object in a picture is deleted.

syntax
BeforeHMIObjectDelete(ByVal HMIObject As IHMIObject, Cancel As
Boolean, CancelForwarding As Boolean)

3134

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object to be deleted.

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object to be deleted:

Private Sub Document_BeforeHMIObjectDelete(ByVal HMIObject As IHMIObject, Cancel As


Boolean, CancelForwarding As Boolean)
'VBA80
Dim strObjName As String
Dim strAnswer As String
'
'"strObjName" contains the name of the deleted object
strObjName = HMIObject.ObjectName
strAnswer = MsgBox("Are you sure to delete " & strObjName & "?", vbYesNo)
If strAnswer = vbNo Then
'if pressed "No" -> set Cancel to true for prevent delete
Cancel = True
End If
End Sub

See also
VBA Reference (Page 3124)

BeforeLibraryFolderDelete event
Description
Occurs immediately before a folder in the components library is deleted.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3135

VBA for Automated Configuration


5.5 VBA Reference
objGDApplication_BeforeLibraryFolderDelete(LibObject As
HMIFolderItem, Cancel As Boolean)

Parameter (Optional)
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The folder that is going to be deleted.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before a folder in the components library is
deleted:

Private Sub objGDApplication_BeforeLibraryFolderDelete(ByVal LibObject As HMIFolderItem,


Cancel As Boolean)
'VBA81
MsgBox "The library-folder " & LibObject.Name & " will be delete..."
End Sub

See also
VBA Reference (Page 3124)

BeforeLibraryObjectDelete event
Description
Occurs immediately before an object in the components library is deleted.

3136

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeLibraryObjectDelete(LibObject As
HMIFolderItem, Cancel As Boolean)

Parameter (Optional)
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The object that is going to be deleted.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before a folder in the components library is
deleted:

Private Sub objGDApplication_BeforeLibraryObjectDelete(ByVal LibObject As HMIFolderItem,


Cancel As Boolean)
'VBA82
MsgBox "The object " & LibObject.Name & " will be delete..."
End Sub

See also
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3137

VBA for Automated Configuration


5.5 VBA Reference

BeforeQuit Event
Description
Occurs immediately before the Graphics Designer is closed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeQuit(Cancel As Boolean)

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In this example a message is output shortly before the Graphics Designer is closed.

Private Sub objGDApplication_BeforeQuit(Cancel As Boolean)


'VBA83
MsgBox "The Graphics Designer will be shut down"
End Sub

See also
VBA Reference (Page 3124)

3138

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

BeforeSave Event
Description
Occurs immediately before a picture is saved.

syntax
Document_BeforeSave(Cancel As Boolean, CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output before the picture is saved:

Private Sub Document_BeforeSave(Cancel As Boolean, CancelForwarding As Boolean)


'VBA84
MsgBox "The document will be saved..."
End Sub

See also
VBA Reference (Page 3124)

BeforeVisibleFalse event
Description
Occurs immediately before the Graphics Designer application is set from Visible to Invisible.

syntax
Document_BeforeVisibleFalse(Cancel As Boolean, CancelForwarding As
Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3139

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
--

See also
VBA Reference (Page 3124)

ConnectionEvent Event
Description
Occurs when two objects are connected via the connector.

syntax
ConnectionEvent(eConnEventType, HMIConnector, HMIConnectedObject,
CancelProcess, CancelForwarding)

Parameter (Optional)
Parameter (Data Type)

Description

eConnEventType (HMIConnectionEventType)

--

HMIConnector (HMIObject)

--

HMIConnectedObject (HMIObject)

--

CancelProcess (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
--

See also
VBA Reference (Page 3124)

3140

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

DataLanguageChanged Event
Description
Occurs when the project language has been changed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DataLanguageChanged(lCID As Long)

Parameters
Parameter (Data Type)

Description

lCID (Long)

The project language identifier

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the newly set project language is output:

Private Sub objGDApplication_DataLanguageChanged(ByVal lCID As Long)


'VBA87
MsgBox "The datalanguage is changed to " & Application.CurrentDataLanguage & "."
End Sub

See also
Language-Dependent Configuration with VBA (Page 3018)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3141

VBA for Automated Configuration


5.5 VBA Reference

DesktopLanguageChanged event
Description
Occurs when the user interface language has been changed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DesktopLanguageChanged(lCID As Long)

Parameters
Parameter (Data Type)

Description

lCID (Long)

The user interface language identifier

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the newly set desktop language is output:

Private Sub objGDApplication_DesktopLanguageChanged(ByVal lCID As Long)


'VBA88
MsgBox "The desktop-language is changed to " & Application.CurrentDesktopLanguage & "."
End Sub

See also
VBA Reference (Page 3124)
Language-Dependent Configuration with VBA (Page 3018)

3142

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

DocumentActivated Event
Description
Occurs when a picture is activated in the Graphics Designer. This happens when you switch
between two pictures, for example.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentActivated(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that is to be activated.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output identifying the picture that has been activated:

Private Sub objGDApplication_DocumentActivated(ByVal Document As IHMIDocument)


'VBA89
MsgBox "The document " & Document.Name & " got the focus." & vbCrLf &_
"This event is raised by the application."
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3143

VBA for Automated Configuration


5.5 VBA Reference

See also
VBA Reference (Page 3124)

DocumentCreated Event
Description
Occurs when a new picture has been created in the Graphics Designer.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentCreated(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that has been created.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the name of the newly created picture is output:

Private Sub objGDApplication_DocumentCreated(ByVal Document As IHMIDocument)


'VBA90
MsgBox Document.Name & " will be created."
End Sub

3144

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
VBA Reference (Page 3124)

DocumentOpened Event
Description
Occurs when a picture has been opened.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentOpened(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that has been opened.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output identifying the picture that has been opened:

Private Sub objGDApplication_DocumentOpened(ByVal Document As IHMIDocument)


'VBA91
MsgBox Document.Name & " is opened."
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3145

VBA for Automated Configuration


5.5 VBA Reference

See also
VBA Reference (Page 3124)

DocumentSaved Event
Description
Occurs when a picture has been saved in the Graphics Designer.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentSaved(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that has been saved.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output identifying the picture that has been saved:

Private Sub objGDApplication_DocumentSaved(ByVal Document As IHMIDocument)


'VBA92
MsgBox Document.Name & " is saved."
End Sub

3146

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
VBA Reference (Page 3124)

DocumentPropertyChanged event
Description
Occurs when a picture property is changed.

syntax
Document_DocumentPropertyChanged(ByVal Property As IHMIProperty,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

Property (IHMIProperty)

Identifies the changed property.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the picture property being changed:

Private Sub Document_DocumentPropertyChanged(ByVal Property As IHMIProperty,


CancelForwarding As Boolean)
'VBA93
Dim strPropName As String
'"strPropName" contains the name of the modified property
strPropName = Property.Name
MsgBox "The picture-property " & strPropName & " is modified..."
End Sub

See also
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3147

VBA for Automated Configuration


5.5 VBA Reference

F-Z
HMIObjectAdded Event
Description
Occurs when an object is added.

syntax
Document_HMIObjectAdded(ByVal HMIObject As IHMIObject,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object being added.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object that has been added:

Private Sub Document_HMIObjectAdded(ByVal HMIObject As IHMIObject, CancelForwarding As


Boolean)
'VBA94
Dim strObjName As String
'
'"strObjName" contains the name of the added object
strObjName = HMIObject.ObjectName
MsgBox "Object " & strObjName & " is added..."
End Sub

See also
VBA Reference (Page 3124)

HMIObjectMoved Event
Description
Occurs when an object is moved.

3148

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Document_HMIObjectMoved(ByVal HMIObject As IHMIObject,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object being moved.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object that has been moved:

Private Sub Document_HMIObjectMoved(ByVal HMIObject As IHMIObject, CancelForwarding As


Boolean)
'VBA95
Dim strObjName As String
'
'"strObjName" contains the name of the moved object
strObjName = HMIObject.ObjectName
MsgBox "Object " & strObjName & " was moved..."
End Sub

See also
VBA Reference (Page 3124)

HMIObjectPropertyChanged Event
Description
Occurs when an object property is changed.

syntax
Document_HMIObjectPropertyChanged(ByVal Property As IHMIProperty,
CancelForwarding As Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3149

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

Property (IHMIProperty)

Identifies the changed property.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object property that has been
changed:

Private Sub Document_HMIObjectPropertyChanged(ByVal Property As IHMIProperty,


CancelForwarding As Boolean)
'VBA96
Dim strObjProp As String
Dim strObjName As String
Dim varPropValue As Variant
'
'"strObjProp" contains the name of the modified property
'"varPropValue" contains the new value
strObjProp = Property.Name
varPropValue = Property.value
'
'"strObjName" contains the name of the selected object,
'which property is modified
strObjName = Property.Application.ActiveDocument.Selection(1).ObjectName
MsgBox "The property " & strObjProp & " of object " & strObjName & " is modified... " &
vbCrLf & "The new value is: " & varPropValue
End Sub

See also
VBA Reference (Page 3124)

HMIObjectResized Event
Description
Occurs when the size of an object is changed.

syntax
Document_HMIObjectResized(ByVal HMIObject As IHMIObject,
CancelForwarding As Boolean)

3150

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object that is being resized.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when an object has been resized:

Private Sub Document_HMIObjectResized(ByVal HMIObject As IHMIObject, CancelForwarding As


Boolean)
'VBA97
Dim strObjName As String
'
'"strObjName" contains the name of the modified object
strObjName = HMIObject.ObjectName
MsgBox "The size of " & strObjName & " was modified..."
End Sub

See also
VBA Reference (Page 3124)

LibraryFolderRenamed Event
Description
Occurs when a folder in the components library has been renamed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_LibraryFolderRenamed(LibObject As HMIFolderItem,
OldName As String)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3151

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The renamed folder.

OldName (String)

The original name of the renamed folder.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the old and new folder names are output:

Private Sub objGDApplication_LibraryFolderRenamed(ByVal LibObject As HMIFolderItem, ByVal


OldName As String)
'VBA98
MsgBox "The Library-folder " & OldName & " is renamed in: " & LibObject.DisplayName
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

LibraryObjectRenamed Event
Description
Occurs when an object in the components library has been renamed.

3152

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_LibraryObjectRenamed(LibObject As HMIFolderItem,
OldName As String)

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The renamed object.

OldName (String)

The original name of the renamed object.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the old and new object names are output:

Private Sub objGDApplication_LibraryObjectRenamed(ByVal LibObject As IHMIFolderItem, ByVal


OldName As String)
'VBA99
MsgBox "The object " & OldName & " is renamed in: " & LibObject.DisplayName
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3153

VBA for Automated Configuration


5.5 VBA Reference

LibraryObjectAdded Event
Description
Occurs when an object has been added to the components library.

syntax
HMIObjectPropertyChanged(ByVal Property As IHMIProperty,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

LibObject (IHMIFolderItem)

Identifies the library object.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when an object has been added to the
components library:

Private Sub Document_LibraryObjectAdded(ByVal LibObject As IHMIFolderItem,


CancelForwarding As Boolean)
'VBA100
Dim strObjName As String
'
'"strObjName" contains the name of the added object
strObjName = LibObject.DisplayName
MsgBox "Object " & strObjName & " was added to the picture."
End Sub

See also
VBA Reference (Page 3124)

3154

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

MenuItemClicked Event
Description
Occurs when an entry in a user-defined menu is clicked.
Note
This event is both application-specific and document-specific.
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application

syntax
Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)

Parameters
Parameter (Data Type)

Description

MenuItem (IHMIMenuItem)

Identifies the user-defined menu.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output when the first entry in a user-defined menu is
clicked:

Private Sub Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)


'VBA101
Dim objMenuItem As HMIMenuItem
Dim varMenuItemKey As Variant
Set objMenuItem = MenuItem
'
'"objMenuItem" contains the clicked menu-item
'"varMenuItemKey" contains the value of parameter "Key"
'from the clicked userdefined menu-item

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3155

VBA for Automated Configuration


5.5 VBA Reference

varMenuItemKey = objMenuItem.Key
Select Case MenuItem.Key
Case "mItem1_1"
MsgBox "The first menu-item was clicked!"
End Select
End Sub

See also
How to assign VBA macros to menus and toolbars (Page 3036)
VBA Reference (Page 3124)

NewLibraryFolder Event
Description
Occurs when a folder has been created in the components library.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_NewLibraryFolder(LibObject As HMIFolderItem)

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The newly created folder.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

3156

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

In the following example the new folder name is output:

Private Sub objGDApplication_NewLibraryFolder(ByVal LibObject As IHMIFolderItem)


'VBA102
MsgBox "The library-folder " & LibObject.DisplayName & " was added."
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

NewLibraryObject Event
Description
Occurs when an object has been created in the components library.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_NewLibraryObject(LibObject As HMIFolderItem)

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The newly created object.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3157

VBA for Automated Configuration


5.5 VBA Reference

Set objGDApplication = grafexe.Application


End Sub

In the following example the new object name is output:

Private Sub objGDApplication_NewLibraryObject(ByVal LibObject As IHMIFolderItem)


'VBA103
MsgBox "The object " & LibObject.DisplayName & " was added."
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

Opened Event
Description
Occurs when a picture is opened.

syntax
Document_Opened(CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when the picture is opened:

Private Sub Document_Opened(CancelForwarding As Boolean)


'VBA104
MsgBox "The Document is open now..."
End Sub

3158

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
VBA Reference (Page 3124)

Saved Event
Description
Occurs after a picture has been saved.

syntax
Document_Saved(CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when the picture has been saved:

Private Sub Document_Saved(CancelForwarding As Boolean)


'VBA105
MsgBox "The document is saved..."
End Sub

See also
VBA Reference (Page 3124)

SelectionChanged Event
Description
Occurs when the selection has been changed.

syntax
Document_SelectionChanged(CancelForwarding As Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3159

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when a new object has been selected:

Private Sub Document_SelectionChanged(CancelForwarding As Boolean)


'VBA106
MsgBox "The selection is changed..."
End Sub

See also
VBA Reference (Page 3124)

Started Event
Description
Occurs when the Graphics Designer has been started.

Syntax
objGDApplication_Started()
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.

Parameters
--

3160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
Declare application.

Dim WithEvents objGDApplication As grafexe.Application

Set event tag.

Private Sub Document_Opened(CancelForwarding As Boolean)


Set objGDApplication = Me.Application
End Sub

Query "Started" event and output message.

Private Sub objGDApplication_Started()


'VBA107
'This event is raised before objGDApplication_Started()
MsgBox "The Graphics Designer is started!"
End Sub

See also
VBA Reference (Page 3124)

ToolbarItemClicked Event
Description
Occurs when an icon in a user-defined toolbar has been clicked
Note
This event is both application-specific and document-specific.
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application

syntax
Document_ToolbarItemClicked(ByVal ToolbarItem As IHMIToolbarItem)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3161

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

ToolbarItem (IHMIToolbarItem)

Identifies the symbol.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output when the first user-defined icon is clicked:

Private Sub Document_ToolbarItemClicked(ByVal ToolbarItem As IHMIToolbarItem)


'VBA108
Dim objToolbarItem As HMIToolbarItem
Dim varToolbarItemKey As Variant
Set objToolbarItem = ToolbarItem
'
'"varToolbarItemKey" contains the value of parameter "Key"
'from the clicked userdefined toolbar-item
varToolbarItemKey = objToolbarItem.Key
'
Select Case varToolbarItemKey
Case "tItem1_1"
MsgBox "The first Toolbar-Icon was clicked!"
End Select
End Sub

See also
How to assign VBA macros to menus and toolbars (Page 3036)
VBA Reference (Page 3124)

3162

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

ViewCreated Event
Description
Occurs when a copy of a picture has been created.
Note
This event is both application-specific and document-specific.
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application

syntax
Document_ViewCreated(ByVal pView As IHMIView, CancelForwarding As
Boolean)

Parameters
Parameter (Data Type)

Description

pView (IHMIView)

Identifies the copy of the picture.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the number of copy pictures is output when a new copy of the picture
has been created.

Private Sub Document_ViewCreated(ByVal pView As IHMIView, CancelForwarding As Boolean)


'VBA109
Dim iViewCount As Integer
'
'To read out the number of views
iViewCount = pView.Application.ActiveDocument.Views.Count

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3163

VBA for Automated Configuration


5.5 VBA Reference

MsgBox "A new copy of the picture (number " & iViewCount & ") was created."
End Sub

See also
VBA Reference (Page 3124)

WindowStateChange Event
Description
Occurs when the window size is changed (e.g. from "Minimized" to "Maximized").

syntax
objGDApplication_WindowStateChanged()

Parameter (Optional)
--

Example:
In the following example a message is output when the window size is changed:

Private Sub objGDApplication_WindowStateChanged()


'VBA110
MsgBox "The state of the application-window is changed!"
End Sub

See also
VBA Reference (Page 3124)

3164

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

5.5.1.6

Methods

A-C
Activate Method
Description
Activates the specified object.

syntax
Expression.Activate()
Expression
Necessary. An expression or element which returns an object of the "Application" or "View"
type.

Parameters
--

Example:
In the following example a copy of the active picture is created and then activated:

Sub CreateAndActivateView()
'VBA111
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
View Object (Page 3468)
Application Object (Page 3284)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3165

VBA for Automated Configuration


5.5 VBA Reference

Add Method
Description
Adds another element to a listing.
The following table shows you the listings to which the Add method can be applied. The
parameters and syntax for the respective Add methods can be found under "Methods".
Listing

Application for the Add Method

AnalogResultInfos Listing

Adds a new, analog value range in the Dynamic


dialog.

Documents Listing

Creates a new picture in the Graphics Designer

GroupedObjects Listing

Adds a new object to a group object.

Toolbars Listing

Creates a new, user-defined toolbar.

Tag Triggers Listing

Creates a new tag trigger.

Views Listing

Creates a copy of the specified picture.

See also
Add Method (Views Listing) (Page 3175)
Add Method (TagTriggers Listing) (Page 3174)
Add Method (CustomToolbars Listing) (Page 3170)
Add Method (GroupedObjects Listing) (Page 3172)
Add Method (Documents Listing) (Page 3171)
Add Method (AnalogResultInfos Listing) (Page 3168)

Add Method (AnalogResultInfos Listing)


Description
Adds a new, analog value range in the Dynamic dialog.

syntax
Expression.Add(RangeTo, ResultValue)
Expression
Necessary. An expression or element which returns an object of the "AnalogResultInfos" type.

3166

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

RangeTo (Variant)

The value range to which the change of property


gives rise.

ResultValue (Variant)

The value to which the object property is assigned


when the value range is reached.

Example:
In the following example the radius of a circle is given dynamics with the In the following
example a tag name is assigned and three analog value ranges are created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA112
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

The diagram shows the Dynamic dialog after the procedure has been carried out:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3167

VBA for Automated Configuration


5.5 VBA Reference

See also
DynamicDialog Object (Page 3327)
AnalogResultInfos Object (Listing) (Page 3283)
CreateDynamic Method (Page 3206)
How to dynamize a property with the Dynamic dialog (Page 3084)

Add Method (CustomToolbars Listing)


Description
Creates a new, user-defined toolbar. There is a difference between application-specific and
picture-specific user-defined toolbars:
Application-specific toolbar: This is linked to the Graphics Designer and is also only visible
when all the pictures in the Graphics Designer are closed. "Place the VBA code in the
document called "GlobalTemplateDocument" or "ProjectTemplateDocument" and use the
Application property.
Picture-specific toolbar: Is linked with a specific picture and remains visible as long as the
picture is visible. Place the VBA code in the document called "ThisDocument" for the desired
picture and use the ActiveDocument property.

syntax
Expression.Add(Key)
Expression
Necessary. An expression or element which returns an object of the "CustomToolbars" type.

Parameters
Parameter (Data Type)

Description

Key (Variant)

Identifies the user-defined toolbar. Use unique


names for "Key" (e.g. "DocToolbar1")

Example:
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA115
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem

3168

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")


'Add toolbar-items to the userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "My first
Symbol-Icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "My second
Symbol-Icon")
'
'Insert seperatorline between the two tollbaritems
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
Toolbars Object (Listing) (Page 3448)
InsertToolbarItem Method (Page 3233)
InsertSeparator Method (Page 3230)
InsertFromMenuItem Method (Page 3226)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

Add Method (Documents Listing)


Description
Creates a new picture in the Graphics Designer

syntax
Expression.Add [HMIOpenDocumentType]
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3169

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)
HMIOpenDocumentType (HMIDocumentType)

Description
Defines how the picture will be opened:
HMIDocumentTypeVisible: Opens the picture
for direct processing. This is the default setting
if you do not specify the parameter.
HMIDocumentTypeInvisible: Opens the
picture in invisible mode, i.e. it is not displayed
in the Graphics Designer. You can only
address the picture via the Documents listing,
and make it visible again by means of the Hide
property.

Example:
In the following example a new picture is created in the Graphics Designer:

Sub AddNewDocument()
'VBA113
Application.Documents.Add hmiOpenDocumentTypeVisible
End Sub

See also
Hide Property (Page 3627)
Documents Object (Listing) (Page 3324)
VBA Reference (Page 3124)

Add Method (GroupedObjects Listing)


Description
Adds an existing object to the specified group object.

syntax
Expression.Add(Index)
Expression
Necessary. An expression or element which returns an object of the "GroupedObjects" type.

3170

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

Index (Variant)

The object that is intended to be added. You can


either use the index number or the object name.

Example:
In this example the group object "My Group" is created from a number of objects. An ellipse
segment is then added to the group object:

Sub CreateGroup()
'VBA114
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipseSegment As HMIEllipseSegment
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
'Set name for new group-object
'The name identifies the group-object
objGroup.ObjectName = "My Group"
'Add new object to active document...
Set objEllipseSegment = ActiveDocument.HMIObjects.AddHMIObject("EllipseSegment",
"HMIEllipseSegment")
Set objGroup = ActiveDocument.HMIObjects("My Group")
'...and add it to the group:
objGroup.GroupedHMIObjects.Add ("EllipseSegment")
End Sub

See also
GroupedObjects Object (Listing) (Page 3355)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3171

VBA for Automated Configuration


5.5 VBA Reference

Add Method (TagTriggers Listing)


Description
Creates a new tag trigger.

syntax
Expression.Add(VarName, Type)
Expression
Necessary. An expression or element which returns an object of the "TagTriggers" type.

Parameters
Parameter (Data Type)

Description

VarName (String)

The name of the tag that is intended to be used as


a trigger. Please note that you have to create the
tag in the Tag Selection dialog.

Type (CycleType)

This is the cycle type. Select the cycle type from a


list in the VBA Editor when you use this method.

Example:
In the following example the radius of a circle is made dynamic using a trigger tag:

Sub DynamicWithVariableTriggerCycle()
'VBA69
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With
End Sub

See also
VariableTriggers Object (Listing) (Page 3467)
VBA Reference (Page 3124)

3172

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Add Method (Views Listing)


Description
Creates a copy of the specified picture.

syntax
Expression.Add()
Expression
Necessary. An expression or element which returns an object of the "Views" type.

Parameters
--

Example:
In the following example a copy of the active picture is created and then activated:

Sub CreateViewAndActivateView()
'VBA117
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Views Object (Listing) (Page 3470)
VBA Reference (Page 3124)

AddAction Method
Description
Configures an action on an object or property. This action is triggered when a defined event
occurs.

syntax
Expression.Method(HMIActionCreationType)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3173

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Actions" type.

Parameters
Parameter (Data Type)

Description

HMIActionCreationType (Variant)

Defines the action:


hmiActionCreationTypeCScript: Configures a
C action
hmiActionCreationTypeVBScript: Configures
a VBS action
hmiActionCreationTypeDirectConnection:
Configures a direct connection

Example:
In the following example a VBS action for changing the radius of a circle is configured:

Sub AddActionToPropertyTypeVBScript()
'VBA118
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
'Create circle in picture. By changing of property "Radius"
'a VBS-action will be started:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objVBScript = objEvent.Actions.AddAction(hmiActionCreationTypeVBScript)
End Sub

See also
Event Object (Page 3338)
Actions Object (Listing) (Page 3273)

AddActiveXControl Method
Description
Adds a new ActiveXControl object to the "HMIObjects" listing. The object is inserted in the
upper left corner of the specified picture.

syntax
Expression.AddActiveXControl("ObjectName", "ProgID")

3174

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Expression
Required. An expression or element which returns an object of the "HMIObjects" type.

Parameter
Parameter (data type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a
listing.

ProgID (String)

The ActiveX Control that is to be inserted.

Determining the ProgID


To determine the ProgID for an ActiveX control, go to the "Object Palette" in the Graphics
Designer and in the Default tab under "Smart Objects" insert the control object into the picture.
The "Insert a Control" dialog displays the path and ProgID for the selected control:

The following table shows a list of ProgIDs of WinCC controls that are installed by WinCC:
Name of the WinCC control

ProgID

Siemens HMI Symbol Library

SiemensHMI.SymbolLibrary.1

WinCC AlarmControl

CCAxAlarmControl.AxAlarmControl.1

WinCC digital/analog clock control

DACLOCK.DaclockCtrl.1

WinCC FunctionTrendControl

CCAxFunctionTrendControl.AxFunctionTrendControl.1

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3175

VBA for Automated Configuration


5.5 VBA Reference
Name of the WinCC control

ProgID

WinCC gauge control

XGAUGE.XGaugeCtrl.1

WinCC media control

CCMediaControl.CCMediaControl.1

WinCC OnlineTableControl

CCAxOnlineTableControl.AxOnlineTableControl.1

WinCC OnlineTrendControl

CCAxOnlineTrendControl.AxOnlineTrendControl.1

WinCC push button control

PBUTTON.PbuttonCtrl.1

WinCC slider control

SLIDER.SliderCtrl.1

WinCC RulerControl

CCAxTrendRulerControl.AxRulerControl.1

WinCC UserArchiveControl

CCAxUserArchiveControl.AxUserArchiveControl.1

Example:
In the following example, the ActiveX Control "WinCC Gauge Control" is inserted in the active
picture.

Sub AddActiveXControl()
'VBA119
Dim objActiveXControl As HMIActiveXControl
Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",
"XGAUGE.XGaugeCtrl.1")
With ActiveDocument
.HMIObjects("WinCC_Gauge").Top = 40
.HMIObjects("WinCC_Gauge").Left = 40
End With
End Sub

Note
After executing the method, the Graphics Designer will not be fully shut down. The
"Grafexe.exe" file remains in the memory. In order to restart the Graphics Designer, exit the
"Grafexe.exe" application in the Task Manager.

See also
ActiveX controls (Page 3064)
HMIObjects Object (Listing) (Page 3361)
ActiveXControl Object (Page 3275)
VBA Reference (Page 3124)

AddDotNetControl method
Description
Adds a new ".Net-Control" object to the "HMIObjects" listing.

3176

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Syntax
Expression.AddDotNetControl(ObjectName, ControlType, InGAC,
AssemblyInfo)
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a listing.

ControlType (String)

The namespace of the object.

InGAC (String)

TRUE: The object is registered in the Global Assembly Cache.


FALSE: The object is not registered in the Global Assembly Cache.

AssemblyInfo (String)

If "InGAC=TRUE", then the following information will be specified:


Assembly
Version
Culture
PublicKeyToken
If "InGAC=FALSE", only the path of the object is specified in "Assembly".

Example
In the following example, the ".NETControl" object from the Global Assembly Cache is inserted
in the active picture.

'VBA851
Dim DotNetControl As HMIDotNetControl
Set DotNetControl = ActiveDocument.HMIObjects.AddDotNetControl("MyVBAControl",
"System.Windows.Forms.Label", True,"Assembly=System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089")

AddFolder Method
Description
Creates a new folder in the components library. The FolderItem object of the "Folder" type is
added to the FolderItems listing.
The new folder created in this way receives the internal name "FolderX", where "X" stands for
a consecutive number, starting with 1. Use the internal name to address the folder in the
FolderItems listing.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3177

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.AddFolder(DefaultName)
Expression
Necessary. An expression or element which returns an object of the "FolderItems" type.

Parameters
Parameter (Data Type)

Description

DefaultName (String)

The name of the folder that is to be created.

Example:
In the following example the folder "My Folder" will be created in the "Project Library":

Sub AddNewFolderToProjectLibrary()
'VBA120
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder")
End Sub

See also
SymbolLibrary Object (Page 3442)
FolderItems Object (Listing) (Page 3345)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

AddFromClipboard Method
Description
Copies an object from the clipboard into a folder in the Components Library. The FolderItem
object of the "Item" type is added to the FolderItems listing.
Note
The clipboard must contain objects from the Graphics Designer. Other contents (such as
ASCII text) will not be pasted.

3178

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.AddFromClipboard(DefaultName)
Expression
Necessary. An expression or element which returns an object of the "FolderItems" type.

Parameters
Parameter (Data Type)

Description

DefaultName (String)

The name to be given to the object pasted into the


components library.

Example:
In the following example the object "PC" from the "Global Library" will be copied into the folder
"Folder 3" in the "Project Library":

Sub CopyObjectFromGlobalLibraryToProjectLibrary()
'VBA121
Dim objGlobalLib As HMISymbolLibrary
Dim objProjectLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder3")
'
'copy object from "Global Library" to clipboard
With objGlobalLib
.FolderItems(2).Folder.Item(2).Folder.Item(1).CopyToClipboard
End With
'
'paste object from clipboard into "Project Library"
objProjectLib.FolderItems(objProjectLib.FindByDisplayName("My
Folder3").Name).Folder.AddFromClipBoard ("Copy of PC/PLC")
End Sub

See also
FolderItems Object (Listing) (Page 3345)
SymbolLibrary Object (Page 3442)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3179

VBA for Automated Configuration


5.5 VBA Reference

AddHMIObject Method
Description
Adds a new standard, smart or Windows object to the "HMIObjects" listing. The object is
inserted in the upper left corner of the specified picture.
Note
Use the AddActiveXControl method to insert an ActiveXControl.
Use the AddOLEObject method to insert an OLE Element.

syntax
Expression.AddHMIObject("ObjectName", "ProgID")
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the


object by its name in a listing.

ProgID (String)

The object type that is to be inserted. "Obtain the


"ProgID" by prefixing the VBA object name with
"HMI" "(e.g. HMICircle or HMIRectangle)

Example:
In the following example a circle will be inserted into the active picture and its background color
set to "Red":

Sub AddCircleToActiveDocument()
'VBA122
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("VBA_Circle", "HMICircle")
objCircle.BackColor = RGB(255, 0, 0)
End Sub

See also
PieSegment Object (Page 3401)
TextList Object (Page 3443)

3180

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
StatusDisplay Object (Page 3438)
StaticText Object (Page 3435)
Slider object (Page 3430)
RoundRectangle Object (Page 3424)
RoundButton Object (Page 3420)
Rectangle Object (Page 3417)
PolyLine Object (Page 3407)
PictureWindow Object (Page 3398)
OptionGroup Object (Page 3395)
HMIObjects Object (Listing) (Page 3361)
Line Object (Page 3375)
IOField Object (Page 3363)
GraphicObject Object (Page 3347)
EllipseArc Object (Page 3332)
EllipseSegment Object (Page 3335)
Ellipse Object (Page 3329)
CircularArc Object (Page 3305)
Circle Object (Page 3302)
CheckBox Object (Page 3299)
Button Object (Page 3295)
BarGraph Object (Page 3288)
ApplicationWindow Object (Page 3286)
AddOLEObject Method (Page 3184)
AddActiveXControl Method (Page 3174)
VBA Reference (Page 3124)

AddItem Method
Description
Copies an object from the specified picture into a folder in the Components Library. The
FolderItem object of the "Item" type is added to the FolderItems listing.

syntax
Expression.Folder.AddItem "DefaultName", pHMIObject

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3181

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "FolderItems" type.

Parameters
Parameter (Data Type)

Description

DefaultName (String)

The name to be given to the object pasted into the


components library.

pHMIObject (HMIObject)

The object that is to be inserted into the


Components Library from the specified picture.

Example:
In the following example a circle will be copied into the "Project Library". For this purpose the
circle will be pasted into the active picture and the folder "My Folder 2" will

Sub VBA123()
'VBA123
Dim objProjectLib As HMISymbolLibrary
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder2")
objProjectLib.FindByDisplayName("My Folder2").Folder.AddItem "ProjectLib Circle",
ActiveDocument.HMIObjects("Circle")
End Sub

See also
FolderItems Object (Listing) (Page 3345)
SymbolLibrary Object (Page 3442)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

AddOLEObject Method
Description
Adds a new OLE Element to the "HMIObjects" listing. The object is inserted in the upper left
corner of the specified picture.

3182

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.AddOLEObject(ObjectName, ServerName, [CreationType],
[UseSymbol])
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a listing.

ServerName (String)

The name of the application which is to contain the OLE Element, or the file
name complete with path. The value for "ServerName" corresponds to the
"Object Type" in the "Insert Object" dialog:

6HUYHU1DPH

CreationType
(HMIOLEObjectCreation
Type-)

Defines whether the OLE Element will be newly created or an existing file
will be used:
HMIOLEObjectCreationTypeDirect: Corresponds to setting "Create
New". This setting is used if you do not specify the parameter.
HMIOLEObjectCreationTypeByLink: Corresponds to setting "Create
from File". This creates a copy of the file. Any changes made to the OLE
Element have no effect on the original file. Assign a name to the file via
the "ServerName" parameter.
HMIOLEObjectCreationTypeByLinkWithReference: Same as above,
except that changes in OLE Element affect the original file. Assign a
name to the file via the "ServerName" parameter.

UseSymbol (Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

TRUE if the standard icon for the file type is to be used. Double clicking on
the icon then opens the associated application. The default setting for this
parameter is FALSE.

3183

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example, an OLE Element containing a Wordpad document will be inserted
into the active picture:

Sub AddOLEObjectToActiveDocument()
'VBA124
Dim objOLEObject As HMIOLEObject
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("MS Wordpad Document",
"Wordpad.Document.1")
End Sub

In the following example, the AddOLEObject method will be used and the
"HMIOLEObjectCreationTypeByLink" parameter will be specified:

Sub AddOLEObjectByLink()
'VBA805
Dim objOLEObject As HMIOLEObject
Dim strFilename As String
'
'Add OLEObject by filename. In this case, the filename has to
'contain filename and path.
'Replace the definition of strFilename with a filename with path
'existing on your system
strFilename = Application.ApplicationDataPath & "Test.bmp"
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("OLEObject1", strFilename,
hmiOLEObjectCreationTypeByLink, False)
End Sub

In the following example, the AddOLEObject method will be used and the
"HMIOLEObjectCreationTypeByLinkWithReference" parameter will be specified:

Sub AddOLEObjectByLinkWithReference()
'VBA806
Dim objOLEObject As HMIOLEObject
Dim strFilename As String
'
'Add OLEObject by filename. In this case, the filename has to
'contain filename and path.
'Replace the definition of strFilename with a filename with path
'existing on your system
strFilename = Application.ApplicationDataPath & "Test.bmp"
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("OLEObject1", strFilename,
hmiOLEObjectCreationTypeByLinkWithReference, True)
End Sub

3184

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
OLEObject Object (Page 3393)
HMIObjects Object (Listing) (Page 3361)
VBA Reference (Page 3124)

AddWPFControl method
Description
Adds a new "WPF-Control" object to the "HMIObjects" listing.

Syntax
Expression.AddWPFControl(ObjectName, ControlType, InGAC,
AssemblyInfo)
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a listing.

ControlType (String)

The namespace of the object.

InGAC (String)

TRUE: The object is registered in the Global Assembly Cache.


FALSE: The object is not registered in the Global Assembly Cache.

AssemblyInfo (String)

If "InGAC=TRUE", then the following information will be specified:


Assembly
Version
Culture
PublicKeyToken
If "InGAC=FALSE", only the path of the object is specified in "Assembly".

Example
In the following example, the "WPF Control" object outside the Global Assembly Cache is
inserted in the active picture.

'VBA852
Dim WPFControl As HMIWPFControl
Set WPFControl = ActiveDocument.HMIObjects.AddWPFControl("MyWPFVBAControl",
"WinCCWPFControl.TestControl", False, "Assembly=Z:\TestControl\WinCCWPFControl.dll")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3185

VBA for Automated Configuration


5.5 VBA Reference

AlignBottom Method
Description
Aligns the objects selected in the specified picture with In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignBottom()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned with the bottom:

Sub AlignSelectedObjectsBottom()
'VBA125
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignBottom
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

3186

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

AlignLeft Method
Description
Left-justifies the objects selected in the specified picture. In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignLeft()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned to the left:

Sub AlignSelectedObjectsLeft()
'VBA126
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignLeft
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3187

VBA for Automated Configuration


5.5 VBA Reference

AlignRight Method
Description
Right-justifies the objects selected in the specified picture. In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignRight()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned to the right:

Sub AlignSelectedObjectsRight()
'VBA127
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignRight
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

3188

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

AlignTop Method
Description
Aligns the objects selected in the specified picture with In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignTop()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned with the top:

Sub AlignSelectedObjectsTop()
'VBA128
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignTop
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3189

VBA for Automated Configuration


5.5 VBA Reference

ArrangeMinimizedWindows Method
Description
Arranges all minimized pictures on the lower margin of the Graphics Designer.

syntax
Expression.ArrangeMinimizedWindows()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all minimized pictures are arranged on the lower margin of the
Graphics Designer. For this example to work, you must have minimized a number of pictures
in the Graphics Designer:

Sub ArrangeMinimizedWindows()
'VBA129
Application.ArrangeMinimizedWindows
End Sub

See also
Application Object (Page 3284)
VBA Reference (Page 3124)

BackwardOneLevel Method
Description
Moves the selected objects one level backward within their current layer.

syntax
Expression.BackwardOneLevel()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

3190

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted last
is then moved backward one level:

Sub MoveObjectOneLevelBackward()
'VBA173
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = False
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.BackwardOneLevel
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

BringToFront Method
Description
Brings the selected objects right to the front within their current layer.
Note
If the "BringToFront" method is used, the sequence of HMI objects can change in the
HMIObjects listing.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3191

VBA for Automated Configuration


5.5 VBA Reference

Syntax
Expression.BringToFront()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted last
is then brought to the front:

Sub MoveObjectToFront()
'VBA198
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = False
End With
MsgBox "The objects circle and rectangle are created" & vbCrLf & "Only the circle is
selected!"
ActiveDocument.Selection.BringToFront
MsgBox "The selection is moved to the front."
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

3192

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

CascadeWindows Method
Description
Arranges all open pictures in the Graphics Designer in a cascade (i.e. overlapping).

syntax
Expression.Methode(Parameter)
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are arranged in a cascade.
For this example to work, you must have opened a number of pictures in the Graphics Designer:

Sub CascadeWindows()
'VBA130
Application.CascadeWindows
End Sub

See also
VBA Reference (Page 3124)
Application Object (Page 3284)

CenterHorizontally Method
Description
Using this method, the objects selected in the specified picture are centered horizontally.

syntax
Expression.CenterHorizontally()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3193

VBA for Automated Configuration


5.5 VBA Reference

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then centered horizontally:

Sub CenterSelectedObjectsHorizontally()
'VBA131
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.CenterHorizontally
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

CenterVertically Method
Description
Using this method, the objects selected in the specified picture are centered vertically.

syntax
Expression.CenterVertically()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

3194

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then centered vertically:

Sub CenterSelectedObjectsVertically()
'VBA132
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.CenterVertically
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

CheckSyntax Method
Description
Checks whether the syntax of the specified C script is correct.
Use the CheckSyntax method in conjunction with the Compiled Property.

syntax
Expression.CheckSyntax(CheckOK, Error)
Expression
Necessary. An expression or element which returns an object of the "DynamicDialog" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3195

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

CheckOK (Boolean)

TRUE if the syntax of the specified C script is


correct.

Error (String)

The message text that is output if the C script is


incorrect.

Example:
--

See also
DynamicDialog Object (Page 3327)
VBA Reference (Page 3124)

Close Method
Description
Closes the specified picture and removes it from the document listing.
Note
Changes that have not been saved will be lost.

Syntax 1
Expression.Close(FileName)
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Syntax 2
Expression.Close()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

3196

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDL file to be closed.

Example:
In the following example the picture "Test.PDL" will For this example to work, you must have
opened the picture "Test.PDL":

Sub CloseDocumentUsingTheFileName()
'VBA134
Dim strFile As String
strFile = Application.ApplicationDataPath & "test.pdl"
Application.Documents.Close (strFile)
End Sub
In the following example the active picture in the Graphics Designer will be closed:
Sub CloseDocumentUsingActiveDocument()
'VBA135
ActiveDocument.Close
End Sub

See also
Document Object (Page 3321)
ActiveDocument Property (Page 3474)
Documents Object (Listing) (Page 3324)
VBA Reference (Page 3124)

CloseAll Method
Description
Closes all the pictures opened in the Graphics Designer and removes them from the
documents listing.
Note
Changes that have not been saved will be lost.

syntax
Expression.CloseAll()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3197

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are closed:

Sub CloseAllDocuments()
'VBA136
Application.Documents.CloseAll
End Sub

See also
Documents Object (Listing) (Page 3324)
VBA Reference (Page 3124)

ConvertToScript Method
Description
Converts the specified Dynamic dialog into a C script.
On conversion the associated DynamicDialog object is deleted.
Note
You cannot undo the conversion.

syntax
Expression.ConvertToScript()
Expression
Necessary. An expression or element which returns an object of the "DynamicDialog" type.

Parameters
--

3198

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example a circle will be inserted into the active picture and its radius will be
dynamically configured using the Dynamic dialog. The Dynamic dialog will then be converted
into a C script.

Sub ConvertDynamicDialogToScript()
'VBA137
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
'
'Create dynamic
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
'
'configure dynamic. "ResultType" defines the valuerange-type:
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
MsgBox "The dynamic-dialog will be changed into a C-script."
.ConvertToScript
End With
End Sub

See also
DynamicDialog Object (Page 3327)
VBA Reference (Page 3124)

ConvertWM method
Description
Is used internally for PowerCC.

CopySelection Method
Description
Using this method, the objects selected in the picture are copied to the clipboard.

syntax
Expression.CopySelection()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3199

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Document" or "Selection"
type.

Parameters
--

Example:
In the following example two of the objects inserted in the active picture are selected. The
selection is copied and pasted to a new picture:

Sub CopySelectionToNewDocument()
'VBA138
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim iNewDoc As Integer
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
'Instead of "ActiveDocument.CopySelection" you can also write:
'"ActiveDocument.Selection.CopySelection".
ActiveDocument.CopySelection
Application.Documents.Add hmiOpenDocumentTypeVisible
iNewDoc = Application.Documents.Count
Application.Documents(iNewDoc).PasteClipboard
End Sub

See also
Document Object (Page 3321)
ActiveDocument Property (Page 3474)
SelectedObjects object (Listing) (Page 3428)
PasteClipboard Method (Page 3245)
Add Method (Documents Listing) (Page 3169)
Activate Method (Page 3165)
VBA Reference (Page 3124)

3200

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

CopyToClipboard Method
Description
Copies an object from a folder in the Components Library to the clipboard.

Syntax
Expression.CopyToClipboard()
Expression
Necessary. An expression or element which returns a FolderItem object of the "Item" type.

Parameters
--

Example:
In the following example the object "PC" from the "Global Library" will be copied into the folder
"My Folder3" in the "Project Library":

Sub CopyObjectFromGlobalLibraryToProjectLibrary()
'VBA139
Dim objGlobalLib As HMISymbolLibrary
Dim objProjectLib As HMISymbolLibrary
Dim objFolderItem As HMIFolderItem
Set objGlobalLib = Application.SymbolLibraries(1)
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder3")
'
'copy object from "Global Library" to clipboard
With objGlobalLib
.FolderItems(2).Folder.Item(2).Folder.Item(1).CopyToClipboard
End With
'
'paste object from clipboard into "Project Library"
Set objFolderItem = objProjectLib.FindByDisplayName("My Folder3")
objFolderItem.Folder.AddFromClipBoard ("Copy of PC/PLC")
End Sub

See also
SymbolLibrary Object (Page 3442)
FolderItem Object (Page 3344)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3201

VBA for Automated Configuration


5.5 VBA Reference
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

CreateCustomizedObject Method
Description
Creates a customized object from the objects selected in the specified picture. You then have
to configure the customized object in the "Configuration Dialog".
For further information on this topic please refer to "Customized Objects" in this documentation
and "Customized Object" in the WinCC documentation.

syntax
Expression.CreateCustomizedObject()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and a customized object is then created:

Sub CreateCustomizedObject()
'VBA140
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objCustObject As HMICustomizedObject
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objCustObject = ActiveDocument.Selection.CreateCustomizedObject
objCustObject.ObjectName = "myCustomizedObject"

3202

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
SelectedObjects object (Listing) (Page 3428)
CustomizedObject Object (Page 3312)
VBA Reference (Page 3124)
Customized Objects (Page 3074)

CreateDynamicDialog method
Description
Dynamizing properties of pictures and objects depending on specific value ranges or variable
statuses.

Syntax
Expression.CreateDynamicDialog([Code as String],iResultType as Long)
Expression
Required. An expression or element which returns an object of the "Property" type.

Parameter
Parameter (Data Type)

Description

Code (String)

Defines the function or tag that is used for dynamic


purposes. Also specify the tag name in single
quotation marks: "Tag name"

iResultType (Long)

Defines the type of value range:


hmiResultTypeDirect = 0
hmiResultTypeAnalog= 1
hmiResultTypeBool = 2
hmiResultTypeBit = 3

Example
In the following example the radius of a circle is given dynamics with the dynamic dialog. A
tag name and a "ResultType" are assigned to the dynamic dialog.

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA820

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3203

VBA for Automated Configuration


5.5 VBA Reference

Dim objDynDialog As HMIDynamicDialog


Dim objCircle As HMICircle
'Create Object
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("myCircle","HMICircle")
'Create dynamic (Tag "myTest" must be exist")
Set objDynDialog = objCircle.Radius.CreateDynamicDialog("'myTest'",1)
End Sub

See also
FaceplateProperty object (Page 3343)

CreateDynamic Method
Description
Makes the specified property dynamic.

syntax
Expression.CreateDynamic(DynamicType, [SourceCode])
Expression
Necessary. An expression or element which returns an object of the "Property" type.

Parameters
You only need use the "SourceCode" parameter if you want to make the specified property
dynamic with the aid of the Dynamic dialog.
In all other types of dynamics you can omit the parameter.

3204

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Parameter (Data Type)

Description

DynamicType (HMIDynamicCreationType)

Defines the type of dynamics:


hmiDynamicCreationTypeVariableDirect:
Dynamics with a tag
hmiDynamicCreationTypeVariableIndirect:
Dynamics with a tag In this type of dynamics
you specify only the name of the tag whose
value will be used for dynamic purposes.
hmiDynamicCreationTypeScript: Dynamics
with a script (C, VB).
hmiDynamicCreationTypeDynamicDialog:
Dynamizing with the dynamic dialog box:

SourceCode (String)

Defines the function or tag that will be used for


dynamic purposes.
Also specify the tag name in single quote marks:
"Tag name"

Example:
In this example a circle property "Top" will be made dynamic with the aid of the tag
"NewDynamic":

Sub AddDynamicAsVariableDirectToProperty()
'VBA141
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("MyCircle", "HMICircle")
'Make property "Top" dynamic:
Set objVariableTrigger = objCircle.Top.CreateDynamic(hmiDynamicCreationTypeVariableDirect,
"NewDynamic")
'
'Define cycle-time
With objVariableTrigger
.CycleType = hmiCycleType_2s
End With
End Sub

See also
Property Object (Page 3411)
DeleteDynamic Method (Page 3212)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3205

VBA for Automated Configuration


5.5 VBA Reference

CreateGroup Method
Description
Creates a group object from the objects selected in the specified picture.
For further information on this topic please refer to "Group Objects" in this documentation and
"Group Object" in the WinCC documentation.

syntax
Expression.CreateGroup()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and a group object is then created:

Sub CreateGroup()
'VBA142
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "myGroup"
End Sub

3206

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
SelectedObjects object (Listing) (Page 3428)
Group Object (Page 3350)
VBA Reference (Page 3124)
Group Objects (Page 3067)

D-M
GetDeclutterObjectSize method
Description
Reads the limits displaying and hiding objects (decluttering) in the specified picture.

Syntax
Expression.GetDeclutterObjectSize(Min, Max)
Expression
Required. An expression or element which returns an object of the "Document" type.

Parameter
Parameter (data type)

Description

Min (Long)

Lower size range in pixels.

Max (Long)

Upper size range in pixels.

Example
In the following example, the decluttering limits of the active picture are read and output:

Sub ReadSettingsOfPicture()
'VBA848
Dim objectsize_min As Long, objectsize_max As Long
ActiveDocument.GetDeclutterObjectSize objectsize_min, objectsize_max
MsgBox objectsize_min & " " & objectsize_max
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3207

VBA for Automated Configuration


5.5 VBA Reference

Delete Method
Description
Deletes the specified object and removes it from the listing.

syntax
Expression.Delete()
Expression
Necessary. An expression or element which returns objects of the following types.
Assignment
FolderItem
LanguageText
Menu
MenuItem
Object
Toolbar
ToolbarItem
VariableTrigger
View

Parameters
--

Example:
In the following example the first object in the active picture will be deleted. For this example
to work, you must have created at least one object in the active picture:

Sub ObjectDelete()
'VBA143
ActiveDocument.HMIObjects(1).Delete
End Sub

See also
LanguageText Object (Page 3370)
View Object (Page 3468)
VariableTrigger Object (Page 3466)

3208

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
ToolbarItem Object (Page 3450)
FolderItem Object (Page 3344)
HMIObject Object (Page 3359)
MenuItem Object (Page 3384)
Menu Object (Page 3380)
VBA Reference (Page 3124)

DeleteAll Method
Description
Deletes all selected objects in the specified picture and removes them from the "Selection"
and "HMIObjects" listings.

syntax
Expression.DeleteAll()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then selected and deleted:

Sub DeleteAllSelectedObjects()
'VBA145
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3209

VBA for Automated Configuration


5.5 VBA Reference

MsgBox "Objects selected!"


ActiveDocument.Selection.DeleteAll
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

DeleteDynamic Method
Description
Removes the dynamic characteristic from the specified property.

syntax
Expression.DeleteDynamic
Expression
Necessary. An expression or element which returns an object of the "Property" type.

Parameters
--

Example:
In the following example the dynamic characteristic created with the aid of the CreateDynamic
Method will be

Sub DeleteDynamicFromObjectMeinKreis()
'VBA146
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects("MyCircle")
objCircle.Top.DeleteDynamic
End Sub

See also
Property Object (Page 3411)
CreateDynamic Method (Page 3204)
VBA Reference (Page 3124)

3210

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

DeselectAll Method
Description
Deselects all selected objects in the specified picture and removes them from the Selection
listing.

syntax
Expression.DeselectAll()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and selected. All selected objects are then deselected:

Sub SelectObjectsAndDeselectThemAgain()
'VBA147
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.DeselectAll
MsgBox "Objects deselected!"
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3211

VBA for Automated Configuration


5.5 VBA Reference

Destroy Method
Description
Ungroups the specified customized object. The objects remain intact.

Syntax
Expression.Destroy()
Expression
An expression or element which returns objects of the "CustomizedObject" types.

Parameters
--

Example:
An example showing how to use the Destroy Method can be found in this documentation under
the heading "Editing a Customized Object with VBA".

See also
CustomizedObject Object (Page 3312)
Destroy Method (Page 3212)
Delete Method (Page 3208)
CreateCustomizedObject Method (Page 3202)
How to Edit a Customized Object with VBA (Page 3076)

DuplicateSelection Method
Description
Duplicates the objects selected in the specified picture. The objects created in this way are
added to the HMIObjects listing. The names of new objects are numbered consecutively with
each duplication.
For instance if you duplicate an object called "Circle", the duplicate object is called "Circle1".
If you duplicate the object called "Circle" once more, the resulting object is called "Circle2" and
so on.

syntax
Expression.DuplicateSelection()

3212

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and selected. They are then duplicated:

Sub DuplicateSelectedObjects()
'VBA149
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.DuplicateSelection
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
VBA Reference (Page 3124)

EvenlySpaceHorizontally Method
Description
Using this method, the objects selected in the specified picture are spaced horizontally at an
even distance from one another.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3213

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.EvenlySpaceHorizontally()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects are inserted at different positions in the current picture
and selected. They are then positioned horizontally at an even distance from one another:

Sub EvenlySpaceObjectsHorizontally()
'VBA150
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.EvenlySpaceHorizontally
End Sub

See also
VBA Reference (Page 3124)
SelectedObjects object (Listing) (Page 3428)

3214

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

EvenlySpaceVertically Method
Description
Using this method, the objects selected in the specified picture are spaced vertically at an even
distance from one another.

syntax
Expression.EvenlySpaceVertically()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects are inserted at different positions in the current picture
and selected. They are then positioned vertically at an even distance from one another:

Sub EvenlySpaceObjectsVertically()
'VBA151
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects created and selected"
ActiveDocument.Selection.EvenlySpaceVertically
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3215

VBA for Automated Configuration


5.5 VBA Reference

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

Export Method
Description
Saves the specified picture as an EMF file.

Syntax
Expression.Export(Type, Path)
Expression
Required. An expression or element which returns an object of the "Document" type.

Parameter
Parameter (Data Type)

Description

Type (HMIImportExportType)

Defines the format in which the exported picture


will be saved.

Path (String)

The path in which the picture is going to be


exported. The path must exist.

Example

Sub ExportAllPicturesAsPDL()
'VBA152
Dim iPictureCounter As Integer
Dim strPath As String
strPath = "C:\WinCC_PDL_Export\"
'Count Pictures in Graphics Designer...
For iPictureCounter = 1 To grafexe.Documents.Count
'...and export each picture as PDL-file to specified path:
grafexe.Documents(iPictureCounter).Export hmiImportExportTypePDL,
strPath
Next iPictureCounter
End Sub

3216

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
View Object (Page 3468)
Document Object (Page 3321)

Find Method
Description
Searches for objects in the specified picture and returns the search result as a collection object.
You can search for the following object properties:
Type
Name
Property

syntax
Expression.Find([ObjectType], [ObjectName], [PropertyName])
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
You must specify at least one of the three parameters.
Parameter (Data Type)

Description

ObjectType (String)

The object type that is to be searched for. Specify


the "ProgID" of the object concerned. "Obtain the
"ProgID" by prefixing the VBA object name with
"HMI" "(e.g. HMICircle or HMIRectangle)

ObjectName (String)

The name of the object that is to be searched for.


You can use placeholders (?,*) in the object name
in order to find objects with similar names.

PropertyName (String)

The name of the object property that is to be


searched for. Specify the VBA property name
concerned (e.g. "BackColor" in place of
"Background Color").

Example:
In the following example, objects of the "HMICircle" type will be searched for in the active
picture and the search result will be output:

Sub FindObjectsByType()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3217

VBA for Automated Configuration


5.5 VBA Reference

'VBA153
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
Set colSearchResults = ActiveDocument.HMIObjects.Find(ObjectType:="HMICircle")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "objectname: " & strName)
Next objMember
End Sub

Note
Further information on using the Find Method can be found in this documentation under the
heading "Editing Standard Objects, Smart Objects and Windows Objects".

See also
Type Property (Page 3792)
Name Property (Page 3696)
Property Object (Page 3411)
HMIObjects Object (Listing) (Page 3361)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
VBA Reference (Page 3124)

FindByDisplayName Method
Description
Searches the entire Components Library for the specified object. A FolderItem object is
returned as the search result.
Note
The display name of the object is language-dependent. Only the language currently set will
be taken into account when searching. The search ends with the first object found.

syntax
Expression.FindByDisplayName(DisplayName)

3218

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "SymbolLibrary" type or
the "FolderItems" listing.

Parameters
Parameter (Data Type)

Description

DisplayName (String)

The display name of the object that is to be


searched for in the Components Library.

Example:
In the following example the entire library will be searched for the object "PC" and its display
name will be output:

Sub FindObjectInSymbolLibrary()
'VBA154
Dim objGlobalLib As HMISymbolLibrary
Dim objFItem As HMIFolderItem
Set objGlobalLib = Application.SymbolLibraries(1)
Set objFItem = objGlobalLib.FindByDisplayName("PC")
MsgBox objFItem.DisplayName
End Sub

See also
FolderItem Object (Page 3344)
Accessing the component library with VBA (Page 3040)

FireConnectionEvents method
Description
Is used internally by the Graphics Designer.

FlipHorizontally Method
Description
Mirrors the selected objects in the specified picture along the horizontal midline.
The object type determines whether it is allowed to be mirrored (for instance an OLE Element
cannot be mirrored). The properties are appropriately modified when mirroring is performed.
For example, if you mirror an object of the "StaticText" type along the horizontal midline, the
value of the "AlignmentTop" property changes from "0" to "2".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3219

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.FlipHorizontally()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a StaticText object will be inserted into the active picture and mirrored
along the horizontal midline:

Sub FlipObjectHorizontally()
'VBA155
Dim objStaticText As HMIStaticText
Dim strPropertyName As String
Dim iPropertyValue As Integer
Set objStaticText = ActiveDocument.HMIObjects.AddHMIObject("Textfield", "HMIStaticText")
strPropertyName = objStaticText.Properties("Text").Name
With objStaticText
.Width = 120
.Text = "Sample Text"
.Selected = True
iPropertyValue = .AlignmentTop
MsgBox "Value of '" & strPropertyName & "' before flip: " & iPropertyValue
ActiveDocument.Selection.FlipHorizontally
iPropertyValue = objStaticText.AlignmentTop
MsgBox "Value of '" & strPropertyName & "' after flip: " & iPropertyValue
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

FlipVertically Method
Description
Mirrors the selected objects in the specified picture along the vertical midline.
The object type determines whether it is allowed to be mirrored (for instance an OLE Element
cannot be mirrored). The properties are appropriately modified when mirroring is performed.

3220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
For example if you mirror an object of the "StaticText" type along the vertical midline, the value
of the "AlignmentLeft" property changes from "0" to "2".

syntax
Expression.FlipVertically()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a StaticText object will be inserted into the active picture and mirrored
along the vertical midline:

Sub FlipObjectVertically()
'VBA156
Dim objStaticText As HMIStaticText
Dim strPropertyName As String
Dim iPropertyValue As Integer
Set objStaticText = ActiveDocument.HMIObjects.AddHMIObject("Textfield", "HMIStaticText")
strPropertyName = objStaticText.Properties("Text").Name
With objStaticText
.Width = 120
.Text = "Sample Text"
.Selected = True
.AlignmentLeft = 0
iPropertyValue = .AlignmentLeft
MsgBox "Value of '" & strPropertyName & "' before flip: " & iPropertyValue
ActiveDocument.Selection.FlipVertically
iPropertyValue = objStaticText.AlignmentLeft
MsgBox "Value of '" & strPropertyName & "' after flip: " & iPropertyValue
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3221

VBA for Automated Configuration


5.5 VBA Reference

ForwardOneLevel Method
Description
Moves the selected objects one level forward within their current layer.

syntax
Expression.ForwardOneLevel()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted first
is then moved forward one level:

Sub MoveObjectOneLevelForward()
'VBA174
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = False
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.ForwardOneLevel
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

3222

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

GetItemByPath Method
Description
Returns a FolderItem object (folder or object) located on the specified internal access path in
the Components Library.
Note
To obtain the internal access path, select the "Copy Path" command from The internal access
path to the folder or object will then be copied to the clipboard.

syntax
Expression.GetItemByPath(PathName)
Expression
Necessary. An expression or element which returns an object of the "SymbolLibrary" type.

Parameters
Parameter (Data Type)

Description

PathName (String)

The internal access path on which the object is


located in the Components Library.

Example:
In this example one object from the entire library will be returned and its display name will be
output:

Sub ShowDisplayName()
'VBA157
Dim objGlobalLib As HMISymbolLibrary
Dim objFItem As HMIFolderItem
Set objGlobalLib = Application.SymbolLibraries(1)
Set objFItem = objGlobalLib.GetItemByPath("\Folder1\Folder2\Object1")
MsgBox objFItem.DisplayName
End Sub

See also
SymbolLibrary Object (Page 3442)
FolderItem Object (Page 3344)
Accessing the component library with VBA (Page 3040)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3223

VBA for Automated Configuration


5.5 VBA Reference

InsertFromMenuItem Method
Description
Inserts into an existing, user-defined toolbar a new icon that references an existing menu entry
in a user-defined menu.
Use this method if you wish to set up a toolbar so that it contains the same commands as an
existing user-defined menu.

Syntax
Expression.InsertFromMenuItem(Position, Key, pMenuItem,
DefaultToolTipText)
Expression
Required. An expression or element which returns an object of the "ToolbarItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the icon within the userdefined toolbar.

Key (Variant)

Identifies the symbol. Use unique names for "Key"


"(e.g. tItem1_1).

pMenuItem (HMIMenuItem)

The MenuItem object that is intended to be


referenced.

DefaultToolTipText (String)

Defines for the icon concerned the tool tip text that
will be displayed when you move the mouse over
the icon.

Example:
In this example a user-defined menu and a user-defined toolbar will be inserted in the active
picture. The icon calls up the menu entry "Hello World" from the user-defined menu:

Sub ToolbarItem_InsertFromMenuItem()
'VBA158
Dim objMenu As HMIMenu
Dim objToolbarItem As HMIToolbarItem
Dim objToolbar As HMIToolbar
Dim objMenuItem As HMIMenuItem
Set objMenu = Application.CustomMenus.InsertMenu(1, "Menu1", "TestMenu")
'
'*************************************************
'* Note:
'* The object-reference has to be unique.
'*************************************************

3224

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'
Set objMenuItem = Application.CustomMenus(1).MenuItems.InsertMenuItem(1, "MenuItem1",
"Hello World")
Application.CustomMenus(1).MenuItems(1).Macro = "HelloWorld"
Set objToolbar = Application.CustomToolbars.Add("Toolbar1")
Set objToolbarItem = Application.CustomToolbars(1).ToolbarItems.InsertFromMenuItem(1,
"ToolbarItem1", objMenuItem, "Call's Hello World of TestMenu")
End Sub
Sub HelloWorld()
MsgBox "Procedure 'HelloWorld()' is execute."
End Sub

See also
ToolbarItems Object (Listing) (Page 3452)
InsertSeparator Method (Page 3230)
Add Method (CustomToolbars Listing) (Page 3168)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertMenu Method
Description
Creates a new, user-defined menu. There is a difference between application-specific and
picture-specific user-defined menus:
Application-specific menu: This is linked to the Graphics Designer and is also only visible
when all the pictures in the Graphics Designer are closed. "Place the VBA code in the
document called "GlobalTemplateDocument" or "ProjectTemplateDocument" and use the
Application property.
Picture-specific menu: Is linked with a specific picture and remains visible as long as the
picture is visible. Place the VBA code in the document called "ThisDocument" for the desired
picture and use the ActiveDocument property.

syntax
Expression.InsertMenu(Position, Key, DefaultLabel)
Expression
Necessary. An expression or element which returns an object of the "CustomMenus" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3225

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the user-defined menu


within the menu bar. However, picture-specific
menus are always positioned to the right of
application-specific menus.

Key (Variant)

Identifies the user-defined menu. Use unique


names for "Key" (e.g. "DocMenu1")

DefaultLabel (String)

The name of the user-defined menu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA159
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "First MenuItem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "Second MenuItem")
'
'Insert a dividing rule into custumized menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "First SubMenu")
'
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "First item in submenu")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "Second item in submenu")
End Sub

The diagram shows the generated menu structure.

3226

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Menus Object (Listing) (Page 3382)
InsertSubmenu Method (Page 3231)
InsertSeparator Method (Page 3230)
InsertMenuItem Method (Page 3229)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertMenuItem Method
Description
Inserts a new entry in a user-defined menu.

syntax
Expression.InsertMenuItem(Position, Key, DefaultLabel)
Expression
Necessary. An expression or element which returns an object of the "MenuItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the submenu within the


user-defined menu.

Key (Variant)

Identifies the submenu. Use unique names for


"Key" "(e.g. dSubMenu1_4).

DefaultLabel (String)

Defines the name of the submenu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA160
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3227

VBA for Automated Configuration


5.5 VBA Reference

'
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "First MenuItem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "Second MenuItem")
'
'Insert a dividing rule into customized menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "First SubMenu")
'
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "First item in submenu")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "Second item in submenu")
End Sub

The diagram shows the menu structure.

See also
MenuItems Object (Listing) (Page 3386)
MenuItem Object (Page 3384)
InsertSubmenu Method (Page 3231)
InsertSeparator Method (Page 3230)
InsertMenu Method (Page 3225)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertSeparator Method
Description
Inserts a dividing line in a user-defined menu or user-defined toolbar.

syntax
Expression.InsertSeparator(Position, Key)

3228

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "MenuItems" or
"ToolbarItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the dividing line within the


user-defined menu or user-defined toolbar.

Key (Variant)

Identifies the dividing line. Use unique names for


"Key" (e.g. "tSeparator1_2").

Example:
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA161
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")
'Add toolbar-item to userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "First
symbol-icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "Second
symbol-icon")
'
'Insert dividing rule between first and second symbol-icon
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
ToolbarItems Object (Listing) (Page 3452)
MenuItems Object (Listing) (Page 3386)
InsertToolbarItem Method (Page 3233)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertSubmenu Method
Description
Inserts a submenu into an existing user-defined menu.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3229

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.InsertSubmenu(Position, Key, DefaultLabel)
Expression
Necessary. An expression or element which returns an object of the "MenuItem" type

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the submenu within the


user-defined menu.

Key (Variant)

Identifies the submenu. Use unique names for


"Key" "(e.g. dSubMenu1_4).

DefaultLabel (String)

Defines the name of the submenu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA162
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "First MenuItem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "Second MenuItem")
'
'Insert a dividing rule into customized menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "First SubMenu")
'
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "First item in submenu")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "Second item in submenu")
End Sub

The diagram shows the menu structure:

3230

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
MenuItem Object (Page 3384)
InsertSeparator Method (Page 3228)
InsertMenuItem Method (Page 3227)
InsertMenu Method (Page 3225)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertToolbarItem Method
Description
Inserts a new icon in an existing user-defined toolbar.

syntax
Expression.InsertToolbarItem(Position, Key, DefaultToolTipText)
Expression
Necessary. An expression or element which returns an object of the "ToolbarItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the icon within the userdefined toolbar.

Key (Variant)

Identifies the symbol. Use unique names for "Key"


"(e.g. tItem1_1).

DefaultToolTipText (String)

Defines for the icon concerned the tool tip text that
will be displayed when you move the mouse over
the icon.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3231

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA163
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")
'Add toolbar-item to userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "First
symbol-icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "Second
symbol-icon")
'
'Insert dividing rule between first and second symbol-icon
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
ToolbarItems Object (Listing) (Page 3452)
InsertSeparator Method (Page 3228)
Add Method (CustomToolbars Listing) (Page 3168)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

IsCSLayerVisible Method
Description
Returns TRUE if the specified CS layer is visible.

syntax
Expression.IsCSLayerVisible(Index)

3232

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the CS layer. Value range from 1 to 32.


Layer0 corresponds to the index value "1".

Example:
The following example determines whether CS layer 1 in the copy of the active picture is visible
and outputs the result:

Sub IsCSLayerVisible()
'VBA164
Dim objView As HMIView
Dim strLayerName As String
Dim iLayerIdx As Integer
Set objView = ActiveDocument.Views(1)
objView.Activate
iLayerIdx = 2
strLayerName = ActiveDocument.Layers(iLayerIdx).Name
If objView.IsCSLayerVisible(iLayerIdx) = True Then
MsgBox "CS " & strLayerName & " is visible"
Else
MsgBox "CS " & strLayerName & " is invisible"
End If
End Sub

See also
Document Object (Page 3321)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

IsRTLayerVisible Method
Description
Returns TRUE if the specified RT layer is visible.

syntax
Expression.IsRTLayerVisible(Index)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3233

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the RT layer. Value range from 1 to 32.


Layer0 corresponds to the index value "1".

Example:
The following example determines whether RT layer 1 is visible and outputs the result:

Sub RTLayerVisibility()
'VBA165
Dim strLayerName As String
Dim iLayerIdx As Integer
iLayerIdx = 2
strLayerName = ActiveDocument.Layers(iLayerIdx).Name
If ActiveDocument.IsRTLayerVisible(iLayerIdx) = True Then
MsgBox "RT " & strLayerName & " is visible"
Else
MsgBox "RT " & strLayerName & " is invisible"
End If
End Sub

See also
Document Object (Page 3321)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

Item Method
Description
Returns an element from a listing.

syntax
Expression.Item(Index)
Expression
Necessary. An expression or element which returns an object.

3234

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

Index (Variant)

The name or index number of an element from the


listing.
You can use the Object Name as the name. As the
index number you can use a numerical expression
(from 1 up to the value of the Count property of the
listing).
If the entered value fails to match any element in
the listing, this counts as an error.

Example:
Note
The Item Method is the default method for listings. Both the following examples give the same
result.
In the following example the name of the first picture in the Graphics Designer is output:

Sub ShowDocumentNameLongVersion()
'VBA166
Dim strDocName As String
strDocName = Application.Documents.Item(3).Name
MsgBox strDocName
End Sub
Sub ShowDocumentNameShortVersion()
'VBA167
Dim strDocName As String
strDocName = Application.Documents(3).Name
MsgBox strDocName
End Sub

See also
VariableStateValues Object (Listing) (Page 3464)
Count Property (Page 3562)
Views Object (Listing) (Page 3470)
VariableTriggers Object (Listing) (Page 3467)
ToolbarItems Object (Listing) (Page 3452)
Toolbars Object (Listing) (Page 3448)
SymbolLibraries Object (Listing) (Page 3441)
SelectedObjects object (Listing) (Page 3428)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3235

VBA for Automated Configuration


5.5 VBA Reference
Properties Object (Listing) (Page 3410)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
MenuItems Object (Listing) (Page 3386)
Menus Object (Listing) (Page 3382)
Layers Object (Listing) (Page 3373)
LanguageTexts Object (Listing) (Page 3371)
LanguageFonts Object (Listing) (Page 3368)
GroupedObjects Object (Listing) (Page 3355)
FolderItems Object (Listing) (Page 3345)
Events Object (Listing) (Page 3339)
Documents Object (Listing) (Page 3324)
DataLanguages Object (Listing) (Page 3316)
ConnectionPoints Object (Listing) (Page 3310)
AnalogResultInfos Object (Listing) (Page 3283)
Actions Object (Listing) (Page 3273)
VBA Reference (Page 3124)

ItemByLcid Method
Description
Selects the language for which you wish to enter the font settings. Read only access.
Note
You can only select languages in which you have already configured.

Syntax
Expression.ItemByLcid(LangID)
Expression
Required. An expression or element which returns an object of the "LanguageFonts" type.

3236

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameter
Parameter (Data Type)

Description

LangID (Long)

This is the language identifier. The list of language


identifiers is contained, for example, in the
"Languages.csv" file that is found in the index of
the WinCC documentation.

Example
The following example sets the font attributes of a button for French and English. In contrast
to English, French is displayed on the button in a smaller font with a constant tracking (Courier
New, 12pt):

Sub ExampleForLanguageFonts()
'VBA168
Dim objLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "Hello"
Set objLangFonts = objButton.LDFonts
'
'To make fontsettings for English:
With objLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
'
'To make fontsettings for French:
With objLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
End Sub

See also
LanguageFonts Object (Listing) (Page 3368)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3237

VBA for Automated Configuration


5.5 VBA Reference

LoadDefaultConfig Method
Description
Loads the file in which the default settings for objects are saved. The PDD file is located in the
"GraCS" folder of the current project.

syntax
Expression.LoadDefaultConfig(FileName)
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDD file which it is intended to


load.

Example:
In the following example the file "Test.PDD" will be loaded. For this example to work, you must
have previously saved the file. You can do this with the aid of the SaveDefaultConfig Method:

Sub LoadDefaultConfig()
'VBA169
Application.LoadDefaultConfig ("Test.PDD")
End Sub

See also
Application Object (Page 3284)
SaveDefaultConfig Method (Page 3257)
VBA Reference (Page 3124)

MoveOneLayerDown Method
Description
Moves the selected object in the specified picture into the next lowest layer.

3238

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.MoveOneLayerDown()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a circle in the active picture is inserted in the third layer and then
moved to the next lowest layer:

Sub MoveObjectOneLayerDown()
'VBA170
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
.Layer = 3
MsgBox "Circle is inserted into layer" & Str(.Layer)
ActiveDocument.Selection.MoveOneLayerDown
MsgBox "Circle is moved into layer" & Str(.Layer)
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

MoveOneLayerUp Method
Description
Moves the selected object in the specified picture into the next highest layer.

syntax
Expression.MoveOneLayerUp()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3239

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a circle in the active picture is inserted in the third layer and then
moved to the next highest layer:

Sub MoveObjectOneLayerUp()
'VBA171
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
.Layer = 3
MsgBox "Circle is inserted into layer" & Str(.Layer)
ActiveDocument.Selection.MoveOneLayerUp
MsgBox "Circle is moved into layer" & Str(.Layer)
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

MoveSelection Method
Description
Moves one or more objects selected in the picture by the specified coordinates.
Note
When you want to reposition one or more selected objects, use the properties "Left" and
"Top".

3240

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.MoveSelection(PosX, PosY)
Expression
Required. An expression or element which returns an object of the "Document" or "Selection"
type.

Parameters
Parameter (Data Type)

Description

PosX (Long)

The number of pixels by which the selection is to


be moved horizontally.

PosY (Long)

The number of pixels by which the selection is to


be moved vertically.

Example:
In the following example two objects are inserted at different positions in the current picture
and selected. The selection is then moved 30 pixels to the right and 40 pixels down:

Sub MoveSelectionToNewPostion()
'VBA172
Dim nPosX As Long
Dim nPosY As Long
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
nPosX = 30
nPosY = 40
ActiveDocument.MoveSelection nPosX, nPosY
End Sub

See also
Top Property (Page 3787)
Left Property (Page 3659)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3241

VBA for Automated Configuration


5.5 VBA Reference
Document Object (Page 3321)
VBA Reference (Page 3124)

O-Z
Open Method
Description
Opens an existing picture in the Graphics Designer and adds it to the documents listing.

syntax
Expression.Open(FileName, [HMIOpenDocumentType])
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDL file to be opened.


Unless you saved the PDL file in the "GraCS"
folder of the open project, you must also specify
the path at the same time.

HMIOpenDocumentType (HMIDocumentType)

Defines how the picture will be opened:


HMIDocumentTypeVisible: Opens the picture
for direct processing. This is the default setting
if you do not specify the parameter.
HMIDocumentTypeInvisible: Opens the
picture in invisible mode, i.e. it is not displayed
in the Graphics Designer. You can only
address the picture via the Documents listing,
and make it visible again by means of the Hide
property.

Example:
In the following example the picture "Test" will be opened. For this example to work, you must
have previously saved a picture with the name "Test" in the "GraCS" folder of the open project.

Sub OpenDocument()
'VBA175
Application.Documents.Open "Test.PDL", hmiOpenDocumentTypeVisible

3242

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
Hide Property (Page 3627)
Documents Object (Listing) (Page 3324)
VBA Reference (Page 3124)

PasteClipboard Method
Description
Pastes the contents of the clipboard into the specified picture.
Note
The clipboard must contain objects from the Graphics Designer. Other contents (such as
ASCII text) will not be pasted.

syntax
Expression.PasteClipboard()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
--

Example:
In the following example all the objects selected in the active picture are copied to the clipboard
and then pasted into a new picture. For this example to work, you must have selected at least
one object in the active picture:

Sub CopySelectionToNewDocument()
'VBA176
Dim iNewDoc As String
ActiveDocument.CopySelection
Application.Documents.Add hmiOpenDocumentTypeVisible
iNewDoc = Application.Documents.Count
Application.Documents(iNewDoc).PasteClipboard
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3243

VBA for Automated Configuration


5.5 VBA Reference

See also
ActiveDocument Property (Page 3474)
Document Object (Page 3321)
CopySelection Method (Page 3199)
Add Method (Documents Listing) (Page 3169)
Activate Method (Page 3165)
VBA Reference (Page 3124)

PrintDocument Method
Description
Prints the specified copy of the picture using the current printer settings.

syntax
Expression.PrintDocument()
Expression
Necessary. An expression or element which returns an object of the "View" type.

Parameters
--

Example:
In the following example a copy of the active picture is created and then activated and printed:

Sub CreateAndPrintView()
'VBA177
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
objView.PrintDocument
End Sub

See also
View Object (Page 3468)
VBA Reference (Page 3124)

3244

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

PrintProjectDocumentation Method
Description
Prints out the project documentation for the current picture complete with all the objects it
contains and their properties via the reporting system in WinCC (Report Designer).
You must first have set the print settings (such as page range) in the "Print Job Properties"
dialog. To do this, go to the Graphics Designer and select the menu command "File" > "Project
Documentation - Setup".
Note
The project documentation will be output on the printer that was set up in the Report Designer.
You can design the print layout to suit your needs with the aid of the Report Designer.

syntax
Expression.PrintProjectDocumentation()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
--

Example:
In the following example the project documentation for the active picture will be printed:

Sub ToPrintProjectDocumentation()
'VBA178
ActiveDocument.PrintProjectDocumentation
End Sub

See also
Document Object (Page 3321)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3245

VBA for Automated Configuration


5.5 VBA Reference

Remove Method
Description
Removes an object from a selection of objects or from a group object.

syntax
Expression.Remove(Index)
Expression
Necessary. An expression or element which returns an object of the "GroupedObjects" or
"Selection" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

The name or index number of the object that is


intended to be removed.
You can use the Object Name as the name. As the
index number you can use a numerical expression
(from 1 up to the value of the Count property of the
listing).
If the entered value fails to match any element in
the listing, this counts as an error.

Example:
In the following example three objects will first be inserted in the active picture and selected.
Then one object will be removed from the selection and the remaining objects will be grouped.
Then the first object will be removed from the group object:

Sub RemoveObjectFromGroup()
'VBA179
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80

3246

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
MsgBox "Group-object is created."
objGroup.GroupedHMIObjects.Remove ("sEllipse")
MsgBox "The ellipse is removed from group-object."
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
GroupedObjects Object (Listing) (Page 3355)
VBA Reference (Page 3124)

Rotate Method
Description
Rotates the object selected in the specified picture by 90 clockwise.

syntax
Expression.Rotate()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects will be inserted in the active picture and then grouped.
The group object will then be rotated once:

Sub RotateGroupObject()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3247

VBA for Automated Configuration


5.5 VBA Reference

'VBA180
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
With objRectangle
.Top = 30
.Left = 30
.Width = 80
.Height = 40
.Selected = True
End With
With objCircle
.Top = 30
.Left = 30
.BackColor = RGB(255, 255, 255)
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
MsgBox "Group-object created."
objGroup.Selected = True
ActiveDocument.Selection.Rotate
End Sub

See also
VBA Reference (Page 3124)
SelectedObjects object (Listing) (Page 3428)

SameHeight Method
Description
Sets the "Height" property for all selected objects in the specified picture to the smallest
available value.

syntax
Expression.SameHeight()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

3248

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same height:

Sub ApplySameHeightToSelectedObjects()
'VBA181
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Height = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Height = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.Height = 120
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameHeight
End Sub

See also
Height Property (Page 3626)
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3249

VBA for Automated Configuration


5.5 VBA Reference

SameWidth Method
Description
Sets the "Width" property for all selected objects in the specified picture to the smallest
available value.

syntax
Expression.SameWidth()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same width:

Sub ApplySameWidthToSelectedObjects()
'VBA182
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Width = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 120
.BackColor = RGB(255, 0, 0)
.Selected = True

3250

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameWidth
End Sub

See also
Width Property (Page 3883)
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

SameWidthAndHeight Method
Description
Sets the "Height" and "Width" properties for all selected objects in the specified picture to the
smallest available value.

syntax
Expression.SameWidthAndHeight()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same height:

Sub ApplySameWidthAndHeightToSelectedObjects()
'VBA183
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3251

VBA for Automated Configuration


5.5 VBA Reference

.Height = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 25
.Height = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.Height = 120
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameWidthAndHeight
End Sub

See also
Width Property (Page 3883)
Height Property (Page 3626)
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

Save Method
Description
Saves the specified picture under its current name.

syntax
Expression.Save()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
--

3252

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the active picture in the Graphics Designer will be saved:

Sub SaveDocument()
'VBA184
ActiveDocument.Save
End Sub

See also
ActiveDocument Property (Page 3474)
Document Object (Page 3321)
VBA Reference (Page 3124)

SaveAll Method
Description
Saves all the open pictures in the Graphics Designer under their current names.

syntax
Expression.SaveAll()
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are saved:

Sub SaveAllDocuments()
'VBA185
Application.Documents.SaveAll
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3253

VBA for Automated Configuration


5.5 VBA Reference

See also
Documents Object (Listing) (Page 3324)
VBA Reference (Page 3124)

SaveAs Method
Description
Saves the specified picture under a new name.
If a previously existing picture is to be overwritten, it must be ascertained prior to the SaveAs
method call that this picture is permitted to be overwritten. You must inquire the
LockedByCreatorID property of the picture to be overwritten to do so. Otherwise an error will
be triggered in VBA.

syntax
Expression.SaveAs(FileName)
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The file name under which the picture is to be


saved.

Example:
In the following example the active picture will be saved under the name "Test2.PDL":

Sub SaveDocumentAs()
'VBA186
ActiveDocument.SaveAs ("Test2.PDL")
End Sub

See also
LockedByCreatorID Property (Page 3667)
ActiveDocument Property (Page 3474)
Document Object (Page 3321)
VBA Reference (Page 3124)

3254

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

SaveDefaultConfig Method
Description
Saves the default settings for objects to a PDD file. The file is saved to the "GraCS" folder of
the current project.

syntax
Expression.SaveDefaultConfig(FileName)
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDD file.

Example:
In the following example the default settings for objects are saved to the file "Test.PDD".

Sub SaveDefaultConfig()
'VBA187
Application.SaveDefaultConfig ("Test.PDD")
End Sub

See also
Application Object (Page 3284)
LoadDefaultConfig Method (Page 3238)
VBA Reference (Page 3124)

SelectAll Method
Description
Selects all the objects in the specified picture and adds them to the selection listing.

syntax
Expression.SelectAll()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3255

VBA for Automated Configuration


5.5 VBA Reference
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects will be inserted in the active picture and then selected.

Sub SelectAllObjectsInActiveDocument()
'VBA188
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Height = 15
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 25
.Height = 40
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.Height = 120
.BackColor = RGB(255, 0, 0)
End With
ActiveDocument.Selection.SelectAll
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

3256

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

SendToBack Method
Description
Sends the selected objects right to the back within their current layer.
Note
If the "SendToBack" method is used, the sequence of HMI objects can change in the
HMIObjects listing.

Syntax
Expression.SendToBack()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted first
is then sent to the back:

Sub SendObjectToBack()
'VBA197
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = False
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = True
End With
MsgBox "The objects circle and rectangle are created" & vbCrLf & "Only the rectangle is
selected!"
ActiveDocument.Selection.SendToBack

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3257

VBA for Automated Configuration


5.5 VBA Reference

MsgBox "The selection is moved to the back."


End Sub

See also
SelectedObjects object (Listing) (Page 3428)
VBA Reference (Page 3124)

SetCSLayerVisible Method
Description
Shows or hides the specified CS layer.

syntax
Expression.SetCSLayerVisible(Index, Val)
Expression
Necessary. An expression or element which returns an object of the "View" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the CS layer that is going to be shown or


hidden. Value range from 1 up to 32.

Val (Boolean)

TRUE if the specified CS layer is intended to be


visible.

Example:
In the following example the second CS layer in the copy of the active picture is hidden (i.e.
made invisible):

Sub SetCSLayerVisible()
'VBA189
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
objView.SetCSLayerVisible 2, False
End Sub

3258

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Document Object (Page 3321)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

SetOpenContext method
Description
The SetOpenContext method sets the password. Password-protected process pictures or
faceplate types can then be opened.

Syntax
Expression.SetOpenContext (Password)
Expression
Required. An expression or element which returns an object of the "Documents" type.

Parameter
Parameter (Data Type)

Description

Password (String)

Password of the available picture.

Example
Several pictures ("A.pdl", "B.pdl" und "C.pdl") are opened in the following example using the
same password string "Test123". Enter the password for the pictures to open these. Terminate
the SetOpenContext method with an empty string "" to prevent further access to the password.

Sub OpenProtectedPicture()
'VBA853
Documents.SetOpenContext ("Test123")
Documents.Open ("A.pdl")
Documents.Open ("B.pdl")
Documents.Open ("C.pdl")
Documents.SetOpenContext ("")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3259

VBA for Automated Configuration


5.5 VBA Reference

SetDeclutterObjectSize Method
Description
Specifies the size area for fading in and out of objects in the specified picture. If height and
width of the object are outside the specified size area, the objects are faded out.
The "ObjectSizeDecluttering" property must be set to TRUE.

syntax
Expression.SetDeclutterObjectSize(Min, Max)
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Min (Long)

Lower size range in pixels.

Max (Long)

Upper size range in pixels.

Example:
In the following example the settings for the lowest layer are configured in the active picture:

Sub ConfigureSettingsOfLayer()
'VBA190
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'Configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
'Define decluttering of objects:
With ActiveDocument
.LayerDecluttering = True
.ObjectSizeDecluttering = True
.SetDeclutterObjectSize 50, 100
End With
End Sub

3260

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
ObjectSizeDecluttering Property (Page 3702)
Document Object (Page 3321)
VBA Reference (Page 3124)

SetRTLayerVisible Method
Description
Shows or hides the specified RT layer.

syntax
Expression.SetRTLayerVisible(Index, Val)
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the RT layer that is going to be shown or


hidden. Value range from 1 to 32.

Val (Boolean)

TRUE if the specified RT layer is intended to be


visible.

Example:
In the following example the first RT layer in the active picture will be made visible:

Sub SetRTLayerVisibleWithVBA()
'VBA191
ActiveDocument.SetRTLayerVisible 1, False
End Sub

See also
Document Object (Page 3321)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3261

VBA for Automated Configuration


5.5 VBA Reference

ShowPropertiesDialog Method
Description
Opens the "Object Properties" dialog.

syntax
Expression.ShowPropertiesDialog()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example the "Object Properties" dialog is opened:

Sub ShowPropertiesDialog()
'VBA192
Application.ShowPropertiesDialog
End Sub

See also
Application Object (Page 3284)
VBA Reference (Page 3124)

ShowSymbolLibraryDialog Method
Description
Opens the Components Library.

syntax
Expression.ShowSymbolLibraryDialog()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

3262

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
--

Example:
In the following example the Components Library is opened:

Sub ShowSymbolLibraryDialog()
'VBA193
Application.ShowSymbolLibraryDialog
End Sub

See also
Application Object (Page 3284)
VBA Reference (Page 3124)

ShowTagDialog Method
Description
Opens the "Tags" dialog.

syntax
Expression.ShowTagDialog()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example the "Tags" dialog is opened:

Sub ShowTagDialog()
'VBA194
Application.ShowTagDialog
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3263

VBA for Automated Configuration


5.5 VBA Reference

See also
Application Object (Page 3284)
VBA Reference (Page 3124)

TileWindowsHorizontally Method
Description
Arranges all open pictures in the Graphics Designer so that they are tiled horizontally.

syntax
Expression.Methode()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are tiled horizontally. For
this example to work, you must have opened a number of pictures in the Graphics Designer:

Sub TileWindowsHorizontally()
'VBA195
Application.TileWindowsHorizontally
End Sub

See also
Application Object (Page 3284)
VBA Reference (Page 3124)

TileWindowsVertically Method
Description
Arranges all open pictures in the Graphics Designer so that they are tiled vertically.

3264

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.Methode()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are tiled vertically. For this
example to work, you must have opened a number of pictures in the Graphics Designer:

Sub TileWindowsVertically()
'VBA196
Application.TileWindowsVertically
End Sub

See also
Application Object (Page 3284)
VBA Reference (Page 3124)

TransformDisplayCoordinate method
Description
Is used internally for PowerCC.

TransformPixelCoordinate method
Description
Is used internally for PowerCC.

Ungroup Method
Description
Ungroups a group object. The objects remain intact.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3265

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.Ungroup(Parameter)
Expression
Necessary. An expression or element which returns an object of the "Group" type.

Parameters
--

Example:
In the following example three objects are created in the current picture and a group object is
then created from them: The group object is then moved and ungrouped.

Sub DissolveGroup()
'VBA199
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
MsgBox "Group-object is created."
With objGroup
.Left = 120
.Top = 300
MsgBox "Group-object is moved."
.UnGroup
MsgBox "Group is dissolved."
End With
End Sub

3266

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Group Object (Page 3350)
CreateGroup Method (Page 3206)
VBA Reference (Page 3124)
Group Objects (Page 3067)

5.5.1.7

Objects and Lists

0-9, A-C
3DBarGraph Object
Description

Represents the "3D Bar" object. The 3DBarGraph object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMI3DBarGraph

Application
Use the Add method to create a new "3D Bar" object in a picture:

Sub Add3DBarGraph()
'VBA200
Dim obj3DBarGraph As HMI3DBarGraph
Set obj3DBarGraph = ActiveDocument.HMIObjects.AddHMIObject("3DBar", "HMI3DBarGraph")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3267

VBA for Automated Configuration


5.5 VBA Reference

Sub Edit3DBarGraph()
'VBA201
Dim obj3DBarGraph As HMI3DBarGraph
Set obj3DBarGraph = ActiveDocument.HMIObjects("3DBar")
obj3DBarGraph.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA202
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Object properties
The 3D Bar object possesses the following properties:
AngleAlpha
AngleBeta
Application
Axe
BackColor
Background
BarDepth
BarHeight
BarWidth
BaseX
BaseY
BorderColor
BorderStyle
BorderWidth
Direction
FillColor
FillStyle
GlobalColorScheme
GlobalShadow
GroupParent

3268

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Height
Layer
Layer00Checked ... Layer10Checked
Layer00Color ... Layer10Color
Layer00FillColor ... Layer10FillColor
Layer00FillStyle ... Layer10FillStyle
Layer00Value ... Layer10Value
Left
LightEffect
Max.
Min.
ObjectName
Operation
Parent
PasswordLevel
PredefinedAngles
Process
Selected
ShowBadTagState
TabOrderAlpha
TabOrderSwitch
ToolTipText
Top
Transparency
Type
Visible
Width
ZeroPointValue

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3269

VBA for Automated Configuration


5.5 VBA Reference
Editing Objects with VBA (Page 3053)
ZeroPointValue Property (Page 3888)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
Process Property (Page 3732)
PredefinedAngels Property (Page 3730)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Name Property (Page 3696)
Min Property (Page 3693)
Max Property (Page 3675)
LightEffect Property (Page 3660)
Left Property (Page 3659)
Layer Property (Page 3648)
Layer00..10Value property (Page 3650)
Height Property (Page 3626)
Direction Property (Page 3573)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderColor Property (Page 3517)
BaseY Property (Page 3511)
BaseX Property (Page 3510)
BarWidth Property (Page 3507)
BarHeight Property (Page 3506)
BarDepth Property (Page 3506)
Background Property (Page 3504)
Axe Property (Page 3493)
AngleBeta Property (Page 3486)
AngleAlpha Property (Page 3485)
Layer00..10Checked property (Page 3648)
Layer00..10Color property (Page 3649)
Application Property (Page 3486)
BackColor Property (Page 3496)

3270

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FillColor Property (Page 3590)
FillStyle Property (Page 3594)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
Layer00..10FillColor property (Page 3650)
Layer00..10FillStyle property (Page 3650)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

Actions Object (Listing)


Description

Displays a listing of the actions that are configured on an event.

VBA Object Name


HMIActions

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3271

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the AddAction method to configure one or more actions on an event. In this example a
button and a circle will be inserted in the active picture. In runtime the radius of the circle
enlarges every time you click the button:

Sub CreateVBActionToClickedEvent()
'VBA203
Dim objButton As HMIButton
Dim objCircle As HMICircle
Dim objVBScript As HMIScriptInfo
Dim strVBCode As String
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircle
.Top = 100
.Left = 100
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "Increase Radius"
End With
'define event and assign sourcecode to it:
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
strVBCode = "Dim myCircle" & vbCrLf & "Set myCircle = "
strVBCode = strVBCode & "HMIRuntime.ActiveScreen.ScreenItems(""Circle_VB"")"
strVBCode = strVBCode & vbCrLf & "myCircle.Radius = myCircle.Radius + 5"
With objVBScript
.SourceCode = strVBCode
End With
End Sub

See also
AddAction Method (Page 3173)
Configuring Event-Driven Actions with VBA (Page 3092)
Parent Property (Page 3710)
Item Property (Page 3639)
Count Property (Page 3562)
Application Property (Page 3486)

3272

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

ActiveXControl Object
Description

Represents the ActiveX Control object. The ActiveXControl object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIActiveXControl

Usage
Use the AddActiveXControl method to insert an ActiveX Control in a picture, for instance. In
the following example the ActiveX Control "WinCC Gauge Control" is inserted in the active
picture.

Sub AddActiveXControl()
'VBA204
Dim objActiveXControl As HMIActiveXControl
Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",
"XGAUGE.XGaugeCtrl.1")
With ActiveDocument
.HMIObjects("WinCC_Gauge").Top = 40
.HMIObjects("WinCC_Gauge").Left = 40
End With
End Sub

See also
ServerName Property (Page 3760)
AddActiveXControl Method (Page 3174)
VBA Reference (Page 3124)
ActiveX controls (Page 3064)
ProgID Property (Page 3734)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3273

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Transparency property (Page 3789)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

AdvancedAnalogDisplay object
Description
Represents the "Analog Display (Advanced)" object. The "AdvancedAnalogDisplay" object is
an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

3274

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMIAdvancedAnalogDisplay

Application
Use the AddHMIObject method to create a new "Analog Display (Advanced)" object in a
picture:

Sub AddAdvancedAnalogDisplay()
'VBA857
Dim objAdvancedAnalogDisplay As HMIAdvancedAnalogDisplay
Set objAdvancedAnalogDisplay = ActiveDocument.HMIObjects.AddHMIObject("Analogdisplay1",
"HMIAdvancedAnalogDisplay")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditAdvancedAnalogDisplay()
'VBA858
Dim objAdvancedAnalogDisplay As HMIAdvancedAnalogDisplay
Set objAdvancedAnalogDisplay = ActiveDocument.HMIObjects("Analogdisplay1")
objAdvancedAnalogDisplay.BackColor_Simulation = RGB(255, 0, 0)
End Sub

See also
AlarmGoneVisible property (Page 3480)
AlignmentLeft Property (Page 3482)
AlignmentTop Property (Page 3483)
Application Property (Page 3486)
BackColor Property (Page 3496)
BackColor_Alarm.._Warning property (Page 3498)
BackFillColor property (Page 3500)
BackFillColor_OK property (Page 3501)
BackFillColor_Simulation property (Page 3501)
BackFillStyle property (Page 3501)
BackFillStyle_OK property (Page 3501)
BackFillStyle_Simulation property (Page 3502)
BorderColor Property (Page 3517)
BorderWidth Property (Page 3525)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3275

VBA for Automated Configuration


5.5 VBA Reference
UseGlobalAlarmClasses property (Page 3805)
CBackColorOff..ColorOn property (Page 3533)
CBackFlash property (Page 3533)
CollectValue property (Page 3544)
CornerRadius property (Page 3562)
CQBackColorOff..ColorOn property (Page 3564)
CQBackFlash property (Page 3564)
CQTextColorOff..ColorOn property (Page 3564)
CTextColorOff..ColorOn property (Page 3565)
CQTextFlash property (Page 3565)
CTextFlash property (Page 3565)
EventQuitMask property (Page 3582)
EnableFlashing property (Page 3581)
Events Property (Page 3583)
FontBold Property (Page 3613)
FontItalic Property (Page 3614)
FontName Property (Page 3615)
FontSize Property (Page 3615)
FontUnderline Property (Page 3616)
ForeColor Property (Page 3617)
Format property (Page 3620)
ForeColor_Alarm.._Warning property (Page 3618)
GlobalShadow property (Page 3621)
GNQBackColorOff..ColorOn property (Page 3621)
GNQBackFlash property (Page 3622)
GNQTextColorOff..ColorOn property (Page 3622)
GNQTextFlash property (Page 3622)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
MessageClass Property (Page 3692)
ObjectName Property (Page 3700)
Operation Property (Page 3705)

3276

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Orientation Property (Page 3707)
OutputValue property (Page 3710)
PaintColor_QualityCodeBad property (Page 3710)
PaintColor_QualityCodeUnCertain property (Page 3710)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
PrioAlarm..Warning property (Page 3732)
PrioBit16..31 property (Page 3732)
Properties Property (Page 3736)
Relevant Property (Page 3744)
Selected Property (Page 3758)
ServerName Property (Page 3760)
ShowBadTagState property (Page 3763)
Simulation property (Page 3764)
SimulationBit property (Page 3764)
Tag property (Page 3778)
tagname property (Page 3778)
tagtype property (Page 3780)
trend property (Page 3790)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Transparency property (Page 3789)
Type Property (Page 3792)
UseValueText property (Page 3809)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectionPoints property (Page 3560)
FlashState property (Page 3610)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3277

VBA for Automated Configuration


5.5 VBA Reference

AdvancedStateDisplay object
Description
Represents the "State Display (Advanced)" object. The "AdvancedStateDisplay" object is an
element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIAdvancedStateDisplay

Application
Use the AddHMIObject method to create a new "State Display (Advanced)" object in a picture:

Sub AddAdvancedStateDisplay()
'VBA859
Dim objAdvancedStateDisplay As HMIAdvancedStateDisplay
Set objAdvancedStateDisplay = ActiveDocument.HMIObjects.AddHMIObject("Statedisplay1",
"HMIAdvancedStateDisplay")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditAdvancedStateDisplay()
'VBA860
Dim objAdvancedStateDisplay As HMIAdvancedStateDisplay
Set objAdvancedStateDisplay = ActiveDocument.HMIObjects("Statedisplay1")
objAdvancedStateDisplay.PaintColor_QualityCodeBad = RGB(255, 0, 0)
End Sub

See also
UseGlobalAlarmClasses property (Page 3805)
EventQuitMask property (Page 3582)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Tag property (Page 3778)
tagname property (Page 3778)

3278

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
tagtype property (Page 3780)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Transparency property (Page 3789)
trend property (Page 3790)
Type Property (Page 3792)
UseEventState property (Page 3804)
Visible Property (Page 3880)
Width Property (Page 3883)
Selected Property (Page 3758)
ServerName Property (Page 3760)
ShowBadTagState property (Page 3763)
Properties Property (Page 3736)
Relevant Property (Page 3744)
Process property (Page 3733)
Process1 property (Page 3733)
Process2 property (Page 3733)
Process3 property (Page 3734)
PaintColor_QualityCodeBad property (Page 3710)
PaintColor_QualityCodeUnCertain property (Page 3710)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
PrioAlarm..Warning property (Page 3732)
PrioBit16..31 property (Page 3732)
MaxIndex property (Page 3676)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Index Property (Page 3633)
Events Property (Page 3583)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3279

VBA for Automated Configuration


5.5 VBA Reference
CollectValue property (Page 3544)
AlarmGoneVisible property (Page 3480)
Application Property (Page 3486)
BasePicture property (Page 3509)
BitPosition0..3 property (Page 3513)
BitSelect0..3 property (Page 3514)
ConnectionPoints property (Page 3560)
FlashPictureState property (Page 3604)
NibbleSelect property (Page 3698)
ConnectorObjects property (Page 3560)

AnalogResultInfo Object
Description

Displays an analog value range and associated property value in the Dynamic dialog. The
AnalogResultInfo object is an element of the AnalogResultInfos listing:

VBA Object Name


HMIAnalogResultInfo

Usage
Use the AnalogResultInfo object to return an individual value range and property value. For a
detailed example, please refer to "AnalogResultInfos Object (Listing)" in this documentation.

See also
AnalogResultInfos Object (Listing) (Page 3283)
Delete Method (Page 3208)
Value Property (Page 3809)
RangeTo Property (Page 3742)

3280

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Parent Property (Page 3710)
Application Property (Page 3486)

AnalogResultInfos Object (Listing)


Description

A listing of AnalogResultInfo objects that contain all the analog value ranges and the associated
property value in the Dynamic dialog.

VBA Object Name


HMIAnalogResultInfos

Usage
Use the Add method to add a new value range in the Dynamic dialog. In the following example
the radius of a circle will be dynamically configured using the Dynamic dialog, a tag name will
be assigned and three analog value ranges will be created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA206
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

Use AnalogResultInfos to return the AnalogResultInfos listing. In this example the value ranges
created in the above example will be output:

Sub ShowAnalogResultInfosOfCircleRadius()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3281

VBA for Automated Configuration


5.5 VBA Reference

'VBA207
Dim colAResultInfos As HMIAnalogResultInfos
Dim objAResultInfo As HMIAnalogResultInfo
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Dim iAnswer As Integer
Dim varRange As Variant
Dim varValue As Variant
Set objCircle = ActiveDocument.HMIObjects("Circle_A")
Set objDynDialog = objCircle.Radius.Dynamic
Set colAResultInfos = objDynDialog.AnalogResultInfos
For Each objAResultInfo In colAResultInfos
varRange = objAResultInfo.RangeTo
varValue = objAResultInfo.value
iAnswer = MsgBox("Ranges of values from Circle_A-Radius:" & vbCrLf & "Range of value to: "
& varRange & vbCrLf & "Value of property: " & varValue, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objAResultInfo
End Sub

See also
Add Method (AnalogResultInfos Listing) (Page 3166)
Parent Property (Page 3710)
Item Property (Page 3639)
ElseCase Property (Page 3580)
Count Property (Page 3562)
Application Property (Page 3486)

Application Object
Description

Represents the Graphics Designer editor. The Application object contains properties and
methods that return objects from the top layer. For example ActiveDocument returns a
Document object.

VBA Object Name


HMIApplication

3282

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use Application to return the Application object. In the following example the application
version is output:

Sub ShowApplicationVersion()
'VBA208
MsgBox Application.Version
End Sub

See also
ShowTagDialog Method (Page 3263)
CurrentDesktopLanguage Property (Page 3566)
TileWindowsVertically Method (Page 3264)
TileWindowsHorizontally Method (Page 3264)
ShowSymbolLibraryDialog Method (Page 3262)
ShowPropertiesDialog Method (Page 3262)
SaveDefaultConfig Method (Page 3255)
LoadDefaultConfig Method (Page 3238)
CascadeWindows Method (Page 3193)
ArrangeMinimizedWindows Method (Page 3190)
Activate Method (Page 3165)
VBA Reference (Page 3124)
WindowState Property (Page 3887)
Visible Property (Page 3880)
Version Property (Page 3879)
VBE Property (Page 3879)
VBAVersion Property (Page 3879)
SymbolLibraries Property (Page 3772)
ProjectType Property (Page 3736)
ProjectName Property (Page 3735)
ProfileName Property (Page 3734)
Parent Property (Page 3710)
Name Property (Page 3696)
IsConnectedToProject Property (Page 3636)
Documents Property (Page 3577)
DefaultHMIObjects Property (Page 3571)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3283

VBA for Automated Configuration


5.5 VBA Reference
CustomToolbars Property (Page 3568)
CustomMenus Property (Page 3568)
CurrentDataLanguage Property (Page 3565)
ConfigurationFileName Property (Page 3559)
AvailableDataLanguages Property (Page 3492)
ApplicationDataPath Property (Page 3487)
Application Property (Page 3486)
ActiveDocument Property (Page 3474)
CommandLine Property (Page 3557)
DisableVBAEvents Property (Page 3574)
AddIns property (Page 3479)
CopyPasteSettings property (Page 3562)
DisablePerformanceWarnings property (Page 3574)

ApplicationWindow Object
Description

Represents the "Application Window" object. The ApplicationWindow object is an element of


the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIApplicationWindow

3284

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Add method to create a new "Application Window" object in a picture:

Sub AddApplicationWindow()
'VBA209
Dim objApplicationWindow As HMIApplicationWindow
Set objApplicationWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow",
"HMIApplicationWindow")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditApplicationWindow()
'VBA210
Dim objApplicationWindow As HMIApplicationWindow
Set objApplicationWindow = ActiveDocument.HMIObjects("AppWindow")
objApplicationWindow.Sizeable = True
End Sub
Use "Selection"(Index) to return an object from the Selection listing:
Sub ShowNameOfFirstSelectedObject()
'VBA211
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Caption Property (Page 3531)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
WindowBorder Property (Page 3884)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
Sizeable Property (Page 3765)
OnTop Property (Page 3704)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3285

VBA for Automated Configuration


5.5 VBA Reference
Name Property (Page 3696)
Moveable Property (Page 3695)
MaximizeButton Property (Page 3676)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
CloseButton Property (Page 3543)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
ConnectionPoints property (Page 3560)
Template property (Page 3780)
ConnectorObjects property (Page 3560)

BarGraph Object
Description

3286

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Represents the "Bar" object. The BarGraph object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default settings of property values of all Standard,
Windows and Smart objects.

VBA Object Name


HMIBarGraph

Application
Use the Add method to create a new "Bar" object in a picture:

Sub AddBarGraph()
'VBA212
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditBarGraph()
'VBA213
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects("Bar1")
objBarGraph.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA214
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
TypeWarningHigh Property (Page 3799)
Max Property (Page 3675)
FillColor Property (Page 3590)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3287

VBA for Automated Configuration


5.5 VBA Reference
BorderStyle Property (Page 3524)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
ZeroPointValue Property (Page 3888)
ZeroPoint Property (Page 3887)
Width Property (Page 3883)
WarningLow Property (Page 3882)
WarningHigh Property (Page 3881)
Visible Property (Page 3880)
TypeWarningLow Property (Page 3800)
TypeToleranceLow Property (Page 3798)
TypeToleranceHigh Property (Page 3797)
TypeLimitLow4 Property (Page 3796)
TypeLimitHigh4 Property (Page 3794)
TypeAlarmLow Property (Page 3793)
TypeAlarmHigh Property (Page 3793)
Trend Property (Page 3790)
TrendColor Property (Page 3790)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
ToleranceLow Property (Page 3784)
ToleranceHigh Property (Page 3784)
ScalingType Property (Page 3752)
Scaling Property (Page 3751)
ScaleTicks Property (Page 3750)
ScaleColor Property (Page 3749)
RightComma Property (Page 3746)
Process Property (Page 3732)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Name Property (Page 3696)

3288

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Min Property (Page 3693)
Marker Property (Page 3674)
LongStrokesTextEach Property (Page 3673)
LongStrokesSize Property (Page 3672)
LongStrokesOnly Property (Page 3672)
LongStrokesBold Property (Page 3671)
LimitLow4 Property (Page 3663)
LimitHigh4 Property (Page 3661)
Left Property (Page 3659)
LeftComma Property (Page 3660)
Layer Property (Page 3648)
HysteresisRange Property (Page 3631)
Hysteresis Property (Page 3630)
Height Property (Page 3626)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontBold Property (Page 3613)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
Exponent Property (Page 3586)
Direction Property (Page 3573)
ColorWarningLow Property (Page 3555)
ColorWarningHigh Property (Page 3554)
ColorToleranceLow Property (Page 3552)
ColorToleranceHigh Property (Page 3551)
ColorLimitLow4 Property (Page 3549)
ColorLimitHigh4 Property (Page 3547)
ColorChangeType Property (Page 3547)
ColorAlarmLow Property (Page 3545)
ColorAlarmHigh Property (Page 3544)
CheckWarningLow Property (Page 3541)
CheckWarningHigh Property (Page 3541)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3289

VBA for Automated Configuration


5.5 VBA Reference
CheckToleranceLow Property (Page 3540)
CheckToleranceHigh Property (Page 3539)
CheckLimitLow4 Property (Page 3537)
CheckLimitHigh4 Property (Page 3536)
CheckAlarmLow Property (Page 3534)
CheckAlarmHigh Property (Page 3533)
BorderWidth Property (Page 3525)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
BackColor3 Property (Page 3498)
BackColor2 Property (Page 3497)
AxisSection Property (Page 3494)
Average Property (Page 3493)
Alignment Property (Page 3482)
AlarmLow Property (Page 3481)
AlarmHigh Property (Page 3480)
FillStyle2 Property (Page 3596)
Application Property (Page 3486)
Events Property (Page 3583)
ObjectName Property (Page 3700)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

3290

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

BinaryResultInfo Object
Description

Displays both the binary (boolean) value ranges and the associated property values in the
Dynamic dialog.

VBA Object Name


HMIBinaryResultInfo

Usage
Use BinaryResultInfo to return the BinaryResultInfo object. In the following example the radius
of a circle will be dynamically configured using the Dynamic dialog, a tag name will be assigned
and the associated property values will be assigned to both the binary value ranges:

Sub AddDynamicDialogToCircleRadiusTypeBinary()
'VBA215
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_C", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBool
.BinaryResultInfo.NegativeValue = 20
.BinaryResultInfo.PositiveValue = 40
End With
End Sub

See also
VBA Reference (Page 3124)
PositiveValue Property (Page 3730)
Parent Property (Page 3710)
NegativeValue Property (Page 3697)
Application Property (Page 3486)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3291

VBA for Automated Configuration


5.5 VBA Reference

BitResultInfo Object
Description

Displays both the value ranges for bit set/not set and the associated property values in the
Dynamic dialog.

VBA Object Name


HMIBitResultInfo

Usage
Use BitResultInfo to return a BitResultInfo object. In the following example the radius of a circle
will be dynamically configured using the Dynamic dialog, a tag name will be assigned, the bit
to be set will be defined and the associated property values will be assigned to the "set"/"not
set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA216
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
'Tag "NewDynmic1" must exist
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

See also
Delete Method (Page 3208)
VBA Reference (Page 3124)
BitSetValue Property (Page 3514)
BitNumber Property (Page 3512)
BitNotSetValue Property (Page 3512)

3292

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3486)
Parent Property (Page 3710)

Button Object
Description

Represents the "Button" object. The Button object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default settings of property values of all Standard,
Windows and Smart objects.

VBA Object Name


HMIButton

Application
Use the Add method to create a new "Button" object in a picture:

Sub AddButton()
'VBA217
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button", "HMIButton")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditButton()
'VBA218
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects("Button")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3293

VBA for Automated Configuration


5.5 VBA Reference

objButton.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA219
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ForeFlashColorOn Property (Page 3619)
BorderColorBottom Property (Page 3518)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
Text Property (Page 3781)
PictureUp Property (Page 3724)
PictureDown Property (Page 3722)
PasswordLevel Property (Page 3713)
Orientation Property (Page 3707)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Hotkey Property (Page 3629)
Height Property (Page 3626)
ForeFlashColorOff Property (Page 3618)

3294

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
ForeColor Property (Page 3617)
FontUnderline Property (Page 3616)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontItalic Property (Page 3614)
FontBold Property (Page 3613)
FlashRateForeColor Property (Page 3609)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashForeColor Property (Page 3601)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
DisplayOptions Property (Page 3576)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColorTop Property (Page 3519)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
BackBorderWidth Property (Page 3495)
AlignmentTop Property (Page 3483)
AlignmentLeft Property (Page 3482)
AdaptBorder Property (Page 3477)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3295

VBA for Automated Configuration


5.5 VBA Reference
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
PicDownReferenced Property (Page 3718)
PicDownTransparent Property (Page 3719)
PicDownUseTransColor Property (Page 3719)
PictAlignment property (Page 3721)
PicUpReferenced Property (Page 3725)
PicUpTransparent Property (Page 3725)
PicUpUseTransColor Property (Page 3726)
PicUseTransColor Property (Page 3727)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
WinCCStyle property (Page 3884)
WindowsStyle property (Page 3886)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

3296

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

CheckBox Object
Description

Represents the "Check Box" object. The CheckBox object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default settings of property values of all Standard,
Windows and Smart objects.

VBA Object Name


HMICheckBox

Application
Use the Add method to create a new "Check Box" object in a picture:

Sub AddCheckBox()
'VBA220
Dim objCheckBox As HMICheckBox
Set objCheckBox = ActiveDocument.HMIObjects.AddHMIObject("CheckBox", "HMICheckBox")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditCheckBox()
'VBA221
Dim objCheckBox As HMICheckBox
Set objCheckBox = ActiveDocument.HMIObjects("CheckBox")
objCheckBox.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3297

VBA for Automated Configuration


5.5 VBA Reference

Sub ShowNameOfFirstSelectedObject()
'VBA222
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Application Property (Page 3486)
AdaptBorder Property (Page 3477)
AlignmentLeft Property (Page 3482)
AlignmentTop Property (Page 3483)
BackColor Property (Page 3496)
BackFlashColorOff Property (Page 3502)
BackFlashColorOn Property (Page 3503)
BorderBackColor Property (Page 3516)
BorderColor Property (Page 3517)
BorderFlashColorOff Property (Page 3521)
BorderFlashColorOn Property (Page 3522)
BorderStyle Property (Page 3524)
BorderWidth Property (Page 3525)
BoxAlignment Property (Page 3527)
BoxCount Property (Page 3528)
Events Property (Page 3583)
FillColor Property (Page 3590)
Filling Property (Page 3592)
FillingIndex Property (Page 3593)
FillStyle Property (Page 3594)
FlashBackColor Property (Page 3598)

3298

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FlashBorderColor Property (Page 3599)
FlashForeColor Property (Page 3601)
FlashRateBackColor Property (Page 3606)
FlashRateBorderColor Property (Page 3607)
FlashRateForeColor Property (Page 3609)
FontBold Property (Page 3613)
FontItalic Property (Page 3614)
FontName Property (Page 3615)
FontSize Property (Page 3615)
FontUnderline Property (Page 3616)
ForeColor Property (Page 3617)
ForeFlashColorOff Property (Page 3618)
ForeFlashColorOn Property (Page 3619)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Index Property (Page 3633)
Layer Property (Page 3648)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
OperationMessage Property (Page 3706)
Orientation Property (Page 3707)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Process Property (Page 3732)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Text Property (Page 3781)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3299

VBA for Automated Configuration


5.5 VBA Reference
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Transparency property (Page 3789)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
WindowsStyle property (Page 3886)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

Circle Object
Description

Represents the "Circle" object. The Circle object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMICircle

Usage
Use the Add method to create a new "Circle" object in a picture:

Sub AddCircle()
'VBA223

3300

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objCircle As HMICircle


Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditCircle()
'VBA224
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects("Circle")
objCircle.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA225
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
FillColor Property (Page 3590)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
Radius Property (Page 3740)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3301

VBA for Automated Configuration


5.5 VBA Reference
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

3302

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

CircularArc Object
Description

Represents the "Circular Arc" object. The CircularArc object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMICircularArc

Usage
Use the Add method to create a new "Circular Arc" object in a picture:

Sub AddCiruclarArc()
'VBA226
Dim objCiruclarArc As HMICircularArc
Set objCiruclarArc = ActiveDocument.HMIObjects.AddHMIObject("CircularArc",
"HMICircularArc")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditCiruclarArc()
'VBA227
Dim objCiruclarArc As HMICircularArc
Set objCiruclarArc = ActiveDocument.HMIObjects("CircularArc")
objCiruclarArc.BorderColor = RGB(255, 0, 0)
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3303

VBA for Automated Configuration


5.5 VBA Reference
Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA228
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
HMIObjects Object (Listing) (Page 3361)
BorderBackColor Property (Page 3516)
SelectedObjects object (Listing) (Page 3428)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
StartAngle Property (Page 3769)
Radius Property (Page 3740)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashBorderColor Property (Page 3599)
EndAngle Property (Page 3582)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)

3304

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

Collection object
Description
Allows access to a listing of objects of the same type, for example, "Documents" objects.

See also
Application Property (Page 3486)
Count Property (Page 3562)
Item Property (Page 3639)
Parent Property (Page 3710)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3305

VBA for Automated Configuration


5.5 VBA Reference

ComboBox object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

&RPER%R[

6HOHFWLRQ
Represents the "ComboBox" object. The ComboBox object is an element of the following lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMIComboBox

Usage
Use the Add method to create a new "ComboBox" object in a picture:

Sub AddComboBox()
'VBA822
Dim objComboBox As HMIComboBox
Set objComboBox = ActiveDocument.HMIObjects.AddHMIObject("ComboBox", "HMIComboBox")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditComboBox()
'VBA850
Dim objComboBox As HMIComboBox
Set objComboBox = ActiveDocument.HMIObjects("ComboBox")
objComboBox.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

3306

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub ShowNameOfFirstSelectedObject()
'VBA824
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Left Property (Page 3659)
Layer Property (Page 3648)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
NumberLines Property (Page 3699)
ForeColor Property (Page 3617)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackColor Property (Page 3496)
BorderStyle Property (Page 3524)
BorderWidth Property (Page 3525)
FillColor Property (Page 3590)
FillStyle Property (Page 3594)
FontName Property (Page 3615)
FontSize Property (Page 3615)
FontBold Property (Page 3613)
FontItalic Property (Page 3614)
FontUnderline Property (Page 3616)
AlignmentLeft Property (Page 3482)
GlobalShadow property (Page 3621)
Index Property (Page 3633)
Text Property (Page 3781)
Operation Property (Page 3705)
PasswordLevel Property (Page 3713)
Visible Property (Page 3880)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3307

VBA for Automated Configuration


5.5 VBA Reference
ToolTipText Property (Page 3786)
SelText property (Page 3759)
SelIndex property (Page 3759)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GroupParent Property (Page 3625)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

ConnectionPoints Object (Listing)


Description

The listing returns the number of points to which the connector can be appended in the
specified object.

VBA object name


HMIConnectionPoints

3308

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Object properties
The ConnectionPoints object possesses the following properties:
Application
Count
Item
Parent

Example 1
In this example, a rectangle is inserted and the number of connection points is output:

Sub CountConnectionPoints()
'VBA229
Dim objRectangle As HMIRectangle
Dim objConnPoints As HMIConnectionPoints
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
Set objConnPoints = ActiveDocument.HMIObjects("Rectangle1").ConnectionPoints
MsgBox "Rectangle1 has " & objConnPoints.Count & " connectionpoints."
End Sub

Example 2:
In this example, a text field is inserted and the connection points are accessed via
"ConnectionPoints.Item". The coordinates of the connection points are shown in an output
window.

Sub GetConnectionPoints()
'VBA825
Dim xPos As Long
Dim yPos As Long
Dim objConnPoints As HMIConnectionPoints
Set objDoc = Application.ActiveDocument
Set objObject = objDoc.HMIObjects.AddHMIObject("Text","HMIStaticText")
Set objConnPoints = ActiveDocument.HMIObjects("Text").ConnectionPoints
For i = 1 To objConnPoints.Count
xPos = objObject.ConnectionPoints.Item(i)(0)
yPos = objObject.ConnectionPoints.Item(i)(1)
MsgBox "Coordinates " & i & ". ConnectionPoint:" & Chr(13) & "x: " & xPos & Chr(13) &
"y: " & yPos
Next
End Sub

The diagram below shows the positions of the 4 connection points of the text field.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3309

VBA for Automated Configuration


5.5 VBA Reference






Note
If you activate the connection points of a connector with VBA, the connection point index
begins with "1".
If you determine the connection points in the property window of the connector in the graphical
interface, the connection point index begins with "0".
The index numbers e.g. of the lower connection point in the picture are assigned as follows:
VBA: Index = 3
Graphical interface: Index = 2

See also
Parent Property (Page 3710)
Item Property (Page 3639)
Count Property (Page 3562)
Application Property (Page 3486)

CustomizedObject Object
Description

3310

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Represents the object called "Customized Object". The CustomizedObject object is an element
of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
In the case of the CustomizedObject object, the only properties that are available in the object
are those that you have selected in the "Configuration" dialog for the customized object
concerned.
Note
You cannot configure the CustomizedObject object with VBA.
Further information regarding customized objects can be found in the WinCC documentation
under "Customized Object".

VBA Object Name


HMICustomizedObject

Application
Use the CreateCustomizedObject Method with the Selection listing to create a new
"Customized Object" object in a picture:

Sub CreateCustomizedObject()
'VBA230
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objCustomizedObject As HMICustomizedObject
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
With objCircle
.Left = 10
.Top = 10
.Selected = True
End With
With objRectangle
.Left = 50
.Top = 50
.Selected = True
End With
MsgBox "objects created and selected!"
Set objCustomizedObject = ActiveDocument.Selection.CreateCustomizedObject
objCustomizedObject.ObjectName = "Customer-Object"
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3311

VBA for Automated Configuration


5.5 VBA Reference

Sub EditCustomizedObject()
'VBA231
Dim objCustomizedObject As HMICustomizedObject
Set objCustomizedObject = ActiveDocument.HMIObjects("Customer-Object")
MsgBox objCustomizedObject.ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
Destroy Method (Page 3212)
Delete Method (Page 3208)
CreateCustomizedObject Method (Page 3202)
How to Edit a Customized Object with VBA (Page 3076)
VBA Reference (Page 3124)
Customized Objects (Page 3074)
Editing Objects with VBA (Page 3053)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
Height Property (Page 3626)
InheritState property (Page 3635)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Type Property (Page 3792)

3312

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectionPoints property (Page 3560)
HMIUdoObjects property (Page 3629)
ConnectorObjects property (Page 3560)

D-I
DataLanguage Object
Description

Represents the installed project language, which is identified by its name and language
identifier. The DataLanguage object is an element of the DataLanguages listing:
The list of language codes is available in the WinCC documentation (Index > Language Code).
The hexadecimal value specified in the list has to be converted to its equivalent decimal value.

VBA Object Name


HMIDataLanguage

Usage
Use the DataLanguages property to return an individual DataLanguage object. In the following
example the first installed project language is output:

Sub ShowFirstObjectOfCollection()
'VBA232
Dim strName As String
strName = ActiveDocument.Application.AvailableDataLanguages(1).LanguageName
MsgBox strName
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3313

VBA for Automated Configuration


5.5 VBA Reference

See also
DataLanguages Object (Listing) (Page 3316)
VBA Reference (Page 3124)
Language-Dependent Configuration with VBA (Page 3018)
Parent Property (Page 3710)
LanguageName Property (Page 3646)
LanguageID Property (Page 3645)
Application Property (Page 3486)

DataLanguages Object (Listing)


Description

A listing of the DataLanguage objects that represent all the installed project languages.

VBA Object Name


HMIDataLanguages

Usage
Use the AvailableDataLanguages property to return the DataLanguages listing. In the following
example the installed project language is output:

Sub ShowDataLanguage()
'VBA233
Dim colDataLanguages As HMIDataLanguages
Dim objDataLanguage As HMIDataLanguage
Dim strLanguages As String
Dim iCount As Integer
iCount = 0
Set colDataLanguages = Application.AvailableDataLanguages
For Each objDataLanguage In colDataLanguages
If "" <> strLanguages Then strLanguages = strLanguages & "/"
strLanguages = strLanguages & objDataLanguage.LanguageName & " "
'Every 15 items of datalanguages output in a messagebox
If 0 = iCount Mod 15 And 0 <> iCount Then
MsgBox strLanguages

3314

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

strLanguages = ""
End If
iCount = iCount + 1
Next objDataLanguage
MsgBox strLanguages
End Sub

See also
Language-Dependent Configuration with VBA (Page 3018)
DataLanguage Object (Page 3313)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

DataSetObj object
Description
The "DataSetObj" object serves as a container for the internal storage of data of the user
objects or faceplate types. The DataSetObj object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIDataSetObj

See also
Application Property (Page 3486)
ConnectionPoints property (Page 3560)
Events Property (Page 3583)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDFonts Property (Page 3653)
Left Property (Page 3659)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3315

VBA for Automated Configuration


5.5 VBA Reference
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectorObjects property (Page 3560)

DestLink Object
Description

Represents the destination for a direct connection.

VBA Object Name


HMIDestLink

Usage
Use the DestinationLink property to return the DestLink object. In the following example the X
position of "Rectangle_A" is copied to the Y position of "Rectangle_B" in Runtime by clicking
on the button:

Sub DirectConnection()
'VBA234

3316

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objButton As HMIButton


Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 90
.Height = 50
.Text = "SetPosition"
End With
'
'Directconnection is initiated on mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of "Rectangle_A"
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of "Rectangle_B"
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DirectConnection Object (Page 3320)
VBA Reference (Page 3124)
Type Property (Page 3792)
ObjectName Property (Page 3700)
AutomationName Property (Page 3490)
Parent Property (Page 3710)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3317

VBA for Automated Configuration


5.5 VBA Reference

DirectConnection Object
Description

Represents a direct connection.

VBA Object Name


HMIDirectConnection

Usage
Use the DestinationLink and SourceLink properties to configure the source and destination of
a direct connection. In the following example the X position of "Rectangle_A" is copied to the
Y position of "Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA235
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 90
.Height = 50
.Text = "SetPosition"

3318

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
'
'Directconnection is initiated on mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of "Rectangle_A"
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of "Rectangle_B"
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DestinationLink Property (Page 3572)
SourceLink Object (Page 3433)
DestLink Object (Page 3316)
VBA Reference (Page 3124)
SourceLink Property (Page 3767)
Application Property (Page 3486)
Parent Property (Page 3710)

Document Object
Description

Displays a picture in Graphics Designer. The document object is an element of the documents
listing.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3319

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMIDocument

Usage
Use Documents(Index) to return an individual document object. In the following example the
file name of the first picture is displayed:

Sub ShowFirstObjectOfCollection()
'VBA236
Dim strName As String
strName = Application.Documents(3).Name
MsgBox strName
End Sub

You may also use the object "Me" if you wish to address the current document:

Sub ShowDocumentName()
'VBA812
Dim obj As Document
set obj = Me
MsgBox obj.Name
End Sub

For example, use the SaveAs method to save the picture under a different name. In the
following example the first picture will be saved under the name "CopyOfPicture1":

Sub SaveDocumentAs()
'VBA237
Application.Documents(3).SaveAs ("CopyOfPicture1")
End Sub

See also
Editing Pictures with VBA (Page 3047)
GridHeight Property (Page 3624)
Documents Object (Listing) (Page 3324)
SetRTLayerVisible Method (Page 3261)
SaveAs Method (Page 3254)
Save Method (Page 3252)
PrintProjectDocumentation Method (Page 3245)
PasteClipboard Method (Page 3243)
MoveSelection Method (Page 3240)

3320

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
IsRTLayerVisible Method (Page 3233)
Export Method (Page 3216)
CopySelection Method (Page 3199)
Close Method (Page 3196)
VBA Reference (Page 3124)
ExtendedZoomingEnable Property (Page 3587)
Width Property (Page 3883)
Visible Property (Page 3880)
Views Property (Page 3880)
UpdateCycle Property (Page 3803)
TabOrderOtherAction Property (Page 3775)
TabOrderMouse Property (Page 3775)
TabOrderKeyboard Property (Page 3774)
TabOrderAllHMIObjects Property (Page 3773)
SnapToGrid Property (Page 3766)
HMIDefaultObjects Object (Listing) (Page 3356)
Selection Property (Page 3759)
Properties Property (Page 3736)
Path Property (Page 3714)
PasswordLevel Property (Page 3713)
Parent Property (Page 3710)
Operation Property (Page 3705)
Name Property (Page 3696)
LockedByCreatorID Property (Page 3667)
LastChange Property (Page 3647)
HMIObjects Property (Page 3628)
Hide Property (Page 3627)
Height Property (Page 3626)
GridWidth Property (Page 3624)
GridColor Property (Page 3623)
Grid Property (Page 3622)
FillStyle Property (Page 3594)
Events Property (Page 3583)
CustomToolbars Property (Page 3568)
CustomMenus Property (Page 3568)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3321

VBA for Automated Configuration


5.5 VBA Reference
CursorMode Property (Page 3567)
BackColor Property (Page 3496)
Application Property (Page 3486)
BackPictureAlignment property (Page 3505)
BackPictureName property (Page 3505)
CommonVBSCode Property (Page 3556)
CommonVBSEventArea property (Page 3556)
CommonVBSPropertyArea property (Page 3557)
GlobalColorScheme property (Page 3621)
LayerDecluttering Property (Page 3651)
Layers Property (Page 3652)
Modified Property (Page 3695)
ObjectSizeDecluttering Property (Page 3702)
PdlProtection property (Page 3715)
GetDeclutterObjectSize method (Page 3207)
SetDeclutterObjectSize Method (Page 3260)
FireConnectionEvents method (Page 3219)
TransformDisplayCoordinate method (Page 3265)
TransformPixelCoordinate method (Page 3265)
FillBackColor property (Page 3590)

Documents Object (Listing)


Description

VBA Object Name


HMIDocuments

3322

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Usage
Note
Use the "ActiveDocument" property if you wish to refer to the active picture.
Use the Documents property to return the Documents listing. In the following example the
names of all open pictures are output:

Sub ShowDocuments()
'VBA238
Dim colDocuments As Documents
Dim objDocument As Document
Set colDocuments = Application.Documents
For Each objDocument In colDocuments
MsgBox objDocument.Name
Next objDocument
End Sub

Use the Add method to add a new Document object to the Documents listing. In the following
example a new picture is created:

Sub AddNewDocument()
'VBA239
Dim objDocument As Document
Set objDocument = Application.Documents.Add
End Sub

See also
Add Method (Page 3166)
Document Object (Page 3319)
SaveAll Method (Page 3253)
Open Method (Page 3242)
CloseAll Method (Page 3197)
Close Method (Page 3196)
VBA Reference (Page 3124)
Editing Pictures with VBA (Page 3047)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)
ActiveDocument Property (Page 3474)
Item Property (Page 3639)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3323

VBA for Automated Configuration


5.5 VBA Reference
SetOpenContext method (Page 3259)
ConvertWM method (Page 3199)

DotNetControl object
Description
Represents the "DotNetControl" object. The DotNetControl object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIDotNetControl

Application
Use the AddDotNetControl method to insert a DotNetControl in a picture.
In the following example, the ".NETControl" object from the Global Assembly Cache is inserted
in the active picture.

'VBA851
Dim DotNetControl As HMIDotNetControl
Set DotNetControl = ActiveDocument.HMIObjects.AddDotNetControl("MyVBAControl",
"System.Windows.Forms.Label", True,"Assembly=System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089")

See also
AddDotNetControl method (Page 3176)
Delete Method (Page 3208)
Application Property (Page 3486)
AssemblyInfo property (Page 3488)
ControlType property (Page 3562)
Events Property (Page 3583)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)

3324

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

DynamicDialog Object
Description

Represents the Dynamic dialog. You can use the dynamic dialog to make the properties of
pictures and objects respond dynamically to different value ranges.
Define the value range with the aid of the ResultType property.

VBA Object Name


HMIDynamicDialog

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3325

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the DynamicDialog object to make an object property dynamic. In the following example
the radius of a circle will be dynamically configured using the Dynamic dialog, a tag name will
be assigned and three analog value ranges will be created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA240
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.Trigger.VariableTriggers.Add "NewDynamic2", hmiVariableCycleType_5s
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

See also
Delete Method (Page 3208)
ConvertToScript Method (Page 3198)
CheckSyntax Method (Page 3195)
VariableStateValues Property (Page 3876)
VariableStateChecked Property (Page 3874)
Trigger Property (Page 3791)
SourceCode Property (Page 3768)
ScriptType Property (Page 3753)
ResultType Property (Page 3745)
Parent Property (Page 3710)
Compiled Property (Page 3558)
BitResultInfo Property (Page 3513)
BinaryResultInfo Property (Page 3511)
Application Property (Page 3486)
AnalogResultInfos Property (Page 3484)
Prototype Property (Page 3737)
QualityCodeStateChecked Properties (Page 3738)
QualityCodeStateValues Property (Page 3739)
UsedLanguage property (Page 3804)

3326

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VariablesExist Property (Page 3874)
VariableStateType Property (Page 3876)

Ellipse Object
Description

Represents the "Ellipse" object. The Ellipse object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIEllipse

Usage
Use the Add method to create a new "Ellipse" object in a picture:

Sub AddEllipse()
'VBA241
Dim objEllipse As HMIEllipse
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("Ellipse", "HMIEllipse")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditEllipse()
'VBA242
Dim objEllipse As HMIEllipse
Set objEllipse = ActiveDocument.HMIObjects("Ellipse")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3327

VBA for Automated Configuration


5.5 VBA Reference

objEllipse.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing.

Sub ShowNameOfFirstSelectedObject()
'VBA243
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
FillingIndex Property (Page 3593)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
RadiusWidth Property (Page 3742)
RadiusHeight Property (Page 3741)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)

3328

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Filling Property (Page 3592)
FillColor Property (Page 3590)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3329

VBA for Automated Configuration


5.5 VBA Reference

EllipseArc Object
Description

Represents the "Ellipse Arc" object. The EllipseArc object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIEllipseArc

Usage
Use the Add method to create a new "Ellipse Arc" object in a picture:

Sub AddEllipseArc()
'VBA244
Dim objEllipseArc As HMIEllipseArc
Set objEllipseArc = ActiveDocument.HMIObjects.AddHMIObject("EllipseArc", "HMIEllipseArc")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditEllipseArc()
'VBA245
Dim objEllipseArc As HMIEllipseArc
Set objEllipseArc = ActiveDocument.HMIObjects("EllipseArc")
objEllipseArc.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

3330

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub ShowNameOfFirstSelectedObject()
'VBA246
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Use the "HMIDefaultObjects(Index)" to return an object from the HMIDefaultObjects Listing:

Sub EditDefaultPropertiesOfEllipseArc()
'VBA247
Dim objEllipseArc As HMIEllipseArc
Set objEllipseArc = Application.DefaultHMIObjects("HMIEllipseArc")
objEllipseArc.BorderColor = RGB(255, 255, 0)
'create new "EllipseArc"-object
Set objEllipseArc = ActiveDocument.HMIObjects.AddHMIObject("EllipseArc2", "HMIEllipseArc")
End Sub

See also
ToolTipText Property (Page 3786)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
StartAngle Property (Page 3769)
RadiusWidth Property (Page 3742)
RadiusHeight Property (Page 3741)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashBorderColor Property (Page 3599)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3331

VBA for Automated Configuration


5.5 VBA Reference
EndAngle Property (Page 3582)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

3332

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

EllipseSegment Object
Description

Represents the "Ellipse Segment" object. The EllipseSegment object is an element of the
following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIEllipseSegment

Usage
Use the Add method to create a new "Ellipse Segment" object in a picture:

Sub AddEllipseSegment()
'VBA248
Dim objEllipseSegment As HMIEllipseSegment
Set objEllipseSegment = ActiveDocument.HMIObjects.AddHMIObject("EllipseSegment",
"HMIEllipseSegment")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditEllipseSegment()
'VBA249
Dim objEllipseSegment As HMIEllipseSegment
Set objEllipseSegment = ActiveDocument.HMIObjects("EllipseSegment")
objEllipseSegment.BorderColor = RGB(255, 0, 0)
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3333

VBA for Automated Configuration


5.5 VBA Reference
Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA250
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3786)
BackFlashColorOn Property (Page 3503)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
StartAngle Property (Page 3769)
RadiusWidth Property (Page 3742)
RadiusHeight Property (Page 3741)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)

3334

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FillColor Property (Page 3590)
EndAngle Property (Page 3582)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3335

VBA for Automated Configuration


5.5 VBA Reference

Event Object
Description

Represents an event that triggers one or more actions in Runtime (e.g. a direct connection).
An event can be configured onto an object and a property.

VBA Object Name


HMIEvent

Usage
Use the AddAction method to configure an action on an event. In this example a C action is
to be triggered in the event of a change of radius in Runtime:

Sub AddActionToPropertyTypeCScript()
'VBA251
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
'Create circle in the picture. If property "Radius" is changed,
'a C-action is added:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
End Sub

See also
Application Property (Page 3486)
Delete Method (Page 3208)
AddAction Method (Page 3173)
VBA Reference (Page 3124)
Parent Property (Page 3710)
EventType Property (Page 3585)

3336

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Actions Property (Page 3472)
EventName property (Page 3584)

Events Object (Listing)


Description

A listing of the Event objects that represent all the events configured onto an object. Use the
Item method to define the event that is intended to be configured:
You configure an action on a property with VBA by using the "Events(1)" property, where
the index "1" stands for the event "Upon change":
To configure an action onto an object with the aid of VBA, use the "Events(Index)" property,
where "Index" stands for the trigger event (see table):
Index

EventType (depending upon the object used)

hmiEventTypeNotDefined

hmiEventTypeMouseClick

hmiEventTypeMouseLButtonDown

hmiEventTypeMouseLButtonUp

hmiEventTypeMouseRButtonDown

hmiEventTypeMouseRButtonUp

hmiEventTypeKeyboardDown

hmiEventTypeKeyboardUp

hmiEventTypeFocusEnter

hmiEventTypeObjectChange

10

hmiEventTypePictureOpen

VBA Object Name


HMIEvents

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3337

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Item method to return an individual Event object. In this example the event names
and event types of all objects in the active pictures are put out. In order for this example to
work, insert some objects into the active picture and configure different events.

Sub ShowEventsOfAllObjectsInActiveDocument()
'VBA252
Dim colEvents As HMIEvents
Dim objEvent As HMIEvent
Dim iMax As Integer
Dim iIndex As Integer
Dim iAnswer As Integer
Dim strEventName As String
Dim strObjectName As String
Dim varEventType As Variant
iIndex = 1
iMax = ActiveDocument.HMIObjects.Count
For iIndex = 1 To iMax
Set colEvents = ActiveDocument.HMIObjects(iIndex).Events
strObjectName = ActiveDocument.HMIObjects(iIndex).ObjectName
For Each objEvent In colEvents
strEventName = objEvent.EventName
varEventType = objEvent.EventType
iAnswer = MsgBox("Objectname: " & strObjectName & vbCrLf & "Eventtype: " & varEventType &
vbCrLf & "Eventname: " & strEventName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objEvent
If vbCancel = iAnswer Then Exit For
Next iIndex
End Sub

See also
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

ExternalShapeInfo object
Description
Is used for internal purposes in Graphics Designer.

3338

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

FaceplateObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

)DFHSODWH2EMHFW

6HOHFWLRQ
Represents the "faceplate instance" object. The FaceplateObject object is an element of the
following lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMIFaceplateObject

Usage
Use the Add method to create a new "faceplate instance" object in a picture:

Sub AddFaceplateInstance()
'VBA826
Dim objFaceplateInstance As HMIFaceplateObject
Set objFaceplateInstance = ActiveDocument.HMIObjects.AddHMIObject("faceplate instance",
"HMIFaceplateObject")
objFaceplateInstance.Properties.Item(3).value = "Faceplate1.fpt"
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditFaceplateInstance()
'VBA827
Dim objFaceplateInstance As HMIFaceplateObject
Set objFaceplateInstance = ActiveDocument.HMIObjects("faceplate instance")
objFaceplateInstance.visible = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3339

VBA for Automated Configuration


5.5 VBA Reference

End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA828
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Layer Property (Page 3648)
Left Property (Page 3659)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
Operation Property (Page 3705)
PasswordLevel Property (Page 3713)
Visible Property (Page 3880)
ToolTipText Property (Page 3786)
ScalingMode property (Page 3751)
FaceplateType property (Page 3588)
Delete Method (Page 3208)
Destroy Method (Page 3212)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
InheritState property (Page 3635)
LDTooltipTexts Property (Page 3658)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)

3340

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

FaceplateObjects object
Description
A listing of the HMIFaceplateObject objects that represent all faceplate objects in the picture.

VBA Object Name


HMIFaceplateObjects

See also
Parent Property (Page 3710)
OriginalPropertyName property (Page 3708)

FaceplateProperty object
Description
Represents the property of a faceplate object. In the case of the FaceplateProperty object, the
use of the Value property is set as the default. For this reason you can use the following
notation, for example, to assign a new value to an object property:
<FaceplateObject>.<FaceplateProperty> = <Value>
You can use the "Dynamic" property to make an object property dynamic with VBA. Use the
"Events" listing to configure actions with VBA.

See also
CreateDynamic Method (Page 3204)
DeleteDynamic Method (Page 3210)
Application Property (Page 3486)
DisplayName Property (Page 3575)
Dynamic Property (Page 3578)
Events Property (Page 3583)
IsDynamicable Property (Page 3637)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3341

VBA for Automated Configuration


5.5 VBA Reference
Name Property (Page 3696)
Parent Property (Page 3710)
Value Property (Page 3809)
IsPublished property (Page 3638)
LDFontsType property (Page 3654)
ParentCookie property (Page 3713)

FolderItem Object
Description

Represents a folder or object in the Components Library. A FolderItem object of the "Folder"
type is an element of the FolderItems listing. A FolderItem object of the "Item" type is an element
of the Folder listing.

VBA Object Name


HMIFolderItem

Usage
Use the FolderItems property to return the FolderItems listing. In the following example the
names of folders in the "Global Library will be output:

Sub ShowFolderItemsOfGlobalLibrary()
'VBA253
Dim colFolderItems As HMIFolderItems
Dim objFolderItem As HMIFolderItem
Set colFolderItems = Application.SymbolLibraries(1).FolderItems
For Each objFolderItem In colFolderItems
MsgBox objFolderItem.Name
Next objFolderItem
End Sub

Use the CopyToClipboard method to copy a "FolderItem" object of the "Item" type to the
clipboard. In the following example the object "PC" will be copied to the clipboard.

3342

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub CopyFolderItemToClipboard()
'VBA254
Dim objGlobalLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
objGlobalLib.FolderItems("Folder2").Folder("Folder2").Folder.Item("Object1").CopyToClipboa
rd
End Sub

See also
Type Property (Page 3792)
FolderItems Object (Listing) (Page 3345)
Delete Method (Page 3208)
CopyToClipboard Method (Page 3201)
How to paste an object from the object library into a picture with VBA (Page 3045)
How to edit the component library with VBA (Page 3043)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3710)
Name Property (Page 3696)
LDNames Property (Page 3655)
Folder Property (Page 3610)
Application Property (Page 3486)
DisplayName Property (Page 3575)
Pathname Property (Page 3715)

FolderItems Object (Listing)


Description

A listing of the FolderItem objects that represent all the folders and objects in the Components
Library.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3343

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMIFolderItems

Usage
Use the FolderItems property to return the FolderItems listing. In the following example the
names of folders in the "Global Library will be output:

Sub ShowFolderItemsOfGlobalLibrary()
'VBA255
Dim colFolderItems As HMIFolderItems
Dim objFolderItem As HMIFolderItem
Set colFolderItems = Application.SymbolLibraries(1).FolderItems
For Each objFolderItem In colFolderItems
MsgBox objFolderItem.Name
Next objFolderItem
End Sub

Use the AddFolder method, for instance, to create a new folder in the Components Library. In
the following example the folder "Project Folder" will be created in the "Project Library":

Sub AddNewFolderToProjectLibrary()
'VBA256
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder")
End Sub

See also
AddItem Method (Page 3181)
SymbolLibrary Object (Page 3442)
FolderItem Object (Page 3342)
AddFromClipboard Method (Page 3178)
AddFolder Method (Page 3177)
How to paste an object from the object library into a picture with VBA (Page 3045)
How to edit the component library with VBA (Page 3043)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

3344

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FindByDisplayName Method (Page 3218)
Item Property (Page 3639)

GraphicObject Object
Description

Represents the object called "Graphic Object". The GraphicObject object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIGraphicObject

Usage
Use the Add method to create a new "Graphic Object" object in a picture:

Sub AddGraphicObject()
'VBA257
Dim objGraphicObject As HMIGraphicObject
Set objGraphicObject = ActiveDocument.HMIObjects.AddHMIObject("Graphic-Object",
"HMIGraphicObject")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditGraphicObject()
'VBA258

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3345

VBA for Automated Configuration


5.5 VBA Reference

Dim objGraphicObject As HMIGraphicObject


Set objGraphicObject = ActiveDocument.HMIObjects("Graphic-Object")
objGraphicObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA259
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Left Property (Page 3659)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3356)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
PicUseTransColor Property (Page 3727)
PictureName Property (Page 3723)
PicTransColor Property (Page 3721)
PicReferenced Property (Page 3720)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Name Property (Page 3696)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)

3346

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3347

VBA for Automated Configuration


5.5 VBA Reference

Group Object
Description

Represents the object called "Group Object". The Group Object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
A group object is created from the objects selected in a picture. The objects in the Group Object
are also saved in the "GroupedHMIObjects" listing and index numbers are newly allocated.
You have unrestricted access to the properties of all objects in the Group Object.
Further information regarding group objects can be found in the WinCC documentation under
"Group Object".

VBA Object Name


HMIGroup

Usage
Use the CreateGroup Method with the Selection listing to create a new "Group Object" object
in a picture:

Sub DoCreateGroup()
'VBA260
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "Group-Object"
End Sub

Use the following methods to edit an existing Group Object:


Methode "Add(Index)": Adds a new object to the group object.
Methode "Remove(Index)": Removes a object from the group object.
"UnGroup()" method: Ungroups the group object (ungroup).
"Delete()" Method: Deletes the group object and the objects that it contains.

3348

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditGroup()
'VBA261
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("Group-Object")
MsgBox objGroup.ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
GroupedObjects Object (Listing) (Page 3355)
Ungroup Method (Page 3265)
Remove Method (Page 3246)
Delete Method (Page 3208)
Add Method (GroupedObjects Listing) (Page 3170)
How to Edit Objects in Group Objects Using VBA (Page 3072)
How to Edit the Group Objects Using VBA (Page 3069)
VBA Reference (Page 3124)
Group Objects (Page 3067)
Editing Objects with VBA (Page 3053)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
GroupedHMIObjects Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3349

VBA for Automated Configuration


5.5 VBA Reference
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

GroupDisplay Object
Description

Represents the "Group Display" object. The GroupDisplay object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIGroupDisplay

Usage
Use the Add method to create a new "Group Display" object in a picture:

Sub AddGroupDisplay()
'VBA262
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("Groupdisplay",
"HMIGroupDisplay")
End Sub

3350

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditGroupDisplay()
'VBA263
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects("Groupdisplay")
objGroupDisplay.BackColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA264
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
MCText Property (Page 3689)
Height Property (Page 3626)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
UserValue1 Property (Page 3806)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
SignificantMask Property (Page 3763)
SameSize Property (Page 3749)
Relevant Property (Page 3744)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
MessageClass Property (Page 3692)
MCGUTextFlash Property (Page 3681)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3351

VBA for Automated Configuration


5.5 VBA Reference
MCGUTextColorOn Property (Page 3680)
MCGUTextColorOff Property (Page 3679)
MCGUBackFlash Property (Page 3679)
MCGUBackColorOn Property (Page 3678)
MCGUBackColorOff-Eigenschaft (Page 3677)
LockText Property (Page 3670)
LockTextColor Property (Page 3670)
LockStatus Property (Page 3669)
LockBackColor Property (Page 3667)
Left Property (Page 3659)
Layer Property (Page 3648)
FontUnderline Property (Page 3616)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontItalic Property (Page 3614)
FontBold Property (Page 3613)
FlashRate Property (Page 3605)
Button1..8Width property (Page 3530)
BackColor Property (Page 3496)
BackBorderWidth Property (Page 3495)
AlignmentTop Property (Page 3483)
AlignmentLeft Property (Page 3482)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)

3352

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Type Property (Page 3792)
Button1..8MessageClasses (Page 3529)
UseGlobalAlarmClasses property (Page 3805)
UseGlobalSettings property (Page 3806)
CollectValue property (Page 3544)
EventQuitMask property (Page 3582)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

GroupedObjects Object (Listing)


Description

A listing of the HMIObject objects that represent all the objects in the group object.

VBA Object Name


HMIGroupedObjects

Usage
Use the GroupedHMIObjects property to return the GroupedObjects listing. In the following
example all the objects in the first group object are output in the active picture. The group
object called "Group1" must first have been created:

Sub ShowGroupedObjectsOfFirstGroup()
'VBA265
Dim colGroupedObjects As HMIGroupedObjects
Dim objObject As HMIObject
Set colGroupedObjects = ActiveDocument.HMIObjects("Group1").GroupedHMIObjects
For Each objObject In colGroupedObjects
MsgBox objObject.ObjectName
Next objObject
End Sub

Use the Remove method, for instance, to remove an object from the group object. In the
following example the first object will be removed from the group object called "Group1":

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3353

VBA for Automated Configuration


5.5 VBA Reference

Sub RemoveObjectFromGroup()
'VBA266
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("Group1")
objGroup.GroupedHMIObjects.Remove (1)
End Sub

See also
Group Object (Page 3348)
Remove Method (Page 3246)
Add Method (GroupedObjects Listing) (Page 3170)
How to Edit the Group Objects Using VBA (Page 3069)
VBA Reference (Page 3124)
Group Objects (Page 3067)
Parent Property (Page 3710)
GroupedHMIObjects Property (Page 3625)
Count Property (Page 3562)
Application Property (Page 3486)
Item Property (Page 3639)

HMIDefaultObjects Object (Listing)


Description

A listing of the following HMIObject objects:

3354

Object

VBA object name

Line

HMILine

Polygon

HMIPolygon

Polyline

HMIPolyLine

Ellipse

HMIEllipse

Circle

HMICircle

Ellipse segment

HMIEllipseSegment

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Object

VBA object name

Pie segment

HMIPieSegment

Ellipse arc

HMIEllipseArc

Circular arc

HMICircularArc

Rectangle

HMIRectangle

Rounded rectangle

HMIRoundRectangle

Application window

HMIApplicationWindow

Screen Window

HMIPictureWindow

Static text

HMIStaticText

I/O Field

HMIIOField

Button

HMIButton

Check box

HMICheckBox

Radio box

HMIOptionGroup

Round button

HMIRoundButton

Bar

HMIBarGraph

Slider object

HMISlider

Graphic Object

HMIGraphicObject

Status display

HMIStatusDisplay

Text list

HMITextList

Connector

HMIObjConnection

Multiple row text

HMIMultiLineEdit

Combo box

HMIComboBox

List box

HMIListBox

Polygon tube

HMITubePolyline

T-piece

HMITubeTeeObject

Double T-piece

HMITubeDoubleTeeObject

Tube bend

HMITubeArcObject

3D bar

HMI3DBarGraph

Group display

HMIGroupDisplay

Faceplate instance

HMIFaceplateObject

VBA object name


HMIDefaultObjects

Usage
Use the DefaultHMIObjects property to change the default property values of the included
objects. In this example all the objects contained in the listing will be output:

Sub ShowDefaultObjects()
'VBA267
Dim strType As String
Dim strName As String

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3355

VBA for Automated Configuration


5.5 VBA Reference

Dim strMessage As String


Dim iMax As Integer
Dim iIndex As Integer
iMax = Application.DefaultHMIObjects.Count
iIndex = 1
For iIndex = 1 To iMax
With Application.DefaultHMIObjects(iIndex)
strType = .Type
strName = .ObjectName
strMessage = strMessage & "Element: " & iIndex & " / Objecttype: " & strType & " /
Objectname: " & strName
End With
If 0 = iIndex Mod 10 Then
MsgBox strMessage
strMessage = ""
Else
strMessage = strMessage & vbCrLf & vbCrLf
End If
Next iIndex
MsgBox "Element: " & iIndex & vbCrLf & "Objecttype: " & strType & vbCrLf & "Objectname: "
& strName
End Sub

See also
Button Object (Page 3293)
TextList Object (Page 3443)
StatusDisplay Object (Page 3438)
StaticText Object (Page 3435)
Slider object (Page 3430)
RoundRectangle Object (Page 3424)
RoundButton Object (Page 3420)
Rectangle Object (Page 3417)
PolyLine Object (Page 3407)
Polygon Object (Page 3404)
PieSegment Object (Page 3401)
PictureWindow Object (Page 3398)
OptionGroup Object (Page 3395)
Line Object (Page 3375)
IOField Object (Page 3363)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)

3356

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
BarGraph Object (Page 3286)
ApplicationWindow Object (Page 3284)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Count Property (Page 3562)
DefaultHMIObjects Property (Page 3571)
Application Property (Page 3486)
Item Property (Page 3639)

HMIObject Object
Description

Represents an object from the Object Palette of the Graphics Designer. The HMIObject object
is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.
This object contains the object properties that apply to all standard, smart and Windows objects
(incl. Width, Height, Top and Left).

VBA Object Name


HMIObject

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3357

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use HMIObjects(Index), for instance, to return an individual HMIObject object. "For Index you
can use either the index number or the name of the object. In the following example the name
of the first object in the active picture is output:

Sub ShowFirstObjectOfCollection()
'VBA268
Dim strName As String
strName = ActiveDocument.HMIObjects(1).ObjectName
MsgBox strName
End Sub

Use the Delete method to remove an object from the HMIObjects listing. In the following
example the first object in the active picture will be removed:

Sub DeleteObject()
'VBA269
ActiveDocument.HMIObjects(1).Delete
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3361)
HMIDefaultObjects Object (Listing) (Page 3354)
Delete Method (Page 3208)
VBA Reference (Page 3124)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Type Property (Page 3792)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
TabOrderAlpha Property (Page 3773)
TabOrderSwitch Property (Page 3776)
Selected Property (Page 3758)
Properties Property (Page 3736)
PasswordLevel Property (Page 3713)

3358

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Parent Property (Page 3710)
Operation Property (Page 3705)
Left Property (Page 3659)
LDTooltipTexts Property (Page 3658)
Layer Property (Page 3648)
Height Property (Page 3626)
GroupParent Property (Page 3625)
Events Property (Page 3583)
Application Property (Page 3486)
ObjectName Property (Page 3700)
ConnectionPoints property (Page 3560)

HMIObjects Object (Listing)


Description

A listing of the HMIObject objects that represent all the objects in the picture.

VBA Object Name


HMIObjects
Note
The sequence of HMI objects in the HMIObjects list can be altered by adding and/or deleting
HMI objects.
The sequence of listing can also change if HMI objects are processed in the current listing.
This behavior can occur if the Layers property is modified and/or if the methods "SendToBack"
and "BringToFront" are used.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3359

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the HMIObjects property to return the HMIObjects listing. In the following example all the
object names in the active picture are output:

Sub ShowObjectsOfDocument()
'VBA270
Dim colObjects As HMIObjects
Dim objObject As HMIObject
Set colObjects = ActiveDocument.HMIObjects
For Each objObject In colObjects
MsgBox objObject.ObjectName
Next objObject
End Sub

Use the AddHMIObject method to create a new object in the picture. In the following example
a circle will be inserted into the active picture:

Sub AddCircle()
'VBA271
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_1", "HMICircle")
End Sub

Use the Find method to search for one or more objects in the picture. In the following example,
objects of the "HMICircle" type will be searched for in the active picture:

Sub FindObjectsByType()
'VBA272
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
Set colSearchResults = ActiveDocument.HMIObjects.Find(ObjectType:="HMICircle")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "Objectname: " & strName
Next objMember
End Sub

See also
Count Property (Page 3562)
HMIDefaultObjects Object (Listing) (Page 3354)
SelectedObjects object (Listing) (Page 3428)
Find Method (Page 3217)
AddOLEObject Method (Page 3182)

3360

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
AddHMIObject Method (Page 3180)
AddActiveXControl Method (Page 3174)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
VBA Reference (Page 3124)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)
Parent Property (Page 3710)
Application Property (Page 3486)
AddDotNetControl method (Page 3176)
AddWPFControl method (Page 3185)
Item Property (Page 3639)

IOField Object
Description

Represents the "I/O Field" object. The IOField object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIIOField

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3361

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Add method to create a new "I/O Field" object in a picture:

Sub AddIOField()
'VBA273
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IO-Field", "HMIIOField")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditIOField()
'VBA274
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects("IO-Field")
objIOField.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA275
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Use the "HMIDefaultObjects(Index)" to return an object from the HMIDefaultObjects Listing:

Sub EditDefaultPropertiesOfIOField()
'VBA276
Dim objIOField As HMIIOField
Set objIOField = Application.DefaultHMIObjects("HMIIOField")
objIOField.BorderColor = RGB(255, 255, 0)
End Sub

See also
LimitMin Property (Page 3665)
ClearOnNew Property (Page 3543)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)

3362

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
PasswordLevel Property (Page 3713)
OutputValue Property (Page 3709)
OutputFormat Property (Page 3708)
Orientation Property (Page 3707)
OperationReport Property (Page 3706)
OperationMessage Property (Page 3706)
Operation Property (Page 3705)
LimitMax Property (Page 3664)
Left Property (Page 3659)
Layer Property (Page 3648)
HiddenInput Property (Page 3628)
Height Property (Page 3626)
ForeFlashColorOn Property (Page 3619)
ForeFlashColorOff Property (Page 3618)
ForeColor Property (Page 3617)
FontUnderline Property (Page 3616)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontItalic Property (Page 3614)
FontBold Property (Page 3613)
FlashRateForeColor Property (Page 3609)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashForeColor Property (Page 3601)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
EditAtOnce Property (Page 3579)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3363

VBA for Automated Configuration


5.5 VBA Reference
DataFormat Property (Page 3571)
CursorControl Property (Page 3566)
ClearOnError Property (Page 3542)
BoxType Property (Page 3529)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
AssumeOnFull Property (Page 3489)
AssumeOnExit Property (Page 3488)
AlignmentTop Property (Page 3483)
AlignmentLeft Property (Page 3482)
AdaptBorder Property (Page 3477)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
InputValue property (Page 3635)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

3364

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

L-Q
LanguageFont Object
Description

Contains the font settings for the project language. The LanguageFont object is an element of
the LanguageFonts listing.

VBA Object Name


HMILanguageFont

Usage
Use LDFonts(Index) to return an individual LanguageFont object. In the following example a
Button object will be created and the name of the first configured font will be output:

Sub ShowFirstObjectOfCollection()
'VBA277
Dim strName As String
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button", "HMIButton")
strName = objButton.LDFonts(1).Family
MsgBox strName
End Sub

Object properties
The LanguageFont object possesses the following properties:

See also
LanguageFonts Object (Listing) (Page 3368)
VBA Reference (Page 3124)
Underlined Property (Page 3801)
Size Property (Page 3764)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3365

VBA for Automated Configuration


5.5 VBA Reference
Parent Property (Page 3710)
LanguageID Property (Page 3645)
Italic Property (Page 3638)
Family Property (Page 3589)
Bold Property (Page 3515)
Application Property (Page 3486)

LanguageFonts Object (Listing)


Description

A listing of the LanguageFont objects that represent all the language-dependent fonts in an
object.

VBA Object Name


HMILanguageFonts

Usage
Use the LDFonts property to return the LanguageFonts listing. In the following example the
language identifiers of the configured fonts will be output:

Sub ShowLanguageFont()
'VBA278
Dim colLanguageFonts As HMILanguageFonts
Dim objLanguageFont As HMILanguageFont
Dim objButton As HMIButton
Dim iMax As Integer
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
Set colLanguageFonts = objButton.LDFonts
iMax = colLanguageFonts.Count
For Each objLanguageFont In colLanguageFonts
MsgBox "Planned fonts: " & iMax & vbCrLf & "Language-ID: " & objLanguageFont.LanguageID
Next objLanguageFont
End Sub

3366

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use the ItemByLcid method to define the language for which it is intended to enter font settings.
The following example sets the font attributes of a button for French and English.
Note
For this example to work, you must already have configured in the languages concerned.

Sub ExampleForLanguageFonts()
'VBA279
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "DefText"
Set colLangFonts = objButton.LDFonts
'Adjust fontsettings for french:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'Adjust fontsettings for english:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

See also
LanguageFont Object (Page 3365)
ItemByLcid Method (Page 3236)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3367

VBA for Automated Configuration


5.5 VBA Reference

LanguageText Object
Description

Contains the multilingual labels for an object. The LanguageText object is an element of the
LanguageTexts listing.

VBA Object Name


HMILanguageText

Usage
In the following example a German label and an English label will be assigned to the button
called "myButton":

Sub AddLanguagesToButton()
'VBA280
Dim objLabelText As HMILanguageText
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'Add text in actual datalanguage:
objButton.Text = "Actual-Language Text"
'
'Add english text:
Set objLabelText = ActiveDocument.HMIObjects("myButton").LDTexts.Add(1033, "English Text")
End Sub

See also
LanguageTexts Object (Listing) (Page 3371)
Delete Method (Page 3208)
VBA Reference (Page 3124)
Parent Property (Page 3710)
LanguageID Property (Page 3645)
DisplayText Property (Page 3576)
Application Property (Page 3486)

3368

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

LanguageTexts Object (Listing)


Description

A listing of the LanguageText objects that represent all the multilingual texts in an object.

VBA Object Name


HMILanguageTexts

Usage
Use one of the following properties to return the LanguageTexts listing:
LDLabelTexts Property
LDNames Property
LDStatusTexts Property
LDTexts Property
LDTooltipTexts Property
An example showing how to use the LanguageTexts listing can be found in this documentation
under the heading "LDStatusTexts Property".
Use the Add method to add multilingual texts to an object. In the following example a German
label and an English label will be assigned to the button called "myButton":

Sub AddLanguagesToButton()
'VBA281
Dim objLabelText As HMILanguageText
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'Add text in actual datalanguage:
objButton.Text = "Actual-Language Text"
'
'Add english text:
Set objLabelText = ActiveDocument.HMIObjects("myButton").LDTexts.Add(1033, "English Text")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3369

VBA for Automated Configuration


5.5 VBA Reference

See also
LanguageText Object (Page 3368)
ItemByLcid Method (Page 3236)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3710)
LDTooltipTexts Property (Page 3658)
LDTexts Property (Page 3657)
LDStatusTexts Property (Page 3656)
LDNames Property (Page 3655)
LDLabelTexts Property (Page 3654)
Count Property (Page 3562)
Application Property (Page 3486)

Layer Object
Description

Represents one of the 32 layers that are available in the picture.

VBA Object Name


HMILayer

Usage
Use the Layer object to define a name and the minimum and maximum zoom for a layer. You
define the visibility of layers separately by CS and RT layers:
Document Object: Controls the visibility of the RT layers.
View Object: Controls the visibility of the RT layers.
Use the Layers listing to return a Layer object. In the following example the settings for the
lowest layer are configured in the active picture:

3370

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub ConfigureSettingsOfLayer()
'VBA282
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
End Sub

See also
Layers Property (Page 3652)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)
Visible Property (Page 3880)
Number Property (Page 3698)
Name Property (Page 3696)
MinZoom Property (Page 3694)
MaxZoom Property (Page 3676)
LDNames Property (Page 3655)
ActiveLayer Property (Page 3474)

Layers Object (Listing)


Description

A listing of the Layer objects that represent the 32 layers in the picture.

VBA Object Name


HMILayer

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3371

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the LayersCS or LayersRT property to return the Layers listing. In the following example
the layer names in the copy of the active picture will be output:

Sub ShowLayer()
'VBA283
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim strLayerList As String
Dim iCounter As Integer
iCounter = 1
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
If 1 = iCounter Mod 2 And 32 > iCounter Then
strLayerList = strLayerList & vbCrLf
ElseIf 11 > iCounter Then
strLayerList = strLayerList & "
"
Else
strLayerList = strLayerList & "
"
End If
strLayerList = strLayerList & objLayer.Name
iCounter = iCounter + 1
Next objLayer
MsgBox strLayerList
End Sub

See also
Layer Object (Page 3370)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

3372

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Line Object
Description

Represents the "Line" object. The Line object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMILine

Usage
Use the Add method to create a new "Line" object in a picture:

Sub AddLine()
'VBA285
Dim objLine As HMILine
Set objLine = ActiveDocument.HMIObjects.AddHMIObject("Line1", "HMILine")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditLine()
'VBA286
Dim objLine As HMILine
Set objLine = ActiveDocument.HMIObjects("Line1")
objLine.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3373

VBA for Automated Configuration


5.5 VBA Reference

Sub ShowNameOfFirstSelectedObject()
'VBA287
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
AddHMIObject Method (Page 3180)
BorderBackColor Property (Page 3516)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
RotationAngle Property (Page 3746)
ReferenceRotationTop Property (Page 3744)
ReferenceRotationLeft Property (Page 3743)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Index Property (Page 3633)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashBorderColor Property (Page 3599)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderEndStyle Property (Page 3520)

3374

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
BorderColor Property (Page 3517)
ActualPointTop Property (Page 3476)
ActualPointLeft Property (Page 3475)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

ListBox object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

/LVW%R[

6HOHFWLRQ
Represents the "ListBox" object. The ListBox object is an element of the following listings:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3375

VBA for Automated Configuration


5.5 VBA Reference
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMIListBox

Usage
Use the Add method to create a new "ListBox" object in a picture:

Sub AddListBox()
'VBA829
Dim objListBox As HMIListBox
Set objListBox = ActiveDocument.HMIObjects.AddHMIObject("ListBox", "HMIListBox")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditListBox()
'VBA830
Dim objListBox As HMIListBox
Set objListBox = ActiveDocument.HMIObjects("ListBox")
objListBox.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA831
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Layer Property (Page 3648)
Left Property (Page 3659)
Top Property (Page 3787)

3376

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Width Property (Page 3883)
Height Property (Page 3626)
NumberLines Property (Page 3699)
ForeColor Property (Page 3617)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackColor Property (Page 3496)
FillColor Property (Page 3590)
BorderStyle Property (Page 3524)
BorderWidth Property (Page 3525)
FillStyle Property (Page 3594)
GlobalShadow property (Page 3621)
FontName Property (Page 3615)
FontSize Property (Page 3615)
FontBold Property (Page 3613)
FontItalic Property (Page 3614)
FontUnderline Property (Page 3616)
AlignmentLeft Property (Page 3482)
Index Property (Page 3633)
Text Property (Page 3781)
Operation Property (Page 3705)
PasswordLevel Property (Page 3713)
Visible Property (Page 3880)
ToolTipText Property (Page 3786)
OperationMessage Property (Page 3706)
OperationReport Property (Page 3706)
SelIndex property (Page 3759)
SelText property (Page 3759)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
Parent Property (Page 3710)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3377

VBA for Automated Configuration


5.5 VBA Reference
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

Menu Object
Description

Represents the "User Defined Menu" object. The Menu object is an element of the
CustomMenus listing.

VBA Object Name


HMIMenu

Usage
Use CustomMenus(Index) to return an individual Menu object. "For Index you can use either
the index number or the name of the object. In order for the following example to work, create
a user defined menu. For an example of this, please refer to "Creating a New ApplicationSpecific Menu" in this documentation. In the following example the name of the first userdefined menu in the active picture will be output:

Sub ShowFirstMenuOfMenucollection()
'VBA288
Dim strName As String
strName = ActiveDocument.CustomMenus(1).Label
MsgBox strName
End Sub

3378

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use the Delete method to remove a "Menu" object from the "CustomMenus" listing. In the
following example the first user-defined menu in the active picture will be removed:

Sub DeleteMenu()
'VBA289
Dim objMenu As HMIMenu
Set objMenu = ActiveDocument.CustomMenus(1)
objMenu.Delete
End Sub

See also
Menus Object (Listing) (Page 3382)
Delete Method (Page 3208)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create a New Application-Specific Menu (Page 3023)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3880)
StatusText Property (Page 3770)
Position Property (Page 3729)
Parent Property (Page 3710)
MenuItems Property (Page 3690)
LDStatusTexts Property (Page 3656)
LDLabelTexts Property (Page 3654)
Label Property (Page 3644)
Key Property (Page 3643)
Enabled Property (Page 3581)
Application Property (Page 3486)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3379

VBA for Automated Configuration


5.5 VBA Reference

Menus Object (Listing)


Description

A listing of the Menu objects that represent all the user-defined menus in the Graphics
Designer.

VBA Object Name


HMIMenus

Usage
Use the CustomMenus property to return the Menus listing. In the following example all the
user-defined menus in the active picture will be output.
Note
The Menus listing does not distinguish between application-specific and picture-specific
menus in the output.

Sub ShowCustomMenusOfDocument()
'VBA290
Dim colMenus As HMIMenus
Dim objMenu As HMIMenu
Dim strMenuList As String
Set colMenus = ActiveDocument.CustomMenus
For Each objMenu In colMenus
strMenuList = strMenuList & objMenu.Label & vbCrLf
Next objMenu
MsgBox strMenuList
End Sub

Use the Application property and the InsertMenu method if you want to create an applicationspecific menu. Create the VBA code in either the "Project Template" document or the "Global

3380

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Template" document. In the following example a user-defined menu called
"myApplicationMenu" will be created:

Sub InsertApplicationSpecificMenu()
'VBA291
Dim objMenu As HMIMenu
Set objMenu = Application.CustomMenus.InsertMenu(1, "a_Menu1", "myApplicationMenu")
End Sub

Use the ActiveDocument property and the InsertMenu method if you want to create a picturespecific menu. Create the VBA code in the document called "ThisDocument": In the following
example a picture-specific menu called "myDocumentMenu" will be created:;

Sub InsertDocumentSpecificMenu()
'VBA292
Dim objMenu As HMIMenu
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "d_Menu1", "myDocumentMenu")
End Sub

See also
Menu Object (Page 3378)
Item Method (Page 3234)
InsertMenu Method (Page 3225)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create a New Application-Specific Menu (Page 3023)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3381

VBA for Automated Configuration


5.5 VBA Reference

MenuItem Object
Description

Represents a menu entry for a user-defined menu in the Graphics Designer. The MenuItem
object is an element of the MenuItems listing.

VBA Object Name


HMIMenuItem

Usage
Note
In order for the examples to work, first create a user-defined menu. For an example of this,
please refer to "Adding a New Entry to the Menu" in this documentation.
Use MenuItems(Index) to return an individual MenuItem object. "For Index you can use either
the index number or the name of the object. In the following example the first entry in the first
user-defined menu in the active picture will be output:

Sub ShowFirstObjectOfCollection()
'VBA293
Dim strName As String
strName = ActiveDocument.CustomMenus(1).MenuItems(1).Label
MsgBox strName
End Sub

Use the Delete method to remove an object from the "MenuItems" listing. In the following
example the first entry in the first user-defined menu in the active picture will be deleted:

Sub DeleteMenuItem()
'VBA294
ActiveDocument.CustomMenus(1).MenuItems(1).Delete

3382

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
Parent Property (Page 3710)
MenuItems Object (Listing) (Page 3386)
Delete Method (Page 3208)
Configuring Menus and Toolbars (Page 3020)
How to assign VBA macros to menus and toolbars (Page 3036)
How to assign help texts to menus and toolbars (Page 3033)
How to add a new menu entry to a menu (Page 3025)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3880)
Tag Property (Page 3777)
SubMenu Property (Page 3771)
StatusText Property (Page 3770)
ShortCut Property (Page 3762)
Position Property (Page 3729)
MenuItemType Property (Page 3691)
Macro Property (Page 3673)
LDStatusTexts Property (Page 3656)
LDLabelTexts Property (Page 3654)
Label Property (Page 3644)
Key Property (Page 3643)
Icon Property (Page 3631)
Enabled Property (Page 3581)
Checked Property (Page 3535)
Application Property (Page 3486)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3383

VBA for Automated Configuration


5.5 VBA Reference

MenuItems Object (Listing)


Description

A listing of the MenuItem objects that represent all the entries in a user-defined menu.

Usage
Note
In order for the examples to work, first create a user-defined menu. For an example of this,
please refer to "Adding a New Entry to the Menu" in this documentation.
Use the MenuItems property to return the MenuItems listing. In the following example all the
entries in the first user-defined menu in the active picture will be output:
Note
The MenuItems listing does not distinguish between an application-specific and a picturespecific menu in the output.

Sub ShowMenuItems()
'VBA295
Dim colMenuItems As HMIMenuItems
Dim objMenuItem As HMIMenuItem
Dim strItemList As String
Set colMenuItems = ActiveDocument.CustomMenus(1).MenuItems
For Each objMenuItem In colMenuItems
strItemList = strItemList & objMenuItem.Label & vbCrLf
Next objMenuItem
MsgBox strItemList
End Sub

Use the InsertMenuItem method, for instance, to insert an entry into an existing user-defined
menu. In the following example the picture-specific menu "DocMenu2" will be created in the
active picture and the menu entry "MenuItem1" is inserted:

3384

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub InsertMenuItem()
'VBA296
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(2, "d_Menu2", "DocMenu2")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "m_Item2_1", "MenuItem 1")
End Sub

See also
InsertSubmenu Method (Page 3229)
MenuItem Object (Page 3382)
InsertSeparator Method (Page 3228)
InsertMenuItem Method (Page 3227)
How to add a new menu entry to a menu (Page 3025)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

MultiLineEdit object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

0XOWL/LQH(GLW

6HOHFWLRQ
Represents the "MultiLineEdit" object. The MultiLineEdit object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3385

VBA for Automated Configuration


5.5 VBA Reference

VBA object name


HMIMultiLineEdit

Usage
Use the Add method to create a new "MultiLineEdit" object in a picture:

Sub AddMultiLineEdit()
'VBA832
Dim objMultiLineEdit As HMIMultiLineEdit
Set objMultiLineEdit = ActiveDocument.HMIObjects.AddHMIObject("MultiLineEdit",
"HMIMultiLineEdit")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditMultiLineEdit()
'VBA833
Dim objMultiLineEdit As HMIMultiLineEdit
Set objMultiLineEdit = ActiveDocument.HMIObjects("MultiLineEdit")
objMultiLineEdit.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA834
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Layer Property (Page 3648)
Left Property (Page 3659)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BorderStyle Property (Page 3524)
BorderWidth Property (Page 3525)
BackColor Property (Page 3496)
FontName Property (Page 3615)

3386

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FontSize Property (Page 3615)
FontBold Property (Page 3613)
FontItalic Property (Page 3614)
FontUnderline Property (Page 3616)
ForeColor Property (Page 3617)
AlignmentLeft Property (Page 3482)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
Text Property (Page 3781)
Operation Property (Page 3705)
PasswordLevel Property (Page 3713)
Visible Property (Page 3880)
ToolTipText Property (Page 3786)
ObjectName Property (Page 3700)
GlobalShadow property (Page 3621)
Application Property (Page 3486)
GroupParent Property (Page 3625)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3387

VBA for Automated Configuration


5.5 VBA Reference

ObjConnection object
Description
Represents the "Connector" object. The ObjConnection object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
Note
You have read-only access to the properties of the ObjConnection object.

VBA Object Name


HMIObjConnection

Application
From the properties of the ObjConnection object you can find out which objects are connected.

Example
In order for the following example to work you must have connected two objects to the
connector in the active picture of the Graphics Designer. You can find the Connector object in
the Graphics Designer in the Object Palette under "Standard Objects". For this example to
work, give the connector the name "Connector1".
In the user-defined menu "Connector Info" you can click on the "Connector Info" entry and
display the objects connected via the connector:

Sub ShowConnectorInfo_Menu()
'VBA297
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim strDocName As String
strDocName = Application.ApplicationDataPath & ActiveDocument.Name
Set objMenu = Documents(strDocName).CustomMenus.InsertMenu(1, "ConnectorMenu",
"Connector_Info")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "ShowConnectInfo", "Info Connector")
End Sub
Sub
Dim
Dim
Dim
Dim
Dim

3388

ShowConnectorInfo()
objConnector As HMIObjConnection
iStart As Integer
iEnd As Integer
strStart As String
strEnd As String

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim strObjStart As String


Dim strObjEnd As String
Set objConnector = ActiveDocument.HMIObjects("Connector1")
iStart = objConnector.BottomConnectedConnectionPointIndex
iEnd = objConnector.TopConnectedConnectionPointIndex
strObjStart = objConnector.BottomConnectedObjectName
strObjEnd = objConnector.TopConnectedObjectName
Select Case iStart
Case 0
strStart = "top"
Case 1
strStart = "right"
Case 2
strStart = "bottom"
Case 3
strStart = "left"
End Select
Select Case iEnd
Case 0
strEnd = "top"
Case 1
strEnd = "right"
Case 2
strEnd = "bottom"
Case 3
strEnd = "left"
End Select
MsgBox "The selected connector links the objects " & vbCrLf & "'" & strObjStart & "' and '"
& strObjEnd & "'" & vbCrLf & "Connected points: " & vbCrLf & strObjStart & ": " & strStart
& vbCrLf & strObjEnd & ": " & strEnd
End Sub
Private Sub Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)
Select Case MenuItem.Key
Case "ShowConnectInfo"
Call ShowConnectorInfo
End Select
End Sub

See also
TopConnectedConnectionPointIndex Property (Page 3788)
TopConnectedObjectName Property (Page 3788)
BottomConnectedConnectionPointIndex Property (Page 3526)
BottomConnectedObjectName Property (Page 3526)
Application Property (Page 3486)
BorderBackColor Property (Page 3516)
BorderColor Property (Page 3517)
BorderEndStyle Property (Page 3520)
BorderFlashColorOff Property (Page 3521)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3389

VBA for Automated Configuration


5.5 VBA Reference
BorderFlashColorOn Property (Page 3522)
BorderStyle Property (Page 3524)
BorderWidth Property (Page 3525)
Events Property (Page 3583)
FlashBorderColor Property (Page 3599)
FlashRateBorderColor Property (Page 3607)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Orientation Property (Page 3707)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Transparency property (Page 3789)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectorType property (Page 3562)
ConnectionPoints property (Page 3560)
Display property (Page 3575)
ConnectorObjects property (Page 3560)

3390

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

OLEObject Object
Description

Represents the object called "OLE Element". The OLEObject object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIOLEObject

Usage
Use the AddOLEObject method to create a new "OLE Element" object in a picture: In the
following example an OLE Element containing a Wordpad document will be inserted into the
active picture:

Sub AddOLEObjectToActiveDocument()
'VBA298
Dim objOleObject As HMIOLEObject
Set objOleObject = ActiveDocument.HMIObjects.AddOLEObject("Wordpad Document",
"Wordpad.Document.1")
End Sub

Use "HMIObjects(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name: In this example the X coordinate of the OLE Element
"Wordpad Document" is set to 140:

Sub EditOLEObject()
'VBA299
Dim objOleObject As HMIOLEObject
Set objOleObject = ActiveDocument.HMIObjects("Wordpad Document")
objOleObject.Left = 140
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3391

VBA for Automated Configuration


5.5 VBA Reference
Use "Selection(Index)" to return an object from the Selection listing. "For Index you can use
either the index number or the name of the object. In this example the name of the first selected
object will be output:

Sub ShowNameOfFirstSelectedObject()
'VBA300
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
How to Create Picture-specific Menus and Toolbars (Page 3048)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
Delete Method (Page 3208)
AddOLEObject Method (Page 3182)
How to Create an Application-specific Toolbar (Page 3029)
VBA Reference (Page 3124)
OLE Objects (Page 3062)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)

3392

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Top Property (Page 3787)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

OptionGroup Object
Description

Represents the "Radio Box" object. The OptionGroup object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIOptionGroup

Usage
Use the Add method to create a new "Option Group" object in a picture:

Sub AddOptionGroup()
'VBA301
Dim objOptionGroup As HMIOptionGroup
Set objOptionGroup = ActiveDocument.HMIObjects.AddHMIObject("Radio-Box", "HMIOptionGroup")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3393

VBA for Automated Configuration


5.5 VBA Reference
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditOptionGroup()
'VBA302
Dim objOptionGroup As HMIOptionGroup
Set objOptionGroup = ActiveDocument.HMIObjects("Radio-Box")
objOptionGroup.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA303
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Left Property (Page 3659)
BorderStyle Property (Page 3524)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
Text Property (Page 3781)
Process Property (Page 3732)
PasswordLevel Property (Page 3713)
Orientation Property (Page 3707)
OperationMessage Property (Page 3706)
Operation Property (Page 3705)
Layer Property (Page 3648)

3394

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Index Property (Page 3633)
Height Property (Page 3626)
ForeFlashColorOn Property (Page 3619)
ForeFlashColorOff Property (Page 3618)
ForeColor Property (Page 3617)
FontUnderline Property (Page 3616)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontItalic Property (Page 3614)
FontBold Property (Page 3613)
FlashRateForeColor Property (Page 3609)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashForeColor Property (Page 3601)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
BoxCount Property (Page 3528)
BoxAlignment Property (Page 3527)
BorderWidth Property (Page 3525)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
AlignmentTop Property (Page 3483)
AlignmentLeft Property (Page 3482)
AdaptBorder Property (Page 3477)
Application Property (Page 3486)
Events Property (Page 3583)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3395

VBA for Automated Configuration


5.5 VBA Reference
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
WindowsStyle property (Page 3886)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

PictureWindow Object
Description

Represents the "Picture Window" object. The PictureWindow object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

3396

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMIPictureWindow

Usage
Use the Add method to create a new "Picture Window" object in a picture:

Sub AddPictureWindow()
'VBA304
Dim objPictureWindow As HMIPictureWindow
Set objPictureWindow = ActiveDocument.HMIObjects.AddHMIObject("PictureWindow1",
"HMIPictureWindow")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditPictureWindow()
'VBA305
Dim objPictureWindow As HMIPictureWindow
Set objPictureWindow = ActiveDocument.HMIObjects("PictureWindow1")
objPictureWindow.Sizeable = True
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA306
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
MaximizeButton Property (Page 3676)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Zoom Property (Page 3889)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3397

VBA for Automated Configuration


5.5 VBA Reference
WindowBorder Property (Page 3884)
Width Property (Page 3883)
Visible Property (Page 3880)
UpdateCycle Property (Page 3803)
Top Property (Page 3787)
TagPrefix Property (Page 3778)
Sizeable Property (Page 3765)
ServerPrefix Property (Page 3761)
ScrollPositionY Property (Page 3755)
ScrollPositionX Property (Page 3754)
ScrollBars Property (Page 3754)
PictureName Property (Page 3723)
OnTop Property (Page 3704)
OffsetTop Property (Page 3703)
OffsetLeft Property (Page 3703)
Moveable Property (Page 3695)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
CloseButton Property (Page 3543)
CaptionText Property (Page 3532)
Caption Property (Page 3531)
AdaptSize Property (Page 3479)
AdaptPicture Property (Page 3478)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
IndependentWindow property (Page 3632)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)

3398

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
ToolTipText Property (Page 3786)
Type Property (Page 3792)
WindowMonitorNumber property (Page 3885)
WindowPositionMode property (Page 3886)
ConnectionPoints property (Page 3560)
MenuToolBarConfig Property (Page 3692)
TitleBackColorActiveEnd property (Page 3782)
TitleBackColorActiveStart property (Page 3782)
TitleBackColorInactiveEnd property (Page 3782)
TitleBackColorInactiveStart property (Page 3782)
TitleForeColorActive property (Page 3783)
TitleForeColorInactive property (Page 3783)
Pinnable property (Page 3727)
Pinned property (Page 3728)
ConnectorObjects property (Page 3560)

PieSegment Object
Description

Represents the "Pie Segment" object. The PieSegment object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIPieSegment

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3399

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Add method to create a new "Pie Segment" object in a picture:

Sub AddPieSegment()
'VBA307
Dim objPieSegment As HMIPieSegment
Set objPieSegment = ActiveDocument.HMIObjects.AddHMIObject("PieSegment1", "HMIPieSegment")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditPieSegment()
'VBA308
Dim objPieSegment As HMIPieSegment
Set objPieSegment = ActiveDocument.HMIObjects("PieSegment1")
objPieSegment.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA309
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Filling Property (Page 3592)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
StartAngle Property (Page 3769)

3400

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Radius Property (Page 3740)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
FillColor Property (Page 3590)
EndAngle Property (Page 3582)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3401

VBA for Automated Configuration


5.5 VBA Reference
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

Polygon Object
Description

Represents the "Polygon" object. The Polygon object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIPolygon

Usage
Use the Add method to create a new "Polygon" object in a picture:

Sub AddPolygon()
'VBA310
Dim objPolygon As HMIPolygon
Set objPolygon = ActiveDocument.HMIObjects.AddHMIObject("Polygon", "HMIPolygon")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

3402

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub EditPolygon()
'VBA311
Dim objPolygon As HMIPolygon
Set objPolygon = ActiveDocument.HMIObjects("Polygon")
objPolygon.BorderColor = RGB (255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA312
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3786)
BorderBackColor Property (Page 3516)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
RotationAngle Property (Page 3746)
ReferenceRotationTop Property (Page 3744)
ReferenceRotationLeft Property (Page 3743)
PointCount Property (Page 3728)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Index Property (Page 3633)
Height Property (Page 3626)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3403

VBA for Automated Configuration


5.5 VBA Reference
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
ActualPointTop Property (Page 3476)
ActualPointLeft Property (Page 3475)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

3404

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

PolyLine Object
Description

Represents the "Polyline" object. The PolyLine object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIPolyLine

Usage
Use the Add method to create a new "Polyline" object in a picture:

Sub AddPolyLine()
'VBA313
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects.AddHMIObject("PolyLine1", "HMIPolyLine")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditPolyLine()
'VBA314
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects("PolyLine1")
objPolyLine.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3405

VBA for Automated Configuration


5.5 VBA Reference

Sub ShowNameOfFirstSelectedObject()
'VBA315
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Use the "HMIDefaultObjects(Index)" to return an object from the HMIDefaultObjects Listing:

Sub EditDefaultPropertiesOfPolyLine()
'VBA316
Dim objPolyLine As HMIPolyLine
Set objPolyLine = Application.DefaultHMIObjects("HMIPolyLine")
objPolyLine.BorderColor = RGB(255, 255, 0)
End Sub

See also
HMIDefaultObjects Object (Listing) (Page 3354)
BorderEndStyle Property (Page 3520)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
RotationAngle Property (Page 3746)
ReferenceRotationTop Property (Page 3744)
ReferenceRotationLeft Property (Page 3743)
PointCount Property (Page 3728)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Index Property (Page 3633)
Height Property (Page 3626)

3406

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FlashRateBorderColor Property (Page 3607)
FlashBorderColor Property (Page 3599)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
ActualPointTop Property (Page 3476)
ActualPointLeft Property (Page 3475)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3407

VBA for Automated Configuration


5.5 VBA Reference

Properties Object (Listing)


Description

A listing of the Property objects that represent all the properties of an object.

VBA Object Name


HMIProperties

Usage
Use the Properties(Index) property in order to return a Property object if you cannot access
an object property directly. For "Index" you can use either the index number or the VBA property
name of the object. In the following example the Properties property has to be used to access
the individual properties of a circle. The circle will be inserted into the picture as an HMIObject
object:

Sub AddObject()
'VBA319
Dim objObject As HMIObject
Set objObject = ActiveDocument.HMIObjects.AddHMIObject("CircleAsHMIObject", "HMICircle")
'
'Standard properties (e.g. "Position") are available every time:
objObject.Top = 40
objObject.Left = 40
'
'Individual properties have to be called using
'property "Properties":
objObject.Properties("FlashBackColor") = True
End Sub

See also
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Parent Property (Page 3710)

3408

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Count Property (Page 3562)
Application Property (Page 3486)
Item Property (Page 3639)

Property Object
Description

Represents the property of an object. In the case of the Property object the use of the Value
property is set as the default. For this reason you can use the following notation in order for
example to assign a new value to an object property:
<Object>.<Property> = <Value>
You can use the "Dynamic" property in order to make an object property dynamic with VBA.
Use the "Events" listing in order to configure actions with VBA.
The Property object is an element of the Properties listing.

VBA Object Name


HMIProperty

Usage
Use Properties(Index) to return an individual Property object. For "Index" you can use either
the index number or the name of the object property. In the following example the name of the
first property of the Circle object will be output:

Sub ShowFirstObjectOfCollection()
'VBA317
Dim objCircle As HMICircle
Dim strName As String
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
strName = objCircle.Properties(1).Name
MsgBox strName
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3409

VBA for Automated Configuration


5.5 VBA Reference
Use the CreateDynamic method to make an object property dynamic. In the following example
the "Radius" property of a circle object will be made dynamic with the aid of the tag "Otto",
which is updated every two seconds:

Sub DynamicToRadiusOfNewCircle()
'VBA318
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects("Circle")
Set objVariableTrigger =
objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVariableDirect, "NewDynamic1")
objVariableTrigger.CycleType = hmiCycleType_2s
End Sub

See also
DisplayName Property (Page 3575)
Properties Object (Listing) (Page 3408)
DeleteDynamic Method (Page 3210)
CreateDynamic Method (Page 3204)
VBA Reference (Page 3124)
Creating Dynamics with VBA (Page 3079)
Editing Objects with VBA (Page 3053)
Value Property (Page 3809)
Parent Property (Page 3710)
Name Property (Page 3696)
IsDynamicable Property (Page 3637)
Events Property (Page 3583)
Dynamic Property (Page 3578)
Application Property (Page 3486)
IsPublished property (Page 3638)

3410

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

QualityCodeStateValue Object
Description

Represents the quality code of a tag which is assigned in the dynamic dialog and used for
dynamization.

VBA Object Name


HMIQualityCodeStateValue

Object properties
The object QualityCodeStateValue has the following properties:
Application
Parent
VALUE_BAD_COMMLUV
VALUE_BAD_COMMLUV
VALUE_BAD_CONFERROR
VALUE_BAD_DEVICE
VALUE_BAD_MISCSTATES
VALUE_BAD_NONSPECIFIC
VALUE_BAD_NOTCONNECTED
VALUE_BAD_OUTOFSERV
VALUE_BAD_PROCRELNOM
VALUE_BAD_PROCRELSUB
VALUE_HIGHLIMITED
VALUE_LOWLIMITED
VALUE_UNCERT_ENGVHIGHLIM
VALUE_UNCERT_ENGVLOWLIM
VALUE_UNCERT_ENGVONLIM
VALUE_UNCERT_INITVAL
VALUE_UNCERT_LUV

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3411

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_MAINTDEM
VALUE_UNCERT_MISCSTATES
VALUE_UNCERT_NONSPECIFIC
VALUE_UNCERT_PROCRELNOM
VALUE_UNCERT_SIMVAL
VALUE_UNCERT_SUBSTSET
VarName

See also
VALUE_BAD_CONFERROR Property (Page 3817)
VBA Reference (Page 3124)
VarName Property (Page 3878)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_MISCSTATES Property (Page 3820)
VALUE_BAD_DEVICE Property (Page 3819)
VALUE_BAD_COMMNUV Property (Page 3815)
VALUE_BAD_COMMLUV Property (Page 3813)

3412

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Parent Property (Page 3710)
Application Property (Page 3486)

QualityCodeStateValues Object (Listing)


Description

A listing of QualityCodeStateValue objects which contain all quality codes in Dynamic dialog
and are used for dynamization.

VBA Object Name


HMIQualityCodeStateValues

Application
For example, use the Item property to define values in Dynamic dialog which will be used for
dynamization when the specified tag returns the configured quality code. In the following
example the radius of a circle is given dynamics with the dynamic dialog. Dynamization uses
the analysis of the quality code of a tag. If the tag fails to return a quality code, a substitute
value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA813
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'Activate qualitycode-statecheck
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3413

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

Object properties
The object QualityCodeStateValues has the following properties:
Application
Count
Item
Parent

See also
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VBA Reference (Page 3124)
VarName Property (Page 3878)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)

3414

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_MISCSTATES Property (Page 3820)
VALUE_BAD_DEVICE Property (Page 3819)
VALUE_BAD_CONFERROR Property (Page 3817)
VALUE_BAD_COMMNUV Property (Page 3815)
VALUE_BAD_COMMLUV Property (Page 3813)
Parent Property (Page 3710)
Item Property (Page 3639)
Count Property (Page 3562)
Application Property (Page 3486)

R-Z
Rectangle Object
Description

Represents the "Rectangle" object. The Rectangle object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3415

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMIRectangle

Usage
Use the Add method to create a new "Rectangle" object in a picture:

Sub AddRectangle()
'VBA320
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditRectangle()
'VBA321
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects("Rectangle1")
objRectangle.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA322
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)

3416

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
ToolTipText Property (Page 3786)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3417

VBA for Automated Configuration


5.5 VBA Reference
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

RoundButton Object
Description

Represents the "Round Button" object. The RoundButton object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIRoundButton

Usage
Use the Add method to create a new "Round Button" object in a picture:

Sub AddRoundButton()
'VBA323
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("Roundbutton1",
"HMIRoundButton")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

3418

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub EditRoundButton()
'VBA324
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects("Roundbutton1")
objRoundButton.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing.:

Sub ShowNameOfFirstSelectedObject()
'VBA325
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3786)
FlashBackColor Property (Page 3598)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
Toggle Property (Page 3783)
Radius Property (Page 3740)
Pressed Property (Page 3731)
PicUpUseTransColor Property (Page 3726)
PicUpTransparent Property (Page 3725)
PicUpReferenced Property (Page 3725)
PictureUp Property (Page 3724)
PictureDown Property (Page 3722)
PictureDeactivated Property (Page 3722)
PicDownUseTransColor Property (Page 3719)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3419

VBA for Automated Configuration


5.5 VBA Reference
PicDownTransparent Property (Page 3719)
PicDownReferenced Property (Page 3718)
PicDeactUseTransColor Property (Page 3717)
PicDeactTransparent Property (Page 3717)
PicDeactReferenced-Eigenschaft (Page 3716)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColorTop Property (Page 3519)
BorderColor Property (Page 3517)
BorderColorBottom Property (Page 3518)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
BackBorderWidth Property (Page 3495)
AlignmentLeft Property (Page 3482)
AlignmentTop Property (Page 3483)
Application Property (Page 3486)
DisplayOptions Property (Page 3576)
Events Property (Page 3583)
FontBold Property (Page 3613)

3420

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FontItalic Property (Page 3614)
FontName Property (Page 3615)
FontSize Property (Page 3615)
FontUnderline Property (Page 3616)
ForeColor Property (Page 3617)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
PictAlignment property (Page 3721)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Text Property (Page 3781)
Transparency property (Page 3789)
Type Property (Page 3792)
WinCCStyle property (Page 3884)
WindowsStyle property (Page 3886)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3421

VBA for Automated Configuration


5.5 VBA Reference

RoundRectangle Object
Description

Represents the "Rounded Rectangle" object. The RoundRectangle object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIRoundRectangle

Usage
Use the Add method to create a new "Rounded Rectangle" object in a picture:

Sub AddRoundRectangle()
'VBA326
Dim objRoundRectangle As HMIRoundRectangle
Set objRoundRectangle = ActiveDocument.HMIObjects.AddHMIObject("Roundrectangle1",
"HMIRoundRectangle")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditRoundRectangle()
'VBA327
Dim objRoundRectangle As HMIRoundRectangle
Set objRoundRectangle = ActiveDocument.HMIObjects("Roundrectangle1")
objRoundRectangle.BorderColor = RGB(255, 0, 0)
End Sub

3422

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA328
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Width Property (Page 3883)
BorderBackColor Property (Page 3516)
SelectedObjects object (Listing) (Page 3428)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
RoundCornerWidth Property (Page 3748)
RoundCornerHeight Property (Page 3747)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3423

VBA for Automated Configuration


5.5 VBA Reference
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

ScriptInfo Object
Description

3424

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Represents a script (C, VB) that is configured for adding dynamics to a property or action to
an event.

VBA Object Name


HMIScriptInfo

Usage
Use the CreateDynamic method to make a property dynamic with the aid of a script. In the
following example...

Sub AddDynamicAsCSkriptToProperty()
'VBA329
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set objCScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeCScript)
'
'Define triggertype and cycletime:
With objCScript
.SourceCode = ""
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub

Use the AddAction method to configure an action on an event. In the following example...

Sub AddActionToPropertyTypeCScript()
'VBA330
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
'Add circle to picture. By changing of property "Radius"
'a C-action is added:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
End Sub

See also
Prototype Property (Page 3737)
Delete Method (Page 3208)
VBA Reference (Page 3124)
Creating Dynamics with VBA (Page 3079)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3425

VBA for Automated Configuration


5.5 VBA Reference
Trigger Property (Page 3791)
SourceCode Property (Page 3768)
ScriptType Property (Page 3753)
Parent Property (Page 3710)
Compiled Property (Page 3558)
Application Property (Page 3486)
UsedLanguage property (Page 3804)

SelectedObjects object (Listing)


Description

A listing of the HMIObject objects that represent all the selected objects in a picture.

VBA Object Name


HMISelectedObjects

Usage
Use the Selection property to return the Selection listing. In the following example the names
of all the selected objects in the active picture will be output:

Sub ShowSelectionOfDocument()
'VBA331
Dim colSelection As HMISelectedObjects
Dim objObject As HMIObject
Dim strObjectList As String
Set colSelection = ActiveDocument.Selection
If colSelection.Count <> 0 Then
strObjectList = "List of selected objects:"
For Each objObject In colSelection
strObjectList = strObjectList & vbCrLf & objObject.ObjectName
Next objObject
Else

3426

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

strObjectList = "No objects selected"


End If
MsgBox strObjectList
End Sub

Use the SelectAll method, for example, to select all the objects in the picture. In the following
example all the objects in the active picture are selected:

Sub SelectAllObjects()
'VBA332
ActiveDocument.Selection.SelectAll
End Sub

See also
HMIObjects Object (Listing) (Page 3359)
AlignTop Method (Page 3189)
HMIDefaultObjects Object (Listing) (Page 3354)
BringToFront Method (Page 3191)
SendToBack Method (Page 3257)
SelectAll Method (Page 3255)
SameWidthAndHeight Method (Page 3251)
SameWidth Method (Page 3250)
SameHeight Method (Page 3248)
Rotate Method (Page 3247)
Remove Method (Page 3246)
ForwardOneLevel Method (Page 3222)
BackwardOneLevel Method (Page 3190)
MoveSelection Method (Page 3240)
Item Method (Page 3234)
FlipVertically Method (Page 3220)
FlipHorizontally Method (Page 3219)
EvenlySpaceVertically Method (Page 3215)
EvenlySpaceHorizontally Method (Page 3213)
DuplicateSelection Method (Page 3212)
DeselectAll Method (Page 3211)
DeleteAll Method (Page 3209)
CreateGroup Method (Page 3206)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3427

VBA for Automated Configuration


5.5 VBA Reference
CreateCustomizedObject Method (Page 3202)
CopySelection Method (Page 3199)
CenterVertically Method (Page 3194)
CenterHorizontally Method (Page 3193)
AlignRight Method (Page 3188)
AlignLeft Method (Page 3187)
AlignBottom Method (Page 3186)
How to Edit a Customized Object with VBA (Page 3076)
How to Edit the Group Objects Using VBA (Page 3069)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
VBA Reference (Page 3124)
Customized Objects (Page 3074)
Group Objects (Page 3067)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

Slider object
Description

Represents the object called "Slider Object". The Slider object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

3428

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMISlider

Usage
Use the Add method to create a new "Slider Object" object in a picture:

Sub AddSlider()
'VBA333
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("Slider1", "HMISlider")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditSlider()
'VBA334
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects("Slider1")
objSlider.ButtonColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA335
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
OperationReport Property (Page 3706)
BorderFlashColorOff Property (Page 3521)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3429

VBA for Automated Configuration


5.5 VBA Reference
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
SmallChange Property (Page 3766)
Process Property (Page 3732)
PasswordLevel Property (Page 3713)
OperationMessage Property (Page 3706)
Operation Property (Page 3705)
Min Property (Page 3693)
Max Property (Page 3675)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
ExtendedOperation Property (Page 3587)
Direction Property (Page 3573)
ColorTop Property (Page 3553)
ColorBottom Property (Page 3546)
ButtonColor Property (Page 3530)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColorTop Property (Page 3500)
BackColor Property (Page 3496)

3430

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
BackColorBottom Property (Page 3499)
BackBorderWidth Property (Page 3495)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
WinCCStyle property (Page 3884)
WindowsStyle property (Page 3886)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

SourceLink Object
Description

Represents the source for a direct connection.

VBA Object Name


HMISourceLink

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3431

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the SourceLink property to return the SourceLink object. In the following example the X
position of "Rectangle_A" is copied to the Y position of "Rectangle_B" in Runtime by clicking
on the button:

Sub DirectConnection()
'VBA336
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
'
'Add objects to active document:
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "SetPosition"
End With
'
'Initiation of directconnection by mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Top-property of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Left-property of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DirectConnection Object (Page 3318)
VBA Reference (Page 3124)

3432

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Type Property (Page 3792)
SourceLink Property (Page 3767)
ObjectName Property (Page 3700)
AutomationName Property (Page 3490)
Application Property (Page 3486)
Parent Property (Page 3710)

StaticText Object
Description

Represents the "Static Text" object. The StaticText object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIStaticText

Usage
Use the Add method to create a new "Static Text" object in a picture:

Sub AddStaticText()
'VBA337
Dim objStaticText As HMIStaticText
Set objStaticText = ActiveDocument.HMIObjects.AddHMIObject("Static_Text1", "HMIStaticText")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3433

VBA for Automated Configuration


5.5 VBA Reference

Sub EditStaticText()
'VBA338
Dim objStaticText As HMIStaticText
Set objStaticText = ActiveDocument.HMIObjects("Static_Text1")
objStaticText.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA339
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
FontBold Property (Page 3613)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
Text Property (Page 3781)
PasswordLevel Property (Page 3713)
Orientation Property (Page 3707)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Height Property (Page 3626)
ForeFlashColorOn Property (Page 3619)
ForeFlashColorOff Property (Page 3618)
ForeColor Property (Page 3617)

3434

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
FontUnderline Property (Page 3616)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontItalic Property (Page 3614)
FlashRateForeColor Property (Page 3609)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashForeColor Property (Page 3601)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillingIndex Property (Page 3593)
Filling Property (Page 3592)
FillColor Property (Page 3590)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
AlignmentTop Property (Page 3483)
AlignmentLeft Property (Page 3482)
AdaptBorder Property (Page 3477)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDFonts Property (Page 3653)
LDTexts Property (Page 3657)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3435

VBA for Automated Configuration


5.5 VBA Reference
Parent Property (Page 3710)
Properties Property (Page 3736)
ReferenceRotationLeft Property (Page 3743)
ReferenceRotationTop Property (Page 3744)
RotationAngle Property (Page 3746)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

StatusDisplay Object
Description

Represents the "Status Display" object. The "StatusDisplay" object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIStatusDisplay

3436

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Add method to create a new "Status Display" object in a picture:

Sub AddStatusDisplay()
'VBA340
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditStatusDisplay()
'VBA341
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects("Statusdisplay1")
objStatusDisplay.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA342
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3786)
BasePicReferenced Property (Page 3507)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3883)
Visible Property (Page 3880)
Top Property (Page 3787)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3437

VBA for Automated Configuration


5.5 VBA Reference
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Left Property (Page 3659)
Layer Property (Page 3648)
Index Property (Page 3633)
Height Property (Page 3626)
FlashRateFlashPic Property (Page 3608)
FlashRateBorderColor Property (Page 3607)
FlashPicUseTransColor Property (Page 3604)
FlashPicture Property (Page 3603)
FlashPicTransColor Property (Page 3602)
FlashPicReferenced Property (Page 3601)
FlashFlashPicture Property (Page 3600)
FlashBorderColor Property (Page 3599)
BorderWidth Property (Page 3525)
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BasePicUseTransColor Property (Page 3510)
BasePicture Property (Page 3509)
BasePicTransColor Property (Page 3508)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)

3438

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Transparency property (Page 3789)
Type Property (Page 3792)
DrawInsideFrame property (Page 3578)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

SymbolLibraries Object (Listing)


Description

A listing of the SymbolLibrary objects that represent the Components Library. The listing
contains two objects: The first object is the "Global Library" and the second object is the "Project
Library".

VBA Object Name


HMISymbolLibraries

Usage
Use the SymbolLibraries property to return the SymbolLibraries listing. In the following example
the names of the libraries will be output:

Sub ShowSymbolLibraries()
'VBA344
Dim colSymbolLibraries As HMISymbolLibraries
Dim objSymbolLibrary As HMISymbolLibrary
Dim strLibraryList As String
Set colSymbolLibraries = Application.SymbolLibraries
For Each objSymbolLibrary In colSymbolLibraries
strLibraryList = strLibraryList & objSymbolLibrary.Name & vbCrLf
Next objSymbolLibrary
MsgBox strLibraryList
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3439

VBA for Automated Configuration


5.5 VBA Reference

See also
SymbolLibrary Object (Page 3442)
Item Method (Page 3234)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

SymbolLibrary Object
Description

Represents the "Global Library" or "Project Library". The SymbolLibrary object is an element
of the SymbolLibraries listing.

VBA Object Name


HMISymbolLibrary

Usage
Use SymbolLibraries(Index) to return an individual SymbolLibrary object. "For Index you can
use either the index number or the name of the object. In the following example the name of
the "Global Library" will be output:

Sub ShowFirstObjectOfCollection()
'VBA343
Dim strName As String
strName = Application.SymbolLibraries(1).Name
MsgBox strName
End Sub

3440

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
SymbolLibraries Object (Listing) (Page 3439)
GetItemByPath Method (Page 3223)
FindByDisplayName Method (Page 3218)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3710)
Name Property (Page 3696)
FolderItems Property (Page 3612)
Application Property (Page 3486)

TextList Object
Description

Represents the "Text List" object. The TextList object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMITextList

Usage
Use the Add method to create a new "Text List" object in a picture:

Sub AddTextList()
'VBA345

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3441

VBA for Automated Configuration


5.5 VBA Reference

Dim objTextList As HMITextList


Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("Textlist1", "HMITextList")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTextList()
'VBA346
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects("Textlist1")
objTextList.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA347
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Width Property (Page 3883)
ForeFlashColorOn Property (Page 3619)
BitNumber Property (Page 3512)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Visible Property (Page 3880)
UnselTextColor Property (Page 3802)
UnselBGColor Property (Page 3802)
Top Property (Page 3787)
ToolTipText Property (Page 3786)
SelTextColor Property (Page 3760)
SelBGColor Property (Page 3757)

3442

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
PasswordLevel Property (Page 3713)
OutputValue Property (Page 3709)
Orientation Property (Page 3707)
OperationReport Property (Page 3706)
OperationMessage Property (Page 3706)
Operation Property (Page 3705)
NumberLines Property (Page 3699)
ListType Property (Page 3666)
Left Property (Page 3659)
Layer Property (Page 3648)
LanguageSwitch Property (Page 3646)
ItemBorderWidth Property (Page 3642)
ItemBorderStyle Property (Page 3641)
ItemBorderColor Property (Page 3640)
ItemBorderBackColor Property (Page 3640)
Height Property (Page 3626)
ForeFlashColorOff Property (Page 3618)
ForeColor Property (Page 3617)
FontUnderline Property (Page 3616)
FontSize Property (Page 3615)
FontName Property (Page 3615)
FontItalic Property (Page 3614)
FontBold Property (Page 3613)
FlashRateForeColor Property (Page 3609)
FlashRateBorderColor Property (Page 3607)
FlashRateBackColor Property (Page 3606)
FlashForeColor Property (Page 3601)
FlashBorderColor Property (Page 3599)
FlashBackColor Property (Page 3598)
FillStyle Property (Page 3594)
FillColor Property (Page 3590)
EditAtOnce Property (Page 3579)
CursorControl Property (Page 3566)
BoxType Property (Page 3529)
BorderWidth Property (Page 3525)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3443

VBA for Automated Configuration


5.5 VBA Reference
BorderStyle Property (Page 3524)
BorderFlashColorOn Property (Page 3522)
BorderFlashColorOff Property (Page 3521)
BorderColor Property (Page 3517)
BorderBackColor Property (Page 3516)
BackFlashColorOn Property (Page 3503)
BackFlashColorOff Property (Page 3502)
BackColor Property (Page 3496)
AssumeOnExit Property (Page 3488)
Assignments Property (Page 3488)
AlignmentTop Property (Page 3483)
AlignmentLeft Property (Page 3482)
AdaptBorder Property (Page 3477)
Application Property (Page 3486)
Events Property (Page 3583)
GlobalColorScheme property (Page 3621)
GlobalShadow property (Page 3621)
GroupParent Property (Page 3625)
InputValue property (Page 3635)
LDTooltipTexts Property (Page 3658)
ObjectName Property (Page 3700)
Parent Property (Page 3710)
Properties Property (Page 3736)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Transparency property (Page 3789)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
DropDownListStyle property (Page 3578)
LDAssignments property (Page 3653)
TextBiblIDs property (Page 3781)
ConnectorObjects property (Page 3560)

3444

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Toolbar Object
Description

Represents the "User Defined Toolbar" object. The Toolbar object is an element of the
CustomToolbars listing.

VBA Object Name


HMIToolbar

Usage
Use CustomToolbars(Index) to return an individual Toolbar object. "For Index you can use
either the index number or the name of the object. In the following example the "Key" parameter
of the first user-defined toolbar in the active picture will be output:

Sub ShowFirstObjectOfCollection()
'VBA348
Dim strName As String
strName = ActiveDocument.CustomToolbars(1).Key
MsgBox strName
End Sub

Use the Delete method to remove a "Toolbar" object from the "CustomToolbars" listing. In the
following example the first user-defined toolbar in the active picture will be removed:

Sub DeleteToolbar()
'VBA349
Dim objToolbar As HMIToolbar
Set objToolbar = ActiveDocument.CustomToolbars(1)
objToolbar.Delete
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3445

VBA for Automated Configuration


5.5 VBA Reference

See also
Key Property (Page 3643)
Toolbars Object (Listing) (Page 3448)
Delete Method (Page 3208)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create an Application-specific Toolbar (Page 3029)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3880)
ToolbarItems Property (Page 3785)
Parent Property (Page 3710)
Application Property (Page 3486)

Toolbars Object (Listing)


Description

A listing of the Toolbar objects that represent all the user-defined toolbars in the Graphics
Designer.

VBA Object Name


HMICustomToolbars

Usage
Note
In order for the examples to work, first create a user-defined toolbar. For an example of this,
please refer to "Creating a New Application-Specific Toolbar" in this documentation.

3446

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use the CustomToolbars property to return the Toolbars listing. In the following example,
values for the "Key" property of all user-defined toolbars in the active picture will be output:
Note
The Toolbars listing does not distinguish between application-specific and picture-specific
toolbars in the output.

Sub ShowCustomToolbarsOfDocument()
'VBA350
Dim colToolbars As HMIToolbars
Dim objToolbar As HMIToolbar
Dim strToolbarList As String
Set colToolbars = ActiveDocument.CustomToolbars
If 0 <> colToolbars.Count Then
For Each objToolbar In colToolbars
strToolbarList = strToolbarList & objToolbar.Key & vbCrLf
Next objToolbar
Else
strToolbarList = "No toolbars existing"
End If
MsgBox strToolbarList
End Sub

Use the Application property and the Add method if you want to create an application-specific
toolbar. Create the VBA code in either the "Project Template" document or the "Global
Template" document.

Sub InsertApplicationSpecificToolbar()
'VBA351
Dim objToolbar As HMIToolbar
Set objToolbar = Application.CustomToolbars.Add("a_Toolbar1")
End Sub

Use the ActiveDocument property and the Add method if you want to create a picture-specific
toolbar. Create the VBA code in the document called "ThisDocument":

Sub InsertDocumentSpecificToolbar()
'VBA352
Dim objToolbar As HMIToolbar
Set objToolbar = ActiveDocument.CustomToolbars.Add("d_Toolbar1")
End Sub

See also
Toolbar Object (Page 3445)
Item Method (Page 3234)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3447

VBA for Automated Configuration


5.5 VBA Reference
Add Method (Page 3166)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create an Application-specific Toolbar (Page 3029)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

ToolbarItem Object
Description

Represents an object (icon or dividing line) in a user-defined toolbar in the GraphicsDesigner.


The ToolbarItem object is an element of the ToolbarItems listing.

VBA Object Name


HMIToolbarItem

Usage
Note
In order for the examples to work, first create a user-defined toolbar. For an example of this,
please refer to "Creating a New Application-Specific Toolbar" in this documentation.
Use ToolbarItems(Index) to return an individual ToolbarItem object. "For Index you can use
either the index number or the name of the object. In the following example the type of the first
object in the first user-defined toolbar in the active picture will be output:

3448

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub ShowFirstObjectOfCollection()
'VBA353
Dim strType As String
strType = ActiveDocument.CustomToolbars(1).ToolbarItems(1).ToolbarItemType
MsgBox strType
End Sub

Use the Delete method to remove an object from the "ToolbarItems" listing. In the following
example the first object will be deleted from the first user-defined toolbar in the active picture:

Sub DeleteToolbarItem()
'VBA354
ActiveDocument.CustomToolbars(1).ToolbarItems(1).Delete
End Sub

See also
Macro Property (Page 3673)
ToolbarItems Object (Listing) (Page 3452)
Delete Method (Page 3208)
Configuring Menus and Toolbars (Page 3020)
How to assign VBA macros to menus and toolbars (Page 3036)
How to assign help texts to menus and toolbars (Page 3033)
How to Add a New Icon to the Toolbar (Page 3031)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3880)
Type Property (Page 3792)
ToolTipText Property (Page 3786)
Tag Property (Page 3777)
StatusText Property (Page 3770)
ShortCut Property (Page 3762)
Position Property (Page 3729)
Parent Property (Page 3710)
LDTooltipTexts Property (Page 3658)
LDStatusTexts Property (Page 3656)
Key Property (Page 3643)
Icon Property (Page 3631)
Enabled Property (Page 3581)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3449

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3486)
ToolbarItemType property (Page 3786)

ToolbarItems Object (Listing)


Description

A listing of the ToolbarItem objects that represent all the objects in a user-defined toolbar.

VBA Object Name


HMIToolbarItems

Usage
Use the ToolbarItems property to return the ToolbarItems listing. In the following example, all
object types in the first user-defined toolbar in the active picture will be output:
Note
The ToolbarItems listing does not distinguish between application-specific and picturespecific toolbars in the output.

Sub ShowToolbarItems()
'VBA355
Dim colToolbarItems As HMIToolbarItems
Dim objToolbarItem As HMIToolbarItem
Dim strTypeList As String
Set colToolbarItems = ActiveDocument.CustomToolbars(1).ToolbarItems
If 0 <> colToolbarItems.Count Then
For Each objToolbarItem In colToolbarItems
strTypeList = strTypeList & objToolbarItem.ToolbarItemType & vbCrLf
Next objToolbarItem
Else
strTypeList = "No Toolbaritems existing"

3450

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End If
MsgBox strTypeList
End Sub

Use the InsertToolbarItem method, for instance, to insert an icon into an existing user-defined
toolbar. In the following example a picture-specific toolbar will be created in the active picture
and an icon will be added:

Sub InsertToolbarItem()
'VBA356
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("d_Toolbar2")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "t_Item2_1",
"ToolbarItem 1")
End Sub

See also
ToolbarItem Object (Page 3448)
InsertToolbarItem Method (Page 3231)
InsertSeparator Method (Page 3228)
InsertFromMenuItem Method (Page 3224)
How to Add a New Icon to the Toolbar (Page 3031)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3451

VBA for Automated Configuration


5.5 VBA Reference

Trigger Object
Description

Represents the trigger (e.g. Picture Cycle) that is necessary for adding dynamics to properties
with the aid of scripts. A trigger can possess multiple tag triggers.

VBA Object Name


HMITrigger

Usage
Use the Trigger property to return the Trigger object. In this example the "Radius" property of
a circle will be made dynamic with the aid of a VB script (the output value sets the radius):

Sub AddDynamicAsVBSkriptToProperty()
'VBA357
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
'
'Define cycletime and sourcecode
With objVBScript
.SourceCode = ""
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub

See also
Delete Method (Page 3208)
VBA Reference (Page 3124)
VariableTriggers Property (Page 3877)

3452

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Type Property (Page 3792)
Trigger Property (Page 3791)
Parent Property (Page 3710)
Name Property (Page 3696)
CycleType Property (Page 3570)
Application Property (Page 3486)

TubeArcObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH$UF2EMHFW

6HOHFWLRQ
Represents the "Tube arc" object. The TubeArcObject object is an element of the following
lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubeArcObject

Usage
Use the Add method to create a new "Tube arc" object in a picture:

Sub AddTubeArcObject()
'VBA835
Dim objTubeArcObject As HMITubeArcObject
Set objTubeArcObject = ActiveDocument.HMIObjects.AddHMIObject("TubeArcObject",
"HMITubeArcObject")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3453

VBA for Automated Configuration


5.5 VBA Reference
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTubeArcObject()
'VBA836
Dim objTubeArcObject As HMITubeArcObject
Set objTubeArcObject = ActiveDocument.HMIObjects("TubeArcObject")
objTubeArcObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA837
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Left Property (Page 3659)
Layer Property (Page 3648)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
BorderColor Property (Page 3517)
BorderWidth Property (Page 3525)
ToolTipText Property (Page 3786)
Visible Property (Page 3880)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Transparency property (Page 3789)
GlobalShadow property (Page 3621)
GlobalColorScheme property (Page 3621)
StartAngle Property (Page 3769)
EndAngle Property (Page 3582)
RadiusHeight Property (Page 3741)
RadiusWidth Property (Page 3742)

3454

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3486)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

TubeDoubleTeeObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH'RXEOH7HH2EMHFW

6HOHFWLRQ
Represents the "Double T-piece" object. The TubeDoubleTeeObject object is an element of
the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubeDoubleTeeObject

Usage
Use the Add method to create a new "Double T-piece" object in a picture:

Sub AddTubeDoubleTeeObject()
'VBA838
Dim objTubeDoubleTeeObject As HMITubeDoubleTeeObject
Set objTubeDoubleTeeObject = ActiveDocument.HMIObjects.AddHMIObject("Double T-piece",
"HMITubeDoubleTeeObject")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3455

VBA for Automated Configuration


5.5 VBA Reference

Sub EditTubeDoubleTeeObject()
'VBA839
Dim objTubeDoubleTeeObject As HMITubeDoubleTeeObject
Set objTubeDoubleTeeObject = ActiveDocument.HMIObjects("Double T-piece")
objTubeDoubleTeeObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA840
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Left Property (Page 3659)
Layer Property (Page 3648)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
BorderColor Property (Page 3517)
BorderWidth Property (Page 3525)
ToolTipText Property (Page 3786)
Visible Property (Page 3880)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Transparency property (Page 3789)
GlobalShadow property (Page 3621)
GlobalColorScheme property (Page 3621)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
Parent Property (Page 3710)
Properties Property (Page 3736)

3456

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

TubePolyline object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH3RO\OLQH

6HOHFWLRQ
Represents the "TubePolyline" object. The TubePolyline object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubePolyline

Usage
Use the Add method to create a new "TubePolyline" object in a picture:

Sub AddTubePolyline()
'VBA841
Dim objTubePolyline As HMITubePolyline
Set objTubePolyline = ActiveDocument.HMIObjects.AddHMIObject("TubePolyline",
"HMITubePolyline")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3457

VBA for Automated Configuration


5.5 VBA Reference
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTubePolyline()
'VBA842
Dim objTubePolyline As HMITubePolyline
Set objTubePolyline = ActiveDocument.HMIObjects("TubePolyline")
objTubePolyline.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA843
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Left Property (Page 3659)
Layer Property (Page 3648)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
BorderColor Property (Page 3517)
BorderWidth Property (Page 3525)
ToolTipText Property (Page 3786)
Visible Property (Page 3880)
PasswordLevel Property (Page 3713)
Operation Property (Page 3705)
Transparency property (Page 3789)
GlobalShadow property (Page 3621)
GlobalColorScheme property (Page 3621)
PointCount Property (Page 3728)
ActualPointLeft Property (Page 3475)
ActualPointTop Property (Page 3476)
Index Property (Page 3633)

3458

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3486)
Events Property (Page 3583)
BorderStyle Property (Page 3524)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

TubeTeeObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH7HH2EMHFW

6HOHFWLRQ
Represents the "T-piece" object. The TubeTeeObject object is an element of the following lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubeTeeObject

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3459

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Add method to create a new "T-piece" object in a picture:

Sub AddTubeTeeObject()
'VBA844
Dim objTubeTeeObject As HMITubeTeeObject
Set objTubeTeeObject = ActiveDocument.HMIObjects.AddHMIObject("T-piece",
"HMITubeTeeObject")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTubeTeeObject()
'VBA845
Dim objTubeTeeObject As HMITubeTeeObject
Set objTubeTeeObject = ActiveDocument.HMIObjects("T-piece")
objTubeTeeObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA846
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3700)
Left Property (Page 3659)
Layer Property (Page 3648)
Top Property (Page 3787)
Width Property (Page 3883)
Height Property (Page 3626)
BorderColor Property (Page 3517)
BorderWidth Property (Page 3525)
ToolTipText Property (Page 3786)
Visible Property (Page 3880)
PasswordLevel Property (Page 3713)

3460

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Operation Property (Page 3705)
Transparency property (Page 3789)
GlobalShadow property (Page 3621)
GlobalColorScheme property (Page 3621)
RotationAngle Property (Page 3746)
Application Property (Page 3486)
Events Property (Page 3583)
GroupParent Property (Page 3625)
LDTooltipTexts Property (Page 3658)
Parent Property (Page 3710)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
Type Property (Page 3792)
ConnectionPoints property (Page 3560)
ConnectorObjects property (Page 3560)

VariableStateValue Object
Description

Represents the state of a tag, the value of which is assigned in the Dynamic dialog and used

VBA Object Name


HMIVariableStateValue

See also
VALUE_SERVERDOWN Property (Page 3849)
VBA Reference (Page 3124)
VarName Property (Page 3878)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3461

VBA for Automated Configuration


5.5 VBA Reference
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_RANGE Property (Page 3843)
VALUE_MAX_LIMIT Property (Page 3841)
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HARDWARE_ERROR Property (Page 3835)
VALUE_HANDSHAKE_ERROR Property (Page 3833)
VALUE_CONVERSION_ERROR Property (Page 3832)
VALUE_ADDRESS_ERROR Property (Page 3811)
VALUE_ACCESS_FAULT Property (Page 3810)
Parent Property (Page 3710)
Application Property (Page 3486)

VariableStateValues Object (Listing)


Description

A listing of VariableStateValue objects containing all tag statuses in Dynamic dialog to be used
for dynamization.

VBA Object Name


HMIVariableStateValues

Usage
Use the Item property in the Dynamic dialog to define values that will be used for creating
dynamics when the specified tag returns the configured state. In the following example the
radius of a circle is given dynamics with the The dynamization takes place be evaluating the

3462

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
status of a tag. If the tag does not return a status, a substitute value (ElseCase property) is
defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA358
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'Activate variable-statecheck
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VALUE_MAX_RANGE Property (Page 3843)
VBA Reference (Page 3124)
VarName Property (Page 3878)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_LIMIT Property (Page 3841)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3463

VBA for Automated Configuration


5.5 VBA Reference
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HARDWARE_ERROR Property (Page 3835)
VALUE_HANDSHAKE_ERROR Property (Page 3833)
VALUE_CONVERSION_ERROR Property (Page 3832)
VALUE_ADDRESS_ERROR Property (Page 3811)
VALUE_ACCESS_FAULT Property (Page 3810)
Parent Property (Page 3710)
Item Property (Page 3639)
Application Property (Page 3486)

VariableTrigger Object
Description

Represents a tag trigger.

VBA Object Name


HMIVariableTrigger

Application
Use the VariableTrigger object in order to edit or delete an existing tag trigger. In this example
a circle property "Top" is made dynamic with the aid of the tag "NewDynamic1":

Sub AddDynamicAsVariableDirectToProperty()
'VBA359
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set objVariableTrigger = objCircle.Top.CreateDynamic(hmiDynamicCreationTypeVariableDirect,
"'NewDynamic1'")
'

3464

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'Define cycletime
With objVariableTrigger
.CycleType = hmiCycleType_2s
End With
End Sub

See also
Delete Method (Page 3208)
VariableTriggers Object (Listing) (Page 3467)
VBA Reference (Page 3124)
VariableTriggers Property (Page 3877)
Type Property (Page 3792)
Parent Property (Page 3710)
Name Property (Page 3696)
CycleType Property (Page 3570)
Application Property (Page 3486)
CycleName Property (Page 3569)
CycleTime Property (Page 3569)
VarName Property (Page 3878)

VariableTriggers Object (Listing)


Description

A listing of the VariableTrigger objects that represent all the tag triggers in use.

VBA Object Name


HMIVariableTriggers

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3465

VBA for Automated Configuration


5.5 VBA Reference

Usage
Use the Add method to create a new tag trigger. In the following example the radius of a circle
is made dynamic with the aid of a VB script. A tag trigger is used as the trigger:

Sub DynamicWithVariableTriggerCycle()
'VBA360
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
'Definition of triggername and cycletime is to do with the Add-methode
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With
End Sub

See also
Add Method (TagTriggers Listing) (Page 3172)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Item Property (Page 3639)
Count Property (Page 3562)
Application Property (Page 3486)

View Object
Description

Represents a copy of a picture. The View object is an element of the Views listing.
You can use the properties of the View object among other things to control the visibility of the
CS layers and to define the zoom.

3466

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VBA Object Name


HMIView

Usage
Use Views(Index) to return an individual View object. In the following example the number of
copies of the active picture will be output:

Sub ShowNumberOfExistingViews()
'VBA361
Dim iMaxViews As Integer
iMaxViews = ActiveDocument.Views.Count
MsgBox "Number of copies from active document: " & iMaxViews
End Sub

Use the Add method to add a new View object to the "Views" listing. In the following example
a copy of the active picture is created and then activated:

Sub AddView()
'VBA362
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Height Property (Page 3626)
Views Object (Listing) (Page 3470)
SetCSLayerVisible Method (Page 3258)
PrintDocument Method (Page 3244)
IsCSLayerVisible Method (Page 3232)
Delete Method (Page 3208)
Add Method (Views Listing) (Page 3173)
Activate Method (Page 3165)
VBA Reference (Page 3124)
Editing a Copy of a Picture with VBA (Page 3051)
Editing Layers with VBA (Page 3050)
ExtendedZoomingEnable Property (Page 3587)
Zoom Property (Page 3889)
WindowState Property (Page 3887)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3467

VBA for Automated Configuration


5.5 VBA Reference
Width Property (Page 3883)
Top Property (Page 3787)
ScrollPosY Property (Page 3757)
ScrollPosX Property (Page 3756)
Parent Property (Page 3710)
Left Property (Page 3659)
IsActive Property (Page 3635)
Application Property (Page 3486)
ActiveLayer Property (Page 3474)

Views Object (Listing)


Description

A listing of the View objects that represent a copy of a picture.

VBA Object Name


HMIViews

Usage
Use the Views listing to return a View object. In the following example the number of existing
copies of the active picture will be output:

Sub ShowNumberOfExistingViews()
'VBA363
Dim iMaxViews As Integer
iMaxViews = ActiveDocument.Views.Count
MsgBox "Number of copies from active document: " & iMaxViews
End Sub

Use the Add method to create a copy of a picture. In the following example a copy of the active
picture is created and then activated:

3468

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub AddViewToActiveDocument()
'VBA364
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Item Method (Page 3234)
View Object (Page 3466)
Add Method (Page 3166)
VBA Reference (Page 3124)
Parent Property (Page 3710)
Count Property (Page 3562)
Application Property (Page 3486)

WPFControl object
Description
Represents the "WPFControl" object. The WPFControl object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIWPFControl

Application
Use the AddWPFControl method to insert a WPFControl in a picture.
In the following example, the "WPF Control" object outside the Global Assembly Cache is
inserted in the active picture.

'VBA852
Dim WPFControl As HMIWPFControl
Set WPFControl = ActiveDocument.HMIObjects.AddWPFControl("MyWPFVBAControl",
"WinCCWPFControl.TestControl", False, "Assembly=Z:\TestControl\WinCCWPFControl.dll")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3469

VBA for Automated Configuration


5.5 VBA Reference

See also
AddWPFControl method (Page 3185)
Delete Method (Page 3208)
Application Property (Page 3486)
AssemblyInfo property (Page 3488)
ControlType property (Page 3562)
Events Property (Page 3583)
GroupParent Property (Page 3625)
Height Property (Page 3626)
Layer Property (Page 3648)
LDTooltipTexts Property (Page 3658)
Left Property (Page 3659)
ObjectName Property (Page 3700)
Operation Property (Page 3705)
Parent Property (Page 3710)
PasswordLevel Property (Page 3713)
Properties Property (Page 3736)
Selected Property (Page 3758)
TabOrderSwitch Property (Page 3776)
TabOrderAlpha Property (Page 3773)
ToolTipText Property (Page 3786)
Top Property (Page 3787)
Type Property (Page 3792)
Visible Property (Page 3880)
Width Property (Page 3883)
ConnectorObjects property (Page 3560)

5.5.1.8

Properties

A
Actions Property
Description
Returns the Actions listing. Use the Actions property to configure an event-driven action.

3470

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In this example a button and a circle will be inserted in the active picture. In Runtime the radius
of the circle enlarges every time you click the button:

Sub CreateVBActionToClickedEvent()
'VBA365
Dim objButton As HMIButton
Dim objCircle As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircle
.Top = 100
.Left = 100
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 120
.Text = "Increase Radius"
End With
'Define event and assign sourcecode:
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
With objVBScript
.SourceCode = "Dim myCircle" & vbCrLf & _
"Set myCircle = HMIRuntime.ActiveScreen.ScreenItems(""Circle_VB"")" & _
vbCrLf & "myCircle.Radius = myCircle.Radius + 5"
End With
End Sub

See also
Actions Object (Listing) (Page 3271)
AddAction Method (Page 3173)
Configuring Event-Driven Actions with VBA (Page 3092)

ActionType property
Description
Only used internally.

See also
VBA Reference: ActionDynamic (Page 3126)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3471

VBA for Automated Configuration


5.5 VBA Reference

ActiveDocument Property
Description
Returns an object of the "Document" type which represents the active picture in the Graphics
Designer. If there is no open or active picture in the Graphics Designer, you receive an error
message.
Note
The "ActiveDocument" property refers to the window that possesses the input focus. If other
editors (e.g. CrossReference) access a picture, the input focus can change. To prevent this
situation leading to errors, reference the picture unambiguously via the Documents listing.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles").

Sub CreateMenuItem()
'VBA366
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
'
'Create new menu "Delete Objects":
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete Objects")
'
'Add two menuitems to the menu "Delete Objects
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
Rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete Circles")
End Sub

See also
Documents Object (Listing) (Page 3322)

ActiveLayer Property
Description
Defines or returns the active layer for the View object. The value range is from 0 to 31, where
"0" represents the uppermost layer and "31" the lowest layer.

3472

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example a new View object is created and layer 1 is set to
"Active":

Sub ActiveDocumentConfiguration()
'VBA367
Application.ActiveDocument.Views.Add
Application.ActiveDocument.Views(1).ActiveLayer = 2
End Sub

See also
View Object (Page 3466)

ActualPointLeft Property
Description
Defines or returns the X coordinate of the current corner point by reference to the picture origin
(top left) for the objects "Polygon" and "Polyline". Each corner point is identified by an index
which is derived from the number ("PointCount") of corner point available.
A change of the value can affect the properties "Width" (object width) and "Left" (x-coordinate
of the object position).

Example:
The "PolygonCoordinatesOutput()" procedure outputs the coordinates of all the corner points
in the first polyline in the current picture:

Sub PolygonCoordinatesOutput()
'VBA368
Dim objPolyline As HMIPolyLine
Dim iPosX As Integer
Dim iPosY As Integer
Dim iCounter As Integer
Dim strResult As String
iCounter = 1
Set objPolyline = ActiveDocument.HMIObjects.AddHMIObject("Polyline1", "HMIPolyLine")
For iCounter = 1 To objPolyline.PointCount
With objPolyline
.index = iCounter
iPosX = .ActualPointLeft
iPosY = .ActualPointTop
End With
strResult = strResult & vbCrLf & "Corner " & iCounter & ": x=" & iPosX & " y=" & iPosY
Next iCounter

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3473

VBA for Automated Configuration


5.5 VBA Reference

MsgBox strResult
End Sub

See also
PointCount Property (Page 3728)
Index Property (Page 3633)
ActualPointTop Property (Page 3476)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

ActualPointTop Property
Description
Defines or returns the Y coordinate of the current corner point by reference to the picture origin
(top left) for the objects "Polygon" and "Polyline". Each corner point is identified by an index
which is derived from the number ("PointCount") of corner point available.
A change of the value can affect the properties "Height" (object height) and "Top" (y-coordinate
of the position).

Example:
The "Polygon()" procedure outputs the coordinates of all the corner points in the first polyline
in the current picture:

Sub PolygonCoordinatesOutput()
'VBA369
Dim objPolyline As HMIPolyLine
Dim iPosX As Integer
Dim iPosY As Integer
Dim iCounter As Integer
Dim strResult As String
iCounter = 1
Set objPolyline = ActiveDocument.HMIObjects.AddHMIObject("Polyline1", "HMIPolyLine")
For iCounter = 1 To objPolyline.PointCount
With objPolyline
.index = iCounter
iPosX = .ActualPointLeft
iPosY = .ActualPointTop
End With
strResult = strResult & vbCrLf & "Corner " & iCounter & ": x=" & iPosX & " y=" & iPosY
Next iCounter
MsgBox strResult

3474

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
PointCount Property (Page 3728)
Index Property (Page 3633)
ActualPointLeft Property (Page 3473)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

AdaptBorder Property
Description
TRUE if the field border is intended to adapt dynamically to the size of the text. BOOLEAN
write-read access.
Note
Changing the contents of a field dynamically can cause pumping in the field.
Performance is improved in Runtime by using "AdaptBorder = False".

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text size is dynamically adapted to the field size.

Sub IOFieldConfiguration()
'VBA372
Dim objIOField As HMIIOField
'
'Add new IO-Feld to active document:
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AdaptBorder = True
End With
End Sub

See also
OptionGroup Object (Page 3393)
TextList Object (Page 3441)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3475

VBA for Automated Configuration


5.5 VBA Reference
StaticText Object (Page 3433)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

AdaptPicture Property
Description
TRUE if the picture size is to be adapted to the picture window size. BOOLEAN write-read
access.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA373
Dim objPicWindow As HMIPictureWindow
'
'Add new picturewindow into active document:
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

3476

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

AdaptSize Property
Description
TRUE if the picture window size is to be adapted to the picture size. BOOLEAN write-read
access.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA374
Dim objPicWindow As HMIPictureWindow
'
'Add new picturewindow into active document:
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

AddIns property
Description
Only used internally.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3477

VBA for Automated Configuration


5.5 VBA Reference

See also
Application Object (Page 3282)

AlarmGoneVisible property
Description
Defines whether an outgoing state is visible.
Assigned Value

Description

True

The outgoing state is visible.

False

The outgoing state is suppressed.

AlarmHigh Property
Description
Defines the top limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmHigh" property.
The "CheckAlarmHigh" property defines whether the monitoring function for the limit value is
activated.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50".

Sub BarGraphLimitConfiguration()
'VBA375
Dim objBarGraph As HMIBarGraph
'
'Add new BarGraph to active document:
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolut
.TypeAlarmHigh = False
'Activate monitoring
.CheckAlarmHigh = True
'Set barcolor to "yellow"
.ColorAlarmHigh = RGB(255, 255, 0)
'set upper limit to "50"
.AlarmHigh = 50
End With
End Sub

3478

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
TypeAlarmHigh Property (Page 3793)
ColorAlarmHigh Property (Page 3544)
CheckAlarmHigh Property (Page 3533)
BarGraph Object (Page 3286)

AlarmLow Property
Description
Defines the bottom limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmLow" property.
The "CheckAlarmLow" property defines whether the monitoring function for the limit value is
activated.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10".

Sub BarGraphLimitConfiguration()
'VBA376
Dim objBarGraph As HMIBarGraph
'
'Add new BarGraph to active document:
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolut
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set Barcolor to "yellow"
.ColorAlarmLow = RGB(255, 255, 0)
'set lower limit to "10"
.AlarmLow = 10
End With
End Sub

See also
TypeAlarmLow Property (Page 3793)
ColorAlarmLow Property (Page 3545)
CheckAlarmLow Property (Page 3534)
BarGraph Object (Page 3286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3479

VBA for Automated Configuration


5.5 VBA Reference

Alignment Property
Description
Defines or returns the scale display (left/right or top/bottom) depending on the position of the
BarGraph object. The Scaling property must be set to TRUE for the scale to be displayed.
Display

Assigned Value

Right or bottom

TRUE

Left or top

FALSE

Example:
The "BarGraphConfiguration()" procedure configures In this example the scale is to be located
to the right of the bar:

Sub BarGraphConfiguration()
'VBA377
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Alignment = True
.Scaling = True
End With
End Sub

See also
Scaling Property (Page 3751)
Direction Property (Page 3573)
BarGraph Object (Page 3286)

AlignmentLeft Property
Description
Defines or returns the horizontal alignment of the text. Value range from 0 to 2.

3480

Horizontal Alignment

Assigned Value

Left

Centered

Right

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text in the I/O field will be centered horizontally:

Sub IOFieldConfiguration()
'VBA378
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AlignmentLeft = 1
End With
End Sub

Related topics
See also
AlignmentTop Property (Page 3483)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

AlignmentTop Property
Description
Defines or returns the vertical alignment of the text. Value range from 0 to 2.
Horizontal Alignment

Assigned Value

Up

Centered

Down

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3481

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text in the I/O field will be centered in the middle:

Sub IOFieldConfiguration()
'VBA379
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AlignmentLeft = 1
.AlignmentTop = 1
End With
End Sub

See also
AlignmentLeft Property (Page 3480)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

AnalogResultInfos Property
Description
Returns the AnalogResultInfos listing. Use the AnalogResultInfos property to define value
ranges and property values in the Dynamic dialog.

Example:
An example showing how to use the AnalogResultInfos property can be found in this
documentation under the heading "AnalogResultInfos Object (Listing)".

See also
DynamicDialog Object (Page 3325)
AnalogResultInfos Object (Listing) (Page 3281)

3482

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

AngleAlpha Property
Description
Defines or returns depth angle a for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example depth angles A and B will be assigned the values "15" and 45:

Sub HMI3DBarGraphConfiguration()
'VBA380
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
'Depth-angle a = 15 degrees
.AngleAlpha = 15
'Depth-angle b = 45 degrees
.AngleBeta = 45
End With
End Sub

See also
AngleBeta Property (Page 3486)
3DBarGraph Object (Page 3267)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3483

VBA for Automated Configuration


5.5 VBA Reference

AngleBeta Property
Description
Defines or returns depth angle b for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example depth angles A and B will be assigned the values "15" and 45:

Sub HMI3DBarGraphConfiguration()
'VBA381
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
'Depth-angle a = 15 degrees
.AngleAlpha = 15
'Depth-angle b = 45 degrees
.AngleBeta = 45
End With
End Sub

See also
AngleAlpha Property (Page 3483)
3DBarGraph Object (Page 3267)

Application Property
Description
Returns the Graphics Designer application when the application property is used without an
object identifier. If the application property is used with object identifier, it returns an application
object which displays the application with which the defined object was created. Read only
access.

3484

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In this example an Excel object is created and the application name is output:

Sub CreateExcelApplication()
'VBA382
'
'Open Excel invisible
Dim objExcelApp As New Excel.Application
MsgBox objExcelApp
'Delete the reference to Excel and close it
Set objExcelApp = Nothing
End Sub

See also
Application Object (Page 3282)

ApplicationDataPath Property
Description
Returns the complete path of the active picture in the Graphics Designer. Read-only access.

Example:
The "ShowApplicationDataPath()" procedure outputs the path of the current picture:
Sub ShowApplicationDataPath()
'VBA383
MsgBox Application.ApplicationDataPath
End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3485

VBA for Automated Configuration


5.5 VBA Reference

AssemblyInfo property
Description
Displays the information of the object registered in the Global Assembly Cache. The
information is made up of "Assembly", "Version", "Culture" and "PublicKeyToken".
If the object is not registered in the Global Assembly Cache, the path of the object is only
displayed in "Assembly".

Assignments Property
Description
A list which contains the assignments between the output values and the actual output texts
to be output.
The assignments are dependent on the list type set. The list type is defined with the ListType
property.
The number of entries depends on the total length of the string passed to the "Assignments"
property. This string cannot be longer than 500,000 bytes. This may be checked prior to
dropping access to the "Assignments" property by using the function LenB().

Example:
--

See also
ListType Property (Page 3666)
TextList Object (Page 3441)

AssumeOnExit Property
Description
TRUE, if the entered text is assumed after exiting the input field (by using the <TAB> key or
mouse click, for example). BOOLEAN write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text that has been entered will be taken over as input on exit from the input field.

Sub IOFieldConfiguration()
'VBA385

3486

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objIOField As HMIIOField


Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AssumeOnExit = True
End With
End Sub

See also
TextList Object (Page 3441)
IOField Object (Page 3361)

AssumeOnFull Property
Description
TRUE, when the content of the input field is full (specified number of characters have been
entered) and should be exited automatically and the input accepted. BOOLEAN write-read
access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text that has been entered will be taken over as input on exit from the input field.

Sub IOFieldConfiguration()
'VBA386
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AssumeOnFull = True
End With
End Sub

See also
OutputFormat Property (Page 3708)
DataFormat Property (Page 3571)
IOField Object (Page 3361)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3487

VBA for Automated Configuration


5.5 VBA Reference

AutomationName Property
Description
Depending on the source and destination object types for the direct connection, either defines
or returns the name of a property.
The two tables show you when you must use the AutomationName property. A "--" means that
the property is assigned an empty string (") by default when the DirectConnection object is
created.
Source object type (SourceLink Property)
Type Property

AutomationName Property

ObjectName Property

hmiSourceTypeConstant

--

Name of the constant (e.g. the


picture name)

hmiSourceTypeProperty

Property of the source object


(e.g. "Top")

Name of the source object (e.g.


"Rectangle_A")

hmiSourceTypePropertyOfThisObj -ect

--

hmiSourceTypeVariableDirect

--

Tag name

hmiSourceTypeVariableIndirect

--

Tag name

Destination object type (DestinationLink Property)


Type Property

AutomationName Property

ObjectName Property

hmiDestTypeProperty

Property of the destination


object (e.g. "Left")

Name of the destination object


(e.g. "Rectangle_A")

hmiDestTypePropertyOfThisObject --

--

hmiDestTypePropertyOfActualWin
dow

Property of the destination


object (e.g. "Left")

--

hmiDestTypeVariableDirect

--

Tag name

hmiDestTypeVariableIndirect

--

Tag name

hmiDestTypeDirectMessage

--

Tag name

hmiDestTypeIndirectMessage

--

Tag name

Example:
In the following example the X position of "Rectangle_A" is copied to the Y position of
"Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA387
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent

3488

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objDynConnection As HMIDirectConnection


'
'Add objects to active document:
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'to position and configure objects:
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "SetPosition"
End With
'
'Directconnection is initiate by mouseclick:
Set objDynConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDynConnection
'Sourceobject: Top-Property of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Left-Property of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DestinationLink Property (Page 3572)
Type Property (Page 3792)
SourceLink Property (Page 3767)
ObjectName Property (Page 3700)
SourceLink Object (Page 3431)
DestLink Object (Page 3316)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3489

VBA for Automated Configuration


5.5 VBA Reference

AvailableDataLanguages Property
Description
Returns a listing of the available project languages.

Example:
The "AusgabetDataLanguages()" procedure outputs all the existing project languages together
with their language identifiers (as a decimal value):

Sub OutputDataLanguages()
'VBA388
Dim colDataLang As HMIDataLanguages
Dim objDataLang As HMIDataLanguage
Dim strLangList As String
Dim iCounter As Integer
'
'Save collection of datalanguages
'into variable "colDataLang"
Set colDataLang = Application.AvailableDataLanguages
iCounter = 1
'
'Get every languagename and the assigned ID
For Each objDataLang In colDataLang
With objDataLang
If 0 = iCounter Mod 3 Or 1 = iCounter Then
strLangList = strLangList & vbCrLf & .LanguageID & " " & .LanguageName
Else
strLangList = strLangList & " / " & .LanguageID & " " & .LanguageName
End If
End With
iCounter = iCounter + 1
Next objDataLang
MsgBox strLangList
End Sub

See also
LanguageName Property (Page 3646)
LanguageID Property (Page 3645)
How to assign help texts to menus and toolbars (Page 3033)
How to create menus in multiple languages (Page 3027)
Language-Dependent Configuration with VBA (Page 3018)

3490

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Average Property
Description
TRUE, if the mean value is calculated based on the last 10 values. A value change is
conditional for calculation of a new mean value. The mean value is reset when you change a
picture. If only one value is available when you change the picture, the following mean value
is calculated: (5+0+0+0+0+0+0+0+0+0)/10=0,5.
BOOLEAN write-read access.

Example
The "BarGraphConfiguration()" procedure configures In this example, value averaging will be
activated:

Sub BarGraphConfiguration()
'VBA389
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Average = True
End With
End Sub

See also
BarGraph Object (Page 3286)

Axe Property
Description
Defines or returns the axis for displaying the measured value. Value range from 0 to 2.
Axis

Assigned Value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3491

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the Y axis for displaying the measured value will be defined:

Sub HMI3DBarGraphConfiguration()
'VBA390
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Axe = 1
End With
End Sub

See also
3DBarGraph Object (Page 3267)

AxisSection Property
Description
Defines or returns the distance between two long axis sections. The information on the distance
is given in scale units and is dependent on the minimum and maximum values configured.

BarGraph Object (Minimum/Maximum Value: -5/5; AxisSection = 2)

3492

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
The "BarGraphConfiguration()" procedure accesses the properties of the BarGraph object. In
this example the axis section will be set to "2".
Sub BarGraphConfiguration()
'VBA391
Dim objBar As HMIBarGraph
Set objBar = ActiveDocument.HMIObjects.AddHMIObject("Bar1",
"HMIBarGraph")
With objBar
.AxisSection = 2
End With
End Sub

See also
BarGraph Object (Page 3286)

B
BackBorderWidth Property
Description
Defines or returns the width of the 3D border in pixels. The value for the width is dependent
on the size of the object.
Slider
Defines or returns the width of the border in pixels. BackBorderWidth = 0 prevents the border
being displayed on the Slider object.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the width of the 3D border will be set to "2".

Sub ButtonConfiguration()
'VBA392
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.BackBorderWidth = 2
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3493

VBA for Automated Configuration


5.5 VBA Reference

See also
Slider object (Page 3428)
RoundButton Object (Page 3418)
GroupDisplay Object (Page 3350)
Button Object (Page 3293)

BackColor Property
Description
Defines or returns the background color for the object. LONG read-write access.
The background color is not displayed if "transparent" is defined as the fill pattern.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the background color will be set to "Yellow".

Sub RectangleConfiguration()
'VBA393
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BackColor = RGB(255, 255, 0)
End With
End Sub

See also
EllipseSegment Object (Page 3333)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)

3494

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
Ellipse Object (Page 3327)
Document Object (Page 3319)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

BackColor2 Property
Description
Defines or returns the bar color for the display of the current value. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphConfiguration()" procedure configures In this example the bar color for
displaying the current value will be set to "Yellow":

Sub BarGraphConfiguration()
'VBA394
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.BackColor2 = RGB(255, 255, 0)
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3495

VBA for Automated Configuration


5.5 VBA Reference

See also
BarGraph Object (Page 3286)

BackColor3 Property
Description
Defines or returns the color of the bar background. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphConfiguration()" procedure configures In this example the color of the bar
background will be set to "Blue":

Sub BarGraphConfiguration()
'VBA395
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.BackColor3 = RGB(0, 0, 255)
End With
End Sub

See also
BarGraph Object (Page 3286)

BackColor_Alarm.._Warning property
Description
Defines the color used for the background of one of the following states or message types:
Alarm
Warning
Tolerance
AS Process Control Error
AS Control System Fault

3496

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Operator request
OK
Simulation
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

BackColorBottom Property
Description
Defines or returns the color for the bottom/right part of the slider. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color of the bottom part of the slider will be set to "Blue":

Sub SliderConfiguration()
'VBA396
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.BackColorBottom = RGB(0, 0, 255)
End With
End Sub

See also
Slider object (Page 3428)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3497

VBA for Automated Configuration


5.5 VBA Reference

BackColorTop Property
Description
Defines or returns the color for the top/left part of the slider. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color of the top part of the slider will be set to "Yellow":

Sub SliderConfiguration()
'VBA397
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.BackColorTop = RGB(255, 255, 0)
End With
End Sub

See also
Slider object (Page 3428)

BackFillColor property
Description
Defines the color with which the background is filled at an advanced analog display.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3498

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

BackFillColor_OK property
Description
Defines the color with which the background is filled at the state "OK".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

BackFillColor_Simulation property
Description
Defines the color with which the background is filled at the "Simulation" state.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

BackFillStyle property
Description
Defines the pattern with which the background is filled at an advanced analog display.
There is a choice of 50 fill patterns. The fill pattern 0 "Solid" fills the object with the set
background color; the fill pattern 1 "Transparent" defines that neither a background nor a fill
pattern is displayed.

BackFillStyle_OK property
Description
Defines the pattern with which the background is displayed at the state "OK".
There is a choice of 50 fill patterns. The fill pattern 0 "Solid" fills the object with the set
background color; the fill pattern 1 "Transparent" defines that neither a background nor a fill
pattern is displayed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3499

VBA for Automated Configuration


5.5 VBA Reference

BackFillStyle_Simulation property
Description
Defines the pattern with which the background is displayed at the "Simulation" state.
There is a choice of 50 fill patterns. The fill pattern 0 "Solid" fills the object with the set
background color; the fill pattern 1 "Transparent" defines that neither a background nor a fill
pattern is displayed.

BackFlashColorOff Property
Description
Defines or returns the color of the object background for the flash status "Off". LONG writeread access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "Off" will be set to "Yellow":

Sub RectangleConfiguration()
'VBA398
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BackFlashColorOff = RGB(255, 255, 0)
End With
End Sub

See also
BarGraph Object (Page 3286)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)

3500

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

BackFlashColorOn Property
Description
Defines or returns the color of the object background for the flash status "On". LONG writeread access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "On" will be set to "Blue":

Sub RectangleConfiguration()
'VBA399
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BackFlashColorOn = RGB(0, 0, 255)
End With
End Suba

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3501

VBA for Automated Configuration


5.5 VBA Reference

See also
RoundButton Object (Page 3418)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

Background Property
Description
TRUE, when the background of the 3D-bar graph object should be visible. BOOLEAN writeread access.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the background will be set to "Transparent":

Sub HMI3DBarGraphConfiguration()
'VBA400
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Background = False
End With
End Sub

3502

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
3DBarGraph Object (Page 3267)

BackPictureAlignment property
Description
As the "Display type" attribute, defines the position and scaling for the background image of
the process picture.
normal
Stretched
(window)
Tiled
Stretched
(picture)

The background picture is centered in the original size. When opening the
picture in runtime, it remains in the location.
The background picture is scaled to the runtime window and process picture
of the larger of the two windows. In runtime, it is scaled to the size of the
runtime window and is scaled when you resize the picture.
Graphics Designer and process picture are exhibited with the picture in its
original size.
The background picture is scaled to the configured size of the process
picture. When opening the picture in runtime, it retains its size.

BackPictureName property
Description
Defines or returns the path and name of the file used as the background image in the process
picture.
Files of format EMF, WMF, DB, BMP, GIF, JPG, JPEG and ICO are suitable.
If no path is specified, the file is searched for in the subdirectory \GraCS. If you specify a
different path, a copy is created in the \GraCS directory.
Path specifications
The following path specification formats are possible:
Absolute: z.B. "C:\Siemens\WinCC\Icons\myIcon.ICO.
Relative: The starting folder for relative path specification is the "GraCS" folder of the current
project.
<global>: Refers to the installation path for WinCC. The path specification "<global>\Icons
\myIcon" is the same as the path specification under "Absolute".
<project>: Refers to the current project directory.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3503

VBA for Automated Configuration


5.5 VBA Reference

BarDepth Property
Description
Defines or returns the depth of the bar in pixels.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the bar depth will be set to "40":

Sub HMI3DBarGraphConfiguration()
'VBA401
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BarDepth = 40
End With
End Sub

See also
3DBarGraph Object (Page 3267)

BarHeight Property
Description
Defines or returns the height of the bar in pixels.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the bar height will be set to "60":

Sub HMI3DBarGraphConfiguration()
'VBA402
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BarHeight = 60
End With
End Sub

3504

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
3DBarGraph Object (Page 3267)

BarWidth Property
Description
Defines or returns the width of the bar in pixels.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the bar width will be set to "80":

Sub HMI3DBarGraphConfiguration()
'VBA403
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BarWidth = 80
End With
End Sub

See also
3DBarGraph Object (Page 3267)

BasePicReferenced Property
Description
TRUE, when the picture assigned in the object status display should be saved. Otherwise,
only the associated object reference is saved. BOOLEAN write-read access.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the picture assigned in the Status Display object is to be saved.

Sub StatusDisplayConfiguration()
'VBA404
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3505

VBA for Automated Configuration


5.5 VBA Reference

.BasePicReferenced = True
End With
End Sub

See also
StatusDisplay Object (Page 3436)

BasePicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "BasePicUseTransColor" property is
"True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the color "Yellow" will be set to "Transparent".

Sub StatusDisplayConfiguration()
'VBA405
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp
.BasePicTransColor = RGB(255, 255, 0)
.BasePicUseTransColor = True
End With
End Sub

See also
BasePicUseTransColor Property (Page 3510)
StatusDisplay Object (Page 3436)

3506

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

BasePicture Property
Description
Defines or returns the basic picture for the Status Display object.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.
In this context, the "BasePicReferenced" property defines whether the basic picture should be
saved together with the object status display or referenced.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the picture "Testpicture.BMP" will be used as the basic picture:

Sub StatusDisplayConfiguration()
'VBA406
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp
'
'To use this example copy a Bitmap-Graphic
'to the "GraCS"-Folder of the actual project.
'Replace the picturename "Testpicture.BMP" with the name of
'the picture you copied
.BasePicture = "Testpicture.BMP"
End With
End Sub

See also
BasePicReferenced Property (Page 3505)
StatusDisplay Object (Page 3436)

BasePicture property
Description
Specifies which picture is to be displayed for the currently selected status. Pictures with the
following formats can be inserted: EMF, WMF, BMP, GIF, JPG.
If no picture that you want to display is defined for a status, the symbol for the status display
is shown as a placeholder.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3507

VBA for Automated Configuration


5.5 VBA Reference

BasePicUseTransColor Property
Description
TRUE, when the configured color ("BasePicTransColor" property) of the bitmap objects should
be set to "transparent". BOOLEAN write-read access.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the color "Yellow" will be set to "Transparent":

Sub StatusDisplayConfiguration()
'VBA407
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp
.BasePicTransColor = RGB(255, 255, 0)
.BasePicUseTransColor = True
End With
End Sub

See also
BasePicTransColor Property (Page 3506)
StatusDisplay Object (Page 3436)

BaseX Property
Description
Defines or returns for the 3DBarGraph object the horizontal distance in pixels between the
right-hand border of the bar and the left-hand border of the object field.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the horizontal distance will be set to "80".

Sub HMI3DBarGraphConfiguration()
'VBA408
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BaseX = 80

3508

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
3DBarGraph Object (Page 3267)

BaseY Property
Description
Defines or returns for the 3DBarGraph object the vertical distance in pixels between the lower
border of the bar and the upper border of the object field.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the vertical distance will be set to "100".

Sub HMI3DBarGraphConfiguration()
'VBA409
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BaseY = 100
End With
End Sub

See also
3DBarGraph Object (Page 3267)

BinaryResultInfo Property
Description
Returns the BinaryResultInfo object.

Example:
An example showing how to use the BinaryResultInfo property can be found in this
documentation under the heading "BinaryResultInfo Object".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3509

VBA for Automated Configuration


5.5 VBA Reference

See also
BinaryResultInfo Object (Page 3291)

BitNotSetValue Property
Description
Defines or returns the value for the dynamic property if the specified bit of a configured tag is
not set.
To define which bit must be set in order to trigger a change of value, use the BitNumber
property.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned, the bit to be set will be defined and the associated property
values will be assigned to the "set"/"not set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA410
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.Trigger.VariableTriggers(1).CycleType = hmiVariableCycleType_5s
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

See also
BitNumber Property (Page 3512)
BitResultInfo Object (Page 3292)

BitNumber Property
Description
Defines or returns the bit whose status must change in order to trigger a change of value. The
tag used must be of the type BYTE, WORD or DWORD.

3510

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned, the bit to be set will be defined and the associated property
values will be assigned to the "set"/"not set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA411
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

See also
BitResultInfo Object (Page 3292)
VBA Reference (Page 3124)

BitPosition0..3 property
Description
Specifies the bit position of the selected tag for which the respective bit (0 to 3) of the status
value is used. The content is only evaluated when a tag is selected for the respective property
"BitSelect0..3". The tags are specified using "Process" and "Process1..3".
You can enter a value from "0" to "31". Each value can only be assigned once.

BitResultInfo Property
Description
Returns the BitResultInfo object.

Example:
An example showing how to use the BitResultInfo property can be found in this documentation
under the heading "BitResultInfo Object".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3511

VBA for Automated Configuration


5.5 VBA Reference

See also
BitResultInfo Object (Page 3292)

BitSelect0..3 property
Description
Specifies the status tag for which the respective (first to fourth) bit of the status value is
specified. The tags are specified using the properties "Process" and "Process1..3".
0

The respective bit of the status value is not evaluated. No status tag is used.

Status tag "Process" is used for the respective bit of the status value.

Status tag "Process1" is used for the respective bit of the status value.

Status tag "Process2" is used for the respective bit of the status value.

Status tag "Process3" is used for the respective bit of the status value.

BitSetValue Property
Description
Defines or returns the value for the dynamic property if the specified bit of a configured tag is
set.
To define which bit must be set in order to trigger a change of value, use the BitNumber
property.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned, the bit to be set will be defined and the associated property
values will be assigned to the "set"/"not set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA412
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

3512

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
BitNumber Property (Page 3510)
BitResultInfo Object (Page 3292)

Bold Property
Description
TRUE if the font attribute "Bold" is set for the language-dependent text in the object. BOOLEAN
write-read access.

Example:
Note
For this example to work, you must already have configured in the languages concerned.
The following example sets the font attributes of a button for French and English:

Sub ExampleForLanguageFonts()
'VBA413
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "Displaytext"
Set colLangFonts = objButton.LDFonts
'Set french fontproperties:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'Set english fontproperties:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3513

VBA for Automated Configuration


5.5 VBA Reference

See also
Underlined Property (Page 3801)
Size Property (Page 3764)
Parent Property (Page 3710)
LanguageID Property (Page 3645)
Italic Property (Page 3638)
Family Property (Page 3589)
Application Property (Page 3484)
LanguageFont Object (Page 3365)

BorderBackColor Property
Description
Defines or returns the background color of the line for the object. LONG write-read access.
The background color is only visible if the BorderStyle property is set >0.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the background color for the line will be set to "Yellow":

Sub RectangleConfiguration()
'VBA415
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderBackColor = RGB(255, 255, 0)
End With
End Sub

See also
PieSegment Object (Page 3399)
BorderStyle Property (Page 3524)
TextList Object (Page 3441)

3514

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
IOField Object (Page 3361)
GraphicObject Object (Page 3345)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

BorderColor Property
Description
Defines or returns the line color for the object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the line color will be set to "Blue":

Sub RectangleConfiguration()
'VBA416

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3515

VBA for Automated Configuration


5.5 VBA Reference

Dim objRectangle As HMIRectangle


Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderColor = RGB(0, 0, 255)
End With
End Sub

See also
GraphicObject Object (Page 3345)
TextList Object (Page 3441)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
IOField Object (Page 3361)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

BorderColorBottom Property
Description
Defines or returns the color for the bottom right-hand part of the 3D-border. LONG write-read
access.

3516

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the 3D-border color will be defined:

Sub ButtonConfiguration()
'VBA417
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.BorderColorBottom = RGB(255, 0, 0)
.BorderColorTop = RGB(0, 0, 255)
End With
End Sub

See also
RoundButton Object (Page 3418)
Button Object (Page 3293)

BorderColorTop Property
Description
Defines or returns the color for the top left-hand part of the 3D-border. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the 3D-border color will be defined:

Sub ButtonConfiguration()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3517

VBA for Automated Configuration


5.5 VBA Reference

'VBA418
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.BorderColorBottom = RGB(255, 0, 0)
.BorderColorTop = RGB(0, 0, 255)
End With
End Sub

See also
RoundButton Object (Page 3418)
Button Object (Page 3293)

BorderEndStyle Property
Description
Defines or returns the line end style of the object. LONG read-write access.
Determination of Line End Style
Determine the line end type with the aid of a five-character hexadecimal value which you then
convert into its equivalent decimal value.

To determine the line ends for the object, go to the "Line End Style" window and proceed as
follows:
Left column: Configures the start of the line. Value range (from the top down) 0 to 6. The
start of the line corresponds to the first character in the hexadecimal value. In the
configuration shown, the value of the first character is "3".
Right Column: Configures the end of the line. Value range (from the top down) 0 to 6. The
line end corresponds to the fifth character in the hexadecimal value. In the configuration
shown, the value of the fifth character is "6".

3518

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
This gives a hexadecimal value of "60003". This corresponds to a decimal value of "393219",
which you then assign to the BorderEndStyle property.

Example:
The "LineConfiguration()" procedure accesses the properties of the line. In this example the
type of line end will be set to the configuration illustrated above:

Sub LineConfiguration()
'VBA419
Dim objLine As HMILine
Set objLine = ActiveDocument.HMIObjects.AddHMIObject("Line1", "HMILine")
With objLine
.BorderEndStyle = 393219
End With
End Sub

See also
PolyLine Object (Page 3405)
Line Object (Page 3373)

BorderFlashColorOff Property
Description
Defines or returns the color of the object lines for the flashing status "Off". LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "Off" will be set to "Black":

Sub RectangleConfiguration()
'VBA420
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3519

VBA for Automated Configuration


5.5 VBA Reference

.BorderFlashColorOff = RGB(0, 0, 0)
End With
End Sub

See also
RoundButton Object (Page 3418)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

BorderFlashColorOn Property
Description
Defines or returns the color of the object lines for the flashing status "On". LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

3520

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "On" will be set to "Red":

Sub RectangleConfiguration()
'VBA421
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderFlashColorOn = RGB(255, 0, 0)
End With
End Sub

See also
StaticText Object (Page 3433)
StatusDisplay Object (Page 3436)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3521

VBA for Automated Configuration


5.5 VBA Reference

BorderStyle Property
Description
Defines or returns the line style for the object. Value range from 0 to 4:
Line style

Assigned Value
0
1
2
3
4

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the line style will be set to "1":

Sub RectangleConfiguration()
'VBA422
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderStyle = 1
End With
End Sub

See also
IOField Object (Page 3361)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PolyLine Object (Page 3405)
TextList Object (Page 3441)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)

3522

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Line Object (Page 3373)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

BorderWidth Property
Description
Defines or returns the line weight (in pixels) for the object.

Example:
in the following example the line weight of a newly added circle will be set to "2".

Sub CircleConfiguration()
'VBA423
Dim objCircle As IHMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
With objCircle
.BorderWidth = 2
End With
End Sub

See also
IOField Object (Page 3361)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3523

VBA for Automated Configuration


5.5 VBA Reference
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

BottomConnectedObjectName Property
Description
Returns the name of the starting object to which the connector is Read only access.

Example:
An example showing how to use the BottomConnectedObjectName property can be found in
this documentation under the heading "ObjConnection Object".

See also
ObjConnection object (Page 3388)

BottomConnectedConnectionPointIndex Property
Description
Returns the connection point on the object to which the connector is connected.

3524

Connection Point

Assigned Value

Up

Right

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Connection Point

Assigned Value

Down

Left

Example:
An example showing how to use the BottomConnectedObjectName property can be found in
this documentation under the heading "ObjConnection Object".

See also
ObjConnection object (Page 3388)

BoxAlignment Property
Description
TRUE, when the fields are arranged aligned to the right. BOOLEAN write-read access.

Example:
The "CreateOptionGroup()" procedure creates the OptionGroup object with four option
buttons. Each option button is assigned the default name "myCustomText<Nummer>":

Sub CreateOptionGroup()
'VBA424
Dim objRadioBox As HMIOptionGroup
Dim iCounter As Integer
Set objRadioBox = ActiveDocument.HMIObjects.AddHMIObject("RadioBox_1", "HMIOptionGroup")
iCounter = 1
With objRadioBox
.Height = 100
.Width = 180
.BoxCount = 4
.BoxAlignment = False
For iCounter = 1 To .BoxCount
.index = iCounter
.Text = "CustomText" & .index
Next iCounter

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3525

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
BoxCount Property (Page 3528)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)

BoxCount Property
Description
Defines or returns the number of fields. Value range from 1 to 32.

Example:
The "CreateOptionGroup()" procedure creates the OptionGroup object with four option
buttons. Each option button is assigned the default name "myCustomText<Nummer>":

Sub CreateOptionGroup()
'VBA425
Dim objRadioBox As HMIOptionGroup
Dim iCounter As Integer
Set objRadioBox = ActiveDocument.HMIObjects.AddHMIObject("RadioBox_1", "HMIOptionGroup")
iCounter = 1
With objRadioBox
.Height = 100
.Width = 180
.BoxCount = 4
.BoxAlignment = True
For iCounter = 1 To .BoxCount
.index = iCounter
.Text = "CustomText" & .index
Next iCounter
End With
End Sub

See also
BoxAlignment Property (Page 3525)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)

3526

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

BoxType Property
Description
Defines or returns the field type. Value range from 0 to 2.
Field type

Assigned Value

Edition

Input

I/O field

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the field type is configured as "Input":

Sub IOFieldConfiguration()
'VBA426
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.BoxType = 1
End With
End Sub

See also
IOField Object (Page 3361)

Button1..8MessageClasses
Description
Defines one or more message events in the group display for representing the respective
command button. This is done by entering the numbers of the bits in the collective value.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there is more than one selected event for one button, the
event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3527

VBA for Automated Configuration


5.5 VBA Reference

Button1..8Width property
Description
Defines or returns for the "Group Display" object the width of the respective button in pixels.
When the "SameSize" property is set to "TRUE", all buttons are set to the same width.

Example
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the width of button "1" is set to "50":

Sub GroupDisplayConfiguration()
'VBA427
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.Button1Width = 50
End With
End Sub

See also
SameSize Property (Page 3749)
GroupDisplay Object (Page 3350)

ButtonColor Property
Description
Defines or returns the color of the slider for the Slider object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3528

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color of the slider will be set to "Yellow".

Sub SliderConfiguration()
'VBA431
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.ButtonColor = RGB(255, 255, 0)
End With
End Sub

See also
Slider object (Page 3428)

C
Caption Property
Description
TRUE, when the application or picture window has a title bar in Runtime. BOOLEAN write-read
access.
The Caption property must be set to "True" if the intention is that the application window or
picture window shall have Maximize and Close buttons.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will

Sub ApplicationWindowConfig()
'VBA432
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow",
"HMIApplicationWindow")
With objAppWindow
.Caption = True
.CloseButton = False
.Height = 200
.Left = 10
.MaximizeButton = True
.Moveable = False
.OnTop = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3529

VBA for Automated Configuration


5.5 VBA Reference

.Sizeable = True
.Top = 20
.Visible = True
.Width = 250
.WindowBorder = True
End With
End Sub

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

CaptionText Property
Description
Defines or returns the window title that will be displayed for the PictureWindow object in
Runtime.
The Caption property must be set to TRUE."

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will

Sub PictureWindowConfig()
'VBA433
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

3530

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
PictureWindow Object (Page 3396)

CBackColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In" which color the background
of the value to be displayed assumes for flashing status "Off" (CBackColorOff) or "On"
(CBackColorOn).
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CBackFlash property
Description
Specifies for the selected message type and status "Came In" whether the background of the
value to be displayed flashes when a message is received.

CheckAlarmHigh Property
Description
TRUE if the "Alarm High" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties AlarmHigh, ColorAlarmHigh and TypeAlarmHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50".

Sub BarGraphLimitConfiguration()
'VBA434
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3531

VBA for Automated Configuration


5.5 VBA Reference

'Set analysis to absolute


.TypeAlarmHigh = False
'Activate monitoring
.CheckAlarmHigh = True
'Set barcolor to "yellow"
.ColorAlarmHigh = RGB(255, 255, 0)
'Set upper limit to "50"
.AlarmHigh = 50
End With
End Sub

See also
TypeAlarmHigh Property (Page 3793)
ColorAlarmHigh Property (Page 3544)
AlarmHigh Property (Page 3478)
BarGraph Object (Page 3286)

CheckAlarmLow Property
Description
TRUE if the "Alarm Low" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties AlarmLow, ColorAlarmLow and TypeAlarmLow.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10".

Sub BarGraphLimitConfiguration()
'VBA435
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set barcolor to "yellow"
.ColorAlarmLow = RGB(255, 255, 0)
'Set lower limit to "10"
.AlarmLow = 10
End With

3532

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
ColorAlarmLow Property (Page 3545)
TypeAlarmLow Property (Page 3793)
AlarmLow Property (Page 3479)
BarGraph Object (Page 3286)

Checked Property
Description
TRUE if a check mark is to appear in front of the user-defined menu entry. BOOLEAN writeread access.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"): The first menu entry is also marked with a
tick:

Sub CreateMenuItem()
'VBA436
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
Rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete Circles")
With objMenu.MenuItems
.Item("DeleteAllRectangles").Checked = True
End With
End Sub

See also
MenuItems Property (Page 3690)
Configuring Menus and Toolbars (Page 3020)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3533

VBA for Automated Configuration


5.5 VBA Reference

CheckLimitHigh4 Property
Description
TRUE if the "Reserve 4" high limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitHigh4, ColorLimitHigh4 and TypeLimitHigh4.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "70".

Sub BarGraphLimitConfiguration()
'VBA437
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh4 = False
'Activate monitoring
.CheckLimitHigh4 = True
'set barcolor to "red"
.ColorLimitHigh4 = RGB(255, 0, 0)
'Set upper limit to "70"
.LimitHigh4 = 70
End With
End Sub

See also
TypeLimitHigh4 Property (Page 3794)
LimitHigh4 Property (Page 3661)
ColorLimitHigh4 Property (Page 3547)
BarGraph Object (Page 3286)

CheckLimitHigh5 Property
Description
TRUE if the "Reserve 5" high limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitHigh5, ColorLimitHigh5 and TypeLimitHigh5.

3534

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "80".

Sub BarGraphLimitConfiguration()
'VBA438
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh5 = False
'Activate monitoring
.CheckLimitHigh5 = True
'set barcolor to "black"
.ColorLimitHigh5 = RGB(0, 0, 0)
'Set upper limit to "80"
.LimitHigh5 = 80
End With
End Sub

See also
ColorLimitHigh5 Property (Page 3548)
TypeLimitHigh5 Property (Page 3795)
LimitHigh4 Property (Page 3661)
BarGraph Object (Page 3286)

CheckLimitLow4 Property
Description
TRUE if the "Reserve 4" low limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitLow4, ColorLimitLow4 and TypeLimitLow4.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "5".

Sub BarGraphLimitConfiguration()
'VBA439

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3535

VBA for Automated Configuration


5.5 VBA Reference

Dim objBarGraph As HMIBarGraph


Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow4 = False
'Activate monitoring
.CheckLimitLow4 = True
'Set barcolor to "green"
.ColorLimitLow4 = RGB(0, 255, 0)
'set lower limit to "5"
.LimitLow4 = 5
End With
End Sub

See also
TypeLimitLow4 Property (Page 3796)
LimitLow4 Property (Page 3663)
ColorLimitLow4 Property (Page 3549)
BarGraph Object (Page 3286)

CheckLimitLow5 Property
Description
TRUE if the "Reserve 5" low limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitLow5, ColorLimitLow5 and TypeLimitLow5.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "0".

Sub BarGraphLimitConfiguration()
'VBA440
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow5 = False
'Activate monitoring
.CheckLimitLow5 = True
'Set barcolor to "white"
.ColorLimitLow5 = RGB(255, 255, 255)

3536

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'set lower limit to "0"


.LimitLow5 = 0
End With
End Sub

See also
TypeLimitLow5 Property (Page 3797)
LimitLow5 Property (Page 3663)
ColorLimitLow5 Property (Page 3550)
BarGraph Object (Page 3286)

CheckToleranceHigh Property
Description
TRUE if the "Tolerance High" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties ToleranceHigh, ColorToleranceHigh and TypeToleranceHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "45".

Sub BarGraphLimitConfiguration()
'VBA441
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceHigh = False
'Activate monitoring
.CheckToleranceHigh = True
'Set barcolor to "yellow"
.ColorToleranceHigh = RGB(255, 255, 0)
'Set upper limit to "45"
.ToleranceHigh = 45
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3537

VBA for Automated Configuration


5.5 VBA Reference

See also
TypeToleranceHigh Property (Page 3797)
ToleranceHigh Property (Page 3784)
ColorToleranceHigh Property (Page 3551)
BarGraph Object (Page 3286)

CheckToleranceLow Property
Description
TRUE if the "Tolerance Low" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties ToleranceLow, ColorToleranceLow and TypeToleranceLow.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "15".

Sub BarGraphLimitConfiguration()
'VBA442
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceLow = False
'Activate monitoring
.CheckToleranceLow = True
'Set barcolor to "yellow"
.ColorToleranceLow = RGB(255, 255, 0)
'Set lower limit to "15"
.ToleranceLow = 15
End With
End Sub

See also
BarGraph Object (Page 3286)
TypeToleranceLow Property (Page 3798)
ToleranceLow Property (Page 3784)
ColorToleranceLow Property (Page 3552)

3538

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

CheckWarningHigh Property
Description
TRUE if the "Warning High" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties WarningHigh, ColorWarningHigh and TypeWarningHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75".

Sub BarGraphLimitConfiguration()
'VBA443
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor to "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit to "75"
.WarningHigh = 75
End With
End Sub

See also
WarningHigh Property (Page 3881)
TypeWarningHigh Property (Page 3799)
ColorWarningHigh Property (Page 3554)
BarGraph Object (Page 3286)

CheckWarningLow Property
Description
TRUE if the "Warning Low" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties WarningLow, ColorWarningLow and TypeWarningLow.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3539

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12".

Sub BarGraphLimitConfiguration()
'VBA444
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True
'Set barcolor to "magenta"
.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit to "12"
.WarningLow = 12
End With
End Sub

See also
WarningLow Property (Page 3882)
TypeWarningLow Property (Page 3800)
ColorWarningLow Property (Page 3555)
BarGraph Object (Page 3286)

ClearOnError Property
Description
TRUE if the entry in the I/O field is automatically deleted when the input is incorrect. BOOLEAN
write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the I/O field is to be cleared when the input is incorrect:

Sub IOFieldConfiguration()
'VBA445
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.ClearOnError = True

3540

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
IOField Object (Page 3361)

ClearOnNew Property
Description
TRUE if the entry in the I/O field is deleted as soon as the I/O field gets the focus. BOOLEAN
write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the entry in the I/O field is deleted as soon as the field gets the focus:

Sub IOFieldConfiguration()
'VBA446
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.ClearOnNew = True
End With
End Sub

See also
IOField Object (Page 3361)

CloseButton Property
Description
TRUE if the ApplicationWindow and PictureWindow objects possess a "Close" button in
Runtime. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3541

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will have a "Close" button in Runtime:

Sub ApplicationWindowConfig()
'VBA447
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow1",
"HMIApplicationWindow")
With objAppWindow
.CloseButton = True
End With
End Sub

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

CollectValue property
Description
The CollectValue property specifies as an initial value the current status of the active message
classes in each case.
The "Relevant" property has to have the value "TRUE" so that the advanced analog display
is taken into account when forming the group display .

ColorAlarmHigh Property
Description
Defines or returns the bar color for the "Alarm High" limit value. LONG write-read access.
The "CheckAlarmHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3542

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50 " and the bar color will change to Red.

Sub BarGraphLimitConfiguration()
'VBA449
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeAlarmHigh = False
'Activate monitoring
.CheckAlarmHigh = True
'Set barcolor to "red"
.ColorAlarmHigh = RGB(255, 0, 0)
'Set upper limit to "50"
.AlarmHigh = 50
End With
End Sub

See also
CheckAlarmHigh Property (Page 3531)
BarGraph Object (Page 3286)

ColorAlarmLow Property
Description
Defines or returns the bar color for the "Alarm Low" limit value. LONG write-read access.
The "CheckAlarmLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3543

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10 " and the bar color will change to Red.

Sub BarGraphLimitConfiguration()
'VBA450
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set barcolor to "red"
.ColorAlarmLow = RGB(255, 0, 0)
'Set lower limit to "10"
.AlarmLow = 10
End With
End Sub

See also
CheckAlarmLow Property (Page 3532)
BarGraph Object (Page 3286)

ColorBottom Property
Description
Defines or returns the color for the bottom/right stop of the slider object. LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color for the lower/right view will be set to "Red":

Sub SliderConfiguration()
'VBA451

3544

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objSlider As HMISlider


Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.ColorBottom = RGB(255, 0, 0)
End With
End Sub

See also
Slider object (Page 3428)

ColorChangeType Property
Description
TRUE if a color change in the BarGraph object (for instance when a limit value is reached) is
to take place segment by segment. If set to FALSE, it defines the change of color for the entire
bar. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures In this example the color change
will apply to the whole bar:

Sub BarGraphLimitConfiguration()
'VBA452
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.ColorChangeType = False
End With
End Sub

See also
BarGraph Object (Page 3286)

ColorLimitHigh4 Property
Description
Defines or returns the color for the "Reserve 4" upper limit value. LONG write-read access.
The "CheckLimitHigh4" property must have been set to TRUE if the bar color should change
on reaching the limit value.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3545

VBA for Automated Configuration


5.5 VBA Reference
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "70 " and the bar color will change to Red.

Sub BarGraphLimitConfiguration()
'VBA453
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh4 = False
'Activate monitoring
.CheckLimitHigh4 = True
'Set barcolor to "red"
.ColorLimitHigh4 = RGB(255, 0, 0)
'Set upper limit to "70"
.LimitHigh4 = 70
End With
End Sub

See also
CheckLimitHigh4 Property (Page 3534)
BarGraph Object (Page 3286)

ColorLimitHigh5 Property
Description
Defines or returns the color for the "Reserve 5" upper limit value. LONG write-read access.
The "CheckLimitHigh5" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3546

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "80" and the bar color will change to "Black".

Sub BarGraphLimitConfiguration()
'VBA454
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh5 = False
'Activate monitoring
.CheckLimitHigh5 = True
'Set barcolor to "black"
.ColorLimitHigh5 = RGB(0, 0, 0)
'Set upper limit to "80"
.LimitHigh5 = 80
End With
End Sub

See also
CheckLimitHigh5 Property (Page 3534)
BarGraph Object (Page 3286)

ColorLimitLow4 Property
Description
Defines or returns the color for the "Reserve 4" lower limit value. LONG write-read access.
The "CheckLimitLow4" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3547

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "5" and the bar color will change to "Green".

Sub BarGraphLimitConfiguration()
'VBA455
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow4 = False
'Activate monitoring
.CheckLimitLow4 = True
'Set barcolor to "green"
.ColorLimitLow4 = RGB(0, 255, 0)
'Set lower limit to "5"
.LimitLow4 = 5
End With
End Sub

See also
CheckLimitLow4 Property (Page 3535)
BarGraph Object (Page 3286)

ColorLimitLow5 Property
Description
Defines or returns the color for the "Reserve 5" lower limit value. LONG write-read access.
The "CheckLimitLow5" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3548

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "0" and the bar color will change to "White".

Sub BarGraphLimitConfiguration()
'VBA456
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow5 = False
'Activate monitoring
.CheckLimitLow5 = True
'Set barcolor to "white"
.ColorLimitLow5 = RGB(255, 255, 255)
'Set lower limit to "0"
.LimitLow5 = 0
End With
End Sub

See also
CheckLimitLow5 Property (Page 3536)
BarGraph Object (Page 3286)

ColorToleranceHigh Property
Description
Defines or returns the color for the "Tolerance High" high limit value. LONG write-read access.
The "CheckToleranceHigh" property must have been set to TRUE if the bar color should
change on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3549

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "45" and the bar color will change to "Yellow".

Sub BarGraphLimitConfiguration()
'VBA457
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceHigh = False
'Activate monitoring
.CheckToleranceHigh = True
'Set barcolor to "yellow"
.ColorToleranceHigh = RGB(255, 255, 0)
'Set upper limit to "45"
.ToleranceHigh = 45
End With
End Sub

See also
CheckToleranceHigh Property (Page 3537)
BarGraph Object (Page 3286)

ColorToleranceLow Property
Description
Defines or returns the color for the "Tolerance Low" low limit value. LONG write-read access.
The "CheckToleranceLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3550

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12" and the bar color will change to "Yellow".

Sub BarGraphLimitConfiguration()
'VBA458
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceLow = False
'Activate monitoring
.CheckToleranceLow = True
'Set barcolor to "yellow"
.ColorToleranceLow = RGB(255, 255, 0)
'Set lower limit to "15"
.ToleranceLow = 15
End With
End Sub

See also
CheckToleranceLow Property (Page 3538)
BarGraph Object (Page 3286)

ColorTop Property
Description
Defines or returns the color for the top/left stop of the slider object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color for the upper/left view will be set to "Orange":

Sub SliderConfiguration()
'VBA459
Dim objSlider As HMISlider

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3551

VBA for Automated Configuration


5.5 VBA Reference

Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")


With objSlider
.ColorTop = RGB(255, 128, 0)
End With
End Sub

See also
Slider object (Page 3428)

ColorWarningHigh Property
Description
Defines or returns the color for the "Warning High" high limit value. LONG write-read access.
The "CheckWarningHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75" and the bar color will change to "Red".

Sub BarGraphLimitConfiguration()
'VBA460
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor to "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit to "75"
.WarningHigh = 75
End With
End Sub

3552

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
CheckWarningHigh Property (Page 3539)
BarGraph Object (Page 3286)

ColorWarningLow Property
Description
Defines or returns the color for the "Warning Low" low limit value. LONG write-read access.
The "CheckWarningLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12" and the bar color will change to "Magenta".

Sub BarGraphLimitConfiguration()
'VBA461
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True
'Set barcolor to "magenta"
.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit to "12"
.WarningLow = 12
End With
End Sub

See also
CheckWarningLow Property (Page 3539)
BarGraph Object (Page 3286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3553

VBA for Automated Configuration


5.5 VBA Reference

CommonVBSCode Property
Description
Defines the higher-level common declaration section of the actions for the active picture or
returns it.
The action editor of the Graphics Designer is used to configure actions at events and
properties. In the declaration section of the actions, you can declare tags for a process image
as well as create functions and procedures. In Runtime, each VBS action can access these
tags, functions and procedures if the picture is active.
If you set "CommonVBSCode", the string is copied to the "Event" and "Property" declaration
sections in the action editor. Any code there is overwritten. Therefore, set "CommonVBSCode"
first before setting the subordinate declaration sections with "CommonVBSEventArea" or
"CommonVBSPropertyArea".

Example
In the following example, a tag that is common to all picture objects is declared in the active
picture. The common declaration section is then output :

Sub DefineTagInActiveDocument
ActiveDocument.CommonVBSCode = "DIM actionIsdone" & vbCrLf
MsgBox ActiveDocument.CommonVBSCode
End Sub

See also
Document Object (Page 3319)

CommonVBSEventArea property
Description
Defines the "Event" declaration section of the actions for the active picture or returns it.
The action editor of the Graphics Designer is used to configure actions, for example, at events.
To this purpose, you can declare tags for a process image as well as create functions and
procedures in the "Event" declaration section of the actions. In Runtime each VBS action that
was configured for an event can access these tags, functions and procedures if the picture is
active.
If you set "CommonVBSEventArea", the string is copied to the "Event" declaration section in
the action editor. Any code there is overwritten. Therefore, first read the code set, for example
with "CommonVBSCode" before you set the declaration section with
"CommonVBSEventArea".

3554

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
In the following example, two tags are declared in the active picture. The "Event" declaration
section is the output:

Sub DefineTagInActiveDocument
ActiveDocument.CommonVBSCode = "DIM actionIsdone" & vbCrLf
ActiveDocument.CommonVBSEventArea = ActiveDocument.CommonVBSEventArea & "DIM
"eventHasOccurred"
MsgBox ActiveDocument.CommonVBSEventArea
End Sub

CommonVBSPropertyArea property
Description
Defines the "Property" declaration section of the actions for the active picture or returns it.
The action editor of the Graphics Designer is used to configure actions for example at
properties. To this purpose you can declare tags for a process image as well as create functions
and procedures in the "Property" declaration section of the actions. In Runtime each VBS
action that was configured for a property can access these tags, functions and procedures if
the picture is active.
If you set "CommonVBSPropertyArea", the string is copied to the "Property" declaration section
in the action editor. Any code there is overwritten. Therefore, first read the code set, for example
with "CommonVBSCode" before you set the declaration section with
"CommonVBSPropertyArea".

Example
In the following example, two tags are declared in the active picture. The "Property" declaration
section is then output:

Sub DefineTagInActiveDocument
ActiveDocument.CommonVBSCode = "DIM actionIsdone" & vbCrLf
ActiveDocument CommonVBSPropertyArea = ActiveDocument.CommonVBSPropertyArea & "DIM
propertyIsChanged"
MsgBox ActiveDocument.CommonVBSPropertyArea
End Sub

CommandLine Property
Description
Returns the start parameter as a string if the application is opened via Start>Execute
"Grafexe.exe start parameter". Read only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3555

VBA for Automated Configuration


5.5 VBA Reference

Example:
In this example a message containing the start parameter is output on opening the document.

Sub Document_Opened(CancelForwarding As Boolean)


'VBA462
MsgBox Application.Commandline
End Sub

See also
Application Object (Page 3282)

Compiled Property
Description
TRUE if the source code of a C script or VB script was successfully compiled. BOOLEAN read
access.

Example:
In the following example a button and a circle will be inserted in the active picture. In Runtime
the radius of the circle will enlarge every time you click the button. A VB script will be used for
this purpose:

Sub IncreaseCircleRadiusWithVBScript()
'VBA463
Dim objButton As HMIButton
Dim objCircleA As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Dim strCode As String
strCode = "Dim objCircle" & vbCrLf & "Set objCircle = "
strCode = strCode & "hmiRuntime.ActiveScreen.ScreenItems(""CircleVB"")"
strCode = strCode & vbCrLf & "objCircle.Radius = objCircle.Radius + 5"
Set objCircleA = ActiveDocument.HMIObjects.AddHMIObject("CircleVB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircleA
.Top = 100
.Left = 100
End With
With objButton
.Top = 10
.Left = 10
.Width = 200
.Text = "Increase Radius"
End With
'On every mouseclick the radius will be increased:

3556

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objEvent = objButton.Events(1)


Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
objVBScript.SourceCode = strCode
Select Case objVBScript.Compiled
Case True
MsgBox "Compilation OK!"
Case False
MsgBox "Errors by compilation!"
End Select
End Sub

See also
SourceCode Property (Page 3768)
ScriptInfo Object (Page 3424)

ConfigurationFileName Property
Description
Returns the file name and full path of the configuration file for the open project. STRING read
access.

Example:
The "ShowConfigurationFileName() procedure outputs the configuration file path for the
current picture:
Sub ShowConfigurationFileName()
'VBA464
MsgBox ActiveDocument.Application.ConfigurationFileName
End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3557

VBA for Automated Configuration


5.5 VBA Reference

ConnectionPoints property
Description
Returns the number of connection points of an object.

Example: Number of connection points of a rectangle


In this example, a rectangle is inserted and the number of connection points is output:

Sub CountConnectionPoints()
'VBA229
Dim objRectangle As HMIRectangle
Dim objConnPoints As HMIConnectionPoints
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
Set objConnPoints = ActiveDocument.HMIObjects("Rectangle1").ConnectionPoints
MsgBox "Rectangle1 has " & objConnPoints.Count & " connectionpoints."
End Sub

ConnectorObjects property
Description
Only used internally.

See also
3DBarGraph Object (Page 3267)
ActiveXControl Object (Page 3273)
AdvancedAnalogDisplay object (Page 3274)
AdvancedStateDisplay object (Page 3278)
ApplicationWindow Object (Page 3284)
BarGraph Object (Page 3286)
Button Object (Page 3293)
CheckBox Object (Page 3297)
Circle Object (Page 3300)
CircularArc Object (Page 3303)
ComboBox object (Page 3306)
CustomizedObject Object (Page 3310)
DataSetObj object (Page 3315)
DotNetControl object (Page 3324)

3558

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Ellipse Object (Page 3327)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
FaceplateObject object (Page 3339)
GraphicObject Object (Page 3345)
Group Object (Page 3348)
GroupDisplay Object (Page 3350)
IOField Object (Page 3361)
Line Object (Page 3373)
ListBox object (Page 3375)
MultiLineEdit object (Page 3385)
ObjConnection object (Page 3388)
OLEObject Object (Page 3391)
OptionGroup Object (Page 3393)
PictureWindow Object (Page 3396)
PieSegment Object (Page 3399)
Polygon Object (Page 3402)
PolyLine Object (Page 3405)
Rectangle Object (Page 3415)
RoundButton Object (Page 3418)
RoundRectangle Object (Page 3422)
Slider object (Page 3428)
StaticText Object (Page 3433)
StatusDisplay Object (Page 3436)
TextList Object (Page 3441)
TubeArcObject object (Page 3453)
TubeDoubleTeeObject object (Page 3455)
TubePolyline object (Page 3457)
TubeTeeObject object (Page 3459)
WPFControl object (Page 3469)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3559

VBA for Automated Configuration


5.5 VBA Reference

ConnectorType property
Description
Defines the type of connector:
Automatic

Both objects are connected by a polyline made up of horizontal and vertical parts.

Simple

Both objects are connected by a straight line between the connecting points.

ControlType property
Description
Returns the name range of the control.

CopyPasteSettings property
Description
Only used internally.

See also
Application Object (Page 3282)

CornerRadius property
Description
Defines the rounding radius of the rectangle which enclose objects in the advanced analog
display. The values are defined in pixels.
The range of values which can be displayed for the corner radius depends on the values set
for the "height" and "width" properties. The maximum corner radius value which can be
displayed is equivalent to 50% of the lower one of the "height" or "width" values. The maximum
value is used if higher values are entered.

Count Property
Description
Returns the number of elements in the specified listing. LONG read access

3560

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example a new picture will be created and a pair of objects will be inserted.
The number of inserted objects will be output at the end:

Sub ObjectsInActiveDocument()
'VBA465
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objDocument As Document
Set objDocument = Application.Documents.Add(hmiOpenDocumentTypeVisible)
Dim iIndex As Integer
iIndex = 1
For iIndex = 1 To 5
Set objCircle = objDocument.HMIObjects.AddHMIObject("Circle" & iIndex, "HMICircle")
Set objRectangle = objDocument.HMIObjects.AddHMIObject("Rectangle" & iIndex,
"HMIRectangle")
With objCircle
.Top = (10 * iIndex)
.Left = (10 * iIndex)
End With
With objRectangle
.Top = ((10 * iIndex) + 50)
.Left = (10 * iIndex)
End With
Next iIndex
MsgBox "There are " & objDocument.HMIObjects.Count & " objects in the document"
End Sub

See also
VariableTriggers Object (Listing) (Page 3465)
Views Object (Listing) (Page 3468)
VariableStateValues Object (Listing) (Page 3462)
ToolbarItems Object (Listing) (Page 3450)
Toolbars Object (Listing) (Page 3446)
SymbolLibraries Object (Listing) (Page 3439)
SelectedObjects object (Listing) (Page 3426)
Properties Object (Listing) (Page 3408)
HMIObjects Object (Listing) (Page 3359)
MenuItems Object (Listing) (Page 3384)
Menus Object (Listing) (Page 3380)
Layers Object (Listing) (Page 3371)
LanguageTexts Object (Listing) (Page 3369)
LanguageFonts Object (Listing) (Page 3366)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3561

VBA for Automated Configuration


5.5 VBA Reference
GroupedObjects Object (Listing) (Page 3353)
FolderItems Object (Listing) (Page 3343)
Events Object (Listing) (Page 3337)
Documents Object (Listing) (Page 3322)
HMIDefaultObjects Object (Listing) (Page 3354)
DataLanguages Object (Listing) (Page 3314)
ConnectionPoints Object (Listing) (Page 3308)
AnalogResultInfos Object (Listing) (Page 3281)
Actions Object (Listing) (Page 3271)

CQBackColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In Acknowledged" which color
the background of the value to be displayed assumes for flashing status "Off" (CBackColorOff)
or "On" (CBackColorOn) when the arrival of a message is acknowledged..
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CQBackFlash property
Description
Specifies for the selected message type and status "Came In Acknowledged" whether the
background of the value to be displayed flashes when the arrival of a message is
acknowledged.

CQTextColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In Acknowledged" which color
the text of the value to be displayed assumes for flashing status "Off" (CTextColorOff) or "On"
(CTextColorOn) when the arrival of a message is acknowledged..
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

3562

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CQTextFlash property
Description
Specifies for the selected message type and status "Came In Acknowledged" whether the
background of the text to be displayed flashes when the arrival of a message is acknowledged.

CTextColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In" which color the text of the
value to be displayed assumes for flashing status "Off" (CTextColorOff) or "On"
(CTextColorOn).
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CTextFlash property
Description
Specifies for the selected message type and status "Came In" whether the text of the value to
be displayed flashes when a message is received.

CurrentDataLanguage Property
Description
Defines the project language or returns the language identifier as a decimal value. LONG readwrite access.

Example:
The "ShowDataLanguage()" procedure outputs the currently set project language:

Sub ShowDataLanguage()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3563

VBA for Automated Configuration


5.5 VBA Reference

'VBA466
MsgBox Application.CurrentDataLanguage
End Sub

See also
Application Property (Page 3484)
DataLanguageChanged Event (Page 3141)
Language-Dependent Configuration with VBA (Page 3018)

CurrentDesktopLanguage Property
Description
Returns the language identifier of the currently set user interface language as a decimal value.
LONG read access.

Example:
The "ShowDesktopLanguage()" procedure outputs the currently set user interface language:

Sub ShowDesktopLanguage()
'VBA467
MsgBox Application.CurrentDesktopLanguage
End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)
DesktopLanguageChanged event (Page 3142)
Language-Dependent Configuration with VBA (Page 3018)

CursorControl Property
Description
TRUE, when Alpha Cursor mode is activated, the cursor skips to the next field in the TAB
sequence after exiting the field. BOOLEAN write-read access.
The CursorMode property must be set to TRUE.

3564

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the cursor will skip into the next field when another field is exited. For this to work, the Cursor
mode property must first be set to TRUE.

Sub IOFieldConfiguration()
'VBA468
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
Application.ActiveDocument.CursorMode = True
With objIOField
.CursorControl = True
End With
End Sub

See also
TabOrderAlpha Property (Page 3773)
TabOrderSwitch Property (Page 3776)
CursorMode Property (Page 3567)
ActiveDocument Property (Page 3472)
TextList Object (Page 3441)
IOField Object (Page 3361)

CursorMode Property
Description
TRUE if the "Alpha Cursor" mode is to be activated. FALSE if the "Tab order" mode is to be
activated. BOOLEAN write-read access.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the "Alpha Cursor" mode will be activated:

Sub ActiveDocumentConfiguration()
'VBA469
Application.ActiveDocument.CursorMode = True
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3565

VBA for Automated Configuration


5.5 VBA Reference

See also
CursorControl Property (Page 3564)
ActiveDocument Property (Page 3472)
Documents Object (Listing) (Page 3322)

CustomMenus Property
Description
Returns a listing of the available user-defined menus.

Example:
The "ShowCustomMenuInformation()" procedure outputs the Key and Label of all user-defined
menus in the current picture:

Sub ShowCustomMenuInformation()
'VBA470
Dim strKey As String
Dim strLabel As String
Dim strOutput As String
Dim iIndex As Integer
For iIndex = 1 To ActiveDocument.CustomMenus.Count
strKey = ActiveDocument.CustomMenus(iIndex).Key
strLabel = ActiveDocument.CustomMenus(iIndex).Label
strOutput = strOutput & vbCrLf & "Key: " & strKey & " Label: " & strLabel
Next iIndex
If 0 = ActiveDocument.CustomMenus.Count Then
strOutput = "There are no custommenus for the document created."
End If
MsgBox strOutput
End Sub

See also
Application Property (Page 3484)
ActiveDocument Property (Page 3472)
Menu Object (Page 3378)

CustomToolbars Property
Description
Returns a listing of the available user-defined toolbars.

3566

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ShowCustomToolbarInformation()" procedure outputs the Key values of all user-defined
toolbars in the current picture:

Sub ShowCustomToolbarInformation()
'VBA471
Dim strKey As String
Dim strOutput As String
Dim iIndex As Integer
For iIndex = 1 To ActiveDocument.CustomToolbars.Count
strKey = ActiveDocument.CustomToolbars(iIndex).Key
strOutput = strOutput & vbCrLf & "Key: " & strKey
Next iIndex
If 0 = ActiveDocument.CustomToolbars.Count Then
strOutput = "There are no toolbars created for this document."
End If
MsgBox strOutput
End Sub

See also
Application Property (Page 3484)
ActiveDocument Property (Page 3472)
Toolbar Object (Page 3445)

CycleName Property
Description
Returns the name of the specified tag trigger. Read only access.

Example:
--

See also
VariableTrigger Object (Page 3464)

CycleTime Property
Description
Returns the cycle time of the specified tag trigger. Read only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3567

VBA for Automated Configuration


5.5 VBA Reference

Example:
--

See also
VariableTrigger Object (Page 3464)

CycleType Property
Description
Defines or returns the cycle type.

Example:
The "DynamicToRadiusOfNewCircle(hmiCircle As IHMICircle)" procedure creates a dynamic
for the radius of a circle. In this example the radius of the circle will be set every two seconds:

Sub DynamicToRadiusOfNewCircle()
'VBA474
Dim objCircle As hmiCircle
Dim VariableTrigger As HMIVariableTrigger
Set objCircle = Application.ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set VariableTrigger = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVariableDirect,
"NewDynamic1")
VariableTrigger.CycleType = hmiVariableCycleType_2s
End Sub

See also
VariableTrigger Object (Page 3464)
Configuring Dynamics in the Properties of Pictures and Objects (Page 3080)

3568

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

D
DataFormat Property
Description
Defines or returns the data type of the IOField object. Value range from 0 to 3.
Data type

Assigned Value

Binary

Decimal

String

Hexadecimal

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this
example, data type "Decimal" will be set for the I/O field:

Sub IOFieldConfiguration()
'VBA475
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.DataFormat = 1
End With
End Sub

See also
IOField Object (Page 3361)

DefaultHMIObjects Property
Description
Returns the HMIDefaultObjects listing.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3569

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ShowDefaultObjectNames()" procedure outputs all the object names contained in the
HMIDefaultObjects listing:

Sub ShowDefaultObjectNames()
'VBA476
Dim strOutput As String
Dim iIndex As Integer
For iIndex = 1 To Application.DefaultHMIObjects.Count
strOutput = strOutput & vbCrLf & Application.DefaultHMIObjects(iIndex).ObjectName
Next iIndex
MsgBox strOutput
End Sub

See also
HMIDefaultObjects Object (Listing) (Page 3354)

DestinationLink Property
Description
Returns the Destination object. Use the DestinationLink property to configure the destination
object in the case of a direct connection.

Example:
Use the DestinationLink property to return the DestLink object. In the following example the X
position of "Rectangle_A" is copied to the Y position of "Rectangle_B" in Runtime by clicking
on the button:

Sub DirectConnection()
'VBA477
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400

3570

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 100
.Text = "SetPosition"
End With
'
'Directconnection is initiated by mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
AutomationName Property (Page 3488)
ObjectName Property (Page 3700)
Type Property (Page 3792)
DirectConnection Object (Page 3318)

Direction Property
Description
Defines or returns the bar direction. BOOLEAN write-read access.
Slider
Defines or returns the position of the Slider object. BOOLEAN write-read access.
Position/Bar Axis

Assigned Value

Vertical/Negative

TRUE

Horizontal/Positive

FALSE

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3571

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the position of the Slider object will be set to "Vertical":

Sub SliderConfiguration()
'VBA478
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.Direction = True
End With
End Sub

See also
Slider object (Page 3428)
3DBarGraph Object (Page 3267)

DisablePerformanceWarnings property
Description
Only used internally.

See also
Application Object (Page 3282)

DisableVBAEvents Property
Description
TRUE if Event Handling is disabled. BOOLEAN write-read access.

Example:
The "DisableVBAEvents()" procedure disables Event Handling:

Sub DisableVBAEvents()
'VBA479
Application.DisableVBAEvents = False
End Sub

3572

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Application Object (Page 3282)
Event Handling (Page 3103)

Display property
Description
Only used internally.

See also
ObjConnection object (Page 3388)

DisplayName Property
Description
Returns the name of the property attribute. STRING read access.
Thus the expression "MsgBox
ActiveDocument.HMIObjects("Circle_1").Properties("Height").DisplayName" would output the
result "Height".

Example:
The "ShowAllObjectDisplayNames()" procedure outputs all the property attribute names of
standard objects contained in the message box:

Sub ShowAllObjectDisplayNames()
'VBA480
Dim strOutput As String
Dim iIndex1 As Integer
iIndex1 = 1
strOutput = "List of all properties-displaynames from object """ &
Application.DefaultHMIObjects(1).ObjectName & """" & vbCrLf & vbCrLf
For iIndex1 = 1 To Application.DefaultHMIObjects(1).Properties.Count
strOutput = strOutput & Application.DefaultHMIObjects(1).Properties(iIndex1).DisplayName &
" / "
Next iIndex1
MsgBox strOutput
End Sub

See also
Property Object (Page 3409)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3573

VBA for Automated Configuration


5.5 VBA Reference

DisplayOptions Property
Description
Defines the assignment of the "Button" or "Round button" object or returns its value. Value
range from 0 to 3.
Assignment

Assigned Value

Graphic or text

Graphic and text

Text only

Graphic only

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button.
In this example the button is assigned "Graphic and text":

Sub ButtonConfiguration()
'VBA814
Dim objbutton As HMIButton
Set objbutton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objbutton
.DisplayOptions = 1
End With
End Sub

See also
Button Object (Page 3293)

DisplayText Property
Description
Returns the value for the "Label" or "TooltipText" property of the following objects (STRING
read access):
Menu Object
MenuItem Object
ToolbarItem Object

3574

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ShowLabelTexts()" procedure outputs all the labels of the first user-defined menu in the
current picture:

Sub ShowLabelTexts()
'VBA481
Dim objLangText As HMILanguageText
Dim iIndex As Integer
For iIndex = 1 To ActiveDocument.CustomMenus(1).LDLabelTexts.Count
Set objLangText = ActiveDocument.CustomMenus(1).LDLabelTexts(iIndex)
MsgBox objLangText.DisplayName
Next iIndex
End Sub

See also
ToolTipText Property (Page 3786)
Label Property (Page 3644)
ToolbarItem Object (Page 3448)
LanguageText Object (Page 3368)
MenuItem Object (Page 3382)
Menu Object (Page 3378)

Documents Property
Description
Returns the Documents listing containing all open pictures. The open pictures are in
chronological order.

Example:
In the following example the names of all open pictures are output:

Sub ShowDocuments()
'VBA482
Dim colDocuments As Documents
Dim objDocument As Document
Dim strOutput As String
Set colDocuments = Application.Documents
strOutput = "List of all opened documents:" & vbCrLf
For Each objDocument In colDocuments
strOutput = strOutput & vbCrLf & objDocument.Name
Next objDocument
MsgBox strOutput

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3575

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)

DrawInsideFrame property
Description
Defines for all line thicknesses greater than "1" whether the border lines are to be drawn inside
the object frame or symmetrically on the frame.
Yes

The border lines are drawn inside the object frame.

No

The border lines are drawn symmetrically on the object frame.

DropDownListStyle property
Description
Defines whether the entries in the "TextList" object are displayed in a drop-down list box.

Dynamic Property
Description
Returns the dynamics of a property.

Example:
Use the Dynamic property if you wish to return, say, an existing dynamic. In the following
example all possibly available object property dynamics are output in the active picture:

Sub ShowPropertiesDynamicsofAllObjects()
'VBA483
Dim objObject As HMIObject
Dim colObjects As HMIObjects
Dim colProperties As HMIProperties
Dim objProperty As HMIProperty
Dim strOutput As String
Set colObjects = Application.ActiveDocument.HMIObjects
For Each objObject In colObjects

3576

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set colProperties = objObject.Properties


For Each objProperty In colProperties
If 0 <> objProperty.DynamicStateType Then
strOutput = strOutput & vbCrLf & objObject.ObjectName & " - " & objProperty.DisplayName
& ": Statetype " & objProperty.Dynamic.DynamicStateType
End If
Next objProperty
Next objObject
MsgBox strOutput
End Sub

See also
Property Object (Page 3409)

DynamicStateType property
Description
Only used internally.

See also
VBA Reference: ActionDynamic (Page 3126)

E
EditAtOnce Property
Description
TRUE, if accessing the field with the <TAB> key permits input immediately and without further
action. BOOLEAN write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
it shall be possible to enter input on skipping into the I/O field:

Sub IOFieldConfiguration()
'VBA484
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.EditAtOnce = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3577

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
TextList Object (Page 3441)
IOField Object (Page 3361)

ElseCase Property
Description
Defines or returns the value for the dynamic property outside of the configured value range.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned and three analog value ranges will be created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA485
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

See also
AnalogResultInfos Object (Listing) (Page 3281)
AnalogResultInfo Object (Page 3280)
Add Method (AnalogResultInfos Listing) (Page 3166)

3578

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Enabled Property
Description
TRUE if the menu, the menu entry or the icon is activated and can be selected. Applies only
to user-defined menus and toolbars. BOOLEAN write-read access.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"): In this example the second menu point in
user-defined menu "Delete Objects" is grayed out and cannot be selected in the Graphics
Designer:

Sub DisableMenuItem()
'VBA486
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
'
'Add a new menu "Delete objects"
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete circles")
'
'Disable menuitem "Delete circles"
With ActiveDocument.CustomMenus("DeleteObjects").MenuItems("DeleteAllCircles")
.Enabled = False
End With
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)
Menu Object (Page 3378)
Configuring Menus and Toolbars (Page 3020)

EnableFlashing property
Description
Specifies whether the value for status "OK" and "Simulation" appears flashing or not in the
advanced analog display in Runtime.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3579

VBA for Automated Configuration


5.5 VBA Reference
For the flashing to be visible in Runtime, the font flashing color must be different to the
background flashing color.

EndAngle Property
Description
Defines or returns the end of the object for the CircularArc, EllipseArc, EllipseSegment and
PieSegment objects. The information is in counterclockwise direction in degrees, beginning at
the 12:00 clock position.

Example:
The "PieSegmentConfiguration()" procedure accesses the properties of the Pie Segment. In
this example the pie segment begins at 40 and ends at 180:

Sub PieSegmentConfiguration()
'VBA487
Dim objPieSegment As HMIPieSegment
Set objPieSegment = ActiveDocument.HMIObjects.AddHMIObject("PieSegment1", "HMIPieSegment")
With objPieSegment
.StartAngle = 40
.EndAngle = 180
End With
End Sub

See also
StartAngle Property (Page 3769)
PieSegment Object (Page 3399)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
CircularArc Object (Page 3303)

EventQuitMask property
Description
The events "Operator request" and "Measuring point blocked" are not acknowledgeable events
in the PCS 7 environment. Using the "@EventQuit" tag and the "EventQuitMask" property in
Runtime, these events are automatically indicated as acknowledged to prevent flashing during
the calculation of the group displays. The start value of the attribute is then 0x00000011 (17).
The value of the "EventQuitMask" property should be identical for all group display objects,
advanced analog display and advanced status display, and for the "@EventQuit" tag.

3580

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
By setting further acknowledgment bits, you can indicate other events as being acknowledged
as well with the display of the group display object and the advanced analog and status display.

Events Property
Description
Returns the Events listing. Use the Events property to define the event that will trigger an
action. Use the index number to define the event that is intended to be configured:
You configure an action on a property with VBA by using the "Events(9)" property, where
the index "1" stands for the event "Upon change":
To configure an action onto an object with the aid of VBA, use the "Events(Index)" property,
where "Index" stands for the trigger event (see table):
Index

EventType (depending upon the object used)

hmiEventTypeNotDefined

hmiEventTypeMouseClick

hmiEventTypeMouseLButtonDown

hmiEventTypeMouseLButtonUp

hmiEventTypeMouseRButtonDown

hmiEventTypeMouseRButtonUp

hmiEventTypeKeyboardDown

hmiEventTypeKeyboardUp

hmiEventTypeFocusEnter

hmiEventTypeObjectChange

10

hmiEventTypeOpenPicture

11

hmiEventTypePictureOpen

12

hmiEventTypePictureClose

13

hmiEventTypeObjectDefined

14

hmiEventTypeFocusEnter

15

hmiEventTypeLastTriggerType

16

hmiEventTypeObjSpecificTriggerStart

Example:
In the following example the X position of "Rectangle_A" is copied to the Y position of
"Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA488
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3581

VBA for Automated Configuration


5.5 VBA Reference

Dim objDirConnection As HMIDirectConnection


Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 100
.Text = "SetPosition"
End With
'
'Directconnection is initiated by mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
Events Object (Listing) (Page 3337)
Configuring Event-Driven Actions with VBA (Page 3092)

EventName property
Description
Returns the name of the "Event" object.

3582

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
In this example the event names and event types of all objects in the active pictures are put
out. In order for this example to work, insert some objects into the active picture and configure
different events.

Sub ShowEventsOfAllObjectsInActiveDocument()
'VBA252
Dim colEvents As HMIEvents
Dim objEvent As HMIEvent
Dim iMax As Integer
Dim iIndex As Integer
Dim iAnswer As Integer
Dim strEventName As String
Dim strObjectName As String
Dim varEventType As Variant
iIndex = 1
iMax = ActiveDocument.HMIObjects.Count
For iIndex = 1 To iMax
Set colEvents = ActiveDocument.HMIObjects(iIndex).Events
strObjectName = ActiveDocument.HMIObjects(iIndex).ObjectName
For Each objEvent In colEvents
strEventName = objEvent.EventName
varEventType = objEvent.EventType
iAnswer = MsgBox("Objectname: " & strObjectName & vbCrLf & "Eventtype: " & varEventType &
vbCrLf & "Eventname: " & strEventName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objEvent
If vbCancel = iAnswer Then Exit For
Next iIndex
End Sub

EventType Property
Description
Returns the event type that is configured on the specified object.
Index

EventType (depending upon the object used)

hmiEventTypeNotDefined

hmiEventTypeMouseClick

hmiEventTypeMouseLButtonDown

hmiEventTypeMouseLButtonUp

hmiEventTypeMouseRButtonDown

hmiEventTypeMouseRButtonUp

hmiEventTypeKeyboardDown

hmiEventTypeKeyboardUp

hmiEventTypeFocusEnter

hmiEventTypeObjectChange

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3583

VBA for Automated Configuration


5.5 VBA Reference
Index

EventType (depending upon the object used)

10

hmiEventTypeOpenPicture

11

hmiEventTypePictureOpen

12

hmiEventTypePictureClose

13

hmiEventTypeObjectDefined

14

hmiEventTypeFocusEnter

15

hmiEventTypeLastTriggerType

16

hmiEventTypeObjSpecificTriggerStart

Example:
Use the EventType property to edit a previously configured event. In the following example
the event "Mouse Action" will be configured, but then changed to "Pressed":

Sub AddActionToObjectTypeCScript()
'VBA489
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
'
'C-action is initiated by click on object circle
Set objEvent = objCircle.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
MsgBox "the type of the projected event is " & objEvent.EventType
End Sub

See also
Events Object (Listing) (Page 3337)
Configuring Event-Driven Actions with VBA (Page 3092)

Exponent Property
Description
TRUE if numbers are to be displayed on the BarGraph object using exponents (e.g. "1.00e
+000"). BOOLEAN write-read access.

Example:
The "BarGraphConfiguration()" procedure configures In this example numbers are to be
displayed on the bar using exponents:

Sub BarGraphConfiguration()

3584

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'VBA490
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Exponent = True
End With
End Sub

See also
BarGraph Object (Page 3286)

ExtendedOperation Property
Description
TRUE if the slider on the Slider object is set to the associated end value (minimum value/
maximum value). This is done by clicking the mouse in an area outside the current regulator
setting. BOOLEAN write-read access.

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the ExtendedOperation property will be set to TRUE:

Sub SliderConfiguration()
'VBA491
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.ExtendedOperation = True
End With
End Sub

See also
Slider object (Page 3428)

ExtendedZoomingEnable Property
Description
TRUE, if the selected process picture in Runtime may be zoomed in or out using the mouse
wheel. This happens by pushing the <CTRL> key while the mouse wheel is turned. If the mouse
wheel is turned away from the palm of the hand, the zoom factor increases.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3585

VBA for Automated Configuration


5.5 VBA Reference
BOOLEAN write-read access.
Requirements for using the zoom function:
Mouse driver by Logitech or Microsoft Intellimouse
Mouse wheel must be set to "Autoscroll".
In the computer properties, the "Graphics Runtime" tab control must have the "Extended
zooming" function enabled for all process pictures.

Example:
The procedure "DocConfiguration()" accesses picture properties.
In this example, the property ExtendedZoomingEnable is set to TRUE:

Sub DocConfiguration()
'VBA815
Dim objDoc As Document
Set objDoc = ActiveDocument
With objDoc
.ExtendedZoomingEnable = True
End With
End Sub

F
FaceplateType property
Description
Sets the faceplate type of the faceplate instance and returns its name. The faceplate type is
"Const" and can therefore only be set once.

Usage
Use the Add method to create a new "faceplate instance" object in a picture.
"Properties.Item(3)" is used to access the FaceplateType property:

Sub FaceplateInstance_and_Properties()
'VBA847
Dim objFaceplateInstance As HMIFaceplateObject
Set objFaceplateInstance = ActiveDocument.HMIObjects.AddHMIObject("faceplate instance",
"HMIFaceplateObject")
objFaceplateInstance.Properties.Item(3).value = "Faceplate1.fpt"
MsgBox "Faceplate """ & objFaceplateInstance.Properties.Item(3).value & """ is used."

3586

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

Family Property
Description
Defines or returns the language-dependent font.

Example:
The following example sets the font attributes of a button for French and English:

Sub ExampleForLanguageFonts()
'VBA492
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Dim iStartLangID As Integer
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
iStartLangID = Application.CurrentDataLanguage
With objButton
.Text = "Command"
.Width = 100
End With
Set colLangFonts = objButton.LDFonts
'
'To do typesettings for french:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'
'To do typesettings for english:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
With objButton
Application.CurrentDataLanguage = 1036
.Text = "Command"
MsgBox "Datalanguage is changed in french"
Application.CurrentDataLanguage = 1033
.Text = "Command"
MsgBox "Datalanguage is changed in english"
Application.CurrentDataLanguage = iStartLangID
MsgBox "Datalanguage is changed back to startlanguage."

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3587

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
Underlined Property (Page 3801)
Size Property (Page 3764)
Parent Property (Page 3710)
Italic Property (Page 3638)
LanguageID Property (Page 3645)
Bold Property (Page 3513)
Application Property (Page 3484)
LanguageFont Object (Page 3365)

FillBackColor property
Description
Only used internally.

See also
Document Object (Page 3319)

FillColor Property
Description
Defines or returns the fill pattern color for the object. LONG read-write access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3588

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the background color will be set to "Yellow".

Sub RectangleConfiguration()
'VBA493
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.FillColor = RGB(255, 255, 0)
End With
End Sub

See also
Button Object (Page 3293)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Document Object (Page 3319)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3589

VBA for Automated Configuration


5.5 VBA Reference

Filling Property
Description
TRUE if an object with closed frame lines (such as a Circle or Rectangle) can be filled (as in
the fill level of a tank, for example). BOOLEAN write-read access.
To set the fill level of the object, use the FillingIndex property.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example a rectangle can be used to display the fill level:

Sub RectangleConfiguration()
'VBA494
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.Filling = True
End With
End Sub

See also
FillingIndex Property (Page 3593)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

3590

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

FillingIndex Property
Description
Defines the percentage value (relative to the height of the object) to which to fill an object with
closed frame lines (such as a Circle or Rectangle).
The fill level is represented by the current background color. The unfilled background is
transparent.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the rectangle will be filled to 50%:

Sub RectangleConfiguration()
'VBA495
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.Filling = True
.FillingIndex = 50
End With
End Sub

See also
PieSegment Object (Page 3399)
FillColor Property (Page 3588)
BackColor Property (Page 3494)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3591

VBA for Automated Configuration


5.5 VBA Reference

FillingDirection property
Description
0 = the object enclosed in a frame line is filled from bottom to top.
1 = the object enclosed in a frame line is filled from top to bottom.
2 = the object enclosed in a frame line is filled from left to right.
3 = the object enclosed in a frame line is filled from right to left.
Write/Read access.
Use the "FillingDirection" property to set the object fill direction.

Example
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example, the object is filled from left to right.

Sub RectangleConfiguration()
'VBA906
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.FillingDirection = 2
End With
End Sub

FillStyle Property
Description
Defines or returns the fill style for the object.
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

65536
0

3592

1048576

196611

196627

1048577

196612

196628

1048578

196613

196629

1048579

196614

196630

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

1048832

196615

196631

1048833

196616

196632

1048834

196617

196633

1048835

196618

196634

131072

196619

196635

131073

196620

196636

131074

196621

196637

131075

196622

196638

131076

196623

196639

196608

196624

196640

196609

196625

196641

196610

196626

196642

Example
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the fill pattern will be set to the value "196642":

Sub RectangleConfiguration()
'VBA496
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.FillStyle = 196642
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3593

VBA for Automated Configuration


5.5 VBA Reference

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Document Object (Page 3319)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

FillStyle2 Property
Description
Defines or returns the fill pattern of the bar for the BarGraph object.
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

65536
0

3594

1048576

196611

196627

1048577

196612

196628

1048578

196613

196629

1048579

196614

196630

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Fill pattern

Value

Fill pattern

Value

Fill pattern

Value

1048832

196615

196631

1048833

196616

196632

1048834

196617

196633

1048835

196618

196634

131072

196619

196635

131073

196620

196636

131074

196621

196637

131075

196622

196638

131076

196623

196639

196608

196624

196640

196609

196625

196641

196610

196626

196642

Example
The "BarGraphConfiguration()" procedure configures In this example the bar pattern will be
set to "196642":

Sub BarGraphConfiguration()
'VBA497
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.FillStyle2 = 196642
End With
End Sub

See also
BarGraph Object (Page 3286)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3595

VBA for Automated Configuration


5.5 VBA Reference

FillStyleAlignment property
Description
Defines the alignment of the fill pattern for the process picture.
Normal
Stretched (window)

The fill pattern refers to the process picture. In runtime, no scaling is


performed when opening the picture.
The fill pattern refers to the window in the Graphics Designer. In
runtime, scaling is performed when opening the picture.

FlashBackColor Property
Description
TRUE, when flashing of the background is activated. BOOLEAN write-read access
Note
A change to the attribute does not automatically deactivate the "Windows Style" attribute.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example, background flashing is activated:

Sub RectangleConfiguration()
'VBA498
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.FlashBackColor = True
End With
End Sub

See also
RoundButton Object (Page 3418)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
Rectangle Object (Page 3415)

3596

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

FlashBorderColor Property
Description
TRUE, when flashing of the object lines is activated. BOOLEAN write-read access.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example, flashing of the border is activated:

Sub RectangleConfiguration()
'VBA499
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.FlashBorderColor = True
End With
End Sub

See also
StaticText Object (Page 3433)
StatusDisplay Object (Page 3436)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3597

VBA for Automated Configuration


5.5 VBA Reference
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

FlashFlashPicture Property
Description
TRUE, when flashing of the flash picture is activated. BOOLEAN write-read access

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example, flashing of the Flash Picture is activated:

Sub StatusDisplayConfiguration()
'VBA500
Dim objsDisplay As HMIStatusDisplay
Set objsDisplay = ActiveDocument.HMIObjects.AddHMIObject("StatusDisplay1",
"HMIStatusDisplay")
With objsDisplay
.FlashFlashPicture = True
End With
End Sub

See also
StatusDisplay Object (Page 3436)

3598

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

FlashForeColor Property
Description
TRUE, when flashing of the text is activated. BOOLEAN write-read access.
Note
A change to the attribute does not automatically deactivate the "Windows Style" attribute.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example,
text flashing is activated:

Sub ButtonConfiguration()
'VBA501
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FlashForeColor = True
End With
End Sub

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

FlashPicReferenced Property
Description
TRUE if the Flash Picture assigned in the Status Display object is to be saved. Otherwise, only
the associated object reference is saved. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3599

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the picture assigned in the Status Display object is to be saved.

Sub StatusDisplayConfiguration()
'VBA502
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("StatusDisplay1",
"HMIStatusDisplay")
With objStatusDisplay
.FlashPicReferenced = True
End With
End Sub

See also
StatusDisplay Object (Page 3436)

FlashPicTransColor Property
Description
Defines which color of the bitmap object (.bmp, .dib) assigned to the flash picture should be
set to "transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "FlashPicUseTransColor" property is
"True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the color "Yellow" will be set to "Transparent".

Sub StatusDisplayConfiguration()
'VBA503
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("StatusDisplay1",
"HMIStatusDisplay")
With objStatusDisplay
.FlashPicTransColor = RGB(255, 255, 0)
.FlashPicUseTransColor = True

3600

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
FlashPicUseTransColor Property (Page 3604)
StatusDisplay Object (Page 3436)

FlashPicture Property
Description
Defines or returns the Flash Picture for the Status Display object.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.
The "FlashPicReferenced" property defines in this case whether the flash picture will be saved
with the Status Display object or referenced.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the picture "Testpicture.BMP" will be used as the flash picture:

Sub StatusDisplayConfiguration()
'VBA504
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("StatusDisplay1",
"HMIStatusDisplay")
With objStatusDisplay
'
'To use this example copy a Bitmap-Graphic
'to the "GraCS"-Folder of the actual project.
'Replace the picturename "Testpicture.BMP" with the name of
'the picture you copied
.FlashPicture = "Testpicture.BMP"
End With
End Sub

See also
FlashPicReferenced Property (Page 3599)
StatusDisplay Object (Page 3436)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3601

VBA for Automated Configuration


5.5 VBA Reference

FlashPicture property
Description
Specifies which flashing picture is to be displayed for the currently selected status. Pictures
with the following formats can be inserted: EMF, WMF, BMP, GIF, JPG.
The flash picture should have the same picture size as the basic picture, otherwise its display
is distorted.

FlashPictureState property
Description
Only used internally.

See also
AdvancedStateDisplay object (Page 3278)

FlashPicUseTransColor Property
Description
TRUE, when the configured color ("FlashPicTransColor" property) of the bitmap objects
assigned to the flash picture should be set to "transparent". BOOLEAN write-read access.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the color "Yellow" will be set to "Transparent":

Sub StatusDisplayConfiguration()
'VBA505
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("StatusDisplay1",
"HMIStatusDisplay")
With objStatusDisplay
.FlashPicTransColor = RGB(255, 255, 0)
.FlashPicUseTransColor = True
End With
End Sub

3602

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
FlashPicTransColor Property (Page 3600)
StatusDisplay Object (Page 3436)

FlashRate Property
Description
Defines or returns the flash frequency of the "GroupDisplay", "AdvancedAnalogDisplay" and
"AdvancedStateDisplay" objects. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

Example
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the flash frequency will be set to "Medium":

Sub GroupDisplayConfiguration()
'VBA506
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.FlashRate = 1
End With
End Sub

See also
GroupDisplay Object (Page 3350)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3603

VBA for Automated Configuration


5.5 VBA Reference

FlashRateBackColor Property
Description
Defines or returns the flash frequency for the object background. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

Example
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the flash frequency for the background will be set to "Medium":

Sub ButtonConfiguration()
'VBA507
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FlashRateBackColor = 1
End With
End Sub

See also
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)

3604

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

FlashRateBorderColor Property
Description
Defines or returns the flash frequency for the lines of the object. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

Example
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the flash frequency for the border will be set to "Medium":

Sub ButtonConfiguration()
'VBA508
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FlashRateBorderColor = 1
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3605

VBA for Automated Configuration


5.5 VBA Reference

See also
Slider object (Page 3428)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

FlashRateFlashPic Property
Description
Defines or returns the flash frequency for the status display. Value range from 0 to 2.

3606

Flash frequency

Assigned Value

Slow (approx. 0.25 Hz)

Medium (approx. 0.5 Hz)

Fast (approx. 1 Hz)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

Example
The "GroupDisplayConfiguration()" procedure accesses the properties of the status display.
In this example the flash frequency for the flash picture will be set to "Medium":

Sub StatusDisplayConfiguration()
'VBA509
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("StatusDisplay1",
"HMIStatusDisplay")
With objStatusDisplay
.FlashRateFlashPic = 1
End With
End Sub

See also
StatusDisplay Object (Page 3436)

FlashRateForeColor Property
Description
Defines or returns the flash frequency for the object label. Value range from 0 to 2.
Flash frequency

Assigned Value

Slow (approx. 0.5 Hz)

Medium (approx. 2 Hz)

Fast (approx. 8 Hz)

Note
Because the flashing is performed by means of software engineering, the flash frequency is
both system-dependent and hardware-bound (number of objects, processor speed, RAM
size, update time, etc.).
The information in the table is therefore only for orientation purposes.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3607

VBA for Automated Configuration


5.5 VBA Reference

Example
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the flash frequency for the label will be set to "Medium":

Sub ButtonConfiguration()
'VBA510
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FlashRateForeColor = 1
End With
End Sub

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

FlashState property
Description
Only used internally.

See also
AdvancedAnalogDisplay object (Page 3274)

Folder Property
Description
Returns a folder from the components library.

3608

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ShowFolderItems()" procedure accesses the symbol libraries. In this example all the
folder names in the global symbol library and project symbol library will be output:

Sub ShowFolderItems()
'VBA511
Dim colFolderItems As HMIFolderItems
Dim objFolderItem As HMIFolderItem
Dim iAnswer As Integer
Dim iMaxFolder As Integer
Dim iMaxSymbolLib As Integer
Dim iSymbolLibIndex As Integer
Dim iSubFolderIndex As Integer
Dim strSubFolderName As String
Dim strFolderItemName As String
'To determine the number of symbollibraries:
iMaxSymbolLib = Application.SymbolLibraries.Count
iSymbolLibIndex = 1
For iSymbolLibIndex = 1 To iMaxSymbolLib
With Application.SymbolLibraries(iSymbolLibIndex)
Set colFolderItems = .FolderItems
'
'To determine the number of folders in actual symbollibrary:
iMaxFolder = .FolderItems.Count
MsgBox "Number of FolderItems in " & .Name & " : " & iMaxFolder
'
'Output of all subfoldernames from actual folder:
For Each objFolderItem In colFolderItems
iSubFolderIndex = 1
For iSubFolderIndex = 1 To iMaxFolder
strFolderItemName = objFolderItem.DisplayName
If 0 <> objFolderItem.Folder.Count Then
strSubFolderName = objFolderItem.Folder(iSubFolderIndex).DisplayName
iAnswer = MsgBox("SymbolLibrary: " & .Name & vbCrLf & "act. Folder: " &
strFolderItemName & vbCrLf & "act. Subfolder: " & strSubFolderName, vbOKCancel)
'
'If "Cancel" is clicked, continued with next FolderItem
If vbCancel = iAnswer Then
Exit For
End If
Else
MsgBox "There are no subfolders in " & objFolderItem.DisplayName
Exit For
End If
Next iSubFolderIndex
Next objFolderItem
End With
Next iSymbolLibIndex
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3609

VBA for Automated Configuration


5.5 VBA Reference

See also
SymbolLibraries Object (Listing) (Page 3439)
SymbolLibrary Object (Page 3440)
FolderItems Object (Listing) (Page 3343)
FolderItem Object (Page 3342)
Accessing the component library with VBA (Page 3040)

FolderItems Property
Description
Returns a listing containing all the folders in the symbol library.

Example:
The "ShowFolderItems()" procedure accesses the symbol libraries. In this example all the
folder names in the global symbol library and project symbol library will be output:

Sub ShowFolderItems()
'VBA512
Dim colFolderItems As HMIFolderItems
Dim objFolderItem As HMIFolderItem
Dim iAnswer As Integer
Dim iMaxFolder As Integer
Dim iMaxSymbolLib As Integer
Dim iSymbolLibIndex As Integer
Dim iSubFolderIndex As Integer
Dim strSubFolderName As String
Dim strFolderItemName As String
'To determine the number of symbollibraries:
iMaxSymbolLib = Application.SymbolLibraries.Count
iSymbolLibIndex = 1
For iSymbolLibIndex = 1 To iMaxSymbolLib
With Application.SymbolLibraries(iSymbolLibIndex)
Set colFolderItems = .FolderItems
'
'To determine the number of folders in actual symbollibrary:
iMaxFolder = .FolderItems.Count
MsgBox "Number of FolderItems in " & .Name & " : " & iMaxFolder
'
'Output of all subfoldernames from actual folder:
For Each objFolderItem In colFolderItems
iSubFolderIndex = 1
For iSubFolderIndex = 1 To iMaxFolder
strFolderItemName = objFolderItem.DisplayName
If 0 <> objFolderItem.Folder.Count Then
strSubFolderName = objFolderItem.Folder(iSubFolderIndex).DisplayName
iAnswer = MsgBox("SymbolLibrary: " & .Name & vbCrLf & "act. Folder: " &
strFolderItemName & vbCrLf & "act. Subfolder: " & strSubFolderName, vbOKCancel)

3610

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'
'If "Cancel" is clicked, continued with next FolderItem
If vbCancel = iAnswer Then
Exit For
End If
Else
MsgBox "There are no subfolders in " & objFolderItem.DisplayName
Exit For
End If
Next iSubFolderIndex
Next objFolderItem
End With
Next iSymbolLibIndex
End Sub

See also
FolderItem Object (Page 3342)
SymbolLibraries Object (Listing) (Page 3439)
SymbolLibrary Object (Page 3440)
FolderItems Object (Listing) (Page 3343)
Accessing the component library with VBA (Page 3040)

FontBold Property
Description
TRUE, when the text in the object should be assigned the "bold" attribute. BOOLEAN writeread access.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font attribute will be set to "Bold":

Sub ButtonConfiguration()
'VBA513
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FontBold = True
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3611

VBA for Automated Configuration


5.5 VBA Reference

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

FontItalic Property
Description
TRUE, when the text in the object should be assigned the "italic" attribute. BOOLEAN writeread access.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font attribute will be set to "Italic":

Sub ButtonConfiguration()
'VBA514
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FontItalic = True
End With
End Sub

See also
StaticText Object (Page 3433)
TextList Object (Page 3441)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

3612

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

FontName Property
Description
Defines or returns the font name of the text in the object.
All the fonts installed in Windows are available for selection.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font is set to Arial:

Sub ButtonConfiguration()
'VBA515
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FontName = "Arial"
End With
End Sub

See also
CheckBox Object (Page 3297)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
Button Object (Page 3293)
BarGraph Object (Page 3286)

FontSize Property
Description
Defines or returns the font size of the text in the object in points.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3613

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font size will be set to 10 points:

Sub ButtonConfiguration()
'VBA516
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FONTSIZE = 10
End With
End Sub

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

FontUnderline Property
Description
TRUE, when the text in the object should be assigned the "underline" attribute. BOOLEAN
write-read access.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font attribute will be set to "Underline":

Sub ButtonConfiguration()
'VBA517
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.FontUnderline = True
End With

3614

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

ForeColor Property
Description
Defines or returns the color of the font for the text in the object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font color will be set to "Red":

Sub ButtonConfiguration()
'VBA518
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.ForeColor = RGB(255, 0, 0)
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3615

VBA for Automated Configuration


5.5 VBA Reference

See also
Button Object (Page 3293)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
CheckBox Object (Page 3297)
BarGraph Object (Page 3286)

ForeColor_Alarm.._Warning property
Description
Defines the color used for the foreground of one of the following states or message types:
Alarm
Warning
Tolerance
AS Process Control Error
AS Control System Fault
Operator request
OK
Simulation
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

ForeFlashColorOff Property
Description
Defines or returns the color of the text for flash status "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

3616

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font color when the flash status is "Off" will be set to "Red":

Sub ButtonConfiguration()
'VBA519
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.ForeFlashColorOff = RGB(255, 0, 0)
End With
End Sub

See also
CheckBox Object (Page 3297)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
Button Object (Page 3293)
BarGraph Object (Page 3286)

ForeFlashColorOn Property
Description
Defines or returns the color of the text for flash status "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3617

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the font color when the flash status is "On" will be set to "White":

Sub ButtonConfiguration()
'VBA520
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.ForeFlashColorOn = RGB(255, 255, 255)
End With
End Sub

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
GroupDisplay Object (Page 3350)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

Format property
Description
Specifies the format in which the value is displayed in the advanced analog display.
No Character

Displays the number without formatting.

(0)

Displays a digit or a zero.

(#)

Displays a digit or no output.

(.)

Placeholder for decimal character.

(%)

Placeholder for percentage.

(,)

Thousand separator.

( ( E- E+ e- e+ )

Scientific format.

-+$()

Display of a literal character.


Display the next character in the format character sequence.

( "ABC" )

3618

Displays the string in inverted commas (" ").

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

G-H
GlobalColorScheme property
Description
Defines whether the colors defined for the current design in the global color scheme will be
used for this object.
yes
No

Uses the colors from the global color scheme defined for this type of object.
Uses the colors from the color scheme defined for this type of object under
"Colors".

Example
--

GlobalShadow property
Description
Defines whether the object will be displayed with the shadowing defined in the active design.
yes
No

Uses the global shadowing defined for this object type.


No shadowing.

Example
--

GNQBackColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Went Out Unacknowledged" which
color the background of the value to be displayed assumes for flashing status "Off"
(GNQBackColorOff) or "On" (GNQBackColorOn).
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3619

VBA for Automated Configuration


5.5 VBA Reference

GNQBackFlash property
Description
Specifies for the selected message type and status "Went Out Unacknowledged" whether the
background of the value to be displayed flashes when a message goes out unacknowledged.

GNQTextColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Went Out Unacknowledged" which
color the text of the value to be displayed assumes for flashing status "Off" (GNQTextColorOff)
or "On" (GNQTextColorOn).
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

GNQTextFlash property
Description
Specifies for the selected message type and status "Went Out Unacknowledged" whether the
text of the value to be displayed flashes when a message goes out unacknowledged.

Grid Property
Description
TRUE if the grid is enabled for the active picture. BOOLEAN write-read access.
The grid is only visible during the configuration phase.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the grid for the active picture will be enabled:

Sub ActiveDocumentConfiguration()
'VBA521
Application.ActiveDocument.Grid = True
End Sub

3620

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
GridWidth Property (Page 3624)
GridHeight Property (Page 3624)
GridColor Property (Page 3623)
ActiveDocument Property (Page 3472)
Application Property (Page 3484)
Document Object (Page 3319)
Application Object (Page 3282)

GridColor Property
Description
Defines or returns the color of the grid during the configuration phase. The Grid property must
be set to TRUE for the grid to be displayed. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the grid color for the active picture will be set to
"Blue":

Sub ActiveDocumentConfiguration()
'VBA522
Application.ActiveDocument.Grid = True
Application.ActiveDocument.GridColor = RGB(0, 0, 255)
End Sub

See also
Grid Property (Page 3620)
ActiveDocument Property (Page 3472)
Application Property (Page 3484)
Document Object (Page 3319)
Application Object (Page 3282)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3621

VBA for Automated Configuration


5.5 VBA Reference

GridHeight Property
Description
Defines or returns the height (in pixels) of the grid in the current picture during the configuration
phase. The Grid property must be set to TRUE for the grid to be displayed.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the grid height for the active picture will be set to
"8":

Sub ActiveDocumentConfiguration()
'VBA523
Application.ActiveDocument.Grid = True
Application.ActiveDocument.GridHeight = 8
End Sub

See also
GridWidth Property (Page 3624)
Grid Property (Page 3620)
ActiveDocument Property (Page 3472)
Application Property (Page 3484)
Document Object (Page 3319)
Application Object (Page 3282)

GridWidth Property
Description
Defines or returns the width (in pixels) of the grid in the current picture during the configuration
phase. The Grid property must be set to TRUE for the grid to be displayed.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the grid width for the active picture will be set to "8":

Sub ActiveDocumentConfiguration()
'VBA524
Application.ActiveDocument.Grid = True

3622

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Application.ActiveDocument.GridWidth = 8
End Sub

See also
Grid Property (Page 3620)
GridHeight Property (Page 3622)
ActiveDocument Property (Page 3472)
Application Property (Page 3484)
Document Object (Page 3319)
Application Object (Page 3282)

GroupParent Property
Description
Returns the higher-ranking object in the specified group object. Read-only access.

Example:
--

See also
Group Object (Page 3348)
ActiveDocument Property (Page 3472)
GroupedObjects Object (Listing) (Page 3353)
Document Object (Page 3319)
Application Object (Page 3282)

GroupedHMIObjects Property
Description
Returns a listing containing all the objects in the current group.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3623

VBA for Automated Configuration


5.5 VBA Reference

Example:
In this example the group object "Group1" is created from a number of objects. An ellipse
segment is then added to the group object:

Sub CreateGroup()
'VBA526
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipseSegment As HMIEllipseSegment
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "Group1"
Set objEllipseSegment = ActiveDocument.HMIObjects.AddHMIObject("EllipseSegment",
"HMIEllipseSegment")
'
'Add one object to the existing group
objGroup.GroupedHMIObjects.Add ("EllipseSegment")
End Sub

See also
Group Object (Page 3348)

Height Property
Description
Defines or returns the height of the object (Document, View, Object) in pixels.
Note concerning the Document and View objects:
The default value corresponds to the vertical screen resolution set by the operating system.
The specified value can be higher than the current screen resolution. The picture can then be
moved with the aid of scroll bars.
The maximum picture height that can be set is 10000 pixels.

3624

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the height of the current picture will be set to "1600":

Sub ActiveDocumentConfiguration()
'VBA527
Application.ActiveDocument.Height = 1600
End Sub

See also
View Object (Page 3466)
HMIObject Object (Page 3357)
Document Object (Page 3319)

Hide Property
Description
TRUE if the specified picture is opened as "Visible". BOOLEAN write-read access.
Use the Hide property in order to test, for example, whether a picture is to be visible or invisible
when opened. Other WinCC editors (such as CrossReference) open pictures so that they are
invisible, i.e. they are not displayed in the Graphics Designer. If you use the DocumentOpened
event, for example, you can use the Hide property to prevent the code in the event from being
executed by testing that the Hide property is FALSE.
Use the Add and Open methods to define whether a picture is to be visible or invisible when
opened.
Note
If you set a picture to "Invisible" (Hide = FALSE), you can then only address it via the
Documents listing. The picture is no longer available in the Graphics Designer.

Example:
In the following example, when a picture opens an output indicates whether the picture was
opened as visible or invisible:

Private Sub Document_Opened(CancelForwarding As Boolean)


'VBA802
MsgBox Me.Hide
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3625

VBA for Automated Configuration


5.5 VBA Reference

See also
Open Method (Page 3242)
Add Method (Documents Listing) (Page 3169)
Document Object (Page 3319)

HiddenInput Property
Description
TRUE, when the input value should not be displayed when being entered. Each character
entered is substituted by a *. BOOLEAN write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the input will be hidden:

Sub IOFieldConfiguration()
'VBA528
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.HiddenInput = True
End With
End Sub

See also
IOField Object (Page 3361)

HMIObjects Property
Description
Returns a listing containing all the objects in the specified picture.
To return an element from the HMIObjects listing you can use either the index number or the
object name.

Example:
Use the "AddHMIObject(ObjectName, ProgID)" method to insert a new object in a picture: :

Sub AddCircle()

3626

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'VBA529
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("my Circle", "HMICircle")
End Sub

See also
Document Object (Page 3319)

HMIUdoObjects property
Description
Supplies a collection of HMIObject objects that represent the inner objects of the
"CustomizedObjects" object.

See also
CustomizedObject Object (Page 3310)

Hotkey Property
Description
Defines or returns the function key for a mouse action in the case of the Button object.
Function key

Assigned Value

F1

112

F2

113

F3

114

F4

115

F5

116

F6

117

F7

118

F8

119

F9

120

F10

121

F11

122

F12

123

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3627

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
it is intended that the button can also be launched with function key "F5":

Sub ButtonConfiguration()
'VBA530
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.Hotkey = 116
End With
End Sub

See also
Button Object (Page 3293)

Hysteresis Property
Description
TRUE if the display must include hysteresis (deadband) in the case of the BarGraph object.
BOOLEAN write-read access.

Example:
The "BarGraphConfiguration()" procedure configures In this example the display shall take
place with hysteresis:

Sub BarGraphConfiguration()
'VBA531
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Hysteresis = True
End With
End Sub

See also
BarGraph Object (Page 3286)

3628

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

HysteresisRange Property
Description
Defines or returns the hysteresis (deadband) as a percentage of the display value.
The Hysteresis property must be set to TRUE for the hysteresis to be calculated.

Example:
The "BarGraphConfiguration()" procedure configures In this example the hysteresis will be set
to "4%":

Sub BarGraphConfiguration()
'VBA532
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Hysteresis = True
.HysteresisRange = 4
End With
End Sub

See also
BarGraph Object (Page 3286)
Hysteresis Property (Page 3628)

I-K
Icon Property
Description
Defines the icon (*.ICO, full path and file name) or returns the path and file name for a button
on a user-defined toolbar.
Path specifications
The following path specification formats are possible:
Absolute: z.B. "C:\Siemens\WinCC\Icons\myIcon.ICO.
Relative: The starting folder for relative path specification is the "GraCS" folder of the current
project.
<global>: Refers to the installation path for WinCC. The path specification "<global>\Icons
\myIcon" is the same as the path specification under "Absolute".
<project>: Refers to the current project directory (see example).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3629

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "CreateToolbar()" procedure creates a user-defined toolbar with two icons:

Sub CreateToolbar()
'VBA533
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Dim strFileWithPath
Set objToolbar = ActiveDocument.CustomToolbars.Add("Tool1_1")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "ti1_1",
"myFirstToolbaritem")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(2, "ti1_2",
"mySecondToolbaritem")
'
'To use this example copy a *.ICO-Graphic
'to the "GraCS"-Folder of the actual project.
'Replace the filename "EZSTART.ICO" in the next commandline
'with the name of the ICO-Graphic you copied
strFileWithPath = Application.ApplicationDataPath & "EZSTART.ICO"
'
'To assign the symbol-icon to the first toolbaritem
objToolbar.ToolbarItems(1).Icon = strFileWithPath
End Sub

See also
ToolbarItems Object (Listing) (Page 3450)
ToolbarItem Object (Page 3448)
How to Add a New Icon to the Toolbar (Page 3031)
How to Create an Application-specific Toolbar (Page 3029)

IndependentWindow property
Description
Defines whether the display of the picture window in Runtime depends on the process picture
in which the picture window was configured.
yes
No

3630

Size and position of the picture window are independent of the process picture
and only defined by the "Window mode" attribute
Size and position of the picture window change with the shift or scaling of the
process picture

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Index Property
Description
Status display
Defines the status (0 bis 255) or returns it. A basic picture and flash picture can be defined for
each status value.
Line Object
Defines the start and end point for a line, and so also defines the direction. Use the
ActualPointLeft and ActualPointTop properties to define the coordinates for each starting and
finishing point.
Polygon object, PolyLine object and TubePolyline object
Defines or returns the number of the corner point whose position coordinates you want to
change or display.
CheckBox and OptionGroup objects
Defines or returns the number (1 to 32) of the field whose text is to be defined.
ComboBox and ListBox object
Defines or returns the number (1 to 32) of the line whose text is to be defined.

Example 1: Line
In the following example a line will be inserted into the active picture and the starting and
finishing points will be defined:

Sub LineAdd()
'VBA682
Dim objLine As HMILine
Dim objEvent As HMIEvent
Set objLine = ActiveDocument.HMIObjects.AddHMIObject("myLine", "HMILine")
With objLine
.BorderColor = RGB(255, 0, 0)
.index = hmiLineIndexTypeStartPoint
.ActualPointLeft = 12
.ActualPointTop = 34
.index = hmiLineIndexTypeEndPoint
.ActualPointLeft = 74
.ActualPointTop = 64
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3631

VBA for Automated Configuration


5.5 VBA Reference

Example 2: Polyline
For this example to work, insert a polyline called "Polyline1" into the active picture: The
"PolyLineCoordsOutput" procedure then outputs the coordinates of all the corner points in the
polyline:

Sub PolyLineCoordsOutput()
'VBA534
Dim iPcIndex As Integer
Dim iPosX As Integer
Dim iPosY As Integer
Dim iIndex As Integer
Dim objPolyLine As HMIPolyLine
Set objPolyLine = Application.ActiveDocument.HMIObjects.AddHMIObject("PolyLine1",
"HMIPolyLine")
'
'Determine number of corners from "PolyLine1":
iPcIndex = objPolyLine.PointCount
'
'Output of x/y-coordinates from every corner:
For iIndex = 1 To iPcIndex
With objPolyLine
.index = iIndex
iPosX = .ActualPointLeft
iPosY = .ActualPointTop
MsgBox iIndex & ". corner:" & vbCrLf & "x-coordinate: " & iPosX & vbCrLf & "y-coordinate:
" & iPosY
End With
Next iIndex
End Sub

Example 3: Check box


The "CreateOptionGroup()" procedure creates the OptionGroup object with four option
buttons. Each option button is assigned the default name "myCustomText<Nummer>":

Sub CreateOptionGroup()
'VBA535
Dim objRadioBox As HMIOptionGroup
Dim iIndex As Integer
Set objRadioBox = ActiveDocument.HMIObjects.AddHMIObject("RadioBox_1", "HMIOptionGroup")
With objRadioBox
.Height = 100
.Width = 180
.BoxCount = 4
For iIndex = 1 To .BoxCount
.index = iIndex
.Text = "myCustomText" & .index
Next iIndex
End With
End Sub

3632

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Line Object (Page 3373)
FlashPicture Property (Page 3601)
BasePicture Property (Page 3507)
ActualPointTop Property (Page 3474)
ActualPointLeft Property (Page 3473)
StatusDisplay Object (Page 3436)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
OptionGroup Object (Page 3393)

InheritState property
Description
Defines whether the "Display" and "Operator Control Enable" properties of the user object can
be inherited by the individual objects of the user object.

InputValue property
Description
Defines the value to be entered by the user in the I/O field. The value is not displayed in the I/
O field when the property is set.
If you want the value to be displayed in the I/O field after confirmation with the <Return> key,
configure a direct connection between the properties "input value" and "output value". The
direct connection is only practical when no tag is connected to the output value, but the user
can nevertheless query the specified value, for example, through a script.

Example:

IsActive Property
Description
Returns TRUE if a copy of the current picture is active. BOOLEAN read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3633

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example a copy of the current picture will be created and an
output will indicate whether the copy is active.

Sub ActiveDocumentConfiguration()
'VBA537
Application.ActiveDocument.Views.Add
'If you comment out the following line
'and recall the procedure, the output of
'the messagebox is different
Application.ActiveDocument.Views(1).Activate
'
'Output state of copy:
MsgBox Application.ActiveDocument.Views(1).IsActive
End Sub

See also
ActiveDocument Property (Page 3472)
View Object (Page 3466)

IsConnectedToProject Property
Description
Returns TRUE if the project connection is available. BOOLEAN read access.

Example:
The "ConnectCheck()" procedure checks whether a project connection exists and outputs the
result:

Sub ConnectCheck()
'VBA538
Dim bCheck As Boolean
Dim strStatus As String
bCheck = Application.IsConnectedToProject
If bCheck = True Then
strStatus = "yes"
Else
strStatus = "no"
End If
MsgBox "Connection to project available: " & strStatus
End Sub

3634

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Application Object (Page 3282)

IsDynamicable Property
Description
TRUE if a property can be made dynamic. BOOLEAN read access.

Example:
The HMIObjectPropertyChanged event always occurs when you change an object property in
the Graphics Designer. In this example the property name and value will be output. A check
will also be made on whether the property can be made dynamic:

Sub Document_HMIObjectPropertyChanged(ByVal Property As IHMIProperty, CancelForwarding As


Boolean)
'VBA539
Dim objProp As HMIProperty
Dim strStatus As String
Set objProp = Property
'
'Checks whether property is dynamicable
If objProp.IsDynamicable = True Then
strStatus = "yes"
Else
strStatus = "no"
End If
MsgBox "Property: " & objProp.Name & vbCrLf & "Value: " & objProp.value & vbCrLf &
"Dynamicable: " & strStatus
End Sub

Further information on the "Events" topic can be found under the heading "Executing VBA
macros in Graphics Designer".

See also
Property Object (Page 3409)
HMIObject Object (Page 3357)
HMIObjectPropertyChanged Event (Page 3149)
Executing VBA Macros in Graphics Designer (Page 3013)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3635

VBA for Automated Configuration


5.5 VBA Reference

IsPublished property
Description
Only used internally.

See also
FaceplateProperty object (Page 3341)
Property Object (Page 3409)

Italic Property
Description
TRUE if the font attribute "Italic" is set for the language-dependent text in the object. BOOLEAN
write-read access.

Example:
The following example sets the font attributes of a button for French and English:

Sub ExampleForLanguageFonts()
'VBA540
Dim objLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "Hello"
Set objLangFonts = objButton.LDFonts
'
'To make fontsettings for french:
With objLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'
'To make fontsettings for english:
With objLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

3636

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Underlined Property (Page 3801)
Size Property (Page 3764)
Parent Property (Page 3710)
LanguageID Property (Page 3645)
Family Property (Page 3587)
Bold Property (Page 3513)
Application Property (Page 3484)
LanguageFont Object (Page 3365)

Item Property
Description
Returns an element from a listing. Depending on the specified object, you can use either the
index number or the name to return a particular element.

Example:
This example shows both kinds of indexing. In order for the example to work, create a group
object ("Group1") with two objects. The example outputs the height of the second object in a
group:

Sub GetHeight()
'VBA541
Dim objGroup As HMIGroup
'Next line uses the property "Item" to get a group by name
Set objGroup = ActiveDocument.HMIObjects.Item("Group1")
'Otherwise next line uses index to identify a groupobject
MsgBox "The height of object 2 is: " & objGroup.GroupedHMIObjects.Item(2).Height
End Sub

See also
VariableTriggers Object (Listing) (Page 3465)
VariableStateValues Object (Listing) (Page 3462)
AnalogResultInfos Object (Listing) (Page 3281)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3637

VBA for Automated Configuration


5.5 VBA Reference

ItemBorderBackColor Property
Description
Defines or returns the background color of the separation lines in the selection list for the
TextList object. LONG write-read access.
The background color is only visible with the property setting ItemBorderStyle > 0.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the background color for the separation lines will be set to "Red":

Sub TextListConfiguration()
'VBA542
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.ItemBorderStyle = 1
.ItemBorderBackColor = RGB(255, 0, 0)
End With
End Sub

See also
ItemBorderStyle Property (Page 3641)
TextList Object (Page 3441)

ItemBorderColor Property
Description
Defines or returns the color of the separation lines in the selection list for the TextList object.
LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

3638

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the color for the separation lines will be set to "White":

Sub TextListConfiguration()
'VBA543
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.ItemBorderStyle = 1
.ItemBorderColor = RGB(255, 255, 255)
End With
End Sub

See also
TextList Object (Page 3441)

ItemBorderStyle Property
Description
Defines or returns the dividing line style in the selection list for the TextList object. Value range
from 0 to 4.
Line style

Assigned Value
0
1
2
3
4

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the dividing line style will be set to "1":

Sub TextListConfiguration()
'VBA544
Dim objTextList As HMITextList

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3639

VBA for Automated Configuration


5.5 VBA Reference

Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")


With objTextList
.ItemBorderStyle = 1
.ItemBorderBackColor = RGB(255, 0, 0)
End With
End Sub

See also
TextList Object (Page 3441)

ItemBorderWidth Property
Description
Defines or returns the weight in pixels of the dividing lines in the selection list for the TextList
object.

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the dividing line width will be set to "4":
'Sub E_628_TextListConfiguration()
Sub E_629_TextListConfiguration()
'VBA545
Dim objTextList As HMITextList
Set objTextList =
ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.ItemBorderWidth = 4
End With
End Sub

See also
TextList Object (Page 3441)

3640

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Key Property
Description
Returns the name that identifies the entry (menu point or icon) in the user-defined menu or
user-defined toolbar. Read only access.
Use the Key property to determine which entry was clicked. For this purpose you can use, say,
the events "MenuItemClicked" and "ToolBarItemClicked".

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"):

Sub CreateMenuItem()
'VBA546
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Adds two menuitems to menu "Delete objects"
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
Rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete Circles")
End Sub

In connection with the "MenuItemClicked" event, you can connect the menu entries with
procedure calls, for instance. In this example the names of the menu entries will be output:

Sub Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)


'VBA547
Dim strClicked As String
Dim objMenuItem As HMIMenuItem
Set objMenuItem = MenuItem
'
'"strClicked can get two values:
'(1) "DeleteAllRectangles" and
'(2) "DeleteAllCircles"
strClicked = objMenuItem.Key
'
'To analyse "strClicked" with "Select Case"
Select Case strClicked
Case "DeleteAllRectangles"
'
'Instead of "MsgBox" a procedurecall (e.g. "Call <Prozedurname>") can stay here
MsgBox "'Delete rectangle' was clicked"
Case "DeleteAllCircles"
MsgBox "'Delete Circles' was clicked"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3641

VBA for Automated Configuration


5.5 VBA Reference

End Select
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)
InsertToolbarItem Method (Page 3231)
InsertMenuItem Method (Page 3227)
ToolbarItemClicked Event (Page 3161)
MenuItemClicked Event (Page 3155)
Creating Customized Menus and Toolbars (Page 3021)

L
Label Property
Description
Returns the label of the user-defined menu or menu entry in the currently set language. Read
only access.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"): In this example the labels will then be output:

Sub CreateMenuItem()
'VBA548
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim iIndex As Integer
iIndex = 1
'
'Add new menu "Delete objects" to menubar
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Adds two menuitems to menu "Delete objects"
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete circles")
MsgBox ActiveDocument.CustomMenus(1).Label
For iIndex = 1 To objMenu.MenuItems.Count
MsgBox objMenu.MenuItems(iIndex).Label

3642

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Next iIndex
End Sub

See also
CustomMenus Property (Page 3566)
MenuItems Object (Listing) (Page 3384)
MenuItem Object (Page 3382)
Menu Object (Page 3378)

LanguageID Property
Description
Returns the language identifier of the project language as a decimal value. LONG read access

Example:
The "DataLanguages()" procedure outputs the project languages together with their language
identifiers:

Sub DataLanguages()
'VBA549
Dim colDataLang As HMIDataLanguages
Dim objDataLang As HMIDataLanguage
Dim nLangID As Long
Dim strLangName As String
Dim iAnswer As Integer
Set colDataLang = Application.AvailableDataLanguages
For Each objDataLang In colDataLang
nLangID = objDataLang.LanguageID
strLangName = objDataLang.LanguageName
iAnswer = MsgBox(nLangID & " " & strLangName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objDataLang
End Sub

See also
DataLanguages Object (Listing) (Page 3314)
DataLanguage Object (Page 3313)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3643

VBA for Automated Configuration


5.5 VBA Reference

LanguageName Property
Description
Returns the project language. STRING read access.

Example:
The "DataLanguages()" procedure outputs the project languages together with their language
identifiers:

Sub DataLanguages()
'VBA550
Dim colDataLang As HMIDataLanguages
Dim objDataLang As HMIDataLanguage
Dim nLangID As Long
Dim strLangName As String
Dim iAnswer As Integer
Set colDataLang = Application.AvailableDataLanguages
For Each objDataLang In colDataLang
nLangID = objDataLang.LanguageID
strLangName = objDataLang.LanguageName
iAnswer = MsgBox(nLangID & " " & strLangName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objDataLang
End Sub

See also
DataLanguages Object (Listing) (Page 3314)
DataLanguage Object (Page 3313)

LanguageSwitch Property
Description
Defines where the language-dependent assignment texts are stored or returns the value.
BOOLEAN write-read access.
TRUE, when the texts in the Text Library are managed. Translation to other language occurs
in the Text Library.
FALSE, when the texts are managed directly in the object. Translation to other language can
be carried out using Text Distributor.

3644

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the texts will be managed in the Text Library:

Sub TextListConfiguration()
'VBA551
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.LanguageSwitch = True
End With
End Sub

See also
TextList Object (Page 3441)

LastChange Property
Description
Returns the date on which the current picture was last changed. READ access.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the date of the last change to the current picture will
be output:

Sub ActiveDocumentConfiguration()
'VBA552
Dim varLastDocChange As Variant
varLastDocChange = Application.ActiveDocument.LastChange
MsgBox "Last changing: " & varLastDocChange
End Sub

See also
Document Object (Page 3319)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3645

VBA for Automated Configuration


5.5 VBA Reference

Layer Property
Description
Defines which layer of the picture an object is located in, or returns that information. There is
a total of 32 layers available, whereby Layer "0" is the bottom layer and Layer "31" the top
layer.
The configured objects are initially in the background of a layer.
Note
In VBA the numbering starts at "1". An entry of "objRectangle.Layer = 1" is therefore located
in the lowest layer.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the Rectangle object will be inserted in layer "4":

Sub RectangleConfiguration()
'VBA553
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.Layer = 4
End With
End Sub

See also
HMIObject Object (Page 3357)
Editing Layers with VBA (Page 3050)

Layer00..10Checked property
Description
TRUE if the respective limit "0" to "10" is monitored in the case of the "3DBarGraph" object.
BOOLEAN write-read access.
The limit and the color representation are specified with the properties "Layer00..10Value" and
"Layer00..10Color".
The bar fill color and the fill pattern are specified with the properties "Layer00..10FillColor" and
"Layer00..10FillStyle".

3646

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example, limit "0" is to be monitored:

Sub HMI3DBarGraphConfiguration()
'VBA554
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer00Checked = True
End With
End Sub

See also
Layer00..10Value property (Page 3650)
Layer00..10Color property (Page 3649)
3DBarGraph Object (Page 3267)

Layer00..10Color property
Description
Defines or returns the color for the respective limit "0" to "10" of the "3DBarGraph" object.
LONG write-read access.
When monitoring of the limit value is activated using the "Layer00..10Checked" property, the
bar turns to the color defined by this attribute on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

Example
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the color for limit "0" is defined as "Magenta":

Sub HMI3DBarGraphConfiguration()
'VBA555
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3647

VBA for Automated Configuration


5.5 VBA Reference

.Layer00Checked = True
.Layer00Color = RGB(255, 0, 255)
End With
End Sub

See also
Layer00..10Checked property (Page 3646)
3DBarGraph Object (Page 3267)

Layer00..10FillColor property
Description
Defines or returns the bar fill color for the respective limit "0" to "10" of the "3DBarGraph" object.
LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

Layer00..10FillStyle property
Description
Defines or returns the bar fill pattern for the respective limit "0" to "10" of the "3DBarGraph"
object.
The bar fill color has to differ from the bar color to make the fill pattern visible.
There is a choice of 50 fill patterns. The "0" fill pattern fills the object with the set background
color. The "1" fill pattern means neither a background nor a fill pattern is displayed.

Layer00..10Value property
Description
Defines or returns the value for "Limit 0" to "Limit 10" in the case of the "3DBarGraph" object.
Monitoring only takes effect when the "Layer00..10Checked" property value is set to "TRUE".

3648

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the value for limit "0" is defined as "0":

Sub HMI3DBarGraphConfiguration()
'VBA556
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer00Checked = True
.Layer00Value = 0
End With
End Sub

See also
Layer00..10Checked property (Page 3646)
3DBarGraph Object (Page 3267)

LayerDecluttering Property
Description
TRUE if showing and hiding objects dependent upon the minimum and maximum zoom set
for a layer has been enabled. BOOLEAN write-read access.

Example:
In the following example the settings for the lowest layer are configured in the active picture:

Sub ConfigureSettingsOfLayer()
'VBA587
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
'define fade-in and fade-out of objects:
With ActiveDocument
.LayerDecluttering = True
.ObjectSizeDecluttering = True
.SetDeclutterObjectSize 50, 100
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3649

VBA for Automated Configuration


5.5 VBA Reference

See also
Document Object (Page 3319)
Editing Layers with VBA (Page 3050)

Layers Property
Description
Returns a listing containing the properties of the layers in the current picture.
Note
If the "Layers" property is used, the sequence of HMI objects in the HMIObjects listing can
change.

Example:
The "LayerInfo()" procedure outputs the name and zoom configuration for each layer of the
current picture:

Sub LayerInfo()
'VBA588
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim iAnswer As Integer
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
With objLayer
iAnswer = MsgBox("Layername: " & .Name & vbCrLf & "max. zoom:
zoom: " & .MinZoom, vbOKCancel)
End With
If vbCancel = iAnswer Then Exit For
Next objLayer
End Sub

" & .MaxZoom & vbCrLf & "min.

See also
Name Property (Page 3696)
MinZoom Property (Page 3694)
MaxZoom Property (Page 3676)
Layers Object (Listing) (Page 3371)
Layer Object (Page 3370)

3650

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

LDAssignments property
Description
Returns a listing with the (foreign language) assignments of display texts that are displayed
depending on the current "Output Value" in the "TextList" object.
The assignments depend on the set list type. Specify the list type with the "ListType" property.

LDFonts Property
Description
Returns a listing containing the language identifiers for the configured fonts.

Example:
Use the LDFonts property to return the LanguageFonts listing. In the following example the
language identifiers of the configured fonts will be output:

Sub ShowLanguageFont()
'VBA589
Dim colLanguageFonts As HMILanguageFonts
Dim objLanguageFont As HMILanguageFont
Dim objButton As HMIButton
Dim iMax As Integer
Dim iAnswer As Integer
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
Set colLanguageFonts = objButton.LDFonts
iMax = colLanguageFonts.Count
For Each objLanguageFont In colLanguageFonts
iAnswer = MsgBox("Projected fonts: " & iMax & vbCrLf & "Language-ID: " &
objLanguageFont.LanguageID, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objLanguageFont
End Sub

See also
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
LanguageFonts Object (Listing) (Page 3366)
CheckBox Object (Page 3297)
Button Object (Page 3293)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3651

VBA for Automated Configuration


5.5 VBA Reference

LDFontsType property
Description
Only used internally.

See also
FaceplateProperty object (Page 3341)

LDLabelTexts Property
Description
Returns a listing containing the multilingual labels of the user-defined menu or menu entry.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"): In this example, multilingual menu labels
will be created:

Sub CreateMenuItem()
'VBA590
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objLangText As HMILanguageText
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete circles")
'
'Define foreign-language labels for menu "Delete objects":
Set objLangText = objMenu.LDLabelTexts.Add(1033, "English_Delete objects")
Set objLangText = objMenu.LDLabelTexts.Add(1032, "Greek_Delete objects")
Set objLangText = objMenu.LDLabelTexts.Add(1034, "Spanish_Delete objects")
Set objLangText = objMenu.LDLabelTexts.Add(1036, "French_Delete objects")
End Sub

The "LDLabelInfo()" procedure outputs the labels configured for the "Delete Objects" menu:

Sub LDLabelInfo()
'VBA591
Dim colLangTexts As HMILanguageTexts

3652

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objLangText As HMILanguageText


Dim iAnswer As Integer
'
'Save all labels of menu into collection "colLangTexts":
Set colLangTexts = ActiveDocument.CustomMenus("DeleteObjects").LDLabelTexts
For Each objLangText In colLangTexts
iAnswer = MsgBox(objLangText.DisplayName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objLangText
End Sub

See also
MenuItem Object (Page 3382)
Menu Object (Page 3378)

LDNames Property
Description
Returns a listing containing the multilingual names of a folder in the Components Library or of
a layer.

Example:
Use the LDNames property to return the LanguageTexts listing. In the following example all
multilingual layer names will be output:
Explanation: What the example shows

Sub LDLabelInfo()
'VBA592
Dim colLayerLngTexts As HMILanguageTexts
Dim objLayerLngText As HMILanguageText
Dim iIndex As Integer
Dim iAnswer As Integer
Dim strResult As String
iIndex = 1
For iIndex = 1 To ActiveDocument.Layers.Count
'
'Save all labels of layers into collection of "colLayerLngTexts":
Set colLayerLngTexts = ActiveDocument.Layers(iIndex).LDNames
For Each objLayerLngText In colLayerLngTexts
strResult = strResult & vbCrLf & objLayerLngText.LanguageID & " - " &
objLayerLngText.DisplayName
Next objLayerLngText
iAnswer = MsgBox(strResult, vbOKCancel)
strResult = ""
If vbCancel = iAnswer Then Exit For

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3653

VBA for Automated Configuration


5.5 VBA Reference

Next iIndex
End Sub

See also
Layer Object (Page 3370)
LanguageTexts Object (Listing) (Page 3369)
FolderItem Object (Page 3342)

LDStatusTexts Property
Description
Returns a listing containing the multilingual status line texts of a user-defined icon or menu
entry.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"). In this example, multilingual status line texts
will be created:

Sub CreateMenuItem()
'VBA593
Dim objMenu As HMIMenu
Dim objMenuItem1 As HMIMenuItem
Dim objMenuItem2 As HMIMenuItem
Dim objLangStateText As HMILanguageText
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem1 = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem2 = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete
circles")
'
'Define foreign-language labels for menuitem "Delete rectangles":
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1033, "English_Delete rectangles")
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1032, "Greek_Delete rectangles")
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1034, "Spanish_Delete rectangles")
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1036, "French_Delete rectangles")
End Sub

The "LDStatusTextInfo()" procedure outputs the status line texts configured for the "Delete
Objects" menu:

3654

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Sub LDStatusTextInfo()
'VBA594
Dim colMenuItems As HMIMenuItems
Dim objMenuItem As HMIMenuItem
Dim colStatusLngTexts As HMILanguageTexts
Dim objStatusLngText As HMILanguageText
Dim strResult As String
Dim iAnswer As Integer
Set colMenuItems = ActiveDocument.CustomMenus("DeleteObjects").MenuItems
For Each objMenuItem In colMenuItems
strResult = "Statustexts of menuitem """ & objMenuItem.Label & """"
Set colStatusLngTexts = objMenuItem.LDStatusTexts
For Each objStatusLngText In colStatusLngTexts
strResult = strResult & vbCrLf & objStatusLngText.DisplayName
Next objStatusLngText
iAnswer = MsgBox(strResult, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objMenuItem
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)
Menu Object (Page 3378)

LDTexts Property
Description
Returns a listing containing the multilingual labels of an object.

Example:
The "LDTextInfo()" procedure outputs the labels configured for the Button object. For this
example to work, create the object "myButton" in the Graphics Designer and configure a
number of multilingual labels:

Sub LDTextInfo()
'VBA595
Dim colLDLngTexts As HMILanguageTexts
Dim objLDLngText As HMILanguageText
Dim objButton As HMIButton
Dim iAnswer As Integer
Set objButton = ActiveDocument.HMIObjects("myButton")
Set colLDLngTexts = objButton.LDTexts
For Each objLDLngText In colLDLngTexts

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3655

VBA for Automated Configuration


5.5 VBA Reference

iAnswer = MsgBox(objLDLngText.DisplayName, vbOKCancel)


If vbCancel = iAnswer Then Exit For
Next objLDLngText
End Sub

See also
Button Object (Page 3293)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)

LDTooltipTexts Property
Description
Returns a listing containing the multilingual Tooltip texts for a user-defined icon or for an object.

Example
The "CreateToolbar()" procedure creates a user-defined toolbar with two icons. Two
multilingual Tooltip texts are assigned to the first icon:

Sub CreateToolbar()
'VBA596
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Dim objLangText As HMILanguageText
Dim strFileWithPath
'
'Create toolbar with two toolbar-items:
Set objToolbar = ActiveDocument.CustomToolbars.Add("Tool1_1")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "ti1_1",
"myFirstToolbaritem")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(2, "ti1_2",
"mySecondToolbaritem")
'
'In order that the example runs correct copy a *.ICO-Graphic
'into the "GraCS"-Folder of the actual project.
'Replace the filename "EZSTART.ICO" in the next commandline
'with the name of the ICO-Graphic you copied
strFileWithPath = Application.ApplicationDataPath & "EZSTART.ICO"
'
'
'To assign the symbol-icon to the first toolbaritem
objToolbar.ToolbarItems(1).Icon = strFileWithPath
'
'Define foreign-language tooltiptexts

3656

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objLangText = objToolbar.ToolbarItems(1).LDTooltipTexts.Add(1036, "French_Tooltiptext")


Set objLangText = objToolbar.ToolbarItems(1).LDTooltipTexts.Add(1034,
"Spanish_Tooltiptext")
End Sub

The "LDTooltipInfo()" procedure outputs all the Tooltip texts configured for the first icon in the
first user-defined toolbar:

Sub LDTooltipInfo()
'VBA597
Dim colLangTexts As HMILanguageTexts
Dim objLangText As HMILanguageText
Dim iAnswer As Integer
Set colLangTexts = ActiveDocument.CustomToolbars(1).ToolbarItems(1).LDTooltipTexts
For Each objLangText In colLangTexts
iAnswer = MsgBox(objLangText.DisplayName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objLangText
End Sub

See also
ToolbarItem Object (Page 3448)
HMIObject Object (Page 3357)

Left Property
Description
Defines or returns the X coordinate of the object (measured from the top left-hand edge of the
picture) in pixels. The X-coordinate relates to the top left corner of the rectangle enclosing the
object.
View Object
Defines or returns the X coordinate of the window (measured from the top left-hand edge of
the Graphics Designer working area) in pixels.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the rectangle will be moved 40 pixels to the right:

Sub RectangleConfiguration()
'VBA598
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3657

VBA for Automated Configuration


5.5 VBA Reference

With objRectangle
.Left = 40
End With
End Sub

See also
View Object (Page 3466)
HMIObject Object (Page 3357)

LeftComma Property
Description
Defines or returns the number of digits to the left of the decimal point (0 to 20) for the BarGraph
object.

Example:
The "BarGraphConfiguration()" procedure configures In this example the number of digits to
the left of the decimal point will be set to "4".

Sub BarGraphConfiguration()
'VBA599
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.LeftComma = 4
End With
End Sub

See also
BarGraph Object (Page 3286)

LightEffect Property
Description
TRUE if the light effect of the 3DBarGraph object is activated. BOOLEAN write-read access.

3658

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the light effect will be activated:

Sub HMI3DBarGraphConfiguration()
'VBA600
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.LightEffect = True
End With
End Sub

See also
3DBarGraph Object (Page 3267)

LimitHigh4 Property
Description
Defines or returns the high limit value for "Reserve 4" in the case of the BarGraph object.
The CheckLimitHigh4 property must be set to TRUE in order that the "Reserve 4" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitHigh4 property.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "70".

Sub BarGraphLimitConfiguration()
'VBA601
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh4 = False
'Activate monitoring
.CheckLimitHigh4 = True
'Set barcolor to "red"
.ColorLimitHigh4 = RGB(255, 0, 0)
'Set upper limit to "70"
.LimitHigh4 = 70
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3659

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
TypeLimitHigh4 Property (Page 3794)
CheckLimitHigh4 Property (Page 3534)
BarGraph Object (Page 3286)

LimitHigh5 Property
Description
Defines or returns the high limit value for "Reserve 5" in the case of the BarGraph object.
The CheckLimitHigh5 property must be set to TRUE in order that the "Reserve 5" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitHigh5 property.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "80".

Sub BarGraphLimitConfiguration()
'VBA602
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh5 = False
'Activate monitoring
.CheckLimitHigh5 = True
'Set barcolor to "black"
.ColorLimitHigh5 = RGB(0, 0, 0)
'Set upper limit to "80"
.LimitHigh4 = 80
End With
End Sub

See also
TypeLimitHigh5 Property (Page 3795)
CheckLimitHigh5 Property (Page 3534)
BarGraph Object (Page 3286)

3660

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

LimitLow4 Property
Description
Defines or returns the low limit value for "Reserve 4" in the case of the BarGraph object.
The CheckLimitLow4 property must be set to TRUE in order that the "Reserve 4" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow4 property.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "5".

Sub BarGraphLimitConfiguration()
'VBA603
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow4 = False
'Activate monitoring
.CheckLimitLow4 = True
'Set barcolor to "green"
.ColorLimitLow4 = RGB(0, 255, 0)
'Set lower limit to "5"
.LimitLow4 = 5
End With
End Sub

See also
CheckLimitLow4 Property (Page 3535)
TypeLimitLow4 Property (Page 3796)
BarGraph Object (Page 3286)

LimitLow5 Property
Description
Defines or returns the low limit value for "Reserve 5" in the case of the BarGraph object.
The CheckLimitLow5 property must be set to TRUE in order that the "Reserve 5" limit value
can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow5 property.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3661

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "0".

Sub BarGraphLimitConfiguration()
'VBA604
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow5 = False
'Activate monitoring
.CheckLimitLow5 = True
'Set barcolor to "white"
.ColorLimitLow5 = RGB(255, 255, 255)
'Set lower limit to "0"
.LimitLow5 = 0
End With
End Sub

See also
BarGraph Object (Page 3286)
TypeLimitLow5 Property (Page 3797)
CheckLimitLow5 Property (Page 3536)

LimitMax Property
Description
Defines or returns the high limit value as an absolute value dependent on the data format in
the case of the IOField object.
If the value to be displayed exceeds the upper limit value, it is identified by a series of *** ,
indicating it cannot be displayed.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the high limit for a decimal value will be set to "100":

Sub IOFieldConfiguration()
'VBA605
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField

3662

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.DataFormat = 1
.LimitMax = 100
End With
End Sub

See also
DataFormat Property (Page 3569)
IOField Object (Page 3361)

LimitMin Property
Description
Defines or returns the low limit value as an absolute value dependent on the data format in
the case of the IOField object.
If the value to be displayed exceeds the upper limit value, it is identified by a series of *** ,
indicating it cannot be displayed.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the high limit for a decimal value will be set to "0":

Sub IOFieldConfiguration()
'VBA606
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.DataFormat = 1
.LimitMin = 0
End With
End Sub

See also
DataFormat Property (Page 3569)
IOField Object (Page 3361)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3663

VBA for Automated Configuration


5.5 VBA Reference

LineJoinStyle property
Description
Defines the way that corners are displayed in a tube polygon.
Angle
Round

The tubes are joined at corner points without rounding.


The tubes are rounded at the outside corner points.

Example

ListType Property
Description
Defines or returns the list type in the case of the TextList object. Value range from 0 to 2.
List type

Assigned Value

Decimal

Binary

Bit

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the list type will be set to "Decimal":

Sub TextListConfiguration()
'VBA607
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.ListType = 0
End With
End Sub

See also
TextList Object (Page 3441)

3664

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

LockBackColor Property
Description
Defines or returns the background color of the button for a locked measuring point in the case
of the GroupDisplay object. LONG write-read access.
The LockStatus property must be set to TRUE for the background color to be displayed.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color for a locked measuring point will be set to "Red":

Sub GroupDisplayConfiguration()
'VBA608
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.LockStatus = True
.LockBackColor = RGB(255, 0, 0)
End With
End Sub

See also
LockStatus Property (Page 3669)
GroupDisplay Object (Page 3350)

LockedByCreatorID Property
Description
TRUE, if a picture was created and/or referenced by SIMATIC Manager. BOOLEAN read
access.
If a picture was created in SIMATIC Manager, you may process and subsequently save it in
WinCC. You may, however, not delete this picture in WinCC. SIMATIC Manager administers
a code for each picture, the so-called CreatorID, which cannot be changed in WinCC.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3665

VBA for Automated Configuration


5.5 VBA Reference
You may process the picture in WinCC, however, overwriting the picture with a WinCC picture
(LockedByCreatorID = FALSE) will be prevented. This may be checked by examining the
LockedByCreatorID property of an existing file prior to writing during the SaveAs method. If
such a picture is saved into a new (not yet existing) or an existing WinCC picture using the
SaveAs method, the CreatorID will not be passed on.

Example 1
Inn the following example, a picture created with SIMATIC Manager (LockedByCreatorID =
TRUE) is opened, processed, and saved. The value of the LockedByCreatorID property is not
changed.

Sub SaveDocAs_1()
'VBA810
'open an existing file, change it and save it
Dim docOld As Document
Const strFile As String = "Simatic_001.Pdl"
'
Set docOld = Application.Documents.Open(Application.ApplicationDataPath & strFile,
hmiOpenDocumentTypeInvisible)
docOld.Width = docOld.Width + 1
docOld.Save
'
MsgBox "LockedByCreatorID = " & docOld.LOckedByCreatorID, vbOKOnly, "Result"
'
docOld.Close
Set docOld = Nothing
'
End Sub

Example 2
In this example, a new picture is saved as a new file using the SaveAs method. To check if
the picture is permitted to be saved, the LockedByCreatorID property is checked. In the new
file the LockedByCreator property is reset.

Sub SaveDocAs_2()
'VBA811
'create a new file and overwrite it to an existing file,
'if it is not 'locked by CreatorID'
Dim docNew As Document
Dim docOld As Document
Const strFile As String = "Simatic_001.Pdl"
'
Set docNew = Application.Documents.Add(hmiOpenDocumentTypeInvisible)
Set docOld = Application.Documents.Open(Application.ApplicationDataPath & strFile,
hmiOpenDocumentTypeInvisible)
'
If docOld.LockedByCreatorID = False Then
docOld.Close

3666

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

docNew.SaveAs(Application.ApplicationDataPath & strFile)


Else
MsgBox "File cannot be stored (LockedByCreatorID). ", vbOKOnly, "Result"
End If
'
docOld.Close
docNew.Close
Set docOld = Nothing
Set docNew = Nothing
'
End Sub

See also
SaveAs Method (Page 3254)
Document Object (Page 3319)

LockStatus Property
Description
TRUE if a locked measuring point is to be displayed with the Object GroupDisplay. BOOLEAN
write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color for a locked measuring point will be set to "Red":

Sub GroupDisplayConfiguration()
'VBA609
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.LockStatus = True
.LockBackColor = RGB(255, 0, 0)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3667

VBA for Automated Configuration


5.5 VBA Reference

LockText Property
Description
Defines the button labels for a locked measuring point in the case of the GroupDisplay object.
The LockStatus property must be set to TRUE for the label to be displayed.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the label for a locked measuring point will be set to "Locked":

Sub GroupDisplayConfiguration()
'VBA610
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.LockStatus = True
.LockText = "gesperrt"
End With
End Sub

See also
LockStatus Property (Page 3667)
GroupDisplay Object (Page 3350)

LockTextColor Property
Description
Defines or returns the color of the button label for a locked measuring point in the case of the
GroupDisplay object. LONG write-read access.
The LockStatus property must be set to TRUE for the background color to be displayed.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

3668

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the button label for a locked measuring point will be set to "Yellow":

Sub GroupDisplayConfiguration()
'VBA611
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.LockStatus = True
.LockTextColor = RGB(0, 255, 255)
End With
End Sub

See also
LockStatus Property (Page 3667)
GroupDisplay Object (Page 3350)

LongStrokesBold Property
Description
TRUE if the long strokes on the scale of the BarGraph object are to be displayed in bold.
BOOLEAN write-read access.

Example:
The "BarGraphConfiguration()" procedure configures In this example the long strokes will not
be displayed in bold:

Sub BarGraphConfiguration()
'VBA612
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.LongStrokesBold = False
End With
End Sub

See also
BarGraph Object (Page 3286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3669

VBA for Automated Configuration


5.5 VBA Reference

LongStrokesOnly Property
Description
TRUE if just the long strokes on the scale of the BarGraph object are to be displayed.
BOOLEAN write-read access.

Example:
The "BarGraphConfiguration()" procedure configures In this example, only the long strokes
will be displayed:

Sub BarGraphConfiguration()
'VBA613
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.LongStrokesOnly = True
End With
End Sub

See also
BarGraph Object (Page 3286)

LongStrokesSize Property
Description
The "BarGraphConfiguration()" procedure configures

Example:
In this example the length of the axis section strokes will be set to "10".

Sub BarGraphConfiguration()
'VBA614
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.LongStrokesSize = 10
End With
End Sub

3670

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
AxisSection Property (Page 3492)
BarGraph Object (Page 3286)

LongStrokesTextEach Property
Description
Defines or returns which strokes will be labeled when displaying the scale on the BarGraph
object (1 = every stroke, 2 = every second stroke, etc.).

Example:
The "BarGraphConfiguration()" procedure configures In this example every third stroke will be
labeled:

Sub BarGraphConfiguration()
'VBA615
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
LongStrokesTextEach = 3
End With
End Sub

See also
BarGraph Object (Page 3286)

M
Macro Property
Description
For a user-defined menu entry or icon, defines the VBA macro that will be executed upon
selection.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3671

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example, a user-defined menu with two menu entries is created, which retrieve
two different VBA macros:

Sub CreateDocumentMenusUsingMacroProperty()
'VBA616
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "My first menuitem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "My second menuitem")
'
'To assign a macro to every menuitem:
With ActiveDocument.CustomMenus("DocMenu1")
.MenuItems("dmItem1_1").Macro = "TestMacro1"
.MenuItems("dmItem1_2").Macro = "TestMacro2"
End With
End Sub

You can call the following two procedures via the menu items in the user-defined menu
"DocMenu1":

Sub TestMacro1()
MsgBox "TestMacro1 is executed"
End Sub

Sub TestMacro2()
MsgBox "TestMacro2 is executed"
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)
How to assign VBA macros to menus and toolbars (Page 3036)

Marker Property
Description
TRUE if the limit values are to be displayed as a scale value in the case of the BarGraph object.
BOOLEAN write-read access.

3672

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphConfiguration()" procedure configures In this example, the limit values will be
displayed as scale values:

Sub BarGraphConfiguration()
'VBA617
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Marker = True
End With
End Sub

See also
BarGraph Object (Page 3286)

Max Property
Description
Defines or returns the absolute value in the case of a full value display.
This value is displayed if the scale display is active.

Example:
The "BarGraphConfiguration()" procedure configures In this example the absolute value will
be set to "10".

Sub BarGraphConfiguration()
'VBA618
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Max = 10
End With
End Sub

See also
Slider object (Page 3428)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3673

VBA for Automated Configuration


5.5 VBA Reference

MaxIndex property
Description
Shows the highest index of all configurable alarm and status combinations at the
"HMIAdvancedStateDisplay" object.

MaximizeButton Property
Description
TRUE if the ApplicationWindow object can be maximized in Runtime. BOOLEAN write-read
access.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will receive a Maximize button in Runtime:

Sub ApplicationWindowConfig()
'VBA619
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow1",
"HMIApplicationWindow")
With objAppWindow
.MaximizeButton = True
End With
End Sub

See also
ApplicationWindow Object (Page 3284)

MaxZoom Property
Description
Defines or returns the maximum zoom level for the layer.

3674

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "LayerInfo()" procedure outputs the name and zoom configuration for each layer of the
current picture:

Sub LayerInfo()
'VBA620
Dim colLayers As HMILayers
Dim objSingleLayer As HMILayer
Dim iAnswer As Integer
Set colLayers = ActiveDocument.Layers
For Each objSingleLayer In colLayers
With objSingleLayer
iAnswer = MsgBox("Layername: " & .Name & vbCrLf & "Min. zoom:
zoom: " & .MaxZoom, vbOKCancel)
End With
If vbCancel = iAnswer Then Exit For
Next objSingleLayer
End Sub

" & .MinZoom & vbCrLf & "Max.

See also
Layer Object (Page 3370)
Editing Layers with VBA (Page 3050)

MCGUBackColorOff-Eigenschaft
Description
In the case of the GroupDisplay object, defines or returns the background color for the "Went
Out Unacknowledged" status when the flash status is "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color when the flash status is "Off" will be set to "Red":

Sub GroupDisplayConfiguration()
'VBA621
Dim objGroupDisplay As HMIGroupDisplay

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3675

VBA for Automated Configuration


5.5 VBA Reference

Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",


"HMIGroupDisplay")
With objGroupDisplay
.MCGUBackColorOff = RGB(255, 0, 0)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCGUBackColorOn Property
Description
In the case of the GroupDisplay object, defines or returns the background color for the "Went
Out Unacknowledged" status when the flash status is "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color when the flash status is "On" will be set to "White":

Sub GroupDisplayConfiguration()
'VBA622
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCGUBackColorOn = RGB(255, 255, 255)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

3676

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

MCGUBackFlash Property
Description
TRUE if the background to the GroupDisplay object is to flash when a message goes out
unacknowledged. BOOLEAN write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color is to flash when a message goes out unacknowledged:

Sub GroupDisplayConfiguration()
'VBA623
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCGUBackFlash = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCGUTextColorOff Property
Description
In the case of the GroupDisplay object, defines or returns the text color for the "Went Out
Unacknowledged" status when the flash status is "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3677

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color to the text when the flash status is "Off" will be set to
"Blue":

Sub GroupDisplayConfiguration()
'VBA624
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCGUTextColorOff = RGB(0, 0, 255)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCGUTextColorOn Property
Description
In the case of the GroupDisplay object, defines or returns the background color to the text for
the "Went Out Unacknowledged" status when the flash status is "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color to the text when the flash status is "On" will be set to
"Black":

Sub GroupDisplayConfiguration()
'VBA625
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCGUTextColorOn = RGB(0, 0, 0)
End With

3678

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
GroupDisplay Object (Page 3350)

MCGUTextFlash Property
Description
TRUE if the font for the GroupDisplay object is to flash when a message goes out
unacknowledged. BOOLEAN write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the font is to flash when a message goes out unacknowledged:

Sub GroupDisplayConfiguration()
'VBA626
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCGUTextFlash = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKOBackColorOff Property
Description
In the case of the GroupDisplay object, defines or returns the background color for the "Came
In" status when the flash status is "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3679

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color when the flash status is "Off" will be set to "Red":

Sub GroupDisplayConfiguration()
'VBA627
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKOBackColorOff = RGB(255, 0, 0)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKOBackColorOn Property
Description
In the case of the GroupDisplay object, defines or returns the background color for the "Came
In" status when the flash status is "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color when the flash status is "On" will be set to "White":

Sub GroupDisplayConfiguration()
'VBA628
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKOBackColorOn = RGB(255, 255, 255)
End With
End Sub

3680

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
GroupDisplay Object (Page 3350)

MCKOBackFlash Property
Description
TRUE if the background to the GroupDisplay object is to flash when a message goes out
unacknowledged. BOOLEAN write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color is to flash when a message goes out unacknowledged:

Sub GroupDisplayConfiguration()
'VBA629
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKOBackFlash = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKOTextColorOff Property
Description
In the case of the GroupDisplay object, defines or returns the text color for the "Came In" status
when the flash status is "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3681

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color to the text when the flash status is "Off" will be set to
"Blue":

Sub GroupDisplayConfiguration()
'VBA630
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKOTextColorOff = RGB(0, 0, 255)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKOTextColorOn Property
Description
In the case of the GroupDisplay object, defines or returns the background color to the text for
the "Came In" status when the flash status is "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color to the text when the flash status is "On" will be set to
"Black":

Sub GroupDisplayConfiguration()
'VBA631
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKOTextColorOn = RGB(0, 0, 0)
End With

3682

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
GroupDisplay Object (Page 3350)

MCKOTextFlash Property
Description
TRUE if the font for the GroupDisplay object is to flash when a message goes out
unacknowledged. BOOLEAN write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the font is to flash when a message goes out unacknowledged:

Sub GroupDisplayConfiguration()
'VBA632
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKOTextFlash = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKQBackColorOff Property
Description
In the case of the GroupDisplay object, defines or returns the background color for the "Went
Out Acknowledged" status when the flash status is "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3683

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color when the flash status is "Off" will be set to "Red":

Sub GroupDisplayConfiguration()
'VBA633
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKQBackColorOff = RGB(255, 0, 0)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKQBackColorOn Property
Description
In the case of the GroupDisplay object, defines or returns the background color for the "Went
Out Acknowledged" status when the flash status is "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color when the flash status is "On" will be set to "White":

Sub GroupDisplayConfiguration()
'VBA634
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKQBackColorOn = RGB(255, 255, 255)
End With
End Sub

3684

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
GroupDisplay Object (Page 3350)

MCKQBackFlash Property
Description
TRUE if the background to the GroupDisplay object is to flash when a message goes out
acknowledged. BOOLEAN write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color is to flash when a message goes out unacknowledged:

Sub GroupDisplayConfiguration()
'VBA635
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKQBackFlash = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKQTextColorOff Property
Description
In the case of the GroupDisplay object, defines or returns the text color for the "Went Out
Acknowledged" status when the flash status is "Off". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3685

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color to the text when the flash status is "Off" will be set to
"Blue":

Sub GroupDisplayConfiguration()
'VBA636
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKQTextColorOff = RGB(0, 0, 255)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCKQTextColorOn Property
Description
In the case of the GroupDisplay object, defines or returns the background color to the text for
the "Went Out Acknowledged" status when the flash status is "On". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color to the text when the flash status is "On" will be set to
"Black":

Sub GroupDisplayConfiguration()
'VBA637
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKQTextColorOn = RGB(0, 0, 0)
End With

3686

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
GroupDisplay Object (Page 3350)

MCKQTextFlash Property
Description
TRUE if the font for the GroupDisplay object is to flash when a message goes out
acknowledged. BOOLEAN write-read access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the font is to flash when a message goes out unacknowledged:

Sub GroupDisplayConfiguration()
'VBA638
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MCKQTextFlash = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

MCText Property
Description
Defines or returns the label for the appropriate message class in the case of the GroupDisplay
object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3687

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the label for the "Alarm High" message class will be set to "Alarm High":

Sub GroupDisplayConfiguration()
'VBA639
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MessageClass = 0
.MCText = "Alarm High"
End With
End Sub

See also
MessageClass Property (Page 3692)
GroupDisplay Object (Page 3350)

MenuItems Property
Description
Returns a listing containing all the menu entries in the user-defined menu.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"). In this example the labels will then be output:

Sub CreateMenuItem()
'VBA640
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim iIndex As Integer
iIndex = 1
'
'Add new menu "Delete objects" to the menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to menu "Delete objects"
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete circles")
'
'Output label of menu:

3688

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

MsgBox ActiveDocument.CustomMenus(1).Label
'
'Output labels of all menuitems:
For iIndex = 1 To objMenu.MenuItems.Count
MsgBox objMenu.MenuItems(iIndex).Label
Next iIndex
End Sub

See also
Menu Object (Page 3378)
MenuItem Object (Page 3382)

MenuItemType Property
Description
Returns the type for a user-defined menu entry. Read only access.
Returned Value

Type of Menu Entry

Separator (Separator)

Submenu (SubMenu)

Menu Entry (MenuItem)

Example:
The "ShowMenuTypes()" procedure outputs the types for the menu entries in the first userdefined menu:

Sub ShowMenuTypes()
'VBA641
Dim iMaxMenuItems As Integer
Dim iMenuItemType As Integer
Dim strMenuItemType As String
Dim iIndex As Integer
iMaxMenuItems = ActiveDocument.CustomMenus(1).MenuItems.Count
For iIndex = 1 To iMaxMenuItems
iMenuItemType = ActiveDocument.CustomMenus(1).MenuItems(iIndex).MenuItemType
Select Case iMenuItemType
Case 0
strMenuItemType = "Trennstrich (Separator)"
Case 1
strMenuItemType = "Untermen (SubMenu)"
Case 2
strMenuItemType = "Meneintrag (MenuItem)"
End Select
MsgBox iIndex & ". Menuitemtype: " & strMenuItemType

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3689

VBA for Automated Configuration


5.5 VBA Reference

Next iIndex
End Sub

See also
MenuItem Object (Page 3382)
Menu Object (Page 3378)

MenuToolBarConfig Property
Description
Specifies the configuration file with the user-defined menu and toolbars for the
"HMIPictureWindow" object or returns the name of the configuration file. STRING write-read
access.

MessageClass Property
Description
Specifies the respective message type (Alarm High, Alarm Low, Warning High, Warning Low,
etc.) for which the attribute settings "Display Text", "Came In", "Came In Acknowledged" and
"Went Out Unacknowledged" are configured for the "GroupDisplay" and
"AdvancedAnalogDisplay" objects.

3690

MessageClass

Assigned Value

AlarmHigh

AlarmLow

WarningHigh

WarningLow

Tolerance High

Tolerance Low

AS Control System Fault

AS Process Control Error

OS Process Control Error

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the background color for the "AlarmHigh" message type when the flash status
is "Off" will be set to "Red":

Sub GroupDisplayConfiguration()
'VBA642
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.MessageClass = 0
.MCGUBackColorOff = RGB(255, 0, 0)
End With
End Sub

See also
GroupDisplay Object (Page 3350)

Min Property
Description
Defines or returns the absolute value in the case of the smallest value display.
This value is displayed if the scale display is active.

Example:
The "BarGraphConfiguration()" procedure configures In this example the absolute value will
be set to "1".

Sub BarGraphConfiguration()
'VBA643
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Min = 1
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3691

VBA for Automated Configuration


5.5 VBA Reference

See also
Slider object (Page 3428)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

MinZoom Property
Description
Defines or returns the minimum zoom level for the layer.

Example:
The "LayerInfo()" procedure outputs the name and zoom configuration for each layer of the
current picture:

Sub LayerInfo()
'VBA644
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim strMaxZoom As String
Dim strMinZoom As String
Dim strLayerName As String
Dim iAnswer As Integer
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
With objLayer
strMinZoom = .MinZoom
strMaxZoom = .MaxZoom
strLayerName = .Name
iAnswer = MsgBox("Layername: " & strLayerName & vbCrLf & "Min. zoom:
vbCrLf & "Max. zoom: " & strMaxZoom, vbOKCancel)
End With
If vbCancel = iAnswer Then Exit For
Next objLayer
End Sub

" & strMinZoom &

See also
Layer Object (Page 3370)
Editing Layers with VBA (Page 3050)

3692

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Modified Property
Description
TRUE if the source code for a script or picture has been changed. BOOLEAN read access.

Example:
In the following example a check will be made on whether the active picture has been changed:

Sub CheckModificationOfActiveDocument()
'VBA645
Dim strCheck As String
Dim bModified As Boolean
bModified = ActiveDocument.Modified
Select Case bModified
Case True
strCheck = "Active document is modified"
Case False
strCheck = "Active document is not modified"
End Select
MsgBox strCheck
End Sub

See also
ScriptInfo Object (Page 3424)
Document Object (Page 3319)

Moveable Property
Description
TRUE if the ApplicationWindow and PictureWindow objects can be moved in Runtime.
BOOLEAN write-read access.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example it shall be possible to move the application window in Runtime:

Sub ApplicationWindowConfig()
'VBA646
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow1",
"HMIApplicationWindow")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3693

VBA for Automated Configuration


5.5 VBA Reference

With objAppWindow
.Moveable = True
End With
End Sub

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

N-O
Name Property
Description
Returns the name of the object. STRING read access.

Example:
The "LayerInfo()" procedure outputs the name and zoom configuration for each layer of the
current picture:

Sub LayerInfo()
'VBA647
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim strMaxZoom As String
Dim strMinZoom As String
Dim strLayerName As String
Dim iAnswer As Integer
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
With objLayer
strMinZoom = .MinZoom
strMaxZoom = .MaxZoom
strLayerName = .Name
iAnswer = MsgBox("Layername: " & strLayerName & vbCrLf & "Min. zoom:
vbCrLf & "Max. zoom: " & strMaxZoom, vbOKCancel)
End With
If vbCancel = iAnswer Then Exit For
Next objLayer
End Sub

3694

" & strMinZoom &

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Trigger Object (Page 3452)
SymbolLibrary Object (Page 3440)
Property Object (Page 3409)
HMIObject Object (Page 3357)
Layer Object (Page 3370)
FolderItem Object (Page 3342)
Document Object (Page 3319)
Application Object (Page 3282)

Name Property (FolderItem)


Description
Returns the internal name of the specified object of the "FolderItem" type. Read only access.

Example:
In this example the internal name is output for the "PC" object contained in the Global
Components Library:

Sub ShowInternalNameOfFolderItem()
'VBA536
Dim objGlobalLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
MsgBox objGlobalLib.FolderItems(2).Folder(2).Folder.Item(1).Name
End Sub

See also
FolderItem Object (Page 3342)
Accessing the component library with VBA (Page 3040)

NegativeValue Property
Description
Use the BinaryResultInfo property to return the BinaryResultInfo object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3695

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned and the associated property values will be assigned to
both the binary value ranges:

Sub AddDynamicDialogToCircleRadiusTypeBinary()
'VBA648
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_C", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBool
.BinaryResultInfo.NegativeValue = 20
.BinaryResultInfo.PositiveValue = 40
End With
End Sub

See also
VBA Reference (Page 3124)
PositiveValue Property (Page 3730)
BinaryResultInfo Object (Page 3291)

NibbleSelect property
Description
Only used internally.

See also
AdvancedStateDisplay object (Page 3278)

Number Property
Description
Returns the layer number of a "Layer" type object. The counting starts with 1. The first layer,
"Layer0", returns the value "0". READ access.

3696

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
This example outputs the name, number and index of a layer:

Sub ShowLayerWithNumbers()
'VBA803
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim iAnswer As Integer
Dim iIndex As Integer
iIndex = 1
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
iAnswer = MsgBox("Layername: " & objLayer.Name & vbCrLf & "Layernumber: " & objLayer.Number
& vbCrLf & "Layersindex: " & iIndex, vbOKCancel)
iIndex = iIndex + 1
If vbCancel = iAnswer Then Exit For
Next objLayer
End Sub

See also
Layer Object (Page 3370)

NumberLines Property
Description
TextList
Defines for the "TextList object" how many lines the selection list should contain or returns the
value. If the configured lines with their number, font size and font do not fit into the dimensions
of the object, a vertical scroll bar is added to the selection list.
Combo box and list box
Defines or returns the number of lines of text for the "Combo box" and "List box" objects. You
can define a maximum of 32,000 lines.
At the same time, the value of the "Number of rows" attribute specifies the high limit value for
the "Index" attribute in the "Font" property group. Changing the value can have the following
effects:
Increasing the number: New lines are added at the bottom. The default labeling of the new
filed can be changed using the "Text" attribute in the "Font" property group.
Reducing the number: All lines are removed for which the value of the "Index" attribute is
higher than the new number.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3697

VBA for Automated Configuration


5.5 VBA Reference

Example
The "TextListConfiguration()" procedure accesses the properties of the "TextList" object. In
this example a selection list is created and the number of visible lines is set to three:

Sub TextListConfiguration()
'VBA649
Dim objTextList As HMITextList
'
'Insert new TextList in current picture:
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.NumberLines=3
End With
End Sub

See also
TextList Object (Page 3441)

ObjectName Property
Description
Depending on the source and destination object types for the direct connection, either defines
or returns the name of the constant, object or tag.
The two tables show you when you must use the ObjectName property. A "--" means that the
property is assigned an empty string (") by default when the DirectConnection object is created.
Source object type (SourceLink Property)
Type Property

AutomationName Property

ObjectName Property

hmiSourceTypeConstant

--

Name of the constant (e.g. the


picture name)

hmiSourceTypeProperty

Property of the source object


(e.g. "Top")

Name of the source object (e.g.


"Rectangle_A")

hmiSourceTypePropertyOfThisObj -ect

--

hmiSourceTypeVariableDirect

--

Tag name

hmiSourceTypeVariableIndirect

--

Tag name

Destination object type (DestinationLink Property)


Type Property

AutomationName Property

ObjectName Property

hmiDestTypeProperty

Property of the destination


object (e.g. "Left")

Name of the destination object


(e.g. "Rectangle_A")

hmiDestTypePropertyOfThisObject --

3698

--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Type Property

AutomationName Property

ObjectName Property

hmiDestTypePropertyOfActualWin
dow

Property of the destination


object (e.g. "Left")

--

hmiDestTypeVariableDirect

--

Tag name

hmiDestTypeVariableIndirect

--

Tag name

hmiDestTypeDirectMessage

--

Tag name

hmiDestTypeIndirectMessage

--

Tag name

Example:
In the following example the X position of "Rectangle_A" is copied to the Y position of
"Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA650
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 100
.Text = "SetPosition"
End With
'
'Directconnection is initiated by mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3699

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
Type Property (Page 3792)
SourceLink Property (Page 3767)
DestinationLink Property (Page 3570)
AutomationName Property (Page 3488)
SourceLink Object (Page 3431)
DestLink Object (Page 3316)

ObjectSizeDecluttering Property
Description
TRUE, if objects of the specified picture outside of two configured sizes are to be faded out.
BOOLEAN write-read access.
Define the size range with the aid of the SetDeclutterObjectSize method.

Example:
In the following example the settings for the lowest layer are configured in the active picture:

Sub ConfigureSettingsOfLayer()
'VBA651
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'Configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
'Define fade-in and fade-out of objects:
With ActiveDocument
.LayerDecluttering = True
.ObjectSizeDecluttering = True
.SetDeclutterObjectSize 50, 100
End With
End Sub

3700

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Document Object (Page 3319)
Editing Layers with VBA (Page 3050)

OffsetLeft Property
Description
Defines or returns the distance of the picture from the left edge of the picture window.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured

Sub PictureWindowConfig()
'VBA652
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

OffsetTop Property
Description
Defines or returns the distance of the picture from the top edge of the picture window.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3701

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured

Sub PictureWindowConfig()
'VBA653
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

OnTop Property
Description
TRUE if the ApplicationWindow object is always in the foreground in Runtime. BOOLEAN writeread access.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will always be in the foreground in Runtime:

Sub ApplicationWindowConfig()
'VBA654
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow1",
"HMIApplicationWindow")
With objAppWindow

3702

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.OnTop = True
End With
End Sub

See also
ApplicationWindow Object (Page 3284)

Operation Property
Description
TRUE if the object can be used or operated in Runtime. BOOLEAN write-read access.

Example:
In this example the status of the operator-control enables will be output for all objects in the
active picture:

Sub ShowOperationStatusOfAllObjects()
'VBA655
Dim objObject As HMIObject
Dim bStatus As Boolean
Dim strStatus As String
Dim strName As String
Dim iMax As Integer
Dim iIndex As Integer
Dim iAnswer As Integer
iMax = ActiveDocument.HMIObjects.Count
iIndex = 1
For iIndex = 1 To iMax
strName = ActiveDocument.HMIObjects(iIndex).ObjectName
bStatus = ActiveDocument.HMIObjects(iIndex).Operation
Select Case bStatus
Case True
strStatus = "yes"
Case False
strStatus = "no"
End Select
iAnswer = MsgBox("Object: " & strName & vbCrLf & "Operator-Control enable: " & strStatus,
vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next iIndex
If 0 = iMax Then MsgBox "No objects in the active document."
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3703

VBA for Automated Configuration


5.5 VBA Reference

See also
HMIObject Object (Page 3357)
Document Object (Page 3319)

OperationMessage Property
Description
TRUE, if a message should be output upon successful operation. The reason for the operation
can only be input if the "OperationReport" property is set to "True". BOOLEAN write-read
access.
The operation is sent to the message system, and is archived. Using the message system, a
message may be output in a message line, for example.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this
example, an operation is supposed to be sent to the message system:

Sub IOFieldConfiguration()
'VBA656
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.OperationReport = True
.OperationMessage = True
End With
End Sub

See also
OperationReport Property (Page 3706)
TextList Object (Page 3441)
Slider object (Page 3428)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
CheckBox Object (Page 3297)

OperationReport Property
Description
TRUE, if the reason for an operation should be recorded. BOOLEAN write-read access.

3704

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
When the object is used or operated in Runtime, a dialog opens in which the operator can
input the reason for the operation in the form of text. The operation is sent to the message
system, and is archived.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this
example, an operation is supposed to be sent to the message system:

Sub IOFieldConfiguration()
'VBA657
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.OperationReport = True
.OperationMessage = True
End With
End Sub

See also
OperationMessage Property (Page 3704)
TextList Object (Page 3441)
Slider object (Page 3428)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
CheckBox Object (Page 3297)

Orientation Property
Description
TRUE, when the text in the object should be displayed horizontally. BOOLEAN write-read
access.
Note
It is only the text that is displayed either horizontally or vertically. The position of the object
remains unchanged.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3705

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the text will be displayed vertically:

Sub ButtonConfiguration()
'VBA658
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.Width = 150
.Height = 150
.Text = "Text is displayed vertical"
.Orientation = False
End With
End Sub

See also
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

OriginalPropertyName property
Description
Only used internally.

See also
FaceplateObjects object (Page 3341)

OutputFormat Property
Description
Defines how the output value shall be displayed, or returns the set value. The representation
is dependent on the data format.

3706

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this
example, data type "Decimal" will be set for the I/O field: The output value will be displayed
with two decimals and three digits to the right of the decimal point:

Sub IOFieldConfiguration()
'VBA659
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.DataFormat = 1
.OutputFormat = "99,999"
End With
End Sub

See also
DataFormat Property (Page 3569)
IOField Object (Page 3361)

OutputValue Property
Description
Defines or returns presetting for the value to be displayed.
This value is used in Runtime when the associated tag cannot be connected or updated when
a picture is started.

Example
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this
example, the output value is set to "0":

Sub IOFieldConfiguration()
'VBA660
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.OutputValue = "0"
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3707

VBA for Automated Configuration


5.5 VBA Reference

See also
TextList Object (Page 3441)
IOField Object (Page 3361)

OutputValue property
Description
Specifies the interconnection with any analog / text tag. The analog display represents the
value of this tag in the configured colors depending on the alarm state.

P-Q
PaintColor_QualityCodeBad property
Description
Defines the color in which the grid is shown when a poor status exists, for example, if the
connection to the server is interrupted.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

PaintColor_QualityCodeUnCertain property
Description
Defines the color with which the grid is shown in an uncertain status.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Parent Property
Description
Returns the higher-ranking object in the specified object. Read only access.

3708

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example a copy of the active picture is created and the name of the picture is
then output with the aid of the Parent property:
Sub ExampleForParent()
'VBA661
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
MsgBox objView.Parent.Name
End Sub

See also
Toolbars Object (Listing) (Page 3446)
Menu Object (Page 3378)
Document Object (Page 3319)
Views Object (Listing) (Page 3468)
View Object (Page 3466)
VariableTriggers Object (Listing) (Page 3465)
VariableTrigger Object (Page 3464)
VariableStateValues Object (Listing) (Page 3462)
VariableStateValue Object (Page 3461)
Trigger Object (Page 3452)
ToolbarItems Object (Listing) (Page 3450)
ToolbarItem Object (Page 3448)
Toolbar Object (Page 3445)
TextList Object (Page 3441)
SymbolLibraries Object (Listing) (Page 3439)
SymbolLibrary Object (Page 3440)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
SourceLink Object (Page 3431)
Slider object (Page 3428)
SelectedObjects object (Listing) (Page 3426)
ScriptInfo Object (Page 3424)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3709

VBA for Automated Configuration


5.5 VBA Reference
Rectangle Object (Page 3415)
Properties Object (Listing) (Page 3408)
Property Object (Page 3409)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PictureWindow Object (Page 3396)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
OLEObject Object (Page 3391)
MenuItems Object (Listing) (Page 3384)
MenuItem Object (Page 3382)
Menus Object (Listing) (Page 3380)
Line Object (Page 3373)
Layers Object (Listing) (Page 3371)
Layer Object (Page 3370)
LanguageTexts Object (Listing) (Page 3369)
LanguageText Object (Page 3368)
LanguageFonts Object (Listing) (Page 3366)
LanguageFont Object (Page 3365)
IOField Object (Page 3361)
HMIObjects Object (Listing) (Page 3359)
HMIObject Object (Page 3357)
HMIDefaultObjects Object (Listing) (Page 3354)
GroupedObjects Object (Listing) (Page 3353)
GroupDisplay Object (Page 3350)
Group Object (Page 3348)
GraphicObject Object (Page 3345)
FolderItems Object (Listing) (Page 3343)
FolderItem Object (Page 3342)
Events Object (Listing) (Page 3337)
Event Object (Page 3336)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
DynamicDialog Object (Page 3325)

3710

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Documents Object (Listing) (Page 3322)
DirectConnection Object (Page 3318)
DestLink Object (Page 3316)
DataLanguages Object (Listing) (Page 3314)
DataLanguage Object (Page 3313)
CustomizedObject Object (Page 3310)
ConnectionPoints Object (Listing) (Page 3308)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BitResultInfo Object (Page 3292)
BinaryResultInfo Object (Page 3291)
BarGraph Object (Page 3286)
ApplicationWindow Object (Page 3284)
Actions Object (Listing) (Page 3271)
3DBarGraph Object (Page 3267)

ParentCookie property
Description
Only used internally.

See also
FaceplateProperty object (Page 3341)

PasswordLevel Property
Description
Defines the authorization for operation (e.g. no input or no triggering actions) of the object.
PasswordLevel

Assigned Value

<No Access Security>

User Administration

Value input

Process controlling

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3711

VBA for Automated Configuration


5.5 VBA Reference
PasswordLevel

Assigned Value

Picture editing

Screen change

Window selection

Hard copy

Confirm alarms

Lock alarms

Free alarms

10

Message editing

11

Start archive

12

Stop archive

13

Edit archive values

14

Archive editing

15

Action editing

16

Project Manager

17

Activate remote

1000

Configure remote

1001

Just monitor

1002

You must first define the operator authorizations in the User Administrator.

Example:
--

See also
HMIObject Object (Page 3357)

Path Property
Description
Returns the full path of the folder in which the specified picture is stored. Read only access.

Example:
In this example the path to the folder of the active picture will be output:

Sub ShowDocumentPath()
'VBA663
MsgBox ActiveDocument.Path
End Sub

3712

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Document Object (Page 3319)

Pathname Property
Description
Returns the internal access path to the Components Library for the specified object of the
"FolderItem" type. Read only access.

Example:
In this example the internal access path is output for the "PC" object contained in the Global
Components Library:

Sub ShowInternalNameOfFolderItem()
'VBA664
Dim objGlobalLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
MsgBox objGlobalLib.FolderItems(2).Folder(2).Folder.Item(1).PathName
End Sub

See also
FolderItem Object (Page 3342)
Accessing the component library with VBA (Page 3040)

PdlProtection property
Description
Sets a password for a process picture or faceplate type or deletes the password. Write access.
Note
Significance of the password protection
With the PdlProtection property, you can only assign a password to process pictures or
faceplate types to, for example, protect the VBA scripts contained in the pictures against
unauthorized access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3713

VBA for Automated Configuration


5.5 VBA Reference

Examples
In this example, a password is set for the active picture:

Sub ProtectPicture()
'VBA854
ActiveDocument.PdlProtection = "Test123"
End Sub

Password protection for the active picture is removed in this example:

Sub UnprotectPicture()
'VBA855
ActiveDocument.PdlProtection = ""
End Sub

Note
Write access only
Read access to the password is prevented due to security reasons.

PicDeactReferenced-Eigenschaft
Description
TRUE if the picture assigned to the "Deactivated" status is to be saved in the RoundButton
object. Otherwise, only the associated object reference is saved. BOOLEAN write-read access.

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the picture assigned to the "Deactivated" status will be referenced:

Sub RoundButtonConfiguration()
'VBA665
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicDeactReferenced = False
End With
End Sub

3714

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
RoundButton Object (Page 3418)

PicDeactTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "Disabled"
status should be set to "transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "PicDeactUseTransColor" property is
"True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the color "Red" assigned in the Bitmap object is to be displayed transparent when
in the "Deactivated" status.

Sub RoundButtonConfiguration()
'VBA666
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicDeactTransparent = RGB(255, 0, 0)
.PicDeactUseTransColor = True
End With
End Sub

See also
PicDeactUseTransColor Property (Page 3717)
RoundButton Object (Page 3418)

PicDeactUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDeactTransparent" property for the
"Disable" status should be used. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3715

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the color "Red" assigned in the Bitmap object is to be displayed transparent when
in the "Deactivated" status:

Sub RoundButtonConfiguration()
'VBA667
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicDeactTransparent = RGB(255, 0, 0)
.PicDeactUseTransColor = True
End With
End Sub

See also
PicDeactTransparent Property (Page 3715)
RoundButton Object (Page 3418)

PicDownReferenced Property
Description
TRUE if the picture assigned to the "On" status is to be saved in the RoundButton object.
Otherwise, only the associated object reference is saved. BOOLEAN write-read access.

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the picture assigned to the "On" status will be referenced:

Sub RoundButtonConfiguration()
'VBA668
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicDownReferenced = False
End With
End Sub

See also
RoundButton Object (Page 3418)

3716

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

PicDownTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "On" status
should be set to "transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "PicDownUseTransColor" property is
"True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the color "Yellow" assigned in the Bitmap object is to be displayed transparent
when in the "Deactivated" status.

Sub RoundButtonConfiguration()
'VBA669
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicDownTransparent = RGB(255, 255, 0)
.PicDownUseTransColor = True
End With
End Sub

See also
PicDownUseTransColor Property (Page 3719)
RoundButton Object (Page 3418)

PicDownUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicDownTransparent" property for the "On"
status should be used. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3717

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the color "Yellow" assigned in the Bitmap object is to be displayed transparent
when in the "Deactivated" status:

Sub RoundButtonConfiguration()
'VBA670
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicDownTransparent = RGB(255, 255, 0)
.PicDownUseTransColor = True
End With
End Sub

See also
PicDownTransparent Property (Page 3717)
RoundButton Object (Page 3418)

PicReferenced Property
Description
TRUE if the picture assigned to the GraphicObject object is to be referenced and not saved in
the object. BOOLEAN write-read access.

Example:
The "GraphicObjectConfiguration()" procedure accesses the properties of the graphics object.
In this example the assigned picture will be referenced:

Sub GraphicObjectConfiguration()
'VBA671
Dim objGraphicObject As HMIGraphicObject
Set objGraphicObject = ActiveDocument.HMIObjects.AddHMIObject("GraphicObject1",
"HMIGraphicObject")
With objGraphicObject
.PicReferenced = True
End With
End Sub

See also
GraphicObject Object (Page 3345)

3718

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

PictAlignment property
Description
As the "Picture alignment" attribute, it defines the position and scaling of the picture placed on
the button or round button.
centered
Left justified
Right justified
Stretched

The picture is positioned, centered in the original proportions.


The picture is positioned with original proportions, with left justification on
the left side of the button.
The picture is positioned with original proportions, with right justification on
the right side of the button.
The picture is scaled to a square and is adapted to the size of the button.

PicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "PicUseTransColor" property is "True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "GraphicObjectConfiguration()" procedure accesses the properties of the graphics object.
In this example the color "Blue" assigned in the Bitmap object is to be displayed transparent:

Sub GraphicObjectConfiguration()
'VBA672
Dim objGraphicObject As HMIGraphicObject
Set objGraphicObject = ActiveDocument.HMIObjects.AddHMIObject("GraphicObject1",
"HMIGraphicObject")
With objGraphicObject
.PicTransColor = 16711680
.PicUseTransColor = True
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3719

VBA for Automated Configuration


5.5 VBA Reference

See also
GraphicObject Object (Page 3345)

PictureDeactivated Property
Description
Defines the picture to be displayed in the "Disable" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the round button. In this
example the pictures for the "On" and "Off" states will be defined:

Sub ButtonConfiguration()
'VBA673
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
'
'Toi use this example copy a Bitmap-Graphic
'to the "GraCS"-Folder of the actual project.
'Replace the picturename "TestPicture1.BMP" with the name of
'the picture you copied
.PictureDeactivated = "TestPicture1.BMP"
End With
End Sub

See also
RoundButton Object (Page 3418)
PicReferenced Property (Page 3718)

PictureDown Property
Description
Defines the picture to be displayed in the "On" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

3720

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ButtonConfiguration()" procedure accesses the properties of the round button. In this
example the pictures for the "On" and "Off" states will be defined:

Sub ButtonConfiguration()
'VBA674
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
'
'To use this example copy two Bitmap-Graphics
'to the "GraCS"-Folder of the actual project.
'Replace the picturenames "TestPicture1.BMP" and "TestPicture2.BMP"
'with the names of the pictures you copied
.PictureDown = "TestPicture1.BMP"
.PictureUp = "TestPicture2.BMP"
End With
End Sub

See also
RoundButton Object (Page 3418)

PictureName Property
Description
Defines the picture to be displayed in the picture window in Runtime or returns the picture
name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA675
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3721

VBA for Automated Configuration


5.5 VBA Reference

.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

PictureUp Property
Description
Defines the picture to be displayed in the "Off" status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the pictures for the "On" and "Off" states will be defined:

Sub ButtonConfiguration()
'VBA676
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
'
'To use this example copy two Bitmap-Graphics
'to the "GraCS"-Folder of the actual project.
'Replace the picturenames "TestPicture1.BMP" and "TestPicture2.BMP"
'with the names of the pictures you copied
.PictureDown = "TestPicture1.BMP"
.PictureUp = "TestPicture2.BMP"
End With
End Sub

3722

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
RoundButton Object (Page 3418)
Button Object (Page 3293)

PicUpReferenced Property
Description
TRUE if the picture assigned to the "Off" status is to be saved in the RoundButton object.
Otherwise, only the associated object reference is saved. BOOLEAN write-read access.

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the picture assigned to the "Off" status will be referenced:

Sub RoundButtonConfiguration()
'VBA677
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicUpReferenced = False
End With
End Sub

See also
RoundButton Object (Page 3418)

PicUpTransparent Property
Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the "Off" status
should be set to "transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "PicUpUseTransColor" property is
"True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3723

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the color "Blue" assigned in the Bitmap object is to be displayed transparent in
the status "Off".

Sub RoundButtonConfiguration()
'VBA678
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicUpTransparent = RGB(0, 0, 255)
.PicUpUseTransColor = True
End With
End Sub

See also
PicUpUseTransColor Property (Page 3726)
RoundButton Object (Page 3418)

PicUpUseTransColor Property
Description
TRUE, when the transparent color defined by the "PicUpTransparent" property for "Off" status
should be used. BOOLEAN write-read access.

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the color "Blue" assigned in the Bitmap object is to be displayed transparent in
the status "Off":

Sub RoundButtonConfiguration()
'VBA679
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.PicUpTransparent = RGB(0, 0, 255)
.PicUpUseTransColor = True
End With
End Sub

3724

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
PicUpTransparent Property (Page 3723)
RoundButton Object (Page 3418)

PicUseTransColor Property
Description
TRUE if the transparent color defined with the "PicTransColor" property is to be used for the
"Deactivated" status. BOOLEAN write-read access.

Example:
The "GraphicObjectConfiguration()" procedure accesses the properties of the graphics object.
In this example the color "Blue" assigned in the Bitmap object is to be displayed transparent:

Sub GraphicObjectConfiguration()
'VBA680
Dim objGraphicObject As HMIGraphicObject
Set objGraphicObject = ActiveDocument.HMIObjects.AddHMIObject("GraphicObject1",
"HMIGraphicObject")
With objGraphicObject
.PicTransColor = RGB(0, 0, 255)
.PicUseTransColor = True
End With
End Sub

See also
PicTransColor Property (Page 3719)
GraphicObject Object (Page 3345)

Pinnable property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3725

VBA for Automated Configuration


5.5 VBA Reference

Pinned property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

PointCount Property
Description
Defines or returns the number of corner points in the case of the Polygon and Polyline objects.
Each corner point has position coordinates and is identified via an index.

Example:
For this example to work, insert a polyline called "Polyline1" into the active picture: The
"PolyLineCoordsOutput" procedure then outputs the coordinates of all the corner points in the
polyline:

Sub PolyLineCoordsOutput()
'VBA681
Dim iPcIndex As Integer
Dim iPosX As Integer
Dim iPosY As Integer
Dim iIndex As Integer
Dim objPolyLine As HMIPolyLine
Set objPolyLine = Application.ActiveDocument.HMIObjects.AddHMIObject("PolyLine1",
"HMIPolyLine")
'
'Determine number of corners from "PolyLine1":
iPcIndex = objPolyLine.PointCount
'
'Output of x/y-coordinates from every corner:
For iIndex = 1 To iPcIndex
With objPolyLine
.index = iIndex
iPosX = .ActualPointLeft
iPosY = .ActualPointTop
MsgBox iIndex & ". corner:" & vbCrLf & "x-coordinate: " & iPosX & vbCrLf & "y-coordinate:
" & iPosY
End With
Next iIndex
End Sub

List of links

3726

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Index Property (Page 3631)
ActualPointTop Property (Page 3474)
ActualPointLeft Property (Page 3473)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)

Position Property
Description
The value for position determines the sequence, in which menu entries and icons are assigned
in user-defined menus and toolbars or how user-defined menus are arranged in the menu bar.
Write/Read access.
A value of "1" means position 1 (start).

Example:
In the following example the position of all menu entries in the first user-defined menu in the
active picture will be output: So that this example will work, first carry out the example shown
under the heading "InsertSubMenu".

Sub ShowPositionOfCustomMenuItems()
'VBA683
Dim objMenu As HMIMenu
Dim iMaxMenuItems As Integer
Dim iPosition As Integer
Dim iIndex As Integer
Set objMenu = ActiveDocument.CustomMenus(1)
iMaxMenuItems = objMenu.MenuItems.Count
For iIndex = 1 To iMaxMenuItems
iPosition = objMenu.MenuItems(iIndex).Position
MsgBox "Position of the " & iIndex & ". menuitem: " & iPosition
Next iIndex
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)
Menu Object (Page 3378)
InsertSubmenu Method (Page 3229)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3727

VBA for Automated Configuration


5.5 VBA Reference

PositiveValue Property
Description
Defines the value for the dynamic property if the configured tag returns a non-zero value, or
returns the value.

Example:
Use the BinaryResultInfo property to return the BinaryResultInfo object. In the following
example the radius of a circle will be dynamically configured using the Dynamic dialog, a tag
name will be assigned and the associated property values will be assigned to both the binary
value ranges:

Sub AddDynamicDialogToCircleRadiusTypeBool()
'VBA684
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_C", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBool
.BinaryResultInfo.NegativeValue = 20
.BinaryResultInfo.PositiveValue = 40
End With
End Sub

See also
NegativeValue Property (Page 3695)
BinaryResultInfo Object (Page 3291)
VBA Reference (Page 3124)

PredefinedAngels Property
Description
Defines or returns the depth of the display of the 3DBarGraph object. Value range from 0 to 3.

3728

Display

Assigned Value

Cavalier

Isometric

Axonometric

Freely Defined

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the depth display will be set to "Isometric":

Sub HMI3DBarGraphConfiguration()
'VBA685
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
'Depth-angle a = 15 degrees
.AngleAlpha = 15
.PredefinedAngles = 1
'Depth-angle b = 45 degrees
.AngleBeta = 45
End With
End Sub

See also
3DBarGraph Object (Page 3267)

Pressed Property
Description
TRUE, when the Button or RoundButton object is pressed. BOOLEAN write-read access.

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the RoundButton object will be set to "Pressed":

Sub RoundButtonConfiguration()
'VBA686
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.Pressed = True
End With
End Sub

See also
RoundButton Object (Page 3418)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3729

VBA for Automated Configuration


5.5 VBA Reference

PrioAlarm..Warning property
Description
Specifies the priority at one of the following states or message types:
Alarm
Warning
Tolerance
AS Process Control Error
AS Control System Fault
Operator request

PrioBit16..31 property
Description
The property indicates the priority of the respective bit in the group value for the alarm
evaluation for the advanced analog and status display. The alarm evaluation starts at the
highest priority (priority 1). Bits that are not used for the alarm evaluation are assigned priority
0.
If the group value contains multiple bits, the priority determines which status is displayed.

Process Property
Description
Defines or returns presetting for the value to be displayed.
This value is used in Runtime when the associated tag cannot be connected or updated when
a picture is started.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the default value will be set to "100":

Sub HMI3DBarGraphConfiguration()
'VBA687
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
'Depth-angle a = 15 degrees
.AngleAlpha = 15
'Depth-angle b = 45 degrees

3730

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.AngleBeta = 45
.Process = 100
End With
End Sub

See also
Slider object (Page 3428)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

Process property
Description
Here the first tag is stored that is used for status value calculation for the
"HMIAdvancedStateDisplay" object.
Use the "BitPosition0..3" properties to specify the bit position of these tags that is taken into
account for the status value calculation. This results in the statuses to which you can then
assign pictures.

Process1 property
Description
Here the second tag is stored that is used for status value calculation for the
"HMIAdvancedStateDisplay" object.
Use the "BitPosition0..3" properties to specify the bit position of these tags that is taken into
account for the status value calculation. This results in the statuses to which you can then
assign pictures.

Process2 property
Description
Here the third tag is stored that is used for status value calculation for the
"HMIAdvancedStateDisplay" object.
Use the "BitPosition0..3" properties to specify the bit position of these tags that is taken into
account for the status value calculation. This results in the statuses to which you can then
assign pictures.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3731

VBA for Automated Configuration


5.5 VBA Reference

Process3 property
Description
Here the fourth tag is stored that is used for status value calculation for the
"HMIAdvancedStateDisplay" object.
Use the "BitPosition0..3" properties to specify the bit position of these tags that is taken into
account for the status value calculation. This results in the statuses to which you can then
assign pictures.

ProfileName Property
Description
Returns the name of the specified application. Read only access.

Example:
In this example the name of the "Graphics Designer" application will be output:

Sub ShowProfileName()
'VBA688
MsgBox Application.ProfileName
End Sub

See also
Application Object (Page 3282)

ProgID Property
Description
Returns the ProgID of an ActiveX Control. STRING read access.

Example:
In the following example the ActiveX Control "WinCC Gauge Control" is inserted in the active
picture. The ProgID is then output:

Sub AddActiveXControl()
'VBA689
Dim objActiveXControl As HMIActiveXControl

3732

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",


"XGAUGE.XGaugeCtrl.1")
With ActiveDocument
.HMIObjects("WinCC_Gauge").Top = 40
.HMIObjects("WinCC_Gauge").Left = 40
MsgBox "ProgID of ActiveX-control: " & .HMIObjects("WinCC_Gauge").ProgID
End With
End Sub

See also
ActiveXControl Object (Page 3273)
AddActiveXControl Method (Page 3174)

ProjectName Property
Description
Returns the project name. Read access.

Example:
In this example the name and type of the loaded project will be output.

Sub ShowProjectInfo()
'VBA690
Dim iProjectType As Integer
Dim strProjectName As String
Dim strProjectType As String
iProjectType = Application.ProjectType
strProjectName = Application.ProjectName
Select Case iProjectType
Case 0
strProjectType = "Single-User System"
Case 1
strProjectType = "Multi-User System"
Case 2
strProjectType = "Client System"
End Select
MsgBox "Projecttype: " & strProjectType & vbCrLf & "Projectname: " & strProjectName
End Sub

See also
Application Object (Page 3282)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3733

VBA for Automated Configuration


5.5 VBA Reference

ProjectType Property
Description
Returns the project type. Value range from 0 to 2. Read access.
Project type

Assigned Value

Single-user project

Multi-user project

client project

Example:
In this example the name and type of the loaded project will be output:

Sub ShowProjectInfo()
'VBA691
Dim iProjectType As Integer
Dim strProjectName As String
Dim strProjectType As String
iProjectType = Application.ProjectType
strProjectName = Application.ProjectName
Select Case iProjectType
Case 0
strProjectType = "Single-User System"
Case 1
strProjectType = "Multi-User System"
Case 2
strProjectType = "Client System"
End Select
MsgBox "Projecttype: " & strProjectType & vbCrLf & "Projectname: " & strProjectName
End Sub

See also
Application Object (Page 3282)

Properties Property
Description
Returns a Properties listing containing all the properties of the specified object. Read only
access.
To return an element from the Properties listing you can use either the index number or the
name of the VBA property.

3734

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
You must use the Properties property if, for example, you wish to access the properties of
objects located in a group object.

Example:
Examples showing how to use the Properties property can be found in this documentation
under the following headings:
"Editing Objects with VBA"
"Group objects"
"Customized Objects"

See also
HMIObject Object (Page 3357)
Customized Objects (Page 3074)
Group Objects (Page 3067)
Editing Objects with VBA (Page 3053)

Prototype Property
Description
Returns the function heading of a script. The function heading is assigned by default if no
source code is configured.

Example:
In the following example a button and a circle will be inserted in the active picture. In Runtime
the radius of the circle will enlarge every time you click the button. In this case only the prototype
of the VB script is output:

Sub ExampleForPrototype()
'VBA692
Dim objButton As HMIButton
Dim objCircleA As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Set objCircleA = ActiveDocument.HMIObjects.AddHMIObject("CircleA", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircleA
.Top = 100
.Left = 100
End With
With objButton
.Top = 10
.Left = 10

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3735

VBA for Automated Configuration


5.5 VBA Reference

.Width = 200
.Text = "Increase Radius"
End With
'On every mouseclick the radius have to increase:
Set objEvent = objButton.Events(1)
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
MsgBox objVBScript.Prototype
End Sub

See also
ScriptInfo Object (Page 3424)

QualityCodeStateChecked Properties
Description
TRUE, if the quality code of the specified tag is used in Dynamic dialog for dynamization.
BOOLEAN write-read access.

Example:
In the following example the radius of a circle is given dynamics with the Dynamization uses
the analysis of the quality code of a tag. If the tag fails to return a quality code, a substitute
value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA816
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80

3736

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
DynamicDialog Object (Page 3325)

QualityCodeStateValues Property
Description
Returns the QualityCodeStateValues listing. Use the QualityCodeStateValues property with
the Item property to assign a value to the quality code status to be used for dynamization.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA817
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3737

VBA for Automated Configuration


5.5 VBA Reference

End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
DynamicDialog Object (Page 3325)
QualityCodeStateValues Object (Listing) (Page 3413)

R
Radius Property
Description
Defines or returns the radius in the case of the following objects:
Circle: Radius in pixels (0 to 10000)
CircularArc: Radius in pixels (0 to 10000)
PieSegment: Radius in pixels (0 to 10000)
RoundButton: Radius in pixels (0 to 10000)

3738

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "PieSegmentConfiguration()" procedure accesses the properties of the Pie Segment. In
this example the radius will be set to "80":

Sub PieSegmentConfiguration()
'VBA693
Dim objPieSegment As HMIPieSegment
Set objPieSegment = ActiveDocument.HMIObjects.AddHMIObject("PieSegment1", "HMIPieSegment")
With objPieSegment
.StartAngle = 40
.EndAngle = 180
.Radius = 80
End With
End Sub

See also
RoundButton Object (Page 3418)
PieSegment Object (Page 3399)
CircularArc Object (Page 3303)
Circle Object (Page 3300)

RadiusHeight Property
Description
Defines or returns the vertical radius in pixels (0 to 5000) in the case of elliptical objects (Ellipse,
EllipseArc, EllipseSegment).

Example:
The "EllipseConfiguration()" procedure accesses the properties of the ellipse object. In this
example the horizontal radius will be set to "60":

Sub EllipseConfiguration()
'VBA694
Dim objEllipse As HMIEllipse
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("Ellipse1", "HMIEllipse")
With objEllipse
.RadiusHeight = 60
.RadiusWidth = 40
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3739

VBA for Automated Configuration


5.5 VBA Reference

See also
RadiusWidth Property (Page 3742)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)

RadiusWidth Property
Description
Defines or returns the horizontal radius in pixels (0 to 5000) in the case of elliptical objects
(Ellipse, EllipseArc, EllipseSegment).

Example:
The "EllipseConfiguration()" procedure accesses the properties of the ellipse object. In this
example the horizontal radius will be set to "40":

Sub EllipseConfiguration()
'VBA695
Dim objEllipse As HMIEllipse
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("Ellipse1", "HMIEllipse")
With objEllipse
.RadiusHeight = 60
.RadiusWidth = 40
End With
End Sub

See also
RadiusHeight Property (Page 3739)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)

RangeTo Property
Description
Defines or returns the analog value range.

3740

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
An example showing how to use the RangeTo property can be found in this documentation
under the heading "AnalogResultInfos Object (Listing)".

See also
Value Property (Page 3809)
AnalogResultInfos Object (Listing) (Page 3281)
AnalogResultInfo Object (Page 3280)

ReferenceRotationLeft Property
Description
Defines or returns the X-coordinate of the reference point about which the object should be
rotated in Runtime.
The value of the X-coordinate is relative to the object width. Enter the value in percent starting
from the left edge of the rectangle enclosing the object.

Example:
The "PolyLineConfiguration()" procedure accesses the properties of the PolyLine object. In
this example, the coordinates of the reference point will be set to 50% of the object width and
50% of the object height:

Sub PolyLineConfiguration()
'VBA696
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects.AddHMIObject("PolyLine1", "HMIPolyLine")
With objPolyLine
.ReferenceRotationLeft = 50
.ReferenceRotationTop = 50
End With
End Sub

See also
RotationAngle Property (Page 3746)
ReferenceRotationTop Property (Page 3744)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3741

VBA for Automated Configuration


5.5 VBA Reference

ReferenceRotationTop Property
Description
Defines or returns the Y-coordinate of the reference point about which the object should be
rotated in Runtime.
The value of the Y-coordinate is relative to the object width. Enter the value in percent starting
from the top edge of the rectangle enclosing the object.

Example:
The "PolyLineConfiguration()" procedure accesses the properties of the PolyLine object. In
this example, the coordinates of the reference point will be set to 50% of the object width and
50% of the object height:

Sub PolyLineConfiguration()
'VBA697
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects.AddHMIObject("PolyLine1", "HMIPolyLine")
With objPolyLine
.ReferenceRotationLeft = 50
.ReferenceRotationTop = 50
End With
End Sub

See also
RotationAngle Property (Page 3746)
ReferenceRotationLeft Property (Page 3741)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

Relevant Property
Description
TRUE when the "GroupDisplay", "AdvancedAnalogDisplay" or "AdvancedStateDisplay" object
is taken into account when forming the group display. BOOLEAN write-read access.

3742

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the object for forming the group display will be considered:

Sub GroupDisplayConfiguration()
'VBA698
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.Relevant = True
End With
End Sub

See also
Group Object (Page 3348)

ResultType Property
Description
Defines or returns the value range evaluation type in the Dynamic dialog.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned and the associated property values will be assigned to
both the binary value ranges:

Sub AddDynamicDialogToCircleRadiusTypeBinary()
'VBA699
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_C", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBool
.BinaryResultInfo.NegativeValue = 20
.BinaryResultInfo.PositiveValue = 40
End With
End Sub

See also
DynamicDialog Object (Page 3325)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3743

VBA for Automated Configuration


5.5 VBA Reference

RightComma Property
Description
Defines or returns the number of decimal places (0 to 20) for the BarGraph object.

Example:
The "BarGraphConfiguration()" procedure configures In this example the number of decimal
places will be limited to 4.

Sub BarGraphConfiguration()
'VBA700
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.RightComma = 4
End With
End Sub

See also
BarGraph Object (Page 3286)

RotationAngle Property
Description
Line, Polygon and PolyLine
Defines or returns the rotation angle of the following objects in degrees: Line, Polygon,
PolyLine.
The object is displayed in Runtime only rotated clockwise around the reference point by the
specified value (starting from the configured starting position).
T-piece
Defines or returns the orientation of a T-piece in degrees. The attribute can only assume one
of four values:
0
90
180
270

The standard position of the T-piece is the shape of the letter "T"
The "leg" of the "T" points towards the left
The "leg" of the "T" points upwards
The "leg" of the "T" points to the right

Other values are automatically converted to modulus 360 and rounded up or down to the
nearest permissible value.

3744

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
The T-piece is shown rotated around the center point in the project and in Runtime.

Example:
The "PolyLineConfiguration()" procedure accesses the properties of the PolyLine object. In
this example the object will be rotated by 45 in Runtime:

Sub PolyLineConfiguration()
'VBA701
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects.AddHMIObject("PolyLine1", "HMIPolyLine")
With objPolyLine
.ReferenceRotationLeft = 50
.ReferenceRotationTop = 50
.RotationAngle = 45
End With
End Sub

See also
ReferenceRotationTop Property (Page 3742)
ReferenceRotationLeft Property (Page 3741)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

RoundCornerHeight Property
Description
Defines or returns the corner radius of the RoundRectangle object.
Enter the value as a percentage of half the height of the object.

Example:
The "RoundRectangleConfiguration()" procedure accesses the properties of the object
RoundRectangle. In this example the corner radius will be set to 25% (height) and 50% (width).

Sub RoundRectangleConfiguration()
'VBA702
Dim objRoundRectangle As HMIRoundRectangle
Set objRoundRectangle = ActiveDocument.HMIObjects.AddHMIObject("RoundRectangle1",
"HMIRoundRectangle")
With objRoundRectangle
.RoundCornerHeight = 25

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3745

VBA for Automated Configuration


5.5 VBA Reference

.RoundCornerWidth = 50
End With
End Sub

See also
RoundCornerWidth Property (Page 3748)
RoundRectangle Object (Page 3422)

RoundCornerWidth Property
Description
Defines or returns the corner radius of the RoundRectangle object.
Enter the value as a percentage of half the width of the object.

Example:
The "RoundRectangleConfiguration()" procedure accesses the properties of the object
RoundRectangle. In this example the corner radius will be set to 25% (height) and 50% (width):

Sub RoundRectangleConfiguration()
'VBA703
Dim objRoundRectangle As HMIRoundRectangle
Set objRoundRectangle = ActiveDocument.HMIObjects.AddHMIObject("RoundRectangle1",
"HMIRoundRectangle")
With objRoundRectangle
.RoundCornerHeight = 25
.RoundCornerWidth = 50
End With
End Sub

See also
RoundCornerHeight Property (Page 3745)
RoundRectangle Object (Page 3422)

3746

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

S
SameSize Property
Description
TRUE, when all four buttons of a Group Display object have the same size. BOOLEAN writeread access.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example all four buttons will have the same size.

Sub GroupDisplayConfiguration()
'VBA704
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.SameSize = True
End With
End Sub

See also
GroupDisplay Object (Page 3350)

ScaleColor Property
Description
Defines or returns the color of the scale. LONG write-read access.
The "Scaling" property must be set to TRUE for the color to be displayed.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3747

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphConfiguration()" procedure configures In this example the scale will be
displayed and the scale color will be set to "Red":

Sub BarGraphConfiguration()
'VBA705
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Scaling = True
.ScaleColor = RGB(255, 0, 0)
End With
End Sub

See also
Scaling Property (Page 3751)
BarGraph Object (Page 3286)

ScaleTicks Property
Description
Defines or returns the number of scale sections for the BarGraph object.
A scale section is a part of the scale bounded by two long scale strokes or division ticks. If you
assign a value of "0" to the property, the appropriate scale marks will be calculated
automatically.

Example:
The "BarGraphConfiguration()" procedure configures In this example the number of scale
sections will be set to "10".

Sub BarGraphConfiguration()
'VBA706
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Scaling = True
.ScaleTicks = 10
End With
End Sub

3748

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
BarGraph Object (Page 3286)

Scaling Property
Description
TRUE if a scale is also used to display the values in the case of the BarGraph object. BOOLEAN
write-read access.

Example:
The "BarGraphConfiguration()" procedure configures the properties of the BarGraph object.
In this example the scale will be displayed and the scale color will be set to "Red":

Sub BarGraphConfiguration()
'VBA707
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Scaling = True
.ScaleColor = RGB(255, 0, 0)
End With
End Sub

See also
BarGraph Object (Page 3286)

ScalingMode property
Description
Defines the size to display the objects of the faceplate instance.
Default
1:1

Like scaling mode "proportional"


The faceplate type is displayed in the original size in the faceplate instance. If
the faceplate instance is too small, the size of the faceplate instance is adapted
to the size of the faceplate type.
Proportional The faceplate type is scaled in proportion with the size of the faceplate instance.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3749

VBA for Automated Configuration


5.5 VBA Reference

Example

ScalingType Property
Description
Defines or returns the type of bar scaling. Value range from 0 to 2.
The "Scaling" property must be set to TRUE for the color to be displayed.
Bar Scaling

Assigned Value

Linear

Logarithmic

Automatic

Example:
The "BarGraphConfiguration()" procedure configures In this example the bar scaling will be
set to "Linear":

Sub BarGraphConfiguration()
'VBA708
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.ScalingType = 0
.Scaling = True
End With
End Sub

See also
Scaling Property (Page 3749)
BarGraph Object (Page 3286)

3750

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

ScriptType Property
Description
Returns the script type (C or VBS) which was used to make a property or event dynamic. Read
only access.

Example:
In the following example a button and a circle will be inserted in the active picture. In Runtime
the radius of the circle will enlarge every time you click the button. In this case the script type
will be output:

Sub ExampleForPrototype()
'VBA709
Dim objButton As HMIButton
Dim objCircleA As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Dim strScriptType As String
Set objCircleA = ActiveDocument.HMIObjects.AddHMIObject("CircleA", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircleA
.Top = 100
.Left = 100
End With
With objButton
.Top = 10
.Left = 10
.Width = 200
.Text = "Increase Radius"
End With
'On every mouseclick the radius have to increase:
Set objEvent = objButton.Events(1)
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
Select Case objVBScript.ScriptType
Case 0
strScriptType = "VB script is used"
Case 1
strScriptType = "C-Skript is used"
End Select
MsgBox strScriptType
End Sub

See also
ScriptInfo Object (Page 3424)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3751

VBA for Automated Configuration


5.5 VBA Reference

ScrollBars Property
Description
TRUE if the picture window has scroll bars in Runtime. BOOLEAN write-read access.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA710
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

ScrollPositionX Property
Description
Specifies the horizontal positioning of the scroll bar in a picture window with slider, or returns
its value.

3752

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA808
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ScrollPositionX = 50
.ScrollPositionY = 50
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

ScrollPositionY Property
Description
Specifies the vertical positioning of the scroll bar in a picture window with slider, or returns its
value.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA809
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3753

VBA for Automated Configuration


5.5 VBA Reference

With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ScrollPositionX = 50
.ScrollPositionY = 50
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

ScrollPosX Property
Description
Defines or returns the X position of the scroll bars for the View object.

Example:
In the following example a copy of the active picture is created and then activated. The position
of the scroll bars will be set to 40 (X) and 10 (Y):

Sub CreateViewAndActivateView()
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
objView.ScrollPosX = 40
objView.ScrollPosY = 10
End Sub

See also
ScrollPosY Property (Page 3757)
View Object (Page 3466)

3754

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

ScrollPosY Property
Description
Defines or returns the Y position of the scroll bars for the View object.

Example:
In the following example a copy of the active picture is created and then activated. The position
of the scroll bars will be set to 40 (X) and 10 (Y):

Sub CreateViewAndActivateView()
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
objView.ScrollPosX = 40
objView.ScrollPosY = 10
End Sub

See also
ScrollPosX Property (Page 3754)
View Object (Page 3466)

SelBGColor Property
Description
Defines or returns the background color for the selected entry in the case of the TextList object.
LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the background color for the selected entry will be set to "Red":

Sub TextListConfiguration()
Dim objTextList As HMITextList
'

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3755

VBA for Automated Configuration


5.5 VBA Reference

'Neue TextListe ins aktuelle Bild einfgen:


Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.SelBGColor = RGB (255, 0, 0)
End With
End Sub

See also
TextList Object (Page 3441)

Selected Property
Description
TRUE if an object is selected in the picture. BOOLEAN write-read access.

Example:
In the following example two new objects will be inserted in the active picture and then selected:

Sub SelectObjects()
'VBA714
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
End Sub

See also
HMIObject Object (Page 3357)

3756

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Selection Property
Description
Returns a listing containing all the objects selected in the specified picture.
To return an element from the Selection listing you can use either the index number or the
object name.
You can use the Selection property, for example, to select all the objects in the picture.

Example:
In the following example all the objects in the active picture are selected:

Sub SelectAllObjectsInActiveDocument()
'VBA715
ActiveDocument.Selection.SelectAll
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
Document Object (Page 3319)

SelIndex property
Description
Defines or returns the index of which the associated text is highlighted in the combobox or list
box.

SelText property
Description
Shows the text defined with the "SelIndex" property which is highlighted in the ComboBox or
ListBox object. You cannot directly change the "Selected text" attribute. You change the
"Selected text" attribute by changing the "Selected box" attribute or the text itself in the "Font"
properties group.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3757

VBA for Automated Configuration


5.5 VBA Reference

SelTextColor Property
Description
Defines or returns the text color for the selected entry in the TextList object. LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the text color for the selected entry will be set to "Yellow":

Sub TextListConfiguration()
'VBA716
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.SelTextColor = RGB(255, 255, 0)
End With
End Sub

See also
TextList Object (Page 3441)

ServerName Property
Description
Returns the name of the specified ActiveX Control or of the embedded object. Read only
access.

Example
In the following example the ActiveX Control "WinCC Gauge Control" will be inserted in the
active picture and the name of the ActiveX Control will be output:

Sub AddActiveXControl()
'VBA717

3758

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim objActiveXControl As HMIActiveXControl


Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",
"XGAUGE.XGaugeCtrl.1")
With objActiveXControl
.Top = 40
.Left = 60
MsgBox .Properties("ServerName").value
End With
End Sub

See also
ActiveXControl Object (Page 3273)

ServerPrefix Property
Description
Defines the server which will hold the picture that is displayed in the picture window in Runtime,
or returns the name of the server.
Enter the server name followed by two colons: "<Servername>::". No check is made as to
whether the server actually exists.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA718
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = "my_Server::"
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3759

VBA for Automated Configuration


5.5 VBA Reference

See also
PictureWindow Object (Page 3396)

ShortCut Property
Description
Defines or returns a shortcut key sequence for a user-defined menu entry or user-defined icon.
The following keys are permitted in combination with <CTRL>, <ALT> and <SHIFT>:
Function keys <F1> to <F12>
The letter keys <A> to <Z> and the number keys <0> to <9>.
The following are not supported: the keys on the alphanumeric keypad, the cursor keys (e.g.
<Page Up>) and the remaining function keys such as <RETURN> and <ESC>. No distinction
is made upper and lower case. Key combinations with two or more letters or numbers are not
permitted, such as "CTRL+A+B", but the combination with two additional keys such as <CTRL
+ALT+A" is allowed.

Notes on using the ShortCut property


The key sequences used must be unique within the user-defined menus and toolbars in a
picture. Key sequences that you configure with VBA have priority over any key sequences that
may be present in the Graphics Designer. Within the user-defined menus and toolbars, picturespecific key sequences have priority over application-specific key sequences.
Note
Shortcut key sequences are only executed if the menu entry or the icon is visible and active.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line. The first menu entry receives the shortcut key sequence <CTRL+SHIFT+M>
for retrieval:

Sub CreateDocumentMenus()
'VBA719
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
'Add menu to menubar:
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
'Add menuitems to the new menu:

3760

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "&My first Menuitem")


Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "My second Menuitem")
'
'Add seperator to menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
'Add submenu to the menu:
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "My first submenu")
'
'Add menuitems to the submenu:
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "My first submenuitem")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "My second
submenuitem")
'
ActiveDocument.CustomMenus("DocMenu1").MenuItems(1).ShortCut = "CTRL+SHIFT+M"
End Sub

See also
Configuring Menus and Toolbars (Page 3020)
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)

ShowBadTagState property
Description
Determines if the object is grayed out when a bad quality code or tag status is detected. At
both objects, "HMIAdvancedAnalogDisplay" and "HMIAdvancedStateAnalogDisplay", the
property is used to specify whether the settings for the "PaintColor_QualityCodeBad" and
"PaintColor_QualityCodeUnCertain" properties are used.

SignificantMask Property
Description
Needed in Runtime for displaying the active message class with the highest priority in the
GroupDisplay object.
The value of the SignificantMask property represents an internal system output value does not
require any specific configuration by the user. Updating takes place in Runtime by clicking on
the object.

Example:
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3761

VBA for Automated Configuration


5.5 VBA Reference

See also
GroupDisplay Object (Page 3350)

Simulation property
Description
Specifies the interconnection with any tag that is used for simulation.

SimulationBit property
Description
Shows the bit position of the linked simulation tags that is used for evaluation.
The value of the simulation tag is only evaluated with the alarm status "OK".

Size Property
Description
Defines or returns the font size in points for a language-dependent font.

Example:
The following example sets the font attributes of a button for French and English:

Sub ExampleForLanguageFonts()
'VBA721
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "DefText"
Set colLangFonts = objButton.LDFonts
'
'Set font-properties for french:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'
'Set font-properties for english:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"

3762

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

See also
Underlined Property (Page 3801)
Parent Property (Page 3708)
LanguageID Property (Page 3643)
Italic Property (Page 3636)
Family Property (Page 3587)
Bold Property (Page 3513)
Application Property (Page 3484)
LanguageFont Object (Page 3365)

Sizeable Property
Description
TRUE if the size of the ApplicationWindow and PictureWindow objects can be changed in
Runtime. BOOLEAN write-read access.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example it is intended that the application window can be resized in Runtime:

Sub ApplicationWindowConfig()
'VBA722
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow1",
"HMIApplicationWindow")
With objAppWindow
.Sizeable = True
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3763

VBA for Automated Configuration


5.5 VBA Reference

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

SmallChange Property
Description
Defines how many steps the controller can be moved with one mouse click or returns the value.

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the number of steps will be set to "4":

Sub SliderConfiguration()
'VBA723
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.SmallChange = 4
End With
End Sub

See also
Slider object (Page 3428)

SnapToGrid Property
Description
TRUE if objects in the picture are aligned on the grid (which is invisible). BOOLEAN write-read
access.

Example:
In the following example, the alignment of objects in the active picture on the grid is activated:

Sub ActivateSnapToGrid()
'VBA724
ActiveDocument.SnapToGrid = True
End Sub

3764

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
Document Object (Page 3319)

SourceLink Property
Description
Returns the Source object. Use the SourceLink property to configure the source object in the
case of a direct connection.

Example:
In the following example the X position of "Rectangle_A" is copied to the Y position of
"Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA725
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 100
.Text = "SetPosition"
End With
'
'Directconnection is initiated by mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of Rectangle_B

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3765

VBA for Automated Configuration


5.5 VBA Reference

.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
Type Property (Page 3792)
ObjectName Property (Page 3698)
AutomationName Property (Page 3488)
SourceLink Object (Page 3431)
DirectConnection Object (Page 3318)

SourceCode Property
Description
Defines or returns the source code of a C script or VB script.
If you assign a C script to the SourceCode property, you must enter only the program code
located between the braces ("{}").
If you assign a VB script to the SourceCode property, you must enter only the program code
located between the Sub and EndSub keywords.
Note
If you use single quote marks (') or double quote marks (") in the program code, you must
enter an additional quote mark in front of every single or double quote mark so that the
program code can be correctly interpreted in the VBA editor.
The Compiled property returns TRUE if the source code was successfully compiled.

Example:
In the following example a button and a circle will be inserted in the active picture. In Runtime
the radius of the circle will enlarge every time you click the button. A VB script will be used for
this purpose:

Sub IncreaseCircleRadiusWithVBScript()
'VBA726
Dim objButton As HMIButton
Dim objCircleA As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo

3766

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim strCode As String


strCode = "Dim objCircle" & vbCrLf & "Set objCircle = "
strCode = strCode & "hmiRuntime.ActiveScreen.ScreenItems(""CircleVB"")"
strCode = strCode & vbCrLf & "objCircle.Radius = objCircle.Radius + 5"
Set objCircleA = ActiveDocument.HMIObjects.AddHMIObject("CircleVB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircleA
.Top = 100
.Left = 100
End With
With objButton
.Top = 10
.Left = 10
.Width = 200
.Text = "Increase Radius"
End With
'
'On every mouseclick the radius have to increase:
Set objEvent = objButton.Events(1)
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
objVBScript.SourceCode = strCode
Select Case objVBScript.Compiled
Case True
MsgBox "Compilation ok!"
Case False
MsgBox "Error on compilation!"
End Select
End Sub

See also
Compiled Property (Page 3556)
ScriptInfo Object (Page 3424)

StartAngle Property
Description
Defines or returns the start of the object for the CircularArc, EllipseArc, EllipseSegment and
PieSegment objects. The information is in counterclockwise direction in degrees, beginning at
the 12:00 clock position.

Example:
The "PieSegmentConfiguration()" procedure accesses the properties of the Pie Segment. In
this example the pie segment begins at 40 and ends at 180:

Sub PieSegmentConfiguration()
'VBA727

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3767

VBA for Automated Configuration


5.5 VBA Reference

Dim PieSegment As HMIPieSegment


Set PieSegment = ActiveDocument.HMIObjects.AddHMIObject("PieSegment1", "HMIPieSegment")
With PieSegment
.StartAngle = 40
.EndAngle = 180
End With
End Sub

See also
EndAngle Property (Page 3580)
PieSegment Object (Page 3399)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
CircularArc Object (Page 3303)

StatusText Property
Description
Defines or returns the text that will be displayed in the status bar when you point with the mouse
to a user-defined menu entry or user-defined icon.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line. A status bar entry will be defined for each menu entry:

Sub CreateDocumentMenus()
'VBA728
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
'Add menu:
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
'Add menuitems to custom-menu:
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "My first menuitem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "My second menuitem")
'
'Add seperator to custom-menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
'Add submenu to custom-menu:
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "My first submenu")

3768

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'
'Add menuitems to submenu:
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "My first submenuitem")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "My second
submenuitem")
'
'Assign statustexts to every menuitem
With objDocMenu
.MenuItems(1).StatusText = "My first menuitem"
.MenuItems(2).StatusText = "My second menuitem"
.MenuItems(4).SubMenu.Item(1).StatusText = "My first submenuitem"
.MenuItems(4).SubMenu.Item(2).StatusText = "My second submenuitem"
End With
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)

SubMenu Property
Description
Returns a MenuItems listing if the specified object is the "SubMenu" type.
Use the SubMenu listing if you wish to create a submenu in a user-defined menu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA730
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
'Add menu:
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
'Add menuitems to custom-menu:
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "My first menuitem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "My second menuitem")
'
'Add seperator to custom-menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3769

VBA for Automated Configuration


5.5 VBA Reference

'
'Add submenu to custom-menu:
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "My first submenu")
'
'Add menuitems to submenu:
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "My first submenuitem")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "My second
submenuitem")
End Sub

See also
MenuItem Object (Page 3382)

SymbolLibraries Property
Description
Returns a SymbolLibraries listing containing objects of the "SymbolLibrary" type.
Use SymbolLibraries(1) to return the "Global Library". Use SymbolLibraries(2) to return the
"Project Library".

Example:
In the following example the names of the libraries will be output:

Sub ShowSymbolLibraries()
'VBA731
Dim colSymbolLibraries As HMISymbolLibraries
Dim objSymbolLibrary As HMISymbolLibrary
Set colSymbolLibraries = Application.SymbolLibraries
For Each objSymbolLibrary In colSymbolLibraries
MsgBox objSymbolLibrary.Name
Next objSymbolLibrary
End Sub

See also
Application Object (Page 3282)

3770

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

T
TabOrderAlpha Property
Description
Defines or returns the position of the object in the TAB sequence for the alpha / tab order
cursor.

Example:
In this example two I/O fields will be inserted in the active picture and the TAB sequence will
then be defined:

Sub IOFieldConfig()
'VBA734
Dim objIOField1 As HMIIOField
Dim objIOField2 As HMIIOField
Set objIOField1 = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
Set objIOField2 = ActiveDocument.HMIObjects.AddHMIObject("IOField2", "HMIIOField")
With objIOField1
.Top = 10
.Left = 10
.TabOrderAlpha = 1
End With
With objIOField2
.Top = 100
.Left = 10
.TabOrderAlpha = 2
End With
End Sub

See also
Document Object (Page 3319)

TabOrderAllHMIObjects Property
Description
TRUE if all the objects in a picture are to be included in the configured TAB sequence.
BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3771

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ConfigureTabOrder()" procedure defines which objects in the active picture are to be
included in the configured TAB sequence. In this example all the objects will be included in
the TAB sequence:

Sub ConfigureTabOrder()
'VBA733
With ActiveDocument
.TABOrderAllHMIObjects = True
.TABOrderKeyboard = False
.TABOrderMouse = False
.TABOrderOtherAction = False
End With
End Sub

See also
TabOrderOtherAction Property (Page 3775)
TabOrderMouse Property (Page 3775)
TabOrderKeyboard Property (Page 3774)
Document Object (Page 3319)

TabOrderKeyboard Property
Description
TRUE if objects with a keyboard operation event configured to them are to be included in the
configured TAB sequence. BOOLEAN write-read access.

Example:
The "ConfigureTabOrder()" procedure defines which objects in the active picture are to be
included in the configured TAB sequence. In this example objects with a keyboard operation
will be included in the TAB sequence:

Sub ConfigureTabOrder()
'VBA735
With ActiveDocument
.TABOrderAllHMIObjects = True
.TABOrderKeyboard = False
.TABOrderMouse = False
.TABOrderOtherAction = False
End With
End Sub

3772

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
TabOrderOtherAction Property (Page 3775)
TabOrderMouse Property (Page 3775)
TabOrderAllHMIObjects Property (Page 3771)
Document Object (Page 3319)

TabOrderMouse Property
Description
TRUE if objects with a mouse operation event configured to them are to be included in the
configured TAB sequence. BOOLEAN write-read access.

Example:
The "ConfigureTabOrder()" procedure defines which objects in the active picture are to be
included in the configured TAB sequence. In this example objects with a mouse operation
event will be included in the TAB sequence:

Sub ConfigureTabOrder()
'VBA736
With ActiveDocument
.TABOrderAllHMIObjects = True
.TABOrderKeyboard = False
.TABOrderMouse = False
.TABOrderOtherAction = False
End With
End Sub

See also
TabOrderOtherAction Property (Page 3775)
TabOrderKeyboard Property (Page 3772)
TabOrderAllHMIObjects Property (Page 3771)
Document Object (Page 3319)

TabOrderOtherAction Property
Description
TRUE if objects with an event other than a mouse or keyboard operation event configured to
them are to be included in the configured TAB sequence. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3773

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "ConfigureTabOrder()" procedure defines which objects in the active picture are to be
included in the configured TAB sequence. In this example objects with events other than a
mouse or keyboard operation will be included in the TAB sequence:

Sub ConfigureTabOrder()
'VBA737
With ActiveDocument
.TABOrderAllHMIObjects = True
.TABOrderKeyboard = False
.TABOrderMouse = False
.TABOrderOtherAction = False
End With
End Sub

See also
TabOrderMouse Property (Page 3773)
TabOrderKeyboard Property (Page 3772)
TabOrderAllHMIObjects Property (Page 3771)
Document Object (Page 3319)

TabOrderSwitch Property
Description
Defines or returns the position of the object in the TAB sequence.

Example:
In this example two I/O fields will be inserted in the active picture and the TAB sequence will
then be defined:

Sub IOFieldConfig()
'VBA732
Dim objIOField1 As HMIIOField
Dim objIOField2 As HMIIOField
Set objIOField1 = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
Set objIOField2 = ActiveDocument.HMIObjects.AddHMIObject("IOField2", "HMIIOField")
With objIOField1
.Top = 10
.Left = 10
.TabOrderSwitch = 1
End With
With objIOField2
.Top = 100

3774

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.Left = 10
.TabOrderSwitch = 2
End With
End Sub

See also
HMIObject Object (Page 3357)

Tag Property
Description
Defines or returns information text for a user-defined menu entry or user-defined icon. You
can use the Tag property for example to briefly describe what the menu entry does.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA738
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
'Add menu:
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
'Add menuitems to custom-menu:
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "My first menuitem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "My second menuitem")
'
'Add seperator to custom-menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
'Add submenu to custom-menu:
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "My first submenu")
'
'Add menuitems to submenu:
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "My first submenuitem")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "My second
submenuitem")
'
'To place an additional information:
With objDocMenu
.MenuItems(1).Tag = "This is the first menuitem"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3775

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)

Tag property
Description
Is used for the "Graphic Object Update Wizard" tool and is not evaluated for the
"HMIAdvancedAnalogDisplay" and "HMIAdvancedStateAnalogDisplay" objects.

tagname property
Description
Is used for the "Graphic Object Update Wizard" tool and is not evaluated for the
"HMIAdvancedAnalogDisplay" and "HMIAdvancedStateAnalogDisplay" objects.

TagPrefix Property
Description
Defines or returns the tag prefix for all the tags contained in the Picture Window object.
Example:
The picture "InputOutput" is to be displayed in the picture window. The picture "InputOutput"
contains three I/O fields which are linked to a structure tag. The structure tag consists of the
elements EA1, EA2, EA3; one element each for each I/O field.
Three such structure tags have been define in the project, with structure names Struct1, Struct2
and Struct3.
The tag prefix is in this case the structure name followed by a period. Specify the tag prefix
as, say, Struct2. (the period is necessary in order to address the elements of the structure tag
as structure elements in a syntactically correct way). The I/O fields in the picture "InputOutput"
are then linked to the elements in structure tag Struct2:
Tag Prefix: "Struct2."
Output value (first I/O field): EA1
Output value (second I/O field): EA2
Output value (third I/O field): EA3

3776

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
The current tag connection in the picture window is then
Output value (first I/O field): Struct2.EA1
Output value (second I/O field): Struct2.EA2
Output value (third I/O field): Struct2.EA3

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA739
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = "my_Server::"
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

TagScaleParam1 property
Description
Sets the value1 for the value range process.

TagScaleParam2 property
Description
Sets the value2 for the value range process.
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3777

VBA for Automated Configuration


5.5 VBA Reference

TagScaleParam3 property
Description
Sets the value3 for the value range process.

TagScaleParam4 property
Description
Sets the value4 for the value range process.

TagStartvaluePersistence property
Description
Defines whether an internal tag is set as persistent. You can only set internal tags as persistent.

tagtype property
Description
Is used for the "Graphic Object Update Wizard" tool and is not evaluated for the
"HMIAdvancedAnalogDisplay" and "HMIAdvancedStateAnalogDisplay" objects.

Template property
Description
Returns the template for displaying the window content of the "ApplicationWindow" object.
Read only access.
The "ApplicationWindow" object can be supplied from applications of the Global Script and the
report system:
GSC Diagnostics

The application window is supplied by applications of the Global Script. The results of the
diagnostics system are displayed.

GSC Runtime

The application window is supplied by applications of the Global Script. The analysis results
regarding characteristics in Runtime are displayed.

All Jobs

The application window is supplied by the report system. The available reports are displayed as
a list.

All Jobs Shortcut Menu

The application window is supplied by the report system. The available reports are displayed as
a list. The shortcut menu enables the selection of print options, display of a print preview as well
as a printout of the report.

3778

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Job Detail View

The application window is supplied by the report system. The available reports are displayed in
a selection menu. Detailed information is displayed for the selected report.

Selected Jobs - Shortcut


Menu

The application window is supplied by the report system. The available reports are displayed as
a list. This list only contains reports which you have activated the option "Mark for print job list"
in the "Print Job Properties" dialog. The shortcut menu enables the selection of print options,
display of a print preview as well as a printout of the report.

See also
ApplicationWindow Object (Page 3284)

Text Property
Description
Defines or returns the labeling for an object.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the label will be defined:

Sub ButtonConfiguration()
'VBA740
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.Text = "Button1"
End With
End Sub

See also
Button Object (Page 3293)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)

TextBiblIDs property
Description
Only used internally.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3779

VBA for Automated Configuration


5.5 VBA Reference

See also
TextList Object (Page 3441)

TitleBackColorActiveEnd property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

TitleBackColorActiveStart property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

TitleBackColorInactiveEnd property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

TitleBackColorInactiveStart property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

3780

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

TitleForeColorActive property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

TitleForeColorInactive property
Description
Only used internally.

See also
PictureWindow Object (Page 3396)

Toggle Property
Description
TRUE, if the button or round button should lock after being operated in Runtime. BOOLEAN
write-read access.

Example:
The "RoundButtonConfiguration()" procedure accesses the properties of the RoundButton. In
this example the round button is intended to latch down when pressed in Runtime:

Sub RoundButtonConfiguration()
'VBA741
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("RButton1", "HMIRoundButton")
With objRoundButton
.Toggle = True
End With
End Sub

See also
RoundButton Object (Page 3418)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3781

VBA for Automated Configuration


5.5 VBA Reference

ToleranceHigh Property
Description
Defines or returns the limit value for "Tolerance high".
The type of the evaluation (in percent or absolute) is defined in the TypeToleranceHigh
property.
Monitoring of the limit value only takes effect when the CheckToleranceHigh property is set to
"True".

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the limit values. In
this example the limit value for "Tolerance High" will be configured:

Sub BarGraphLimitConfiguration()
'VBA742
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeToleranceHigh = False
'Activate monitoring
.CheckToleranceHigh = True
'Set barcolor = "yellow"
.ColorToleranceHigh = RGB(255, 255, 0)
'Set upper limit to "40"
.ToleranceHigh = 40
End With
End Sub

See also
TypeToleranceHigh Property (Page 3797)
CheckToleranceHigh Property (Page 3537)
BarGraph Object (Page 3286)

ToleranceLow Property
Description
Defines or returns the limit value for "Tolerance low".
The type of the evaluation (in percent or absolute) is defined in the TypeToleranceLow property.
Monitoring of the limit value only takes effect when the CheckToleranceLow property is set to
"True".

3782

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the limit values. In
this example the limit value for "Tolerance Low" will be configured.

Sub BarGraphLimitConfiguration()
'VBA743
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeToleranceLow = False
'Activate monitoring
.CheckToleranceLow = True
'Set barcolor = "red"
.ColorToleranceLow = RGB(255, 0, 0)
'Set lower limit to "40"
.ToleranceLow = 40
End With
End Sub

See also
TypeToleranceLow Property (Page 3798)
CheckToleranceLow Property (Page 3538)
BarGraph Object (Page 3286)

ToolbarItems Property
Description
Returns a listing containing all the elements (icons and separation lines) of a user-defined
toolbar.

Example
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA744
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")
'
'Add symbol-icon to userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "My first
symbol-icon")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3783

VBA for Automated Configuration


5.5 VBA Reference

Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "My second


symbol-icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
ToolbarItem Object (Page 3448)
Toolbar Object (Page 3445)

ToolbarItemType property
Description
Returns the type of the "HMIToolbarItem" object of a user-defined toolbar as a "string".
Returned Value

Type in the toolbar

Separator

Icon

Example
In the following example the type of the first object in the first user-defined toolbar in the active
picture is output:

Sub ShowFirstObjectOfCollection()
'VBA353
Dim strType As String
strType = ActiveDocument.CustomToolbars(1).ToolbarItems(1).ToolbarItemType
MsgBox strType
End Sub

ToolTipText Property
Description
Defines or returns the text that will be displayed as a Tooltip when you run the mouse over an
object (HMIObject, icon).

3784

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "RectangleConfiguration()" procedure accesses the properties of the Rectangle object. In
this example a tool tip text will be assigned to the rectangle:

Sub RectangleConfiguration()
'VBA745
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.ToolTipText = "This is a rectangle"
End With
End Sub

The following example shows how you have to initialize the property prior to dynamization:

Sub Dyn()
'VBA823
Dim objCircle As HMICircle
Dim doc As Document
Dim objDynDialog As HMIDynamicDialog
Set doc = ActiveDocument
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle","HMICircle")
objCircle.ObjectName = "Circle1"
objCircle.BorderColor = RGB(255, 0, 0)
objCircle.BackColor = RGB(0, 255, 0)
objCircle.ToolTipText = "Text"
Set objDynDialog =
objCircle.ToolTipText.CreateDynamic(hmiDynamicCreationTypeDynamicDialog, "'Var'")
End Sub

See also
ToolbarItem Object (Page 3448)
HMIObject Object (Page 3357)
How to dynamize a property with the Dynamic dialog (Page 3084)

Top Property
Description
Defines or returns the Y-coordinate of an object (measured from the top left edge of the picture)
in pixels. The Y-coordinate relates to the top left corner of the rectangle enclosing the object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3785

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "RectangleConfiguration()" procedure accesses the properties of the Rectangle object. In
this example the rectangle will be set to position 10/40:

Sub RectangleConfiguration()
'VBA746
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.Left = 10
.Top = 40
End With
End Sub

See also
View Object (Page 3466)
HMIObject Object (Page 3357)

TopConnectedObjectName Property
Description
Returns the name of the end object to which the connector is connected. Read only access.

Example:
An example showing how to use the BottomConnectedObjectName property can be found in
this documentation under the heading "ObjConnection Object".

See also
ObjConnection object (Page 3388)

TopConnectedConnectionPointIndex Property
Description
Returns the connection point on the object to which the connector is connected.

3786

Connection Point

Assigned Value

Up

Right

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Connection Point

Assigned Value

Down

Left

Example:
An example showing how to use the BottomConnectedObjectName property can be found in
this documentation under the heading "ObjConnection Object".

See also
ObjConnection object (Page 3388)

Transparency property
Description
Defines the degree of transparency of the object display. Values between 0 and 100 indicate
the transparency as a percentage. In the case of a semi-transparent objects other objects
shine through. A 100% transparent object is invisible. An invisible object can also be controlled
in Runtime.

Example

Sub addTransparentObject()
'VBA849
Dim objHMICircle As HMICircle
Set objHMICircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
objHMICircle.Transparency = 40
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3787

VBA for Automated Configuration


5.5 VBA Reference

Trend Property
Description
TRUE if the trend or tendency of the measured value being monitored (rising or falling) is to
be indicated by a little arrow. BOOLEAN write-read access.

Example:
The "BarGraphConfiguration()" procedure configures In this example the trend of the
measured value will be indicated:

Sub BarGraphConfiguration()
'VBA747
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.trend = True
End With
End Sub

See also
BarGraph Object (Page 3286)

trend property
Description
Is used for the "Graphic Object Update Wizard" tool and is not evaluated for the
"HMIAdvancedAnalogDisplay" and "HMIAdvancedStateAnalogDisplay" objects.

TrendColor Property
Description
Defines or returns the color of the trend display.
The trend display indicates the tendency (rising or falling) of the measuring value being
monitored by a small arrow. In order to activate the trend display, the Trend property must be
set to "True". LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

3788

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphConfiguration()" procedure configures In this example the trend in the measured
value will be indicated. The trend display will be set to "Red":

Sub BarGraphConfiguration()
'VBA748
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.trend = True
.TrendColor = RGB(255, 0, 0)
End With
End Sub

See also
Trend Property (Page 3788)
BarGraph Object (Page 3286)

Trigger Property
Description
Returns a Trigger object. Use the Trigger property when making a property dynamic with the
aid of a script.

Example:
In this example the "Radius" property of a circle will be made dynamic with the aid of a C script
(the output value sets the radius):

Sub AddDynamicAsCSkriptToProperty()
'VBA749
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3789

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
Trigger Object (Page 3452)
ScriptInfo Object (Page 3424)

Type Property
Description
Returns or defines the type of an object.
The object type is returned as either a string or and integer.

Example:
The "RectangleConfiguration()" procedure accesses the properties of the Rectangle object. In
this example the object type will be output:

Sub RectangleConfiguration()
'VBA750
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
MsgBox "Objecttype: " & .Type
End With
End Sub

See also
Trigger Object (Page 3452)
ToolbarItem Object (Page 3448)
SourceLink Object (Page 3431)
Property Object (Page 3409)
HMIObject Object (Page 3357)
FolderItem Object (Page 3342)
DestLink Object (Page 3316)

3790

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

TypeAlarmHigh Property
Description
TRUE, when the upper limit value, at which an alarm is triggered, should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value. BOOLEAN writeread access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50".

Sub BarGraphLimitConfiguration()
'VBA751
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeAlarmHigh = False
'Activate monitoring
.CheckAlarmHigh = True
'Set barcolor = "yellow"
.ColorAlarmHigh = RGB(255, 255, 0)
'Set upper limit = "50"
.AlarmHigh = 50
End With
End Sub

See also
ColorAlarmHigh Property (Page 3542)
CheckAlarmHigh Property (Page 3531)
AlarmHigh Property (Page 3478)
BarGraph Object (Page 3286)

TypeAlarmLow Property
Description
TRUE, when the lower limit value, at which an alarm is triggered, should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value. BOOLEAN writeread access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3791

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10".

Sub BarGraphLimitConfiguration()
'VBA752
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set barcolor = "yellow"
.ColorAlarmLow = RGB(255, 255, 0)
'Set lower limit = "10"
.AlarmLow = 10
End With
End Sub

See also
ColorAlarmLow Property (Page 3543)
CheckAlarmLow Property (Page 3532)
AlarmLow Property (Page 3479)
BarGraph Object (Page 3286)

TypeLimitHigh4 Property
Description
TRUE, when the "Reserve 4" upper limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "70".

Sub BarGraphLimitConfiguration()
'VBA753
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph

3792

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'Set analysis = absolute


.TypeLimitHigh4 = False
'Activate monitoring
.CheckLimitHigh4 = True
'Set barcolor = "red"
.ColorLimitHigh4 = RGB(255, 0, 0)
'Set upper limit = "70"
.LimitHigh4 = 70
End With
End Sub

See also
LimitHigh4 Property (Page 3659)
CheckLimitHigh4 Property (Page 3534)
BarGraph Object (Page 3286)

TypeLimitHigh5 Property
Description
TRUE, when the "Reserve 5" upper limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "80".

Sub BarGraphLimitConfiguration()
'VBA754
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeLimitHigh5 = False
'Activate monitoring
.CheckLimitHigh5 = True
'Set barcolor = "black"
.ColorLimitHigh5 = RGB(0, 0, 0)
'Set upper limit = "70"
.LimitHigh5 = 70
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3793

VBA for Automated Configuration


5.5 VBA Reference

See also
LimitHigh5 Property (Page 3660)
CheckLimitHigh5 Property (Page 3534)
BarGraph Object (Page 3286)

TypeLimitLow4 Property
Description
TRUE, when the "Reserve 4" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "5".

Sub BarGraphLimitConfiguration()
'VBA755
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeLimitLow4 = False
'Activate monitoring
.CheckLimitLow4 = True
'Set barcolor = "green"
.ColorLimitLow4 = RGB(0, 255, 0)
'Set lower limit = "5"
.LimitLow4 = 5
End With
End Sub

See also
LimitLow4 Property (Page 3661)
ColorLimitLow4 Property (Page 3547)
CheckLimitLow4 Property (Page 3535)
BarGraph Object (Page 3286)

3794

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

TypeLimitLow5 Property
Description
TRUE, when the "Reserve 5" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "0".

Sub BarGraphLimitConfiguration()
'VBA756
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeLimitLow5 = False
'Activate monitoring
.CheckLimitLow5 = True
'Set barcolor = "white"
.ColorLimitLow5 = RGB(255, 255, 255)
'Set lower limit = "0"
.LimitLow5 = 0
End With
End Sub

See also
LimitLow5 Property (Page 3661)
ColorLimitLow5 Property (Page 3548)
CheckLimitLow5 Property (Page 3536)
BarGraph Object (Page 3286)

TypeToleranceHigh Property
Description
TRUE, when the "Tolerance high" lower limit value should be evaluated as a percentage.
FALSE, when the evaluation should be as an absolute value. BOOLEAN write-read access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3795

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the limit values. In
this example the limit value for "Tolerance High" will be configured:

Sub BarGraphLimitConfiguration()
'VBA757
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeToleranceHigh = False
'Activate monitoring
.CheckToleranceHigh = True
'Set barcolor = "yellow"
.ColorToleranceHigh = RGB(255, 255, 0)
'Set upper limit = "40"
.ToleranceHigh = 40
End With
End Sub

See also
ColorToleranceHigh Property (Page 3549)
CheckToleranceHigh Property (Page 3537)
BarGraph Object (Page 3286)

TypeToleranceLow Property
Description
TRUE, when the "Tolerance low" lower limit value should be evaluated as a percentage.
FALSE, when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the limit values. In
this example the limit value for "Tolerance Low" will be configured:

Sub BarGraphLimitConfiguration()
'VBA758
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeToleranceLow = False
'Activate monitoring
.CheckToleranceLow = True

3796

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'Set barcolor = "red"


.ColorToleranceLow = RGB(255, 0, 0)
'Set lower limit = "10"
.ToleranceLow = 10
End With
End Sub

See also
ToleranceLow Property (Page 3782)
ColorToleranceLow Property (Page 3550)
CheckToleranceLow Property (Page 3538)
BarGraph Object (Page 3286)

TypeWarningHigh Property
Description
TRUE, when the "Warning high" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75".

Sub BarGraphLimitConfiguration()
'VBA759
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor = "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit = "75"
.WarningHigh = 75
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3797

VBA for Automated Configuration


5.5 VBA Reference

See also
WarningHigh Property (Page 3881)
ColorWarningHigh Property (Page 3552)
CheckWarningHigh Property (Page 3539)
BarGraph Object (Page 3286)

TypeWarningLow Property
Description
TRUE, when the "Warning low" lower limit value should be evaluated as a percentage. FALSE,
when the evaluation should be as an absolute value. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12".

Sub BarGraphLimitConfiguration()
'VBA760
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True
'Set barcolor = "magenta"
.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit = "12"
.WarningLow = 12
End With
End Sub

See also
WarningLow Property (Page 3882)
ColorWarningLow Property (Page 3553)
CheckWarningLow Property (Page 3539)
BarGraph Object (Page 3286)

3798

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

U
Underlined Property
Description
TRUE if the font attribute "Underline" is set for the language-dependent text in the object.
BOOLEAN write-read access.

Example:
The following example sets the font attributes of a button for French and English:

Sub ExampleForLanguageFonts()
'VBA761
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "DefText"
Set colLangFonts = objButton.LDFonts
'
'Set font-properties for french:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'
'Set font-properties for english:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

See also
Size Property (Page 3762)
Parent Property (Page 3708)
LanguageID Property (Page 3643)
Italic Property (Page 3636)
Family Property (Page 3587)
Bold Property (Page 3513)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3799

VBA for Automated Configuration


5.5 VBA Reference
Application Property (Page 3484)
LanguageFont Object (Page 3365)

UnselBGColor Property
Description
Defines or returns the background color of entries in the text list object which are not selected.
LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the colors will be defined for entries that are not selected in the selection list:

Sub TextListConfiguration()
'VBA762
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.UnselBGColor = RGB(255, 0, 0)
.UnselTextColor = RGB(0, 0, 0)
End With
End Sub

See also
TextList Object (Page 3441)

UnselTextColor Property
Description
In the case of the TextList object, defines or returns the color of text in the selection list for
entries that are not selected. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

3800

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "TextListConfiguration()" procedure accesses the properties of the object TextList. In this
example the colors will be defined for entries that are not selected in the selection list:

Sub TextListConfiguration()
'VBA763
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("myTextList", "HMITextList")
With objTextList
.UnselBGColor = RGB(255, 0, 0)
.UnselTextColor = RGB(0, 0, 0)
End With
End Sub

See also
TextList Object (Page 3441)

UpdateCycle Property
Description
Defines or returns the type and frequency of updates to the picture window in Runtime.
Update Cycle

Assigned Value

Upon change

250 ms

500 ms

1s

2s

5s

10 s

1 min

5 min

10 min

1h

10

User cycle 1

11

User cycle 2

12

User cycle 3

13

User cycle 4

14

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3801

VBA for Automated Configuration


5.5 VBA Reference
Update Cycle

Assigned Value

User cycle 5

15

Picture cycle

255

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be updated every 5 seconds in Runtime:

Sub PictureWindowConfig()
'VBA764
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.UpdateCycle = 5
End With
End Sub

See also
PictureWindow Object (Page 3396)

UseEventState property
Description
Specifies for the "HMIAdvancedStateDisplay" object whether the group value is evaluated for
the representation of the states.
If the group value is used, you can assign pictures for the individual alarm statuses.

UsedLanguage property
Description
Use the UsedLanguage property to set the code page that matches the character set used.
LONG write-read access.

Example
The "UsedLanguage" property and language ID "1033" are used in the following example to
set the code page to English US.

Sub AddDynamicAsCSkriptToProperty()

3802

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'VBA856
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
Dim strCode As String
strCode = "long lHeight;" & vbCrLf & "int check;" & vbCrLf
strCode = strCode & "GetHeight (""events.PDL"", ""myCircle""); & vbcrlf"
strCode = strCode & "lHeight = lHeight+5;" & vbCrLf
strCode = strCode & "check = SetHeight(""events.PDL"", ""myCircle"",lHeight);"
strCode = strCode & vbCrLf & "//Return-Type: BOOL" & vbCrLf
strCode = strCode & "return check;"
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_C", "HMICircle")
'Create dynamic for Property "Radius":
Set objCScript = objCircle.Height.CreateDynamic(hmiDynamicCreationTypeCScript)
'set Sourcecode and cycletime:
With objCScript
.SourceCode = strCode
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
'Set language English-US
.UsedLanguage = 1033
End With
End Sub

UseGlobalAlarmClasses property
Description
Defines whether to use globally configured alarm classes to visualize message events. The
property is only relevant for PCS7 projects.
Value

Description

TRUE

Activates the global settings made in PCS7 alarm editor for


visualizing the message events.

FALSE

Visualization of the message events is defined locally for each


message class.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3803

VBA for Automated Configuration


5.5 VBA Reference

UseGlobalSettings property
Description
Specify whether to use global settings to assign message events to the buttons visualized in
the group view. The display of the message events is configured using the "MessageClass"
properties. The property is only relevant for PCS7 projects.
Value

Description

TRUE

Activates the settings made in the PCS7 alarm editor for the
assignment of message events to the buttons in the group
display. The bit numbers in the group value are assigned to
the respective buttons.

FALSE

The message types are assigned locally to the buttons in the


group display.

UserValue1 Property
Description
Defines or returns any value in the case of the GroupDisplay object.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example four different user values will be assigned:

Sub GroupDisplayConfiguration()
'VBA765
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.UserValue1 = 0
.UserValue2 = 25
.UserValue3 = 50
.UserValue4 = 75
End With
End Sub

See also
UserValue4 Property (Page 3808)
UserValue3 Property (Page 3807)

3804

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
UserValue2-Eigenschaft (Page 3807)
GroupDisplay Object (Page 3350)

UserValue2-Eigenschaft
Description
Defines or returns any value in the case of the GroupDisplay object.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example four different user values will be assigned:

Sub GroupDisplayConfiguration()
'VBA766
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.UserValue1 = 0
.UserValue2 = 25
.UserValue3 = 50
.UserValue4 = 75
End With
End Sub

See also
UserValue4 Property (Page 3808)
UserValue3 Property (Page 3807)
UserValue1 Property (Page 3804)
GroupDisplay Object (Page 3350)

UserValue3 Property
Description
Defines or returns any value in the case of the GroupDisplay object.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3805

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example four different user values will be assigned:

Sub GroupDisplayConfiguration()
'VBA767
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.UserValue1 = 0
.UserValue2 = 25
.UserValue3 = 50
.UserValue4 = 75
End With
End Sub

See also
UserValue4 Property (Page 3808)
UserValue2-Eigenschaft (Page 3805)
UserValue1 Property (Page 3804)
GroupDisplay Object (Page 3350)

UserValue4 Property
Description
Defines or returns any value in the case of the GroupDisplay object.
The value can be evaluated by a script, for example. This value is neither evaluated nor
displayed in Runtime.

Example:
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example four different user values will be assigned:

Sub GroupDisplayConfiguration()
'VBA768
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.UserValue1 = 0
.UserValue2 = 25

3806

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.UserValue3 = 50
.UserValue4 = 75
End With
End Sub

See also
UserValue3 Property (Page 3805)
UserValue2-Eigenschaft (Page 3805)
UserValue1 Property (Page 3804)
GroupDisplay Object (Page 3350)

UseValueText property
Description
Specifies whether a text tag is used instead of a formatted analog value.

V
Value
Value Property
Description
Returns or defines the value of an object property.

Example:
Use the Value property if you wish to return or define a value with the aid of the Properties
listing. In this example the property of an ActiveX Control will be accessed via the Value
property:

Sub AddActiveXControl()
'VBA769
Dim objActiveXControl As HMIActiveXControl
Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge2",
"XGAUGE.XGaugeCtrl.1")
'
'Move ActiveX-Control:
objActiveXControl.Top = 40
objActiveXControl.Left = 60

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3807

VBA for Automated Configuration


5.5 VBA Reference

'
'Modify individual properties:
objActiveXControl.Properties("BackColor").value = RGB(255, 0, 0)
End Sub

See also
Property Object (Page 3409)

VALUE_ACCESS_FAULT Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Access
to tag not permitted" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle is given dynamics with the The dynamization
takes place be evaluating the status of a tag. If the tag does not return a status, a substitute
value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100

3808

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VALUE_MAX_LIMIT Property (Page 3841)
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_RANGE Property (Page 3843)
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HARDWARE_ERROR Property (Page 3835)
VALUE_HANDSHAKE_ERROR Property (Page 3833)
VALUE_CONVERSION_ERROR Property (Page 3832)
VALUE_ADDRESS_ERROR Property (Page 3811)
VariableStateValue Object (Page 3461)

VALUE_ADDRESS_ERROR Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status
"Addressing error" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3809

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA771
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_RANGE Property (Page 3843)

3810

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_MAX_LIMIT Property (Page 3841)
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HARDWARE_ERROR Property (Page 3835)
VALUE_HANDSHAKE_ERROR Property (Page 3833)
VALUE_CONVERSION_ERROR Property (Page 3832)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_BAD_COMMLUV Property
Description
Specifies the value assigned to a dynamized property if quality code "bad, no communication
(last usable value)" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA818
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3811

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_BAD_DEVICE Property (Page 3819)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_MISCSTATES Property (Page 3820)

3812

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_BAD_CONFERROR Property (Page 3817)
VALUE_BAD_COMMNUV Property (Page 3815)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_COMMNUV Property
Description
Specifies the value assigned to a dynamized property if quality code "bad, no communication
(last usable value)" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3813

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_MISCSTATES Property (Page 3820)
VALUE_BAD_DEVICE Property (Page 3819)
VALUE_BAD_CONFERROR Property (Page 3817)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

3814

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VALUE_BAD_CONFERROR Property
Description
Specifies the value assigned to a dynamized property if quality code "bad, no communication,
value not accepted" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3815

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_MISCSTATES Property (Page 3865)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_MISCSTATES Property (Page 3820)
VALUE_BAD_DEVICE Property (Page 3819)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

3816

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VALUE_BAD_DEVICE Property
Description
Specifies a value assigned to a dynamized property if quality code "bad, device failure" occurs,
or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3817

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_MISCSTATES Property (Page 3820)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_MISCSTATES Property
Description
Specifies the value assigned to a dynamized property if quality code "bad miscellaneous
states" occurs, or returns its value.

3818

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3819

VBA for Automated Configuration


5.5 VBA Reference

See also
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_NONSPECIFIC Property (Page 3822)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_NONSPECIFIC Property
Description
Specifies the value assigned to a dynamized property if quality code "bad, non-specific" occurs,
or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

3820

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3821

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NOTCONNECTED Property (Page 3824)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_NOTCONNECTED Property
Description
Specifies a value assigned to a dynamized property if quality code "bad, not connected" occurs,
or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()

3822

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_HIGHLIMITED Property (Page 3836)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3823

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3826)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_OUTOFSERV Property
Description
Specifies a value assigned to a dynamized property if quality code "bad, out of service" occurs,
or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog

3824

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_BAD_CONFERROR Property (Page 3815)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3825

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_PROCRELNOM Property (Page 3828)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_PROCRELNOM Property
Description
Specifies the value assigned to a dynamized property if quality code "bad, process related, no
maintenance" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'

3826

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'define a value for every state:


.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_LUV Property (Page 3861)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELSUB Property (Page 3830)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3827

VBA for Automated Configuration


5.5 VBA Reference
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_BAD_PROCRELSUB Property
Description
Specifies the value assigned to a dynamized property if quality code "bad, process related,
substitute value" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90

3828

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_HIGHLIMITED Property (Page 3836)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3829

VBA for Automated Configuration


5.5 VBA Reference
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_CONVERSION_ERROR Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status
"Conversion error" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA772
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160

3830

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_RANGE Property (Page 3843)
VALUE_MAX_LIMIT Property (Page 3841)
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HARDWARE_ERROR Property (Page 3835)
VALUE_HANDSHAKE_ERROR Property (Page 3833)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_HANDSHAKE_ERROR Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status
"Handshake error" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA773
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3831

VBA for Automated Configuration


5.5 VBA Reference

Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")


Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_RANGE Property (Page 3843)
VALUE_MAX_LIMIT Property (Page 3841)
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HARDWARE_ERROR Property (Page 3835)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)

3832

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_HARDWARE_ERROR Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "No
network module" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA774
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3833

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
VALUE_MAX_RANGE Property (Page 3843)
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_LIMIT Property (Page 3841)
VALUE_INVALID_KEY Property (Page 3838)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_HIGHLIMITED Property
Description
Specifies the value assigned to a dynamized property if quality code "high limited" occurs, or
returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")

3834

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,


"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3835

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_LOWLIMITED Property (Page 3840)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_INVALID_KEY Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Tag
not found" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA775
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True

3836

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_RANGE Property (Page 3843)
VALUE_MAX_LIMIT Property (Page 3841)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3837

VBA for Automated Configuration


5.5 VBA Reference

VALUE_LOWLIMITED Property
Description
Specifies the value assigned to a dynamized property if quality code "low limited" occurs, or
returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220

3838

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_BAD_PROCRELSUB Property (Page 3828)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3853)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_MAX_LIMIT Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Upper
limit exceeded" occurs.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3839

VBA for Automated Configuration


5.5 VBA Reference
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA776
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VALUE_MIN_LIMIT Property (Page 3844)
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)

3840

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MAX_RANGE Property (Page 3843)
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_MAX_RANGE Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Format
upper limit exceeded" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA777
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3841

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MIN_LIMIT Property (Page 3844)
VALUE_MAX_LIMIT Property (Page 3839)
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_MIN_LIMIT Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Lower
limit exceeded" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

3842

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA778
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_RANGE Property (Page 3846)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3843

VBA for Automated Configuration


5.5 VBA Reference
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_MIN_RANGE Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Format
lower limit exceeded" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA779
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90

3844

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_NOT_ESTABLISHED Property (Page 3847)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_NOT_ESTABLISHED Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "No
check-back message from the channel" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3845

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA780
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_SERVERDOWN Property (Page 3849)
VALUE_MIN_RANGE Property (Page 3844)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)

3846

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_SERVERDOWN Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Server
not available" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA781
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3847

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_STARTUP_VALUE Property (Page 3850)
VALUE_NOT_ESTABLISHED Property (Page 3845)
VALUE_MIN_RANGE Property (Page 3844)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_STARTUP_VALUE Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "Start
value" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

3848

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA782
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_TIMEOUT Property (Page 3852)
VALUE_SERVERDOWN Property (Page 3847)
VALUE_NOT_ESTABLISHED Property (Page 3845)
VALUE_MIN_RANGE Property (Page 3844)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

3849

VBA for Automated Configuration


5.5 VBA Reference
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_TIMEOUT Property
Description
Defines or returns the value that will be assigned to the dynamic property if tag status "No
connection" occurs.
The value of the VariableStateChecked property must be TRUE in order for the status to be
evaluated.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If the tag does not
return a status, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA783
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90

3850

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateChecked Property (Page 3874)
VALUE_STARTUP_VALUE Property (Page 3848)
VALUE_SERVERDOWN Property (Page 3847)
VALUE_NOT_ESTABLISHED Property (Page 3845)
VALUE_MIN_RANGE Property (Page 3844)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
VariableStateValue Object (Page 3461)

VALUE_UNCERT_ENGVHIGHLIM Property
Description
Specifies the value assigned to a dynamized property if quality code "uncertain, engineering
unit range violation, high limit set" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3851

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_BAD_PROCRELSUB Property (Page 3828)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)

3852

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3855)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_ENGVLOWLIM Property
Description
Specifies the value assigned to a dynamized property if quality code "uncertain, engineering
unit range violation, low limit set" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3853

VBA for Automated Configuration


5.5 VBA Reference

'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)

3854

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVONLIM Property (Page 3857)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_ENGVONLIM Property
Description
Specifies the value assigned to a dynamized property if quality code "uncertain, engineering
unit range violation, on limits set" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3855

VBA for Automated Configuration


5.5 VBA Reference

.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_SIMVAL Property (Page 3870)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3861)
VALUE_UNCERT_INITVAL Property (Page 3859)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)

3856

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_INITVAL Property
Description
Specifies a value assigned to a dynamized property if quality code "uncertain, initial value"
occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3857

VBA for Automated Configuration


5.5 VBA Reference

'define a value for every state:


.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_LUV Property (Page 3861)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)

3858

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_LUV Property
Description
Specifies a value assigned to a dynamized property if quality code "uncertain, last usable
value" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3859

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_HIGHLIMITED Property (Page 3834)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_MAINTDEM Property (Page 3863)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)

3860

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_MAINTDEM Property
Description
Specifies a value assigned to a dynamized property if quality code "uncertain, maintenance
demanded" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3861

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_MISCSTATES Property (Page 3865)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

3862

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

VALUE_UNCERT_MISCSTATES Property
Description
Specifies the value assigned to a dynamized property if quality code "uncertain miscellaneous
states" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3863

VBA for Automated Configuration


5.5 VBA Reference

.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_LOWLIMITED Property (Page 3838)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_NONSPECIFIC Property (Page 3866)
VALUE_UNCERT_MAINTDEM Property (Page 3861)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_NONSPECIFIC Property
Description
Specifies the value assigned to a dynamized property if quality code "uncertain, non-specific"
occurs, or returns its value.

3864

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3865

VBA for Automated Configuration


5.5 VBA Reference

See also
VALUE_UNCERT_MAINTDEM Property (Page 3861)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_PROCRELNOM Property (Page 3868)
VALUE_UNCERT_MISCSTATES Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_PROCRELNOM Property
Description
Specifies the value assigned to a dynamized property if quality code "uncertain, process
related, no maintenance" occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

3866

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_BAD_COMMNUV Property (Page 3813)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3867

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_SIMVAL Property (Page 3870)
VALUE_UNCERT_NONSPECIFIC Property (Page 3864)
VALUE_UNCERT_MISCSTATES Property (Page 3863)
VALUE_UNCERT_MAINTDEM Property (Page 3861)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_SIMVAL Property
Description
Specifies a value assigned to a dynamized property if quality code "uncertain, simulated value"
occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()

3868

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_BAD_PROCRELNOM Property (Page 3826)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SUBSTSET Property (Page 3872)
VALUE_UNCERT_PROCRELNOM Property (Page 3866)
VALUE_UNCERT_NONSPECIFIC Property (Page 3864)
VALUE_UNCERT_MISCSTATES Property (Page 3863)
VALUE_UNCERT_MAINTDEM Property (Page 3861)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3869

VBA for Automated Configuration


5.5 VBA Reference
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VALUE_UNCERT_SUBSTSET Property
Description
Specifies a value assigned to a dynamized property if quality code "uncertain, substitute set"
occurs, or returns its value.
In order for the quality code to be analyzed, the QualityCodeStateChecked property must be
TRUE.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. Dynamization uses the analysis of the quality code of a tag. If the tag fails to return a
quality code, a substitute value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA770
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog

3870

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of qualitycodestate
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60
.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

See also
VALUE_UNCERT_MISCSTATES Property (Page 3863)
QualityCodeStateChecked Properties (Page 3736)
VALUE_UNCERT_SIMVAL Property (Page 3868)
VALUE_UNCERT_PROCRELNOM Property (Page 3866)
VALUE_UNCERT_NONSPECIFIC Property (Page 3864)
VALUE_UNCERT_MAINTDEM Property (Page 3861)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3871

VBA for Automated Configuration


5.5 VBA Reference
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
QualityCodeStateValue Object (Page 3411)

VariablesExist Property
Description
TRUE when all the tags used in the source code of a DynamicDialog object are defined. Read
only access.
You can use this property to check whether all the tags that you have defined in the source
code of the Dynamic dialog are created in WinCC.

Example:
--

See also
DynamicDialog Object (Page 3325)

VariableStateChecked Property
Description
TRUE if the status of the specified tag is used in the dynamic dialog for dynamization.
BOOLEAN write-read access.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If a tag does not return

3872

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
a status, a substitute value (ElseCase property) is defined, a tag name is issued and three
analog value ranges are created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA785
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
DynamicDialog Object (Page 3325)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3873

VBA for Automated Configuration


5.5 VBA Reference

VariableStateType Property
Description
Returns the type of tag monitoring used to dynamize a property or an event: No monitoring,
quality code, or tag status. Read only access.
Index

VariableStateType

hmiNoVariableState

hmiVariableQCState

hmiVariableState

Example:
The procedure "GetVariableStateType()" reads the type of monitoring from the current
document. In this example, the type of monitoring is output in a message:

Sub GetVariableStateType()
'VBA819
Dim objDyn As HMIDynamicDialog
Set objDyn =
ActiveDocument.Properties("Width").CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'TestVal'")
MsgBox objDyn.VariableStateType
objDyn.Delete
End Sub

See also
DynamicDialog Object (Page 3325)

VariableStateValues Property
Description
Returns the VariableStateValues listing. Use the VariableStateValues property with the Item
property to assign a value to the tag status to be used for dynamization.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog. The dynamization takes place be evaluating the status of a tag. If a tag does not return

3874

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
a status, a substitute value (ElseCase property) is defined, a tag name is issued and three
analog value ranges are created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA786
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VariableStateValues Object (Listing) (Page 3462)
DynamicDialog Object (Page 3325)

VariableTriggers Property
Description
Returns the VariableTriggers listing. Use the VariableTriggers property in order to add a tag
trigger to a VB action or C action.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3875

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the radius of a circle is made dynamic with the aid of a VB script. A
tag trigger is used as the trigger:

Sub DynamicWithVariableTrigger()
'VBA787
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
'Triggername and cycletime are defined by add-methode
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With
End Sub

See also
VariableTriggers Object (Listing) (Page 3465)

VarName Property
Description
Defines the tag whose status is to be used in the Dynamic dialog for the purpose of dynamics,
or returns the name.

Example:
In this example the name of the trigger tag used for creating dynamics in the radius of a circle
will be output:

Sub GetVarName()
'VBA788
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.Item("Circle_VariableTrigger")
Set objVBScript = objCircle.Radius.Dynamic
With objVBScript
'Reading out of variablename
MsgBox "The radius is dynamicabled with: " & .Trigger.VariableTriggers.Item(1).VarName
End With
End Sub

3876

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
VariableStateValue Object (Page 3461)

VBAVersion Property
Description
Returns the VBA version number. Read only access.

Example:
In the following example the current VBA version number is output:

Sub ShowVBAVersion()
'VBA789
MsgBox Application.VBAVersion
End Sub

See also
Application Object (Page 3282)

VBE Property
Description
Returns the VB Extensibility object. Read access.

Example:
--

See also
Application Object (Page 3282)

Version Property
Description
Returns the version number of the specified application. Read only access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3877

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example the version number of the Graphics Designer is output:

Sub ShowVersionOfGraphicsDesigner()
'VBA791
MsgBox Application.Version
End Sub

See also
Application Object (Page 3282)

Views Property
Description
Returns the Views listing. Use the Views listing to create a new copy of a picture, for instance.

Example:
In the following example a copy of the active picture is created and then activated:

Sub AddView()
'VBA792
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Views Object (Listing) (Page 3468)

Visible Property
Description
TRUE if the specified object is intended to be visible. BOOLEAN write-read access.

3878

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example a circle will be inserted into the active picture. This circle is not
intended to be visible in Runtime:

Sub HideCircleInRuntime()
'VBA793
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
objCircle.Visible = False
End Sub

See also
ToolbarItem Object (Page 3448)
MenuItem Object (Page 3382)
HMIObject Object (Page 3357)
Document Object (Page 3319)
Toolbar Object (Page 3445)
Menu Object (Page 3378)
Application Object (Page 3282)

W-Z
WarningHigh Property
Description
Defines or returns the high limit value "Warning High" in the case of the BarGraph object.
The "CheckWarningHigh" property must be set to "True" in order for the limit value to be
monitored.
The display on reaching the limit value and the type of evaluation are defined via the properties
ColorWarningHigh and TypeWarningHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75".

Sub BarGraphLimitConfiguration()
'VBA794

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3879

VBA for Automated Configuration


5.5 VBA Reference

Dim objBarGraph As HMIBarGraph


Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor = "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit = "75"
.WarningHigh = 75
End With
End Sub

See also
TypeWarningHigh Property (Page 3797)
ColorWarningHigh Property (Page 3552)
CheckWarningHigh Property (Page 3539)
BarGraph Object (Page 3286)

WarningLow Property
Description
Defines or returns the low limit value "Warning Low" in the case of the BarGraph object.
The "CheckWarningLow" property must be set to "True" in order for the limit value to be
monitored.
The display on reaching the limit value and the type of evaluation are defined via the properties
ColorWarningLow and TypeWarningLow.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12".

Sub BarGraphLimitConfiguration()
'VBA795
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True

3880

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'Set barcolor = "magenta"


.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit = "12"
.WarningLow = 75
End With
End Sub

See also
TypeWarningLow Property (Page 3798)
ColorWarningLow Property (Page 3553)
CheckWarningLow Property (Page 3539)
BarGraph Object (Page 3286)

Width Property
Description
Defines or returns the width of an object in pixels.

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same width:

Sub ApplySameWidthToSelectedObjects()
'VBA796
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Width = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3881

VBA for Automated Configuration


5.5 VBA Reference

.Width = 120
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameWidth
End Sub

See also
HMIObject Object (Page 3357)

WinCCStyle property
Description
Defines the style in which the object is displayed.
User-defined
global
Windows Style

Shows the object according to the respective settings.


Shows the object in a globally defined design.
Shows the object in Windows style.

Example

WindowBorder Property
Description
TRUE if it is intended that the application window or picture window shall be displayed with a
border in Runtime. BOOLEAN write-read access.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will

Sub ApplicationWindowConfig()
'VBA797
Dim objAppWindow As HMIApplicationWindow

3882

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow",


"HMIApplicationWindow")
With objAppWindow
.Caption = True
.CloseButton = False
.Height = 200
.Left = 10
.MaximizeButton = True
.Moveable = False
.OnTop = True
.Sizeable = True
.Top = 20
.Visible = True
.Width = 250
.WindowBorder = True
End With
End Sub

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

WindowMonitorNumber property
Description
Defines the monitor on which the picture window is displayed. This requires that the system
supports more than one monitor. The attribute is only effective if the "Independent window"
attribute is set to "Yes".
1-n

The number of the monitor in the operating system on which the picture window is
displayed.

Example

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3883

VBA for Automated Configuration


5.5 VBA Reference

WindowPositionMode property
Description
Defines the position and scaling of the picture window on the screen. The property is only
effective if the "Independent window" attribute is set to "Yes".
Standard
Center
Maximize

The picture window is positioned in its original size in the configured position
on the screen.
The picture window is positioned in its original size, centered on the screen.
The picture window is scaled to the size of the screen.

Example

WindowsStyle property
Description
Defines whether the object is displayed in the Windows style of WinCC version 6.2. It can only
be selected if "WinCC Classic" is chosen as the current design.
yes
No

Shows the object using the Windows style from WinCC version 6.2.
Shows the object not using the Windows style from WinCC version 6.2.

Example

3884

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

WindowState Property
Description
Returns the status of the window containing the specified application. READ access.
WindowState

Assigned Value

Maximized

Minimized

Custom sized

Example:
In the following example the window status of the Graphics Designer is output:

Sub ShowWindowState()
'VBA798
Dim strState As String
Select Case Application.WindowState
Case 0
strState = "The application-window is maximized"
Case 1
strState = "The applicationwindow is minimized"
Case 2
strState = "The application-window has a userdefined size"
End Select
MsgBox strState
End Sub

See also
Application Object (Page 3282)

ZeroPoint Property
Description
Defines or returns the position of the zero point on the bar in the case of the BarGraph object.
Specify the value as a %age of the total bar height. The zero point can also be outside of the
range represented.
The "ScalingType" property must be set to "2" and "Scaling" must be set to "True".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3885

VBA for Automated Configuration


5.5 VBA Reference

Example:
The "BarGraphConfiguration()" procedure configures In this example the zero point is located
halfway up the bar height:

Sub BarGraphConfiguration()
'VBA799
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Scaling = True
.ScalingType = 2
.ZeroPoint = 50
.ZeroPointValue = 0
End With
End Sub

See also
ZeroPointValue Property (Page 3888)
ScalingType Property (Page 3750)
Scaling Property (Page 3749)
BarGraph Object (Page 3286)

ZeroPointValue Property
Description
Defines or returns the absolute value for the zero point.

Example:
The "BarGraphConfiguration()" procedure configures In this example the absolute value of the
zero point will be set to "0".

Sub BarGraphConfiguration()
'VBA800
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Scaling = True
.ScalingType = 2
.ZeroPointValue = 0
End With
End Sub

3886

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
ZeroPoint Property (Page 3885)
ScalingType Property (Page 3750)
Scaling Property (Page 3749)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

Zoom Property
Description
Defines or returns the zoom factor.

Example:
In this example a copy of the active picture is created and the zoom factor is set to 50%:

Sub CreateViewFromActiveDocument()
'VBA801
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Zoom = 50
End Sub

See also
View Object (Page 3466)
PictureWindow Object (Page 3396)

5.5.2

VBA in Other WinCC Editors

5.5.2.1

VBA in Other WinCC Editors

Introduction
In addition to Graphics Designer, you can automate the following WinCC editors with VBA:
Tag Management
Tag Logging

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3887

VBA for Automated Configuration


5.5 VBA Reference
Text library
Alarm Logging
The functions for accessing the editors are contained in the "HMIGO" class.

Requirement
The "HMIGenObjects.dll" file is referenced. This happens automatically during WinCC
installation.

Principle
For access to the "HMIGO" class with VBA, you must reference the "HMI GeneralObjects 1.0
Type Library" in the VBA editor via the "Tools > References" menu. You must create a new
instance of this class in the program code, e.g.:
'Dim HMIGOObject As New HMIGO
Create several different objects of this class if access several objects at the same time. Two
instances of the "HMIGO" class are required, for example, in Tag Logging: The first instance
is required for access to the archive tags, the second instance for access to the process value
archive.

Application
To enable you to use the functions and properties of the editors in VBA, you must have opened
a project in WinCC.
You can then, for example, do the following directly from the program code:
Create several tags and change the values
Edit text entries in the TextLibrary
Adapt messages.

Querying Object State


The "HMIGO" class has the enumeration "HMIGO_OBJECT_STATE" which returns the state
of the specified object. The enumeration can return the following values:
OBJECT_EMPTY (2): Connection to the object is not available.
OBJECT_OPENED (3): Connection to objects exists. You can change and read its
parameters.
OBJECT_MODIFIED (4): An object's parameters have been changed. If the corresponding
Commit function is not called, the changes are not saved.
WINCC_CONNECTED (1): The object is connected to the WinCC project. By default this
connection is established when a function is called the first time. To release the connection,
use the instruction "HMIGO = nothing", for example.

3888

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Error Handling
Errors can occur when you use the "HMIGO" class. Use the "OnError" statement to respond
to these error messages. The "OnError" statement must come before the call of a function
from the HMIGeneralObjects class:

Sub CreateTag()
'HMIGO_000
Dim hmiGOTag as New HMIGO
On Error GoTo ErrorHandlerHMIGO
hmiGOTag.CreateTag "NewTag", TAG_BINARY_TAG, "ExistingConnection", "DB1,DD0,QC",
"NewOrExistingGroupName"
'...
Exit Sub
ErrorHandlerHMIGO:
MsgBox ("Error: " & Err.Number & " " & Err.Description & " " & Err.Source)
Resume Next
End Sub

As a result, an error text returned by the interface is output.

See also
VBA in Alarm Logging (Page 3948)
VBA in the Text Library (Page 3935)
VBA in Tag Logging (Page 3902)
VBA in Tag Management (Page 3891)

5.5.2.2

VBA in Tag Management

VBA in Tag Management


Introduction
VBA can be used to:
Create tags directly from the program code
Modify and delete tags
Read out and change the properties of the tags
Read out and change the types of the tags
Read out and change the values of the tags

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3889

VBA for Automated Configuration


5.5 VBA Reference

Note
The tags may not be open or opened in tag management when editing with VBA.
If you wish to change the data type of a tag, you must first delete the tag and then regenerate
it. You must save the parameters first in order to be able to transfer them following the
generation of tags.

Principle
When you have created the instance of the "HMIGO" class, the following functions are available
to you to access the tag management facility:
CloseTag
CommitTag
CreateTag
DeleteTag
GetTag
ListTag
The following enumerations are available for the parameter supply of these functions:
HMIGO_TAG_TYPE
HMIGO_TAG_LIST_TYPE
Note
If you set the start value to a binary tag, use the values "0" or "1". Do not use the values
"False" or "True". These values are no longer valid for VBA programming in WinCC and will
result in an error message.
Replace the values "False" and "True" with "0" and "1" in your existing VBA code.

Access to the Object Properties


You can also access the parameters of the above-mentioned functions directly in VBA by
means of the following object properties:

3890

Object property

Description

Read/Write

ObjectStateTag

Returns the object state via the enumeration


HMIGO_OBJECT_STATE. Further information on this
enumeration can be found in this documentation under "VBA in
other WinCC Editors".

Yes/no

TagName

Name of the tag

Yes/no

TagGroupName

Name of a group in which the tag is inserted. If the group does


not yet exist, it is created. If no group name is specified, the tag
is created outside all groups.

Yes/no

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

Read/Write

TagConnection

Name of a connection in which the tag and/or group is to be


created. The connection must already be in existence,
otherwise a tag cannot be created. If the name is omitted, an
internal tag is created.

Yes/no

TagMaximum

Sets the new value of the upper limit

Yes/yes

TagMinimum

Sets the new value of the lower limit

Yes/yes

TagStart

Sets the new start value

Yes/yes

TagS5S7Addres
s

Address of the S7 or S5 PLC to which the tag is connected. If


no address is specified, a blank entry is passed.

Yes/yes

TagType
(Enum)

Data type of the tag. The possible types are:

Yes/no

TAG_BINARY_TAG (1)
TAG_SIGNED_8BIT_VALUE (2)
TAG_UNSIGNED_8BIT_VALUE (3)
TAG_SIGNED_16BIT_VALUE (4)
TAG_UNSIGNED_16BIT_VALUE (5)
TAG_SIGNED_32BIT_VALUE (6)
TAG_UNSIGNED_32BIT_VALUE (7)
TAG_FLOATINGPOINT_NUMBER_32BIT_IEEE_754 (8)
TAG_FLOATINGPOINT_NUMBER_64BIT_IEEE_754 (9)
TAG_TEXT_TAG_8BIT_CHARACTER_SET (10)
TAG_TEXT_TAG_16BIT_CHARACTER_SET (11)
TAG_RAW_DATA_TYPE (12)
TAG_STRUCT (14)
TAG_TEXT_REFERENCE (18)

TagUpdate
(Enum)

Defines whether the tag is updated on the local computer or for


the entire project. (For internal tag only.)

Yes/yes

TAG_COMPUTER_LOCAL (1)
TAG_PROJECT_WIDE (2)
LengthText

Length of a text tag (0...255)


"LengthText" can also be used for the length of the raw data
tag. A testing of the correctness of the length will not be
conducted. Observe the instructions of the communication
channels.

yes/yes
(only for external
tag of type text)

TagScaleValid

Defines a linear scaling.

Yes/yes

TagScaleParam1 Sets the value1 for the value range process.

Yes/yes

TagScaleParam2 Sets the value2 for the value range process.

Yes/yes

TagScaleParam3 Sets the value1 for the value range tag.

Yes/yes

TagScaleParam4 Sets the value2 for the value range tag.

Yes/yes

TagStartvaluePe
rsistence

Defines whether an internal tag is set as persistent.

Yes/yes

TagSubst

Replacement value (only for external variables)

Yes/yes

UseSubstValueO Set the replacement value for connection errors.


nCommonError

Yes/yes

UseSubstValueO Set the replacement value for upper limit.


nMaxLimit

Yes/yes

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3891

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

Read/Write

UseSubstValueO Set the replacement value for lower limit.


nMinLimit

Yes/yes

UseSubstValueO Set the replacement value for the start value.


nStartValue

Yes/yes

You will find a description of the properties under the parameter descriptions for the
corresponding functions.
Note
The "Tag synchronization" point in the property dialog of tags is not addressable with VBA.
Tag synchronization is only available for internal tags.
For external tags, the "Type Conversion" point is not addressable with VBA.

See also
ListTag function (Page 3901)
GetTag Function (Page 3900)
DeleteTag Function (Page 3899)
CreateTag Function (Page 3897)
CommitTag Function (Page 3896)
CloseTag Function (Page 3894)
VBA in Other WinCC Editors (Page 3887)

CloseTag Function
Description
Closes the open tag.
Note
Modified parameters are not saved.

Syntax
Expression.CloseTag()
Expression
Necessary. An expression which returns a "HMIGO" type object.

3892

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
--

Example:

Sub CloseTag()
' HMIGO_001
' procedure to close a variable
' tag need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strVariableName As String
Set objHMIGO = New HMIGO
strVariableName = "NewVariable"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
'open a tag
objHMIGO.GetTag strVariableName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
'open a tag
objHMIGO.CloseTag
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
Set objHMIGO = Nothing
End Sub

See also
ListTag function (Page 3901)
GetTag Function (Page 3900)
DeleteTag Function (Page 3899)
CreateTag Function (Page 3897)
CommitTag Function (Page 3896)
VBA in Tag Management (Page 3889)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3893

VBA for Automated Configuration


5.5 VBA Reference

CommitTag Function
Description
Writes the changed parameters of the open tag to WinCC.
Note
If further parameters are changed after a CommitTag call, write the changes to WinCC by
calling this function again.

syntax
Expression.CommitTag()
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
--

Example:

Sub CommitTag()
' HMIGO_002
' procedure to change a property of a variable
' tag need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strVariableName As String
Set objHMIGO = New HMIGO
strVariableName = "NewVariable"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status
'open a tag
objHMIGO.GetTag strVariableName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status
'change a property
objHMIGO.TagStart = 10
'current status is "MODIFIED"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status
'commit a tag
objHMIGO.CommitTag
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status

Variable"

Variable"

Variable"

Variable"

Set objHMIGO = Nothing

3894

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
ListTag function (Page 3901)
GetTag Function (Page 3900)
DeleteTag Function (Page 3899)
CreateTag Function (Page 3897)
CloseTag Function (Page 3892)
VBA in Tag Management (Page 3889)

CreateTag Function
Description
Creates a new tag.

syntax
Expression.CreateTag(TagName,TagType,[Connection],[S7S5Address],
[GroupName])
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

TagName (string)

Name of the tag to be created.

TagType (HMIGO_TAG_TYPE)

Data type of the tag. The possible types are:


TAG_BINARY_TAG
TAG_SIGNED_8BIT_VALUE
TAG_UNSIGNED_8BIT_VALUE
TAG_SIGNED_16BIT_VALUE
TAG_UNSIGNED_16BIT_VALUE
TAG_SIGNED_32BIT_VALUE
TAG_UNSIGNED_32BIT_VALUE
TAG_FLOATINGPOINT_NUMBER_32BIT_IEEE_
754
TAG_FLOATINGPOINT_NUMBER_64BIT_IEEE_
754
TAG_TEXT_TAG_8BIT_CHARACTER_SET
TAG_TEXT_TAG_16BIT_CHARACTER_SET
TAG_RAW_DATA_TYPE
TAG_TEXT_REFERENCE

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3895

VBA for Automated Configuration


5.5 VBA Reference
Parameter (Data Type)

Description

Connection (String, optional)

Name of a connection in which the tag and/or


group is to be created. The connection must
already be in existence, otherwise a tag cannot be
created.
If the name is omitted, an internal tag and/or group
is recreated.

S7S5Address (String, optional)

Address of the S7 or S5 PLC to which the tag is


connected. Without an address indication, an
empty entry will be handed over.
The parameter "S7S5Address" must be
supplemented by the string ",QC"for the
configuration of the Quality Code, for example:
"DB1,DD0,QC".
If the Quality Code of the tag is no longer to be
monitored, the string ",QC" must be deleted.

GroupName (String, optional)

Name of a group in which the tag is inserted. If the


group does not exist, it will be newly created.
If the group name is not indicated, the tag will be
created outside all groups.

Example:

Sub CreateTag()
' HMIGO_003
' procedure to create a variable
' tag must not be created before
' declarations
Dim objHMIGO As HMIGO
Dim strVariableName As String
Set objHMIGO = New HMIGO
strVariableName = "NewVariable"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
'create a tag
objHMIGO.CreateTag strVariableName, TAG_SIGNED_32BIT_VALUE
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
Set objHMIGO = Nothing
End Sub

See also
ListTag function (Page 3901)
GetTag Function (Page 3900)
DeleteTag Function (Page 3899)
CommitTag Function (Page 3894)

3896

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CloseTag Function (Page 3892)
VBA in Tag Management (Page 3889)

DeleteTag Function
Description
Deletes the specified tag.

syntax
Expression.DeleteTag(TagName)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

TagName (string)

Name of the tag to be deleted.

Example:

Sub DeleteTag()
' HMIGO_004
' procedure to delete a variable
' tag need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strVariableName As String
Set objHMIGO = New HMIGO
strVariableName = "NewVariable"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
'delete a tag
objHMIGO.DeleteTag strVariableName
Set objHMIGO = Nothing
End Sub

See also
ListTag function (Page 3901)
GetTag Function (Page 3900)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3897

VBA for Automated Configuration


5.5 VBA Reference
CreateTag Function (Page 3895)
CommitTag Function (Page 3894)
CloseTag Function (Page 3892)
VBA in Tag Management (Page 3889)

GetTag Function
Description
Reads in the parameters of the specified tag.
You can change or read the parameters by means of the object properties. You will find a list
of the available object properties in this documentation under "VBA in Tag Management".

syntax
Expression.GetTag(TagName)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

TagName (string)

Name of the tag whose values are to be read in.

Example:

Sub GetTag()
' HMIGO_005
' procedure to open a variable
' tag need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strVariableName As String
Set objHMIGO = New HMIGO
strVariableName = "NewVariable"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
'open/ get a tag
objHMIGO.GetTag strVariableName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTag, vbOKOnly, "Status Variable"
Set objHMIGO = Nothing
End Sub

3898

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
ListTag function (Page 3901)
DeleteTag Function (Page 3897)
CreateTag Function (Page 3895)
CommitTag Function (Page 3894)
CloseTag Function (Page 3892)
VBA in Tag Management (Page 3889)

ListTag function
Description
Alternatively, the ListTag function returns the following contents of the Tag Management as a
list:
All the channel units created
All the channels created
All the connections created
All the tag groups created
All the tags created

syntax
Expression.ListTag(ListType,pListArray,[Filter])
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ListType (HMIGO_TAG_LIST_TYPE)

Defines which content should be returned as a list.


Possibilities are:
TAG_CHANNEL_UNITS (0) all channel units
created
TAG_CHANNELS (2) all channels created
TAG_CONNECTIONS (3) all connections
created
TAG_GROUPS (4) all tag groups created
TAG_NAMES (5) all tags created

pListArray (Variant)

List with the requested content.

Filter (String)

Filters can be set optionally. Wildcards "*" and "?"


are also possible.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3899

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example, a check is made whether the list with the connections created is
empty because no connections have been set up:

Sub ReadTagByConnection()
'HMIGO_027
'read content in data manager by connections
'no conections are implemented
Dim objHMIGO As New HMIGO
Dim varRange As Variant
'read all connections
objHMIGO.ListTag TAG_CONNECTIONS, arrContent
'check result
If (UBound(arrContent) - LBound(arrContent) + 1) <= 0 Then
MsgBox "no entries because no connections are implemented"
End If
End Sub

See also
GetTag Function (Page 3898)
DeleteTag Function (Page 3897)
CreateTag Function (Page 3895)
CommitTag Function (Page 3894)
CloseTag Function (Page 3892)
VBA in Tag Management (Page 3889)

5.5.2.3

VBA im Tag Logging

VBA in Tag Logging


Introduction
VBA allows you to create process value archives, archive tags and triggers directly from the
program code, modify them, and delete them.
Note
You should not have or should not open the "Tag Logging" editor when editing with VBA.

3900

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Principle
When you have created the instance of the "HMIGO" class, the following functions are available
to you to access Tag Logging:
CloseTlgArchive
CloseTlgTag
CloseTlgTrigger
CommitTlgArchive
CommitTlgTag
CommitTlgTrigger
CreateTlgArchive
CreateTlgTag
CreateTlgTrigger
DeleteTlgArchive
DeleteTlgTag
DeleteTlgTrigger
GetTlgArchive
GetTlgTag
GetTlgTrigger
ListTlgArchive
ListTlgTag
ListTlgTrigger
The following enumerations are available for the parameter supply of these functions:
HMIGO_TLG_ARCHIVE_TYPE
HMIGO_TLG_ARCHIVE_LIST_TYPE
HMIGO_TLG_TAG_TYPE
HMIGO_TLG_TAG_LIST_TYPE
HMIGO_TLG_TRIGGER_BASE
HMIGO_TLG_TRIGGER_LIST_TYPE

Direct Access to the Object Properties


You can also access the parameters of the above-mentioned functions directly in VBA by
means of the following object properties. The column "is used in" will display whether you will

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3901

VBA for Automated Configuration


5.5 VBA Reference
be able to access the object property in the process value archive (P) and/or in the compressed
archive (V).
Object property

Description

Read/
Write

is used in

ObjectStateTlgArchive

Returns the object state for the archive via the


enumeration "HMIGO_OBJECT_STATE". Further
information on this enumeration can be found in this
documentation under "VBA in other WinCC Editors".

Yes/no

P, V

ObjectStateTlgTag

Returns the object state for the archive tag via the
enumeration "HMIGO_OBJECT_STATE".

Yes/no

P, V

TlgArchiveAccessLevelRead

The authorization level for reading.

Yes/no

P, V

TlgArchiveAccessLevelWrite

The authorization level for writing.

Yes/no

P, V

TlgArchiveArchiveState

Specifies whether archiving is disabled or enabled at


system startup. Possible values of the enum
"HMIGO_TLG_ARCHIVE_STATE":

Yes/yes

P, V

TLG_ARCHIVE_STATE_LOCKED (1)
TLG_ARCHIVE_STATE_ACTIVATED (0)
TlgArchiveBufferSize

Specifies the number of records for a short-term archive. Yes/yes

TlgArchiveBufferType

Specifies the tag storage location. The possible types of


the enum "HMIGO_TLG_ARCHIVE_BUFFER_TYPE":

Yes/yes

TLG_ARCHIVE_BUFFER_TYPE_DISK (2)
TLG_ARCHIVE_BUFFER_TYPE_RAM (1)
TlgArchiveCompressRange

Specifies the compression time period. Name of the


timer, greater than or equal to 1, defined under "Times"
in the Tag Logging editor. Since the format is a string, it
is language dependent.
Can be determined via the function
"ListTlgArchive(TLG_ARCHIVE_TRIGGER_NAMES,
arrTrigger)"

Yes/yes

TlgArchiveCompressType

Specifies the algorithm for compressing the values. The


possible types of the enum
"HMIGO_TLG_ARCHIVE_COMPRESS_TYPE":

Yes/yes

Yes/no

P, V

TLG_COMPRESS_TYPE_CALC (1)
TLG_COMPRESS_TYPE_CALC_COPY (2)
TLG_COMPRESS_TYPE_CALC_DEL (3)
TLG_COMPRESS_TYPE_CALC_COPY_DEL (4)
TlgArchiveFlags

Used internally.

TlgArchiveName

Name of the process value archive or compressed


archive.

3902

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

TlgArchiveQCRActive

Specifies for the compressed archive whether weighted


quality codes are used during archiving. The possible
types of the enum
"HMIGO_TLG_QCR_ACTIVE_FLAGS":

Read/
Write

is used in
V

TLG_QCR_ALL (15)
TLG_QCR_BAD (1)
TLG_QCR_GOOD_CASCADED (8)
TLG_QCR_GOOD_NONCASCADED (4)
TLG_QCR_OFF (0)
TLG_QCR_UNCERTAIN (2)
TlgArchiveQCRBad

If weighted quality codes are used and the "Bad" option


is activated, you define for the compression archive the
percentage as of which the "Bad" state of process values
is archived in the compression tag.

TlgArchiveQCRGoodCascade

If weighted quality codes are used and the "Good


(Cascade)" option is activated, you define for the
compression tag the percentage as of which the "Good
(Cascade)" state of process values is archived in the
compression tag.

TlgArchiveQCRGoodNonCasca
de

If weighted quality codes are used and the "Good (NonCascade)" option is activated, you define for the
compression archive the percentage as of which the
"Good (Non-Cascade)" state of process values is
archived in the compression tag.

TlgArchiveQCRUncertain

If weighted quality codes are used and the "Uncertain"


option is activated, you define for the compression
archive the percentage as of which the "Uncertain" state
of process values is archived in the compression tag.

TlgArchiveType

Specifies whether the archive is a process value archive


or a compressed archive.

Yes/no

P, V

TlgTagAliasName

The alternative name by means of which the tag can be


addressed (alias).

Yes/yes

TlgTagArchiveName

Name of the archive.

Yes/no

P, V

TlgTagArchiving

Specifies the acquisition type. Possible values of the


enum "HMIGO_TLG_TAG_ARCHIVING":

Yes/yes

Yes/yes

P, V

Yes/yes

TLG_TAG_ACYCLIC (8388609)
TLG_TAG_CYCLIC_CONTINUOUS (8388610)
TLG_TAG_CYCLIC_SELECTIVE (8388612)
TLG_TAG_ON_EVERY_CHANGE (8388616)
TlgTagArchivingState

Specifies whether archiving is enabled or disabled at


system startup. Possible values of the enum
"HMIGO_TLG_TAG_ARCHIVING_STATE":
TLG_TAG_LOCKED (1)
TLG_TAG_ACTIVATED (0)

TlgTagConvertModule

Name of the conversion DLL used for data conversion.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3903

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

TlgTagFlags

Possible values of the enum


"HMIGO_TLG_TAG_FLAGS":

Read/
Write

is used in

TLG_TAG_LONGTERM_DISABLED (1)
TLG_TAG_NOFLAGS (0)
TlgTagHysterese

Value for the hysteresis by means of which a check is


carried out to establish whether a value has changed.

Yes/yes

TlgTagLowerLimit

Value for the scaling of the tag's lower limit.

Yes/yes

TlgTagMethodType

Specifies the method by which the value is edited before


archiving. Possible values of the enum
"HMIGO_TLG_TAG_METHOD_TYPE":

Yes/yes

P, V

TLG_TAG_ACTUAL (1)
TLG_TAG_SUM (3)
TLG_TAG_MaxValue (5)
TLG_TAG_MinValue (4)
TLG_TAG_AVERAGE (2)
TlgTagName

Name of the archive tag.

Yes/no

P, V

TlgTagNameCompressArchive

In the case of compressed archives, contains the name


of the source archive.

Yes/yes

TlgTagNameCompressTag

In the case of compressed archives, contains the name


of the source tag.

Yes/yes

TlgTagNameProcTag

Name of the process tag from which the value to be


acquired is taken.

Yes/yes

TlgTagNameRawValue

In the cast of process-controlled archives, contains the


name of the raw-data tag.

Yes/yes

TlgTagOnChange

Specifies whether archiving is to be carried out in the


event of a change. Possible values of the enum
"HMIGO_TLG_TAG_ON_CHANGE":

Yes/yes

Yes/yes

TLG_TAG_EVERY_VALUE (0)
TLG_TAG_RELATIVE_HYSTERESE (1)
TLG_TAG_ABSOLUTE_HYSTERESE (2)
TlgTagOnError

Specifies whether, in the event of a problem, the most


recently acquired value or the substitute value is saved.
Possible values of the enum
"HMIGO_TLG_TAG_ON_ERROR":
TLG_TAG_LAST_VALUE (1)
TLG_TAG_SUBSTITUTE (2)

TlgTagPreviousOSGUID

3904

Used internally.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

TlgTagQCRActive

Specifies for the compression tag whether weighted


quality codes are used during archiving. The possible
types of the enum
"HMIGO_TLG_QCR_ACTIVE_FLAGS":

Read/
Write

is used in
V

TLG_QCR_ALL (15)
TLG_QCR_BAD (1)
TLG_QCR_GOOD_CASCADED (8)
TLG_QCR_GOOD_NONCASCADED (4)
TLG_QCR_OFF (0)
TLG_QCR_UNCERTAIN (2)
TlgTagQCRBad

If weighted quality codes are used and the "Bad" option


is activated, you define for the compression tag the
percentage as of which the "Bad" state of process values
is archived in the compression tag.

TlgTagQCRGoodCascade

If weighted quality codes are used and the "Good


(Cascade)" option is activated, you define for the
compression tag the percentage as of which the "Good
(Cascade)" state of process values is archived in the
compression tag.

TlgTagQCRGoodNonCascade

If weighted quality codes are used and the "Good (NonCascade)" option is activated, you define for the
compression tag the percentage as of which the "Good
(Non-Cascade)" state of process values is archived in
the compression tag.

TlgTagQCRUncertain

If weighted quality codes are used and the "Uncertain"


option is activated, you define for the compression tag
the percentage as of which the "Uncertain" state of
process values is archived in the compression tag.

TlgTagSDCompressDeviation

Specifies the absolute or relative value of the deviation,


which is permitted for the calculation of the increase by
the algorithm. Basic value is the process value saved last.

TlgTagSDCompression

Specifies whether the swinging door compression is


activated.

TlgTagSDLowLimit

Specifies the low limit of the swinging door compression


distribution when a relative deviation is activated.

TlgTagSDRelativeDecision

Specifies whether the relative value of the deviation is


taken into consideration at the swinging door algorithm.

TlgTagSDtMax

Specifies the maximum duration between two archived


values as the detection limit for swinging door
compression.

TlgTagSDtMin

Specifies the minimum duration between two archived


values as the detection limit for swinging door
compression.

TlgTagSDUpperLimit

Specifies the upper limit of the swinging door


compression distribution when a relative deviation is
activated.

TlgTagStartEvent

Name of the tag by means of which the start of archiving


is checked.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Yes/yes

3905

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

Read/
Write

is used in

TlgTagStartTriggerFunction

Specifies the name of a script function by means of which Yes/yes


a check is carried out for a start event for the start of
archiving.

TlgTagStartTriggerModule

Specifies the name of a DLL from which the script


function is called for the checking of a start event.

Yes/yes

TlgTagStopEvent

Name of the tag by means of which the stopping of


archiving is checked.

Yes/yes

TlgTagStopTriggerFunction

Specifies the name of a script function by means of which Yes/yes


a check is carried out for a stop event for the start of
archiving.

TlgTagTriggerArchiving

Name of the timer for the archiving cycle.

Yes/yes

TlgTagTriggerFactor

Contains the factor for the display cycle as a multiple of


the archiving cycle.

Yes/yes

TlgTagTriggerFunction

Specifies the name of a script function for the dynamic


switching of the acquisition and archiving cycles.

Yes/yes

TlgTagTriggerScan

Name of the timer for the acquisition cycle

Yes/yes

TlgTagTriggerType

Specifies how archiving is carried out at a signal change.


Possible values of the enum
"HMIGO_TLG_TAG_TRIGGER_TYPE":

Yes/yes

Yes/yes

P, V

Yes/yes

TLG_TAG_FROM_0_TO_1 (2)
TLG_TAG_FROM_1_TO_0 (3)
TLG_TAG_ALWAYS (4)
TLG_TAG_EVERY_CHANGE (1)
TlgTagType

Specifies the tag type. The possible types of the enum


"HMIGO_TLG_TAG_TYPE":
TLG_TAG_TYP_ANALOG (65537)
TLG_TAG_TYP_BINARY (65538)
TLG_TAG_TYP_PROCESS (65544)
TLG_TAG_TYP_COMPRESS (65540)

TlgTagUpperLimit

Value for the scaling of the tag's upper limit.

TlgTriggerBase

Time base for the trigger. Possible values of the enum


"HMIGO_TLG_TRIGGER_BASE":

TLG_TRIGGER_BASE_250MS (250)
TLG_TRIGGER_BASE_500MS (500)
TLG_TRIGGER_BASE_DAY (&H5265C00)
TLG_TRIGGER_BASE_HOUR (&H36EE80)
TLG_TRIGGER_BASE_MIN (&HEA60)
TLG_TRIGGER_BASE_SEC (&H3E8)
TlgTriggerCreatorID

Used internally.

TlgTriggerFactor

Integer factor that is taken into consideration for the


trigger together with the time base.

TlgTriggerName

Name of the trigger.

TlgTriggerScheduleDayOfMonth

Specifies the day for the trigger for the "Monthly" time
series.

3906

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

TlgTriggerScheduleDaysOfWee
k

Specifies the days for the trigger for the "Weekly" time
series. Possible values of the enum
"HMIGO_TLG_TRIGGER_SCHEDULE_DAYSOFWEEK
":

Read/
Write

is used in
P

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_EVE
RY_DAY (127)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_FRI
DAY (32)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_MO
NDAY (2)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_NO_
DAY (0)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_SAT
URDAY (64)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_SUN
DAY (1)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_THU
RSDAY (16)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_TUE
SDAY (4)
TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_WE
DNESDAY (8)
TlgTriggerScheduleInterval

Specifies the interval for the trigger for the calendar times.

TlgTriggerScheduleMonthOfYea
r

Specifies the month for the trigger for the "Yearly" time
series.

TlgTriggerScheduleType

Defines the type of trigger. Possible time series of the


enum "HMIGO_TLG_TRIGGER_SCHEDULE_TYPE":

TLG_TRIGGER_SCHEDULE_TYPE_CYCLIC (0)
TLG_TRIGGER_SCHEDULE_TYPE_DAILY (1)
TLG_TRIGGER_SCHEDULE_TYPE_MONTHLY (3)
TLG_TRIGGER_SCHEDULE_TYPE_WEEKLY (2)
TLG_TRIGGER_SCHEDULE_TYPE_YEARLY (4)
TlgTriggerStartByShutdown

The trigger is initiated additionally when the system is


shut down regardless of the configured triggers.

TlgTriggerStartByStartup

The trigger is initiated additionally when the system is


started up regardless of the configured triggers.

TlgTriggerStartDay

Specifies the day for the starting point of the trigger.

TlgTriggerStartHour

Specifies the hour for the starting point of the trigger.

TlgTriggerStartMilliSecond

Specifies the milliseconds for the starting point of the


trigger.

TlgTriggerStartMinute

Specifies the minute for the starting point of the trigger.

TlgTriggerStartMonth

Specifies the month for the starting point of the trigger.

TlgTriggerStartSecond

Specifies the seconds for the starting point of the trigger.

TlgTriggerStartYear

Specifies the year for the starting point of the trigger.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3907

VBA for Automated Configuration


5.5 VBA Reference

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
DeleteTlgArchive Function (Page 3926)
CreateTlgTag Function (Page 3920)
CreateTlgArchive Function (Page 3917)
CommitTlgTag Function (Page 3915)
CommitTlgArchive Function (Page 3914)
CloseTlgTag Function (Page 3912)
CloseTlgArchive Function (Page 3910)
VBA in Other WinCC Editors (Page 3887)
CloseTlgTrigger function (Page 3913)
CommitTlgTrigger function (Page 3917)
CreateTlgTrigger function (Page 3924)
DeleteTlgTrigger function (Page 3928)
GetTlgTrigger function (Page 3931)
ListTlgTrigger function (Page 3935)

CloseTlgArchive Function
Description
Closes the process value or compressed archive which is open.
Note
Modified parameters are not saved.

syntax
Expression.CloseTlgArchive()
Expression
Necessary. An expression which returns a "HMIGO" type object.

3908

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
--

Example:

Sub CloseTlgArchive()
' HMIGO_006
' procedure to close an archive
' the archive need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
'open archive
objHMIGO.GetTlgArchive strArchiveName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
'close archive
objHMIGO.CloseTlgArchive
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
Set objHMIGO = Nothing
End Sub

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
DeleteTlgArchive Function (Page 3926)
CreateTlgTag Function (Page 3920)
CreateTlgArchive Function (Page 3917)
CommitTlgTag Function (Page 3915)
CommitTlgArchive Function (Page 3914)
CloseTlgTag Function (Page 3912)
VBA in Tag Logging (Page 3900)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3909

VBA for Automated Configuration


5.5 VBA Reference

CloseTlgTag Function
Description
Closes the archive tag which is open.
Note
Modified parameters are not saved.

syntax
Expression.CloseTlgTag()
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
--

Example:

Sub CloseTlgTag()
' HMIGO_007
' procedure to close a tag logging tag
' the archive need to be created before
' the tag logging tag need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Dim strTlgTagName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
strTlgTagName = "NewTag"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgTag,
'open/ get tag logging tag
objHMIGO.GetTlgTag strArchiveName,
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgTag,
'close tag logging tag
objHMIGO.CloseTlgTag
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgTag,
Set objHMIGO = Nothing
End Sub

3910

vbOKOnly, "Status Tlg Tag"


strTlgTagName
vbOKOnly, "Status Tlg Archive"

vbOKOnly, "Status Tlg Archive"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
DeleteTlgArchive Function (Page 3926)
CreateTlgTag Function (Page 3920)
CreateTlgArchive Function (Page 3917)
CommitTlgTag Function (Page 3915)
CommitTlgArchive Function (Page 3914)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

CloseTlgTrigger function
Description
Closes the opened trigger.
Note
Modified parameters are not saved.

Syntax
Expression.CloseTlgTrigger()
Expression
Required. An expression which returns a "HMIGO" type object.

Parameter
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3911

VBA for Automated Configuration


5.5 VBA Reference

CommitTlgArchive Function
Description
Writes the changed parameters of the specified archive to WinCC.
Note
If further parameters are changed after a CommitTlgArchive call, write the changes to WinCC
by calling this function again.

syntax
Expression.CommitTlgArchive()
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
--

Example:

Sub CommitTlgArchive()
' HMIGO_008
' procedure to change a property of an archive
' the archive need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status
'open archive
objHMIGO.GetTlgArchive strArchiveName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status
'change a property
objHMIGO.TlgArchiveArchiveState = TLG_STATE_LOCKED
'current status is "MODIFIED"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status
'commit archive
objHMIGO.CommitTlgArchive
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status

Tlg Archive"

Tlg Archive"

Tlg Archive"

Tlg Archive"

Set objHMIGO = Nothing

3912

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

End Sub

See also
DeleteTlgArchive Function (Page 3926)
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
CreateTlgTag Function (Page 3920)
CreateTlgArchive Function (Page 3917)
CommitTlgTag Function (Page 3915)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

CommitTlgTag Function
Description
Writes the changed parameters of the specified archive tag to WinCC.
Note
If further parameters are changed after a CommitTlgTag call, write the changes to WinCC by
calling this function again.

syntax
Expression.CommitTlgTag()
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3913

VBA for Automated Configuration


5.5 VBA Reference

Example:

Sub CommitTlgTag()
' HMIGO_009
' procedure to change a property of a tag logging tag
' the archive need to be created before
' the tag logging tag need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Dim strTlgTagName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
strTlgTagName = "NewTag"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status
'open/ get tag logging tag
objHMIGO.GetTlgTag strArchiveName, strTlgTagName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status
'change a property
objHMIGO.TlgTagArchiving = TLG_TAG_ON_EVERY_CHANGE
'current status is "MODIFIED"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status
'commit tag logging tag
objHMIGO.CommitTlgTag
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status
Set objHMIGO = Nothing
End Sub

Tlg Tag"

Tlg Archive"

Tlg Archive"

Tlg Archive"

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
DeleteTlgArchive Function (Page 3926)
CreateTlgTag Function (Page 3920)
CreateTlgArchive Function (Page 3917)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

3914

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

CommitTlgTrigger function
Description
Writes the changed parameters of the specified trigger to WinCC.
Note
If further parameters are changed after a CommitTlgTrigger call, write the changes to WinCC
by calling this function again.

Syntax
Expression.CommitTlgTrigger()
Expression
Required. An expression which returns a "HMIGO" type object.

Parameter
--

CreateTlgArchive Function
Description
Creates a process value archive or compressed archive.

syntax
Expression.CreateTlgArchive(ArchiveName,ArchiveType)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ArchiveName (String)

Name of the archive to be created

ArchiveType (HMIGO_TLG_ARCHIVE_TYPE)

Type of the archive. The possible types are:


TLG_PROCESSARCHIVE (131073) for a
process value archive
TLG_COMPRESSARCHIVE (131074) for a
compressed archive

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3915

VBA for Automated Configuration


5.5 VBA Reference
Default Values when Creating a New Tag Archive
The following table indicates the default values that are entered when a new process value
archive or compressed archive is created. These values can be modified later and written using
the CommitTlgArchive function.
Property

Default Value (Enum Name =>


Value)

Comment

TlgArchiveAccessLevelRe
ad

Without authorization level

TlgArchiveAccessLevelWri 0
te

Without authorization level

TlgArchiveArchiveState

TLG_ARCHIVE_STATE_ACTIVAT
ED (0)

Archiving is started at start of


Runtime.

TlgArchiveBufferSize

1000

Number of data records

TlgArchiveBufferType

TLG_ARCHIVE_BUFFER_TYPE_D
ISK (2)

The values are stored on hard disk


in the database.

TlgArchiveCompressRang
e

"1 Tag". This string must be created


individually for each language (e.g.
English: "1 day")

Corresponds to exactly one day.


Only relevant in the case of
compressed tags.
Special Feature: the user is
responsible for values >= 1 minute

TlgArchiveCompressType

TLG_COMPRESS_TYPE_CALC (1) Only calculate compression


values. Only relevant in the case of
compressed tags.

Enum HMIGO_TLG_ARCHIVE_STATE
Parameters

Description

TLG_ARCHIVE_STATE_LOCKED (1)

Archiving is disabled at system startup.

TLG_ARCHIVE_STATE_ACTIVATED (0)

Archiving is started at start of Runtime.

Enum HMIGO_TLG_ARCHIVE_BUFFER_TYPE
Parameters

Description

TLG_ARCHIVE_BUFFER_TYPE_DISK (2) The values are archived on hard disk.


TLG_ARCHIVE_BUFFER_TYPE_RAM (1) The values are only archived in working memory.

Enum HMIGO_TLG_ARCHIVE_COMPRESS_TYPE
Parameters

Description

TLG_COMPRESS_TYPE_CALC (1)

Only the compression values are calculated.

TLG_COMPRESS_TYPE_CALC_COPY (2) The compression values are calculated and the original
values copied.

3916

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Parameters

Description

TLG_COMPRESS_TYPE_CALC_DEL (3)

The compression values are calculated and the original


values then deleted.

TLG_COMPRESS_TYPE_CALC_COPY_D
EL (4)

The compression values are calculated and the original


values copied and then deleted.

Example:

Sub CreateTlgArchive()
' HMIGO_010
' procedure to create an archive
' the archive must not be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
'create tag logging archive
objHMIGO.CreateTlgArchive strArchiveName, TLG_PROCESSARCHIVE
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
Set objHMIGO = Nothing
End Sub

See also
GetTlgArchive Function (Page 3929)
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
DeleteTlgTag Function (Page 3927)
DeleteTlgArchive Function (Page 3926)
CreateTlgTag Function (Page 3920)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3917

VBA for Automated Configuration


5.5 VBA Reference

CreateTlgTag Function
Description
Creates a new archive tag.

syntax
Expression.CreateTlgTag(ArchiveName,TagName,[TagType])
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ArchiveName (String)

Name of an existing archive in which the tag is to


be entered

TagName (string)

Name of the tag to be created

TagType (HMIGO_TLG_TAG_TYPE, optional)

Specifies the type of the tag. If no type is specified,


the default value TLG_VAR_TYP_ANALOG is
entered. The possible types are:
TLG_VAR_TYP_ANALOG (65537) for an
analog tag.
TLG_VAT_TYP_BINARY (65538) for a binary
tag.
TLG_VAR_TYP_PROCESS (65544) for a
process tag.
TLG_VAT_TYP_COMPRESS (65540) for a
compression tag.

Default Values When a New Archive Tag Is Created


The following table indicates the default values that are entered when a new archive tag is
created. These values can be modified later and written using the CommitTlgTag function.

3918

Property

Default Value (Enum Name => Value) Comment

TlgTagType

TLG_VAR_TYP_ANALOG (65537)

Acquired by means of an
analog data manager tag

TlgTagArchiving

TLG_TAG_CYCLIC_CONTINUOUS
(8388610)

Cyclic, continuous acquisition

TlgTagArchivingState

TLG_TAG_ACTIVATED (0)

Archiving is started at start of


Runtime.

TlgTagTriggerScan

1 second

Please note that "1 second" is


only the name of the trigger.
You must ensure yourself that
the trigger exists and actually
has a cycle of 1 s.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Property

Default Value (Enum Name => Value) Comment

TlgTagTriggerArchiving

1 second

Please note that "1 second" is


only the name of the trigger.
You must ensure yourself that
the trigger exists and actually
has a cycle of 1 s.

TlgTagTriggerFactor

The display cycle and archiving


cycle are identical.

TlgTagOnError

TLG_TAG_LAST_VALUE (1)

The last valid value is taken as


the substitute value.

TlgTagTriggerType

TLG_TAG_ALWAYS (4)

Every value is archived.

TlgTagMethodType

TLG_TAG_ACTUAL (1)

No editing. The value is


accepted immediately.

TlgTagStartTriggerFunction

No function specified

--

TlgTagStopTriggerFunction

No function specified

--

TlgTagTriggerFunction

No function specified

--

TlgTagUpperLimit

No value specified

--

TlgTagLowerLimit

No value specified

--

TlgTagNameCompressArchi No archive name specified


ve

--

TlgTagNameCompressTag

No tag name specified

--

TlgTagNameRawValue

No raw-data tag specified

--

TlgTagStartTriggerModule

No DLL name specified

--

TlgTagNameProcTag

Corresponds to "TagName"

--

TlgTagOnChange

TLG_TAG_EVERY_VALUE (0)

Every value will be archived.

TlgTagHysterese

No check is carried out by


means of hysteresis.

TlgTagAliasName

No value specified

--

TlgTagStartEvent

No tag specified

--

TlgTagStopEvent

No tag specified

--

List of the enumerators for Tag Logging


Enum types

Description

TLG_TAG_TYPE

The passed parameter specifies the type of the tag. The possible types
are in the table Enum HMIGO_TLG_TAG_TYPE.

TLG_TAG_ARCHIVING

The passed parameter specifies the acquisition type. The possible


values are in the table Enum HMIGO_TLG_TAG_ARCHIVING.

TLG_TAG_ARCHIVING_STA
TE

The passed parameter specifies whether archiving is disabled or


enabled at system startup. The possible values are in the table Enum
HMIGO_TLG_TAG_ARCHIVING_STATE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3919

VBA for Automated Configuration


5.5 VBA Reference
Enum types

Description

TLG_TAG_ON_ERROR

The passed parameter specifies which value is stored in the event of


a problem: the most recently acquired value or the substitute value.
The possible values are in the table Enum
HMIGO_TLG_TAG_ON_ERROR.

TLG_TAG_TRIGGER_TYPE

The passed parameter specifies how archiving is carried out at a signal


change. The possible values are in the table Enum
HMIGO_TLG_TAG_TRIGGER_TYPE.

TLG_TAG_METHOD_TYPE

The passed parameter specifies the method by which the value is


edited before archiving. The possible values are in the table Enum
HMIGO_TLG_TAG_METHOD_TYPE.

TLG_TAG_ON_CHANGE

The passed parameter specifies whether archiving is to be carried out


in the event of a change. The possible values are in the table Enum
HMIGO_TLG_TAG_ON_CHANGE.

Enum HMIGO_TLG_TAG_TYPE
Values

Description

TLG_TAG_TYP_ANALOG (65537)

Analog tag

TLG_TAG_TYP_BINARY (65538)

Binary Tags

TLG_TAG_TYP_PROCESS (65544)

Process tag

TLG_TAG_TYP_COMPRESS (65540)

Compressed archive tag

Enum HMIGO_TLG_TAG_ARCHIVING
Values

Description

TLG_TAG_ACYCLIC (8388609)

Acyclic acquisition

TLG_TAG_CYCLIC_CONTINUOUS (8388610)

Cyclic-continuous acquisition

TLG_TAG_CYCLIC_SELECTIVE (8388612)

Cyclic-selective acquisition

TLG_TAG_ON_EVERY_CHANGE (8388616)

Acquisition only in the event of a change

Enum HMIGO_TLG_TAG_ARCHIVING_STATE

3920

Values

Description

TLG_TAG_LOCKED (1)

Acquisition disabled at system startup

TLG_TAG_ACTIVATED (0)

Acquisition enabled at system startup

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Enum HMIGO_TLG_TAG_ON_ERROR
Values

Description

TLG_TAG_LAST_VALUE (1)

The most recently acquired value is used.

TLG_TAG_SUBSTITUTE (2)

A substitute value is entered.

Enum HMIGO_TLG_TAG_TRIGGER_TYPE
Values

Description

TLG_TAG_FROM_0_TO_1 (2)

Signal change from the value 0 to 1

TLG_TAG_FROM_1_TO_0 (3)

Signal change from the value 1 to 0

TLG_TAG_ALWAYS (4)

Always archive.

TLG_TAG_EVERY_CHANGE (1)

Archive at every signal change.

Enum HMIGO_TLG_TAG_METHOD_TYPE
Values

Description

TLG_TAG_ACTUAL (1)

The current value is accepted.

TLG_TAG_SUM (3)

The sum is formed.

TLG_TAG_MaxValue (5)

The greatest value is saved.

TLG_TAG_MinValue (4)

The smallest value is saved.

TLG_TAG_AVERAGE (2)

The average value is saved.

Enum HMIGO_TLG_TAG_ON_CHANGE
Values

Description

TLG_TAG_EVERY_VALUE (0)

The current value is accepted.

TLG_TAG_RELATIVE_HYSTERESE A hysteresis specified as a percentage is used for the


(1)
calculation as to whether the value is to be archived.
TLG_TAG_ABSOLUTE_HYSTERES A hysteresis specified as an absolute value is used for the
E (2)
calculation as to whether the value is to be archived.

Example:

Sub CreateTlgTag()
' HMIGO_011
' procedure to create a tag logging tag
' the archive need to be created before
' the tag logging tag must not be created before
' declarations
Dim objHMIGO As HMIGO

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3921

VBA for Automated Configuration


5.5 VBA Reference

Dim strArchiveName As String


Dim strTlgTagName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
strTlgTagName = "NewTag"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status Tlg Tag"
'create tag logging tag
objHMIGO.CreateTlgTag strArchiveName, strTlgTagName, TLG_TAG_TYPE_ANALOG
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status Tlg Archive"
Set objHMIGO = Nothing
End Sub

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
DeleteTlgArchive Function (Page 3926)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CloseTlgArchive Function (Page 3908)
CloseTlgTag Function (Page 3910)
VBA in Tag Logging (Page 3900)

CreateTlgTrigger function
Description
Creates a new trigger that is used as a timer for the acquisition and archiving cycle.

Syntax
Expression.CreateTlgTrigger(TriggerName,TriggerBase,TriggerFactor)
Expression
Required. An expression which returns a "HMIGO" type object.

3922

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameter
Parameter (Data Type)

Description

TriggerName (String)

Name of the trigger to be created

TriggerBase (HMIGO_TLG_TRIGGER_BASE)

Time base of the trigger. Possible values:


TLG_TRIGGER_BASE_250MS (250)
TLG_TRIGGER_BASE_500MS (500)
TLG_TRIGGER_BASE_DAY (&H5265C00)
TLG_TRIGGER_BASE_HOUR (&H36EE80)
TLG_TRIGGER_BASE_MIN (&HEA60)
TLG_TRIGGER_BASE_SEC (&H3E8)

TriggerFactor

Integer factor that is taken into consideration for the trigger together
with the time base.

Enum HMIGO_TLG_TRIGGER_BASE
Parameter

Description

TLG_TRIGGER_BASE_250MS (250)

The time base is "250 ms".

TLG_TRIGGER_BASE_500MS (500)

The time base is "500 ms".

TLG_TRIGGER_BASE_DAY (&H5265C00)

The time base is "1 day".

TLG_TRIGGER_BASE_HOUR (&H36EE80)

The time base is "1 hour".

TLG_TRIGGER_BASE_MIN (&HEA60)

The time base is "1 minute".

TLG_TRIGGER_BASE_SEC (&H3E8)

The time base is "1 second".

Enum HMIGO_TLG_TRIGGER_SCHEDULE_DAYSOFWEEK
Parameter

Description

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_EVERY_DAY
(127)

Every day is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_FRIDAY (32)

Friday is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_MONDAY (2)

Monday is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_NO_DAY (0)

No day is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_SATURDAY (64)

Saturday is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_SUNDAY (1)

Sunday is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_THURSDAY (16)

Thursday is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_TUESDAY (4)

Tuesday is used for the "Weekly" trigger.

TLG_TRIGGER_SCHEDULE_DAYSOFWEEK_WEDNESDAY (8)

Wednesday is used for the "Weekly" trigger.

Enum HMIGO_TLG_TRIGGER_SCHEDULE_TYPE
Parameter

Description

TLG_TRIGGER_SCHEDULE_TYPE_CYCLIC (0)

The time series "Standard (cyclic)" is used for the trigger.

TLG_TRIGGER_SCHEDULE_TYPE_DAILY (1)

The time series "Daily" is used for the trigger.

TLG_TRIGGER_SCHEDULE_TYPE_MONTHLY (3)

The time series "Monthly" is used for the trigger.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3923

VBA for Automated Configuration


5.5 VBA Reference
Parameter

Description

TLG_TRIGGER_SCHEDULE_TYPE_WEEKLY (2)

The time series "Weekly" is used for the trigger.

TLG_TRIGGER_SCHEDULE_TYPE_YEARLY (4)

The time series "Yearly" is used for the trigger.

DeleteTlgArchive Function
Description
Deletes the specified archive.

Syntax
Expression.DeleteTlgArchive(ArchiveName)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ArchiveName (String)

Name of the archive to be deleted. Archive tags


contained in the archive are also deleted.

Example:

Sub DeleteTlgArchive()
' HMIGO_012
' procedure to delete an archive
' the archive need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
'delete tag logging archive
objHMIGO.DeleteTlgArchive strArchiveName
Set objHMIGO = Nothing
End Sub

3924

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgTag Function (Page 3927)
CreateTlgTag Function (Page 3918)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

DeleteTlgTag Function
Description
Deletes the specified archive tag.

syntax
Expression.DeleteTlgTag(ArchiveName,TagName)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ArchiveName (String)

Name of the archive containing the archive tag to


be deleted

TagName (string)

Name of the archive tag to be deleted.

Example:

Sub DeleteTlgTag()
' HMIGO_013
' procedure to delete a tag logging tag
' the archive need to be created before
' the tag logging tag need to be created before

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3925

VBA for Automated Configuration


5.5 VBA Reference

' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Dim strTlgTagName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
strTlgTagName = "NewTag"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status Tlg Tag"
'delete tag logging tag
objHMIGO.DeleteTlgTag strArchiveName, strTlgTagName
Set objHMIGO = Nothing
End Sub

See also
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3929)
DeleteTlgArchive Function (Page 3924)
CreateTlgTag Function (Page 3918)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

DeleteTlgTrigger function
Description
Deletes the specified trigger.

Syntax
Expression.DeleteTlgTrigger(TriggerName)
Expression
Required. An expression which returns a "HMIGO" type object.

3926

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameter
Parameter (Data Type)

Description

TriggerName (String)

Name of the trigger that is deleted.

GetTlgArchive Function
Description
Reads in the parameters of the specified archive.
You can change or read the parameters by means of the object properties. You will find a list
of the available object properties in this documentation under "VBA in TagLogging".

syntax
Expression.GetTlgArchive(ArchiveName)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ArchiveName (String)

Name of the archive whose values are to be read


in.

Example:

Sub GetTlgArchive()
' HMIGO_014
' procedure to open an archive
' the archive need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
'open/ get tag logging archive
objHMIGO.GetTlgArchive strArchiveName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgArchive, vbOKOnly, "Status Tlg Archive"
Set objHMIGO = Nothing
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3927

VBA for Automated Configuration


5.5 VBA Reference

See also
CreateTlgTag Function (Page 3918)
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3927)
DeleteTlgTag Function (Page 3925)
DeleteTlgArchive Function (Page 3924)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

GetTlgTag Function
Description
Reads in the parameters of the specified archive tag.
You can change or read the parameters by means of the object properties. You will find a list
of the available object properties in this documentation under "VBA in TagLogging".

syntax
Expression.GetTlgTag(ArchiveName,TagName)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ArchiveName (String)

Name of the archive containing the archive tag.

TagName

Name of the archive tag whose parameters are to


be read in.

Example:

Sub GetTlgTag()

3928

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'
'
'
'
'

HMIGO_015
procedure to close a tag logging tag
the archive need to be created before
the tag logging need to be created before
declarations
Dim objHMIGO As HMIGO
Dim strArchiveName As String
Dim strTlgTagName As String
Set objHMIGO = New HMIGO
strArchiveName = "NewArchive"
strTlgTagName = "NewTag"

'current status is "EMPTY"


MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status Tlg Tag"
'open/ get tag logging tag
objHMIGO.GetTlgTag strArchiveName, strTlgTagName
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateTlgTag, vbOKOnly, "Status Tlg Archive"
Set objHMIGO = Nothing
End Sub

See also
CreateTlgTag Function (Page 3918)
ListTlgTag Function (Page 3933)
ListTlgArchive Function (Page 3932)
GetTlgArchive Function (Page 3927)
DeleteTlgTag Function (Page 3925)
DeleteTlgArchive Function (Page 3924)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

GetTlgTrigger function
Description
Reads in the parameters of the specified trigger.
You can change or read the parameters by means of the object properties. You will find a list
of the available object properties in this documentation under "VBA in TagLogging".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3929

VBA for Automated Configuration


5.5 VBA Reference

Syntax
Expression.GetTlgTrigger(TriggerName)
Expression
Required. An expression which returns a "HMIGO" type object.

Parameter
Parameter (Data Type)

Description

TriggerName (String)

Name of the trigger whose values are read in.

ListTlgArchive Function
Description
Alternatively, the ListTlgArchive function returns the following Tag Logging values in a list:
All existing Tag Logging archives
All existing cycles / timers

syntax
Expression.ListTlgArchive(ListType,pListArray,[Filter])
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ListType (HMIGO_TLG_ARCHIVE_LIST_TYPE)

Defines which content should be returned in a list.


Possibilities are:
TLG_ARCHIVE_NAMES (1) All created Tag
Logging archives
TLG_ARCHIVE_TRIGGER_NAMES (2) All
created cycles / timers

3930

pListArray (Variant)

List with the requested content.

Filter (String)

Filters can be set optionally. A trigger name can


be used as a filter. Wildcards "*" and "?" are also
possible.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example, a check is made whether archives are configured:

Sub ReadTlgArchives()
'HMIGO_028
'read content in tag logging
'no archives are implemented
Dim objHMIGO As New HMIGO
Dim varRange As Variant
'read all tlg archives
objHMIGO.ListTlgArchive TLG_ARCHIVE_NAMES, arrContent
'check result
If (UBound(arrContent) - LBound(arrContent) + 1) <= 0 Then
MsgBox "no entries because no tag logging archives are implemented"
End If
End Sub

See also
ListTlgTag Function (Page 3933)
GetTlgArchive Function (Page 3927)
DeleteTlgTag Function (Page 3925)
DeleteTlgArchive Function (Page 3924)
CreateTlgTag Function (Page 3918)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

ListTlgTag Function
Description
The ListTlgTag function returns all the tags created in a Tag Logging archive in a list.

syntax
Expression.ListTlgTag(ListType,ListArray,[ArchiveName],[Filter])
Expression
Necessary. An expression which returns a "HMIGO" type object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3931

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

ListType (HMIGO_TLG_TAG_LIST_TYPE)

Defines which content should be returned in a list.


Possibilities are:
TLG_TG_NAMES (1) All tags created in a Tag
Logging archive

ListArray (Variant)

List with the requested content.

ArchiveName (String)

Name of the archive in Tag Logging (optional). If


the name of the archive is not specified, all,archive
tags are returned.

Filter (String)

Filters can be set optionally. Wildcards "*" and "?"


are also possible.

Example:
In the following example, a check is made whether the archive tags are configured in the
"Process Archive":

Sub ReadTlgTag()
'HMIGO_029
'read content in tag logging
'no tags within archives are implemented
Dim objHMIGO As New HMIGO
Dim varRange As Variant
Dim strArchive as String
'set tlg archive name
strArchive = "processarchive"
'read all tlg tags in specified archive
objHMIGO.ListTlgTag TLG_TAG_NAMES, arrContent, strArchive
'check result
If (UBound(arrContent) - LBound(arrContent) + 1) <= 0 Then
MsgBox "no entries because no tag logging tags in specified archive are implemented"
End If
End Sub

See also
ListTlgArchive Function (Page 3930)
GetTlgArchive Function (Page 3927)
DeleteTlgTag Function (Page 3925)
DeleteTlgArchive Function (Page 3924)
CreateTlgTag Function (Page 3918)
CreateTlgArchive Function (Page 3915)
CommitTlgTag Function (Page 3913)
CommitTlgArchive Function (Page 3912)

3932

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CloseTlgTag Function (Page 3910)
CloseTlgArchive Function (Page 3908)
VBA in Tag Logging (Page 3900)

ListTlgTrigger function
Description
The function returns all created triggers in a list.

Syntax
Expression.ListTlgTrigger(ListType,ListArray,[Filter])
Expression
Required. An expression which returns a "HMIGO" type object.

Parameter
Parameter (Data Type)

Description

ListType (HMIGO_TLG_TRIGGER_LIST_TYPE)

Defines the content that is to be returned in a list.


Possibilities are:
TLG_TRIGGER_NAMES (1) all created
triggers

5.5.2.4

ListArray (Variant)

List with the requested content.

Filter (String)

Filters can be set optionally. A trigger name can


be used as a filter. Wildcards "*" and "?" are also
possible.

VBA in the Text Library

VBA in the Text Library


Introduction
VBA allows you to generate Text Library texts directly from the program code, modify and
delete them, and display text IDs and texts.
Note
You should not have or should not open the "TextLibrary" editor when editing with VBA.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3933

VBA for Automated Configuration


5.5 VBA Reference

Principle
When you have created the instance of the "HMIGO" class, the following functions are available
to you to access the TextLibrary:
CreateTextLanguage
CreateText
DeleteText
DeleteTextLanguage
GetText
GetTextID
ListText
ModifyText
The following enumerations are available for the parameter supply of these functions:
HMIGO_TEXT_CREATE_MODE
HMIGO_TEXT_LIST_TYPE

See also
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetTextID Function (Page 3943)
GetText Function (Page 3942)
DeleteTextLanguage Function (Page 3941)
DeleteText Function (Page 3939)
CreateText Function (Page 3938)
CreateTextLanguage Function (Page 3936)
VBA in Other WinCC Editors (Page 3887)

CreateTextLanguage Function
Description
Creates a language in the Text Library.

syntax
Expression.CreateTextLanguage(LanguageID)
Expression
Necessary. An expression which returns a "HMIGO" type object.

3934

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

LanguageID (Long)

ID for the language to be created (e.g. 1031 for


German, 1033 for English, etc.)
For a table of all language codes refer to the
WinCC online help on "Language Identifiers".

Example:

Sub CreateTextLanguage()
' HMIGO_016
' procedure to create a language in text library
' language must not be created before
' LanguageID german = 1031
' LanguageID english(US) = 1033
' LanguageID spanish = 1034
' LanguageID french = 1040
' LanguageID farsi= 1065
' declarations
Dim objHMIGO As HMIGO
Dim lngLangugeNumber As Long
Set objHMIGO = New HMIGO
lngLangugeNumber = 1065
'farsi
'create new language
objHMIGO.CreateTextLanguage lngLangugeNumber
Set objHMIGO = Nothing
End Sub

See also
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetTextID Function (Page 3943)
GetText Function (Page 3942)
DeleteTextLanguage Function (Page 3941)
DeleteText Function (Page 3939)
CreateText Function (Page 3938)
VBA in the Text Library (Page 3933)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3935

VBA for Automated Configuration


5.5 VBA Reference

CreateText Function
Description
Creates a new text for the language specified. Text input for other languages can be added
using ModifyText.

syntax
Expression.CreateText(LanguageID,Text,CreateMode,TextID)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

LanguageID (Long)

ID of the language for which the text will be created.

Text (string)

Text to be created.

CreateMode (HMIGO_TEXT_CREATE_MODE)

Mode of text creation:


TEXT_ADD_REFCOUNT (0) only increases
the reference counter when an identical text
already exists.
TEXT_CREATE_ALWAYS (1) always sets up
a new text line and inserts the text in it.

TextID (long)

Returns the TextID assigned to the new text or the


TextID whose reference counter is increased. This
ID is required for processing the text in other
functions.

Example:

Sub CreateText()
' HMIGO_017
' procedure to create a new text
' declarations
Dim objHMIGO As HMIGO
Dim lngLanguageID As Long
Dim lngTextCreateMode As Long
Dim lngTextID As Long
'return value of ".CreateText"
Dim strText As String
Set objHMIGO = New HMIGO
strText = "new text"
'LanguageID = english
lngLanguageID = 1033
'"TEXT_ADD_REFCOUNT" check if text exists, if not create new text
lngTextCreateMode = 0

3936

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

'

'"TEXT_CREATE_ALWAYS" create always a new text (for messages)


lngTextCreateMode = 1

'create new text


objHMIGO.CreateText lngLanguageID, strText, lngTextCreateMode, lngTextID
'show TextID of created text
MsgBox "TextID: " & lngTextID, vbOKOnly, "Result CreateText"
Set objHMIGO = Nothing
End Sub

See also
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetTextID Function (Page 3943)
GetText Function (Page 3942)
DeleteTextLanguage Function (Page 3941)
DeleteText Function (Page 3939)
CreateTextLanguage Function (Page 3934)
VBA in the Text Library (Page 3933)

DeleteText Function
Description
Deletes a line of text. All the languages for the corresponding line of text and the line of text
itself are deleted.

syntax
Expression.DeleteText(TextID)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

TextID (long)

ID of the line of text to be deleted

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3937

VBA for Automated Configuration


5.5 VBA Reference

Example:

Sub DeleteText()
' HMIGO_018
' procedure to delete a text
' text will be searched and deleted
' declarations
Dim objHMIGO As HMIGO
Dim lngLanguageID As Long
Dim lngTextID As Long
'return value of GetTextID
Dim strText As String
On Error GoTo ErrorHandler
Set objHMIGO = New HMIGO
strText = "new text"
lngLanguageID = 1033
'first: find text in text library and return TextID
objHMIGO.GetTextID 1033, strText, lngTextID
'if searched text exists: delete this text
If Not lngTextID = -1 Then
objHMIGO.DeleteText lngTextID
MsgBox "Text : """ & strText & """ found in TextID: " & lngTextID & vbNewLine & _
"TextID is deleted!", vbOKOnly, "Result DeleteText"
Else
MsgBox "Text : """ & strText & """ not found." & vbNewLine & _
"No Text deleted!", vbOKOnly, "Result DeleteText"
End If
Set objHMIGO = Nothing
Exit Sub
ErrorHandler:
'if lngText = (-1),searched text does not exit
If lngTextID = -1 Then
'reset errorhandler
Err.Clear
Resume Next
End If
MsgBox "ErrNr. : " & Err.Number & vbNewLine & _
"ErrDes.: " & Err.Description, vbOKOnly, "Error ocurred"
'reset errorhandler
Err.Clear
End Sub

See also
VBA in the Text Library (Page 3933)
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetTextID Function (Page 3943)
GetText Function (Page 3942)
DeleteTextLanguage Function (Page 3941)

3938

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CreateText Function (Page 3936)
CreateTextLanguage Function (Page 3934)

DeleteTextLanguage Function
Description
Enables a language to be deleted from the TextLibrary. In this case, all the texts in this
language are also deleted.

syntax
Expression.DeleteTextLanguage(LanguageID)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

LanguageID (Long)

ID of the language to be deleted

Example:
In the following example, a check is made whether the language '1036' exists. If it does, it will
be deleted.

Sub DeleteLanguage()
'HMIGO_030
' delete an existing languages in TextLibrary
' language '1036'/spanish has to exist
Dim objHMIGO As New HMIGO
Dim varRange As Variant
Dim intLanguage As Long
Dim lngPointer As Long
' get all existing languages
objHMIGO.ListText TEXT_LANGUAGE_IDS, arrContent
' check requested list for language '1036'/ spanish and delete
For lngPointer = LBound(arrContent) To UBound(arrContent)
intLanguage = arrContent(lngPointer) + Val("&H400")
If intLanguage = 1036 Then
'delete language
objHMIGO.DeleteTextLanguage intLanguage
End If
Next lngPointer
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3939

VBA for Automated Configuration


5.5 VBA Reference

See also
GetText Function (Page 3942)
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetTextID Function (Page 3943)
DeleteText Function (Page 3937)
CreateText Function (Page 3936)
CreateTextLanguage Function (Page 3934)
VBA in the Text Library (Page 3933)

GetText Function
Description
Returns the text for the selected text ID in the selected language.

syntax
Expression.GetText(LanguageID,TextID,Text)
Expression
Necessary. An expression that returns an object of the type "HMIGeneralObjects".

Parameters
Parameter (Data Type)

Description

LanguageID (Long)

ID of the language of the text to be read

TextID (long)

ID of the line of text from which text is to be read

Text (string)

Returns the text of the selected line of text and


language.

Example:

Sub GetText()
' HMIGO_019
' procedure to get a text
' text with TextID = '69' need to be created
' declarations
Dim objHMIGO As HMIGO
Dim lngLanguageID As Long
Dim lngTextID As Long
Dim strText As String
'return value of GetText

3940

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Set objHMIGO = New HMIGO


lngTextID = 69
lngLanguageID = 1033
'find text text library
objHMIGO.GetText lngLanguageID, lngTextID, strText
'show found text
MsgBox "Read Text in TextID : " & lngTextID & " is """ & strText & """ !", _
vbOKOnly, "Result GetText"
Set objHMIGO = Nothing
End Sub

See also
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetTextID Function (Page 3943)
DeleteTextLanguage Function (Page 3939)
DeleteText Function (Page 3937)
CreateText Function (Page 3936)
CreateTextLanguage Function (Page 3934)
VBA in the Text Library (Page 3933)

GetTextID Function
Description
Returns the ID of the text searched for in the selected language.
If there are several texts with the same contents, only the line of text with the lowest ID is
returned. Whether there are several lines of text with the same contents depends on the
CreateMode of the CreateText function.

syntax
Expression.GetTextID(LanguageID,Text,TextID)
Expression
Necessary. An expression which returns a "HMIGO" type object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3941

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

LanguageID (Long)

ID of the language of the text searched for

Text (string)

The text searched for

TextID (long)

ID of the line of text in which the text searched for


was found

Example:

Sub GetTextID()
' HMIGO_020
' procedure to search a TextID
' text will be searched and a TextID will be returned
' declarations
Dim objHMIGO As HMIGO
Dim lngLanguageID As Long
Dim lngTextID As Long
'return value of GetTextID
Dim strText As String
On Error GoTo ErrorHandler
Set objHMIGO = New HMIGO
strText = "old text"
lngLanguageID = 1033
'first: find text in text library and return TextID
objHMIGO.GetTextID 1033, strText, lngTextID
'if searched text exists: delete this text
If Not lngTextID = -1 Then
MsgBox "Text : """ & strText & """ found in TextID: " & lngTextID, _
vbOKOnly, "Result GetTextID"
Else
MsgBox "Text : """ & strText & """ not found!", vbOKOnly, "Result GetTextID"
End If
Set objHMIGO = Nothing
Exit Sub
ErrorHandler:
'if lngText = (-1),searched text does not exit
If lngTextID = -1 Then
'reset errorhandler
Err.Clear
Resume Next
End If
MsgBox "ErrNr. : " & Err.Number & vbNewLine & _
"ErrDes.: " & Err.Description, vbOKOnly, "Error ocurred"
'reset errorhandler
Err.Clear
End Sub

3942

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

See also
ModifyText Function (Page 3946)
ListText Function (Page 3945)
GetText Function (Page 3940)
DeleteTextLanguage Function (Page 3939)
DeleteText Function (Page 3937)
CreateText Function (Page 3936)
CreateTextLanguage Function (Page 3934)
VBA in the Text Library (Page 3933)

ListText Function
Description
Alternatively, the ListText function returns the following contents of the TextLibrary as a list:
All languages created
All text IDs
All texts in a specific language

syntax
Exoression.ListText(ListType,pListArray,[LanguageID],[Filter])
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

ListType (HMIGO_TEXT_LIST_TYPE)

Defines which content should be returned as a list.


Possibilities are:
TEXT_LANGUAGE_IDS (1) All the created
languages. The result still has to be converted
by adding 400hex.
TEXT_IDS (2) All text IDs.
TEXT_TEXTS (3) All texts in a language.

pListArray (Variant)

List with the requested content.

LanguageID (Long)

The language ID whose text is to be returned.

Filter (String)

Filters can be set optionally. Wildcards "*" and "?"


are also possible.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3943

VBA for Automated Configuration


5.5 VBA Reference

Example:
In the following example, a check is made whether the list with the text of a language is empty
because the language does not exist:

Sub ReadTextsByLanguage()
'HMIGO_031
'read content in textLibrary by language
Dim objHMIGO As New HMIGO
Dim varRange As Variant
Dim intLanguage As Integer
'set invalid language ID
intLanguage = 1051 'language does not exist
'read all texts
objHMIGO.ListText TEXT_TEXTS, arrContent, intLanguage
'check result
If (UBound(arrContent) - LBound(arrContent) + 1) <= 0 Then
MsgBox "no entries because wrong language selection"
End If
End Sub

See also
ModifyText Function (Page 3946)
GetTextID Function (Page 3941)
GetText Function (Page 3940)
DeleteTextLanguage Function (Page 3939)
DeleteText Function (Page 3937)
CreateTextLanguage Function (Page 3934)
VBA in the Text Library (Page 3933)

ModifyText Function
Description
Modifies the text for the selected language with the ID specified.

syntax
Expression.ModifyText(LanguageID,TextID,Text)
Expression
Necessary. An expression which returns a "HMIGO" type object.

3944

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

LanguageID (Long)

ID of the language of the text to be changed.

TextID (long)

ID of the language of the text to be changed.

Text (string)

New text to be inserted.

Example:

Sub ModifyText()
' HMIGO_021
' procedure to modify a text
' text will be searched and replaced
' declarations
Dim objHMIGO As HMIGO
Dim lngLanguageID As Long
Dim lngTextID As Long
'return value of GetTextID
Dim strOldText As String
Dim strNewText As String
On Error GoTo ErrorHandler
Set objHMIGO = New HMIGO
strOldText = "old text"
strNewText = "new text"
lngLanguageID = 1033
'first: find text in text library and return TextID
objHMIGO.GetTextID 1033, strOldText, lngTextID
'if searched text exists: replace this text
If Not lngTextID = -1 Then
objHMIGO.ModifyText lngLanguageID, lngTextID, strNewText
MsgBox "Text : """ & strOldText & """ found in TextID: " & lngTextID & vbNewLine & _
"Text replaced with : """ & strNewText & """ !", vbOKOnly, "Result DeleteText"
Else
MsgBox "Text : """ & strOldText & """ not found." & vbNewLine & _
"No Replacements done!", vbOKOnly, "Result DeleteText"
End If
Set objHMIGO = Nothing
Exit Sub
ErrorHandler:
'if lngText = (-1),searched text does not exit
If lngTextID = -1 Then
'reset errorhandler
Err.Clear
Resume Next
End If
MsgBox "ErrNr. : " & Err.Number & vbNewLine & _
"ErrDes.: " & Err.Description, vbOKOnly, "Error ocurred"
'reset errorhandler
Err.Clear
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3945

VBA for Automated Configuration


5.5 VBA Reference

See also
ListText Function (Page 3943)
GetTextID Function (Page 3941)
GetText Function (Page 3940)
DeleteTextLanguage Function (Page 3939)
DeleteText Function (Page 3937)
CreateText Function (Page 3936)
CreateTextLanguage Function (Page 3934)
VBA in the Text Library (Page 3933)

5.5.2.5

VBA in Alarm Logging

VBA in Alarm Logging


Introduction
VBA allows you to create messages directly from the program code, modify them, and delete
them.
Note
You should not have or should not open the "Alarm Logging" editor when editing with VBA.

Principle
When you have created the instance of the "HMIGO" class, the following functions are available
to you to access Alarm Logging:
CloseSingleAlarm
CommitSingleAlarm
CreateSingleAlarm
DeleteSingleAlarm
GetSingleAlarm
ListSingleAlarm
The following enumerations are available for the parameter supply of these functions:
HMIGO_SINGLE_ALARM_CLASS_IDS
HMIGO_SINGLE_ALARM_LIST_TYPE

3946

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Access to the Object Properties


You can also access the parameters of the above-mentioned functions directly in VBA by
means of the following object properties:
Object property

Description

Read/Write

ObjectStateSingleAlarm

Returns the object state via the enumeration


HMIGO_OBJECT_STATE. Further information on this enumeration
can be found in this documentation under "VBA in other WinCC
Editors".

Yes/no

SingleAlarmMessageNumber

Number of the message

Yes/no

SingleAlarmAGNumber

AS Number

Yes/yes

SingleAlarmCPUNumber

CPU number of the AGs.

Yes/yes

SingleAlarmClassID

Message class of the message. Possible values of the Enum


SINGLE_ALARM_CLASS_IDS:

Yes/yes

SINGLE_ALARM_ERROR (1)
SINGLE_ALARM_CLASS_2 (2)
SINGLE_ALARM_CLASS_3 (3)
SINGLE_ALARM_CLASS_4 (4)
SINGLE_ALARM_CLASS_5 (5)
SINGLE_ALARM_CLASS_6 (6)
SINGLE_ALARM_CLASS_7 (7)
SINGLE_ALARM_CLASS_8 (8)
SINGLE_ALARM_CLASS_9 (9)
SINGLE_ALARM_CLASS_10 (10)
SINGLE_ALARM_CLASS_11 (11)
SINGLE_ALARM_CLASS_12 (12)
SINGLE_ALARM_CLASS_13 (13)
SINGLE_ALARM_CLASS_14 (14)
SINGLE_ALARM_CLASS_15 (15)
SINGLE_ALARM_CLASS_16 (16)
SINGLE_ALARM_CLASS_SYSTEM_REQUIRE_ACKNOWLEDG
EMENT (17)
SINGLE_ALARM_CLASS_SYSTEM_WITHOUT_ACKNOWLEDG
EMENT (18)
SingleAlarmMessageTypeID

Type ID of the message. The permissible values depend on the


message class:

Yes/yes

Class 1: Values from 1 to 16


Class 2: Values from 17 to 32
Class 3: Values from 33 to 48
...
Class 18: 273 and 274
SingleAlarmTextXXID
XX = 1...10

The properties SingleAlarmText1ID to SingleAlarmText10ID exist for


the user texts 1 to 10.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

Yes/yes

3947

VBA for Automated Configuration


5.5 VBA Reference
Object property

Description

Read/Write

SingleAlarmTagNameProcessVal For the process values there are the properties


Yes/yes
ueXX
SingleAlarmTagNameProcessValue1 through 10
XX = 1...10
If you want to delete a configured process value, you must describe
this parameter with a tag of the type "Long", which has the value "0".1)
SingleAlarmTagName

Tag name for event

Yes/yes

SingleAlarmMessageBit

Bits for bit reporting procedure

Yes/yes

SingleAlarmQuitTag

Tag name for acknowledgment status

Yes/yes

SingleAlarmQuitBits

Bit for bit reporting procedure

Yes/yes

SingleAlarmStateTag

Tag for status query

Yes/yes

SingleAlarmStateBits

Bit for status tag

Yes/yes

SingleAlarmNormDLL

Name of the conversion DLL

Yes/yes

SingleAlarmQuitSingle

Acknowledgment of the messages, TRUE or FALSE possible

Yes/yes

SingleAlarmHornActivate

Activation of the horn, TRUE or FALSE possible

Yes/yes

SingleAlarmArchiving

Archiving of the message, TRUE or FALSE possible

Yes/yes

SingleAlarmProtocol

Logging of the message, TRUE or FALSE possible

Yes/yes

SingleAlarmFlankInvert

Triggering of message at falling edge, TRUE or FALSE possible

Yes/yes

SingleAlarmLockedOnStart

Message is disabled at system startup, TRUE or FALSE possible

Yes/yes

SingleAlarmGlobalAPFunction

Forward message to global AP function, TRUE or FALSE possible

Yes/yes

SingleAlarmActionName

Name of the action

Yes/yes

SingleAlarmActionParams

Parameters of the action

Yes/yes

SingleAlarmInfoText

Information text for message

Yes/yes

SingleAlarmGroup

Name of the user-defined group message assigned to a message.

Yes/yes

1)

Sub DeleteSingleAlarmTagNameProcessValue1()
'HMIGO_033
Dim objGO as HMIGO
Dim var as Long
var = 0
Set objGO = new HMIGO
'message 1 will be modified
objGO.GetSingleAlarm 1
objGO.SingleAlarmTagNameProcessValue1 = var
objGO.CommitSingleAlarm
Set objGO = nothing
End Sub

See also
ListSingleAlarm Function (Page 3959)
GetSingleAlarm Function (Page 3958)
DeleteSingleAlarm Function (Page 3956)
CreateSingleAlarm Function (Page 3953)
CommitSingleAlarm Function (Page 3952)

3948

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CloseSingleAlarm Function (Page 3951)
VBA in Other WinCC Editors (Page 3887)

CloseSingleAlarm Function
Description
Closes the message which is open.
Note
Modified parameters are not saved. If the current value should be saved, execute the
CommitSingleAlarm() function again.

syntax
Expression.CloseSingleAlarm()
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
--

Example:

Sub CloseSingleAlarm()
' HMIGO_22
' procedure to open a singlealarm
' message #100 need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim lngMsgNumber As Long
Set objHMIGO = New HMIGO
lngMsgNumber = 100
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
'open a singlealarm
objHMIGO.GetSingleAlarm lngMsgNumber
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
'close a singlealarm
objHMIGO.CloseSingleAlarm
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3949

VBA for Automated Configuration


5.5 VBA Reference

Set objHMIGO = Nothing


End Sub

See also
ListSingleAlarm Function (Page 3959)
GetSingleAlarm Function (Page 3958)
DeleteSingleAlarm Function (Page 3956)
CreateSingleAlarm Function (Page 3953)
CommitSingleAlarm Function (Page 3952)
VBA in Alarm Logging (Page 3946)

CommitSingleAlarm Function
Description
Writes the changed parameters of the open message to WinCC.
Note
To change further parameters after a CommitSingleAlarm call, write these changes to WinCC
by calling the function again.

syntax
Expression.CommitSingleAlarm()
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
--

Example:

Sub CommitSingleAlarm()
' HMIGO_023
' procedure to change a property of a singlealarm
' message #100 need to be created before
' declarations
Dim objHMIGO As HMIGO

3950

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

Dim lngMsgNumber As Long


Dim lngMsgBitNumber As Long
Set objHMIGO = New HMIGO
lngMsgNumber = 100
lngMsgBitNumber = 10
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly,
'open a singlealarm
objHMIGO.GetSingleAlarm lngMsgNumber
'current status is "OPENED" for changes
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly,
'change a property
objHMIGO.SingleAlarmMessageBit = lngMsgBitNumber
'current status is "MODIFIED" for changes
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly,
'commit a single alarm
objHMIGO.CommitSingleAlarm
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly,

"Status SingleAlarm"

"Status SingleAlarm"

"Status SingleAlarm"

"Status SingleAlarm"

Set objHMIGO = Nothing


End Sub

See also
ListSingleAlarm Function (Page 3959)
GetSingleAlarm Function (Page 3958)
DeleteSingleAlarm Function (Page 3956)
CreateSingleAlarm Function (Page 3953)
CloseSingleAlarm Function (Page 3949)
VBA in Alarm Logging (Page 3946)

CreateSingleAlarm Function
Description
Creates a new message.

syntax
Expression.CreateSingleAlarm(MessageNumber,ClassID,MessageTypeID,Tex
t1ID,MessageTagName,MessageBit)
Expression
Necessary. An expression which returns a "HMIGO" type object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3951

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

MessageNumber (long)

Number of the message.


If an unused message number is specified
here, it is accepted.
If the value "0" is entered, the message number
is freely assigned by the system. In this case,
the message number is given back here.

ClassID (HMIGO_SINGLE_ALARM_CLASS_IDS) Message class. The possible values are in the


table Enum
HMIGO_SINGLE_ALARM_CLASS_IDS.
MessageTypeID (Integer)

The permissible values depend on the message


class:
Class 1: Values from 1 to 16
Class 2: Values from 17 to 32
Class 3: Values from 33 to 48
...
Class 18: Values from 263 to 288

Text1ID (Long)

ID for the first user text. The ModifySingleAlarm


function can be used to define nine further user
texts (1-10).

MessageTagName (String)

Tag name for the event.

MessageBit (integer)

Bit in bit reporting process (0...31)

Default Values When a New Message Is Created


The following table indicates the default values that are entered when a new message is
created. These properties can be modified. The modifications are saved using the
ModifySingleAlarm function.

3952

Parameters

Default Value (Enum


Name => Value)

Comment

SingleAlarmAGNumber

--

SingleAlarmCPUNumber

--

SingleAlarmTextXXID

No text entered

--

SingleAlarmTagNameProcessValu
eXX

No tag entered

--

SingleAlarmQuitTag

No tag entered

--

SingleAlarmQuitBits

No bits set.

SingleAlarmStateTag

No tag entered

Corresponds to exactly one day. Only


relevant in the case of compressed
tags.

SingleAlarmStateBits

No bits set.

SingleAlarmNormDLL

No name entered

--

SingleAlarmQuitSingle

FALSE

Single acknowledgment, no group


acknowledgment

SingleAlarmHornActivate

FALSE

Horn Not active.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
Parameters

Default Value (Enum


Name => Value)

Comment

SingleAlarmArchiving

TRUE

Message will be archived.

SingleAlarmProtocol

TRUE

Message is logged.

SingleAlarmFlankInvert

FALSE

Not activated.

SingleAlarmLockedOnStart

FALSE

Message is not disabled.

SingleAlarmGlobalAPIFunction

FALSE

Message is not forwarded.

SingleAlarmActionName

No name entered

--

SingleAlarmActionParams

No parameters
entered for the action

--

SingleAlarmInfoText

No text entered

--

SingleAlarmGroup

No text entered

--

Enum HMIGO_SINGLE_ALARM_CLASS_IDS
The following message classes are available for selection:
Values

Description

SINGLE_ALARM_ERROR (1)

--

SINGLE_ALARM_CLASS_2 (2)

--

SINGLE_ALARM_CLASS_3 (3)

--

SINGLE_ALARM_CLASS_4 (4)

--

SINGLE_ALARM_CLASS_5 (5)

--

SINGLE_ALARM_CLASS_6 (6)

--

SINGLE_ALARM_CLASS_7 (7)

--

SINGLE_ALARM_CLASS_8 (8)

--

SINGLE_ALARM_CLASS_9 (9)

--

SINGLE_ALARM_CLASS_10 (10)

--

SINGLE_ALARM_CLASS_11 (11)

--

SINGLE_ALARM_CLASS_12 (12)

--

SINGLE_ALARM_CLASS_13 (13)

--

SINGLE_ALARM_CLASS_14 (14)

--

SINGLE_ALARM_CLASS_15 (15)

--

SINGLE_ALARM_CLASS_16 (16)

--

SINGLE_ALARM_CLASS_SYSTEM_REQUIRE_ACKNOWLEDGEMENT (17)

--

SINGLE_ALARM_CLASS_SYSTEM_WITHOUT_ACKNOWLEDGEMENT (18)

--

Example:

Sub CreateSingleAlarm()
' HMIGO_024
' procedure to create a SingleAlarm
' message must not be created before

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3953

VBA for Automated Configuration


5.5 VBA Reference

' message Text ID need to be created before in text library


' declarations
Dim objHMIGO As HMIGO
Dim strMsgText As String
'message text
Dim strMsgTagName As String
'message variable
Dim lngMsgNumber As Long
'message number
Dim lngMsgBitNumber As Long
'bit number within the message variable
Dim lngMsgTypeID As Long
'message type
Dim lngMsgClassID
'SINGLE_ALARM_ERROR
Dim lngMsgTextID As Long
'message text ID from textlibrary
Set objHMIGO = New HMIGO
strMsgText = "NewText"
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
'preset reqiured parameter
lngMsgNumber = 50
lngMsgClassID = 1
lngMsgTypeID = 2
lngMsgTextID = 69
strMsgText = "new text message"
strMsgTagName = "NewVariable"
lngMsgBitNumber = 5
'create a tag
objHMIGO.CreateSingleAlarm lngMsgNumber,SINGLE_ALARM_ERROR, lngMsgTypeID,lngMsgTextID,
strMsgTagName, lngMsgBitNumber
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
Set objHMIGO = Nothing
End Sub

See also
ListSingleAlarm Function (Page 3959)
GetSingleAlarm Function (Page 3958)
DeleteSingleAlarm Function (Page 3956)
CommitSingleAlarm Function (Page 3950)
CloseSingleAlarm Function (Page 3949)
VBA in Alarm Logging (Page 3946)

DeleteSingleAlarm Function
Description
Deletes the specified message.

3954

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference

syntax
Expression.DeleteSingleAlarm(MessageNumber)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

MessageNumber (long)

Number of the message to be deleted.

Example:

Sub DeleteSingleAlarm()
' HMIGO_025
' procedure to delete a singlealarm
' message #100 need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim lngMsgNumber As Long
Set objHMIGO = New HMIGO
lngMsgNumber = 100
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
'delete a singlealarm
objHMIGO.DeleteSingleAlarm lngMsgNumber
Set objHMIGO = Nothing
End Sub

See also
VBA in Alarm Logging (Page 3946)
ListSingleAlarm Function (Page 3959)
GetSingleAlarm Function (Page 3958)
CreateSingleAlarm Function (Page 3951)
CommitSingleAlarm Function (Page 3950)
CloseSingleAlarm Function (Page 3949)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3955

VBA for Automated Configuration


5.5 VBA Reference

GetSingleAlarm Function
Description
Reads in the parameters of the message entered.
You can change or read the parameters by means of the object properties. You will find a list
of the available object properties in this documentation under "VBA in Alarm Logging".

syntax
Expression.GetSingleAlarm(MessageNumber)
Expression
Necessary. An expression which returns a "HMIGO" type object.

Parameters
Parameter (Data Type)

Description

MessageNumber (long)

The message number of the message to be read


in.

Example:

Sub GetSingleAlarm()
' HMIGO_026
' procedure to open a singlealarm
' message #100 need to be created before
' declarations
Dim objHMIGO As HMIGO
Dim lngMsgNumber As Long
Set objHMIGO = New HMIGO
lngMsgNumber = 100
'current status is "EMPTY"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
'open/ get a tag
objHMIGO.GetSingleAlarm lngMsgNumber
'current status is "OPENED"
MsgBox objHMIGO.ObjectStateSingleAlarm, vbOKOnly, "Status SingleAlarm"
Set objHMIGO = Nothing
End Sub

See also
ListSingleAlarm Function (Page 3959)
DeleteSingleAlarm Function (Page 3954)
CreateSingleAlarm Function (Page 3951)

3956

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CommitSingleAlarm Function (Page 3950)
CloseSingleAlarm Function (Page 3949)
VBA in Alarm Logging (Page 3946)

ListSingleAlarm Function
Description
The ListSingleAlarm function returns the content of Alarm Logging in a list:
All actions created which are linked to messages
All message class IDs created
All info texts created
All message numbers created
All message type IDs created
All message classes created
All group messages created

syntax
Expression.ListSingleAlarm(ListType,pListArray,[Filter])
Expression
Necessary. An expression which returns a "HMIGO" type object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3957

VBA for Automated Configuration


5.5 VBA Reference

Parameters
Parameter (Data Type)

Description

ListType
(HMIGO_SINGLE_ALARM_LIST_TYPE)

Defines which content should be returned in a list.


Possibilities are:
SINGLE_ALARM_ACTION_NAMES (1) All actions
created for Loop In Alarm when the parameter is set
in the configuration as a string
SINGLE_ALARM_CLASS_IDS (2) All message class
IDs created
SINGLE_ALARM_INFO_TEXTS (3) All info texts
created
SINGLE_ALARM_MESSAGE_NUMBERS (4) All
message numbers created
SINGLE_ALARM_MESSAGE_TYPE_IDS (5) All
message type IDs created
SINGLE_ALARM_GROUP_MESSAGE_CLASSES
(6) All message classes created
SINGLE_ALARM_GROUP_MESSAGE_USER_DEF
INED (7) All group messages created

pListArray (Variant)

List with the requested content.

Filter (String)

Filters can be set optionally. Wildcards "*" and "?" are


also possible.

Example:
In the following example, a check is made whether info texts have been configured:

Sub ReadSingleAlarm()
'HMIGO_032
'read content in alarm logging
'no info texts are implemented
Dim objHMIGO As New HMIGO
Dim varRange As Variant
'read all info texts
objHMIGO.ListSingleAlarm SINGLE_ALARM_INFO_TEXTS, arrContent
'check result
If (UBound(arrContent) - LBound(arrContent) + 1) <= 0 Then
MsgBox "no entries because no info texts are implemented"
End If
End Sub

See also
CreateSingleAlarm Function (Page 3951)
CommitSingleAlarm Function (Page 3950)

3958

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA for Automated Configuration


5.5 VBA Reference
CloseSingleAlarm Function (Page 3949)
VBA in Alarm Logging (Page 3946)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3959

VBA Reference
6.1

The object model of the Graphics Designer

6.1.1

VBA Reference

VBA Object Model


When you click an object name, you are shown a detailed description.
Note
The prefix "HMI" will be omitted from the following descriptions. Note that in the code you
must prefix objects with "HMI", e.g. "HMISymbolLibrary".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3961

VBA Reference
6.1 The object model of the Graphics Designer

See also
Events Object (Listing) (Page 3337)
SymbolLibraries Object (Listing) (Page 3439)
Actions Object (Listing) (Page 3271)
Application Object (Page 3282)
DataLanguage Object (Page 3313)
DataLanguages Object (Listing) (Page 3314)
Document Object (Page 3319)
Documents Object (Listing) (Page 3322)
Event Object (Page 3336)
HMIDefaultObjects Object (Listing) (Page 3354)
HMIObject Object (Page 3357)
HMIObjects Object (Listing) (Page 3359)
FolderItem Object (Page 3342)
FolderItems Object (Listing) (Page 3343)
VBA Reference: ActionDynamic (Page 3126)
VBA Reference: HMIObjects (Page 3128)
VBA Reference: Languages (Page 3130)
Layer Object (Page 3370)
Layers Object (Listing) (Page 3371)
Menu Object (Page 3378)
Menus Object (Listing) (Page 3380)
MenuItem Object (Page 3382)
MenuItems Object (Listing) (Page 3384)
Properties Object (Listing) (Page 3408)
Toolbar Object (Page 3445)
Toolbars Object (Listing) (Page 3446)
ToolbarItem Object (Page 3448)
ToolbarItems Object (Listing) (Page 3450)
View Object (Page 3466)
Views Object (Listing) (Page 3468)
SelectedObjects object (Listing) (Page 3426)
SymbolLibrary Object (Page 3440)
Property Object (Page 3409)

3962

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

6.1.2

VBA Reference: ActionDynamic

VBA Object Model: ActionDynamic


"ActionDynamic" represents the interface port for dynamics and actions such as scripts, the
dynamic dialog, the direct connection and the triggers.
When you click an object name, you are shown a detailed description.

See also
VBA Reference (Page 3124)
AnalogResultInfo Object (Page 3280)
AnalogResultInfos Object (Listing) (Page 3281)
BinaryResultInfo Object (Page 3291)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3963

VBA Reference
6.1 The object model of the Graphics Designer
BitResultInfo Object (Page 3292)
Actions Object (Listing) (Page 3271)
DestLink Object (Page 3316)
DirectConnection Object (Page 3318)
DynamicDialog Object (Page 3325)
QualityCodeStateValue Object (Page 3411)
QualityCodeStateValues Object (Listing) (Page 3413)
ScriptInfo Object (Page 3424)
SourceLink Object (Page 3431)
Trigger Object (Page 3452)
VariableStateValue Object (Page 3461)
VariableStateValues Object (Listing) (Page 3462)
VariableTrigger Object (Page 3464)
VariableTriggers Object (Listing) (Page 3465)
ActionType property (Page 3471)
DynamicStateType property (Page 3577)

3964

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

6.1.3

VBA Reference: HMIObjects

VBA Object Model: HMIObjects


When you click an object name, you are shown a detailed description.
+0,'HIDXOW2EMHFWV

6HOHFWLRQ

+0,2EMHFWV

+0,2EMHFW

6WDQGDUGREMHFWV

:LQGRZVREMHFWV

6SHFLDOREMHFWV

6PDUWREMHFWV

&LUFOH

%XWWRQ

&XVWRPL]HG2EMHFW

'%DU*UDSK

&LUFOH$UF

&KHFN%R[

*URXS

$FWLYH;&RQWURO

(OOLSVH

2SWLRQ*URXS

(OOLSVH$UF

5RXQG%XWWRQ

(OOLSVH6HJPHQW

6OLGHU

$SSOLFDWLRQ:LQGRZ
*URXS2EMHFWV

%DU*UDSK
&RPER%R[

/LQH

)DFHSODWH2EMHFW

3LH6HJPHQW

7XEHREMHFWV

*UDSKLF2EMHFW

3RO\JRQ

7XEH$UF2EMHFW

*URXS'LVSOD\

3RO\/LQH

7XEH'RXEOH7HH2EMHFW

,2)LHOG

5HFWDQJOH

7XEH7HH2EMHFW

/LVW%R[

5RXQG5HFWDQJOH

7XEH3RO\OLQH

0XOWL/LQH(GLW

6WDWLF7H[W

2/(2EMHFW
3LFWXUH:LQGRZ
6WDWXV'LVSOD\
7H[W/LVW

Object and List


Object
Detail view available.
Multilingual object configuration is possible.
*

Not in DefaultObjects list.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3965

VBA Reference
6.1 The object model of the Graphics Designer

See also
VBA Reference (Page 3124)
PolyLine Object (Page 3405)
GroupDisplay Object (Page 3350)
3DBarGraph Object (Page 3267)
ActiveXControl Object (Page 3273)
ApplicationWindow Object (Page 3284)
Button Object (Page 3293)
CheckBox Object (Page 3297)
Circle Object (Page 3300)
CircularArc Object (Page 3303)
Line Object (Page 3373)
OLEObject Object (Page 3391)
OptionGroup Object (Page 3393)
PictureWindow Object (Page 3396)
PieSegment Object (Page 3399)
Polygon Object (Page 3402)
Property Object (Page 3409)
Rectangle Object (Page 3415)
RoundButton Object (Page 3418)
RoundRectangle Object (Page 3422)
Slider object (Page 3428)
StaticText Object (Page 3433)
StatusDisplay Object (Page 3436)
TextList Object (Page 3441)
Ellipse Object (Page 3327)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
GraphicObject Object (Page 3345)
Group Object (Page 3348)
HMIDefaultObjects Object (Listing) (Page 3354)
HMIObject Object (Page 3357)
HMIObjects Object (Listing) (Page 3359)
IOField Object (Page 3361)
BarGraph Object (Page 3286)

3966

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
GroupedObjects Object (Listing) (Page 3353)
VBA Reference: Languages (Page 3130)
SelectedObjects object (Listing) (Page 3426)
CustomizedObject Object (Page 3310)
FaceplateObject object (Page 3339)
AdvancedAnalogDisplay object (Page 3274)
AdvancedStateDisplay object (Page 3278)

6.1.4

VBA Reference: Languages

VBA Object Model: Languages


When you click an object name, you are shown a detailed description.

See also
VBA Reference (Page 3124)
LanguageFont Object (Page 3365)
LanguageFonts Object (Listing) (Page 3366)
LanguageText Object (Page 3368)
LanguageTexts Object (Listing) (Page 3369)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3967

VBA Reference
6.1 The object model of the Graphics Designer

6.1.5

Events

6.1.5.1

A-D

Activated event
Description
Occurs when a picture is activated in the Graphics Designer. This happens when you switch
between two pictures, for example.

syntax
Document_Activated(CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when the picture is activated:

Private Sub Document_Activated(CancelForwarding As Boolean)


'VBA76
MsgBox "The document got the focus." & vbCrLf &_
"This event (Document_Activated) is raised by the document itself"
End Sub

See also
VBA Reference (Page 3124)
Event Handling (Page 3103)

BeforeClose Events
Description
Occurs immediately before a picture is closed.

3968

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Document_BeforeClose(Cancel As Boolean, CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output before the picture is closed:

Private Sub Document_BeforeClose(Cancel As Boolean, CancelForwarding As Boolean)


'VBA77
MsgBox "Event Document_BeforeClose is raised"
End Sub

See also
VBA Reference (Page 3124)

BeforeDocumentClose Event
Description
Occurs immediately before the picture is closed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeDocumentClose(Document As HMIDocument, Cancel
As Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3969

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that is going to be closed.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before the picture is closed:

Private Sub objGDApplication_BeforeDocumentClose(ByVal Document As IHMIDocument, Cancel As


Boolean)
'VBA78
MsgBox "The document " & Document.Name & " will be closed after press ok"
End Sub

See also
VBA Reference (Page 3124)

BeforeDocumentSave event
Description
Occurs immediately before the picture is saved.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.

3970

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
objGDApplication_BeforeDocumentSave(Document As HMIDocument, Cancel
As Boolean)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that is going to be closed.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before the picture is closed:

Private Sub objGDApplication_BeforeDocumentSave(ByVal Document As IHMIDocument, Cancel As


Boolean)
'VBA79
MsgBox Document.Name & "-saving will start after press ok."
End Sub

See also
VBA Reference (Page 3124)

BeforeHMIObjectDelete-Ereignis
Description
Occurs immediately before an object in a picture is deleted.

syntax
BeforeHMIObjectDelete(ByVal HMIObject As IHMIObject, Cancel As
Boolean, CancelForwarding As Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3971

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object to be deleted.

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object to be deleted:

Private Sub Document_BeforeHMIObjectDelete(ByVal HMIObject As IHMIObject, Cancel As


Boolean, CancelForwarding As Boolean)
'VBA80
Dim strObjName As String
Dim strAnswer As String
'
'"strObjName" contains the name of the deleted object
strObjName = HMIObject.ObjectName
strAnswer = MsgBox("Are you sure to delete " & strObjName & "?", vbYesNo)
If strAnswer = vbNo Then
'if pressed "No" -> set Cancel to true for prevent delete
Cancel = True
End If
End Sub

See also
VBA Reference (Page 3124)

BeforeLibraryFolderDelete event
Description
Occurs immediately before a folder in the components library is deleted.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.

3972

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
objGDApplication_BeforeLibraryFolderDelete(LibObject As
HMIFolderItem, Cancel As Boolean)

Parameter (Optional)
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The folder that is going to be deleted.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before a folder in the components library is
deleted:

Private Sub objGDApplication_BeforeLibraryFolderDelete(ByVal LibObject As HMIFolderItem,


Cancel As Boolean)
'VBA81
MsgBox "The library-folder " & LibObject.Name & " will be delete..."
End Sub

See also
VBA Reference (Page 3124)

BeforeLibraryObjectDelete event
Description
Occurs immediately before an object in the components library is deleted.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3973

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeLibraryObjectDelete(LibObject As
HMIFolderItem, Cancel As Boolean)

Parameter (Optional)
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The object that is going to be deleted.

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output before a folder in the components library is
deleted:

Private Sub objGDApplication_BeforeLibraryObjectDelete(ByVal LibObject As HMIFolderItem,


Cancel As Boolean)
'VBA82
MsgBox "The object " & LibObject.Name & " will be delete..."
End Sub

See also
VBA Reference (Page 3124)

3974

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BeforeQuit Event
Description
Occurs immediately before the Graphics Designer is closed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeQuit(Cancel As Boolean)

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In this example a message is output shortly before the Graphics Designer is closed.

Private Sub objGDApplication_BeforeQuit(Cancel As Boolean)


'VBA83
MsgBox "The Graphics Designer will be shut down"
End Sub

See also
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3975

VBA Reference
6.1 The object model of the Graphics Designer

BeforeSave Event
Description
Occurs immediately before a picture is saved.

syntax
Document_BeforeSave(Cancel As Boolean, CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output before the picture is saved:

Private Sub Document_BeforeSave(Cancel As Boolean, CancelForwarding As Boolean)


'VBA84
MsgBox "The document will be saved..."
End Sub

See also
VBA Reference (Page 3124)

BeforeVisibleFalse event
Description
Occurs immediately before the Graphics Designer application is set from Visible to Invisible.

syntax
Document_BeforeVisibleFalse(Cancel As Boolean, CancelForwarding As
Boolean)

3976

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

Cancel (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
--

See also
VBA Reference (Page 3124)

ConnectionEvent Event
Description
Occurs when two objects are connected via the connector.

syntax
ConnectionEvent(eConnEventType, HMIConnector, HMIConnectedObject,
CancelProcess, CancelForwarding)

Parameter (Optional)
Parameter (Data Type)

Description

eConnEventType (HMIConnectionEventType)

--

HMIConnector (HMIObject)

--

HMIConnectedObject (HMIObject)

--

CancelProcess (Boolean)

TRUE if command processing is to be canceled.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
--

See also
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3977

VBA Reference
6.1 The object model of the Graphics Designer

DataLanguageChanged Event
Description
Occurs when the project language has been changed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DataLanguageChanged(lCID As Long)

Parameters
Parameter (Data Type)

Description

lCID (Long)

The project language identifier

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the newly set project language is output:

Private Sub objGDApplication_DataLanguageChanged(ByVal lCID As Long)


'VBA87
MsgBox "The datalanguage is changed to " & Application.CurrentDataLanguage & "."
End Sub

See also
Language-Dependent Configuration with VBA (Page 3018)
VBA Reference (Page 3124)

3978

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

DesktopLanguageChanged event
Description
Occurs when the user interface language has been changed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DesktopLanguageChanged(lCID As Long)

Parameters
Parameter (Data Type)

Description

lCID (Long)

The user interface language identifier

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the newly set desktop language is output:

Private Sub objGDApplication_DesktopLanguageChanged(ByVal lCID As Long)


'VBA88
MsgBox "The desktop-language is changed to " & Application.CurrentDesktopLanguage & "."
End Sub

See also
VBA Reference (Page 3124)
Language-Dependent Configuration with VBA (Page 3018)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3979

VBA Reference
6.1 The object model of the Graphics Designer

DocumentActivated Event
Description
Occurs when a picture is activated in the Graphics Designer. This happens when you switch
between two pictures, for example.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentActivated(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that is to be activated.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output identifying the picture that has been activated:

Private Sub objGDApplication_DocumentActivated(ByVal Document As IHMIDocument)


'VBA89
MsgBox "The document " & Document.Name & " got the focus." & vbCrLf &_
"This event is raised by the application."
End Sub

3980

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
VBA Reference (Page 3124)

DocumentCreated Event
Description
Occurs when a new picture has been created in the Graphics Designer.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentCreated(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that has been created.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the name of the newly created picture is output:

Private Sub objGDApplication_DocumentCreated(ByVal Document As IHMIDocument)


'VBA90
MsgBox Document.Name & " will be created."
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3981

VBA Reference
6.1 The object model of the Graphics Designer

See also
VBA Reference (Page 3124)

DocumentOpened Event
Description
Occurs when a picture has been opened.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentOpened(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that has been opened.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output identifying the picture that has been opened:

Private Sub objGDApplication_DocumentOpened(ByVal Document As IHMIDocument)


'VBA91
MsgBox Document.Name & " is opened."
End Sub

3982

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
VBA Reference (Page 3124)

DocumentSaved Event
Description
Occurs when a picture has been saved in the Graphics Designer.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_DocumentSaved(Document As HMIDocument)

Parameters
Parameter (Data Type)

Description

Document (HMIDocument)

The picture that has been saved.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output identifying the picture that has been saved:

Private Sub objGDApplication_DocumentSaved(ByVal Document As IHMIDocument)


'VBA92
MsgBox Document.Name & " is saved."
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3983

VBA Reference
6.1 The object model of the Graphics Designer

See also
VBA Reference (Page 3124)

DocumentPropertyChanged event
Description
Occurs when a picture property is changed.

syntax
Document_DocumentPropertyChanged(ByVal Property As IHMIProperty,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

Property (IHMIProperty)

Identifies the changed property.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the picture property being changed:

Private Sub Document_DocumentPropertyChanged(ByVal Property As IHMIProperty,


CancelForwarding As Boolean)
'VBA93
Dim strPropName As String
'"strPropName" contains the name of the modified property
strPropName = Property.Name
MsgBox "The picture-property " & strPropName & " is modified..."
End Sub

See also
VBA Reference (Page 3124)

3984

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

6.1.5.2

F-Z

HMIObjectAdded Event
Description
Occurs when an object is added.

syntax
Document_HMIObjectAdded(ByVal HMIObject As IHMIObject,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object being added.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object that has been added:

Private Sub Document_HMIObjectAdded(ByVal HMIObject As IHMIObject, CancelForwarding As


Boolean)
'VBA94
Dim strObjName As String
'
'"strObjName" contains the name of the added object
strObjName = HMIObject.ObjectName
MsgBox "Object " & strObjName & " is added..."
End Sub

See also
VBA Reference (Page 3124)

HMIObjectMoved Event
Description
Occurs when an object is moved.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3985

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Document_HMIObjectMoved(ByVal HMIObject As IHMIObject,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object being moved.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object that has been moved:

Private Sub Document_HMIObjectMoved(ByVal HMIObject As IHMIObject, CancelForwarding As


Boolean)
'VBA95
Dim strObjName As String
'
'"strObjName" contains the name of the moved object
strObjName = HMIObject.ObjectName
MsgBox "Object " & strObjName & " was moved..."
End Sub

See also
VBA Reference (Page 3124)

HMIObjectPropertyChanged Event
Description
Occurs when an object property is changed.

syntax
Document_HMIObjectPropertyChanged(ByVal Property As IHMIProperty,
CancelForwarding As Boolean)

3986

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

Property (IHMIProperty)

Identifies the changed property.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output identifying the object property that has been
changed:

Private Sub Document_HMIObjectPropertyChanged(ByVal Property As IHMIProperty,


CancelForwarding As Boolean)
'VBA96
Dim strObjProp As String
Dim strObjName As String
Dim varPropValue As Variant
'
'"strObjProp" contains the name of the modified property
'"varPropValue" contains the new value
strObjProp = Property.Name
varPropValue = Property.value
'
'"strObjName" contains the name of the selected object,
'which property is modified
strObjName = Property.Application.ActiveDocument.Selection(1).ObjectName
MsgBox "The property " & strObjProp & " of object " & strObjName & " is modified... " &
vbCrLf & "The new value is: " & varPropValue
End Sub

See also
VBA Reference (Page 3124)

HMIObjectResized Event
Description
Occurs when the size of an object is changed.

syntax
Document_HMIObjectResized(ByVal HMIObject As IHMIObject,
CancelForwarding As Boolean)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3987

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

HMIObject (IHMIObject)

Identifies the object that is being resized.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when an object has been resized:

Private Sub Document_HMIObjectResized(ByVal HMIObject As IHMIObject, CancelForwarding As


Boolean)
'VBA97
Dim strObjName As String
'
'"strObjName" contains the name of the modified object
strObjName = HMIObject.ObjectName
MsgBox "The size of " & strObjName & " was modified..."
End Sub

See also
VBA Reference (Page 3124)

LibraryFolderRenamed Event
Description
Occurs when a folder in the components library has been renamed.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_LibraryFolderRenamed(LibObject As HMIFolderItem,
OldName As String)

3988

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The renamed folder.

OldName (String)

The original name of the renamed folder.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the old and new folder names are output:

Private Sub objGDApplication_LibraryFolderRenamed(ByVal LibObject As HMIFolderItem, ByVal


OldName As String)
'VBA98
MsgBox "The Library-folder " & OldName & " is renamed in: " & LibObject.DisplayName
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

LibraryObjectRenamed Event
Description
Occurs when an object in the components library has been renamed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3989

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_LibraryObjectRenamed(LibObject As HMIFolderItem,
OldName As String)

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The renamed object.

OldName (String)

The original name of the renamed object.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the old and new object names are output:

Private Sub objGDApplication_LibraryObjectRenamed(ByVal LibObject As IHMIFolderItem, ByVal


OldName As String)
'VBA99
MsgBox "The object " & OldName & " is renamed in: " & LibObject.DisplayName
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

3990

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

LibraryObjectAdded Event
Description
Occurs when an object has been added to the components library.

syntax
HMIObjectPropertyChanged(ByVal Property As IHMIProperty,
CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

LibObject (IHMIFolderItem)

Identifies the library object.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when an object has been added to the
components library:

Private Sub Document_LibraryObjectAdded(ByVal LibObject As IHMIFolderItem,


CancelForwarding As Boolean)
'VBA100
Dim strObjName As String
'
'"strObjName" contains the name of the added object
strObjName = LibObject.DisplayName
MsgBox "Object " & strObjName & " was added to the picture."
End Sub

See also
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3991

VBA Reference
6.1 The object model of the Graphics Designer

MenuItemClicked Event
Description
Occurs when an entry in a user-defined menu is clicked.
Note
This event is both application-specific and document-specific.
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application

syntax
Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)

Parameters
Parameter (Data Type)

Description

MenuItem (IHMIMenuItem)

Identifies the user-defined menu.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output when the first entry in a user-defined menu is
clicked:

Private Sub Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)


'VBA101
Dim objMenuItem As HMIMenuItem
Dim varMenuItemKey As Variant
Set objMenuItem = MenuItem
'
'"objMenuItem" contains the clicked menu-item
'"varMenuItemKey" contains the value of parameter "Key"
'from the clicked userdefined menu-item

3992

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

varMenuItemKey = objMenuItem.Key
Select Case MenuItem.Key
Case "mItem1_1"
MsgBox "The first menu-item was clicked!"
End Select
End Sub

See also
How to assign VBA macros to menus and toolbars (Page 3036)
VBA Reference (Page 3124)

NewLibraryFolder Event
Description
Occurs when a folder has been created in the components library.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_NewLibraryFolder(LibObject As HMIFolderItem)

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The newly created folder.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3993

VBA Reference
6.1 The object model of the Graphics Designer

In the following example the new folder name is output:

Private Sub objGDApplication_NewLibraryFolder(ByVal LibObject As IHMIFolderItem)


'VBA102
MsgBox "The library-folder " & LibObject.DisplayName & " was added."
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

NewLibraryObject Event
Description
Occurs when an object has been created in the components library.

syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_NewLibraryObject(LibObject As HMIFolderItem)

Parameters
Parameter (Data Type)

Description

LibObject (HMIFolderItem)

The newly created object.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first

3994

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Set objGDApplication = grafexe.Application


End Sub

In the following example the new object name is output:

Private Sub objGDApplication_NewLibraryObject(ByVal LibObject As IHMIFolderItem)


'VBA103
MsgBox "The object " & LibObject.DisplayName & " was added."
End Sub

See also
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

Opened Event
Description
Occurs when a picture is opened.

syntax
Document_Opened(CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when the picture is opened:

Private Sub Document_Opened(CancelForwarding As Boolean)


'VBA104
MsgBox "The Document is open now..."
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3995

VBA Reference
6.1 The object model of the Graphics Designer

See also
VBA Reference (Page 3124)

Saved Event
Description
Occurs after a picture has been saved.

syntax
Document_Saved(CancelForwarding As Boolean)

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when the picture has been saved:

Private Sub Document_Saved(CancelForwarding As Boolean)


'VBA105
MsgBox "The document is saved..."
End Sub

See also
VBA Reference (Page 3124)

SelectionChanged Event
Description
Occurs when the selection has been changed.

syntax
Document_SelectionChanged(CancelForwarding As Boolean)

3996

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
In the following example a message is output when a new object has been selected:

Private Sub Document_SelectionChanged(CancelForwarding As Boolean)


'VBA106
MsgBox "The selection is changed..."
End Sub

See also
VBA Reference (Page 3124)

Started Event
Description
Occurs when the Graphics Designer has been started.

Syntax
objGDApplication_Started()
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3997

VBA Reference
6.1 The object model of the Graphics Designer

Example
Declare application.

Dim WithEvents objGDApplication As grafexe.Application

Set event tag.

Private Sub Document_Opened(CancelForwarding As Boolean)


Set objGDApplication = Me.Application
End Sub

Query "Started" event and output message.

Private Sub objGDApplication_Started()


'VBA107
'This event is raised before objGDApplication_Started()
MsgBox "The Graphics Designer is started!"
End Sub

See also
VBA Reference (Page 3124)

ToolbarItemClicked Event
Description
Occurs when an icon in a user-defined toolbar has been clicked
Note
This event is both application-specific and document-specific.
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application

syntax
Document_ToolbarItemClicked(ByVal ToolbarItem As IHMIToolbarItem)

3998

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

ToolbarItem (IHMIToolbarItem)

Identifies the symbol.

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example a message is output when the first user-defined icon is clicked:

Private Sub Document_ToolbarItemClicked(ByVal ToolbarItem As IHMIToolbarItem)


'VBA108
Dim objToolbarItem As HMIToolbarItem
Dim varToolbarItemKey As Variant
Set objToolbarItem = ToolbarItem
'
'"varToolbarItemKey" contains the value of parameter "Key"
'from the clicked userdefined toolbar-item
varToolbarItemKey = objToolbarItem.Key
'
Select Case varToolbarItemKey
Case "tItem1_1"
MsgBox "The first Toolbar-Icon was clicked!"
End Select
End Sub

See also
How to assign VBA macros to menus and toolbars (Page 3036)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

3999

VBA Reference
6.1 The object model of the Graphics Designer

ViewCreated Event
Description
Occurs when a copy of a picture has been created.
Note
This event is both application-specific and document-specific.
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application

syntax
Document_ViewCreated(ByVal pView As IHMIView, CancelForwarding As
Boolean)

Parameters
Parameter (Data Type)

Description

pView (IHMIView)

Identifies the copy of the picture.

CancelForwarding (Boolean)

TRUE if the event is not intended to be forwarded.


Default setting is "False".

Example:
Carry out the following procedure so that the example shown below will work:

Private Sub SetApplication()


'This procedure have to execute with "F5" first
Set objGDApplication = grafexe.Application
End Sub

In the following example the number of copy pictures is output when a new copy of the picture
has been created.

Private Sub Document_ViewCreated(ByVal pView As IHMIView, CancelForwarding As Boolean)


'VBA109
Dim iViewCount As Integer
'
'To read out the number of views
iViewCount = pView.Application.ActiveDocument.Views.Count

4000

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

MsgBox "A new copy of the picture (number " & iViewCount & ") was created."
End Sub

See also
VBA Reference (Page 3124)

WindowStateChange Event
Description
Occurs when the window size is changed (e.g. from "Minimized" to "Maximized").

syntax
objGDApplication_WindowStateChanged()

Parameter (Optional)
--

Example:
In the following example a message is output when the window size is changed:

Private Sub objGDApplication_WindowStateChanged()


'VBA110
MsgBox "The state of the application-window is changed!"
End Sub

See also
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4001

VBA Reference
6.1 The object model of the Graphics Designer

6.1.6

Methods

6.1.6.1

A-C

Activate Method
Description
Activates the specified object.

syntax
Expression.Activate()
Expression
Necessary. An expression or element which returns an object of the "Application" or "View"
type.

Parameters
--

Example:
In the following example a copy of the active picture is created and then activated:

Sub CreateAndActivateView()
'VBA111
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
View Object (Page 3466)
Application Object (Page 3282)
VBA Reference (Page 3124)

4002

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Add Method
Description
Adds another element to a listing.
The following table shows you the listings to which the Add method can be applied. The
parameters and syntax for the respective Add methods can be found under "Methods".
Listing

Application for the Add Method

AnalogResultInfos Listing

Adds a new, analog value range in the Dynamic


dialog.

Documents Listing

Creates a new picture in the Graphics Designer

GroupedObjects Listing

Adds a new object to a group object.

Toolbars Listing

Creates a new, user-defined toolbar.

Tag Triggers Listing

Creates a new tag trigger.

Views Listing

Creates a copy of the specified picture.

See also
Add Method (Views Listing) (Page 3173)
Add Method (TagTriggers Listing) (Page 3172)
Add Method (CustomToolbars Listing) (Page 3168)
Add Method (GroupedObjects Listing) (Page 3170)
Add Method (Documents Listing) (Page 3169)
Add Method (AnalogResultInfos Listing) (Page 3166)

Add Method (AnalogResultInfos Listing)


Description
Adds a new, analog value range in the Dynamic dialog.

syntax
Expression.Add(RangeTo, ResultValue)
Expression
Necessary. An expression or element which returns an object of the "AnalogResultInfos" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4003

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

RangeTo (Variant)

The value range to which the change of property


gives rise.

ResultValue (Variant)

The value to which the object property is assigned


when the value range is reached.

Example:
In the following example the radius of a circle is given dynamics with the In the following
example a tag name is assigned and three analog value ranges are created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA112
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

The diagram shows the Dynamic dialog after the procedure has been carried out:

4004

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
DynamicDialog Object (Page 3325)
AnalogResultInfos Object (Listing) (Page 3281)
CreateDynamic Method (Page 3204)
How to dynamize a property with the Dynamic dialog (Page 3084)

Add Method (CustomToolbars Listing)


Description
Creates a new, user-defined toolbar. There is a difference between application-specific and
picture-specific user-defined toolbars:
Application-specific toolbar: This is linked to the Graphics Designer and is also only visible
when all the pictures in the Graphics Designer are closed. "Place the VBA code in the
document called "GlobalTemplateDocument" or "ProjectTemplateDocument" and use the
Application property.
Picture-specific toolbar: Is linked with a specific picture and remains visible as long as the
picture is visible. Place the VBA code in the document called "ThisDocument" for the desired
picture and use the ActiveDocument property.

syntax
Expression.Add(Key)
Expression
Necessary. An expression or element which returns an object of the "CustomToolbars" type.

Parameters
Parameter (Data Type)

Description

Key (Variant)

Identifies the user-defined toolbar. Use unique


names for "Key" (e.g. "DocToolbar1")

Example:
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA115
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4005

VBA Reference
6.1 The object model of the Graphics Designer

Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")


'Add toolbar-items to the userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "My first
Symbol-Icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "My second
Symbol-Icon")
'
'Insert seperatorline between the two tollbaritems
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
Toolbars Object (Listing) (Page 3446)
InsertToolbarItem Method (Page 3231)
InsertSeparator Method (Page 3228)
InsertFromMenuItem Method (Page 3224)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

Add Method (Documents Listing)


Description
Creates a new picture in the Graphics Designer

syntax
Expression.Add [HMIOpenDocumentType]
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

4006

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)
HMIOpenDocumentType (HMIDocumentType)

Description
Defines how the picture will be opened:
HMIDocumentTypeVisible: Opens the picture
for direct processing. This is the default setting
if you do not specify the parameter.
HMIDocumentTypeInvisible: Opens the
picture in invisible mode, i.e. it is not displayed
in the Graphics Designer. You can only
address the picture via the Documents listing,
and make it visible again by means of the Hide
property.

Example:
In the following example a new picture is created in the Graphics Designer:

Sub AddNewDocument()
'VBA113
Application.Documents.Add hmiOpenDocumentTypeVisible
End Sub

See also
Hide Property (Page 3625)
Documents Object (Listing) (Page 3322)
VBA Reference (Page 3124)

Add Method (GroupedObjects Listing)


Description
Adds an existing object to the specified group object.

syntax
Expression.Add(Index)
Expression
Necessary. An expression or element which returns an object of the "GroupedObjects" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4007

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

Index (Variant)

The object that is intended to be added. You can


either use the index number or the object name.

Example:
In this example the group object "My Group" is created from a number of objects. An ellipse
segment is then added to the group object:

Sub CreateGroup()
'VBA114
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipseSegment As HMIEllipseSegment
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
'Set name for new group-object
'The name identifies the group-object
objGroup.ObjectName = "My Group"
'Add new object to active document...
Set objEllipseSegment = ActiveDocument.HMIObjects.AddHMIObject("EllipseSegment",
"HMIEllipseSegment")
Set objGroup = ActiveDocument.HMIObjects("My Group")
'...and add it to the group:
objGroup.GroupedHMIObjects.Add ("EllipseSegment")
End Sub

See also
GroupedObjects Object (Listing) (Page 3353)

4008

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Add Method (TagTriggers Listing)


Description
Creates a new tag trigger.

syntax
Expression.Add(VarName, Type)
Expression
Necessary. An expression or element which returns an object of the "TagTriggers" type.

Parameters
Parameter (Data Type)

Description

VarName (String)

The name of the tag that is intended to be used as


a trigger. Please note that you have to create the
tag in the Tag Selection dialog.

Type (CycleType)

This is the cycle type. Select the cycle type from a


list in the VBA Editor when you use this method.

Example:
In the following example the radius of a circle is made dynamic using a trigger tag:

Sub DynamicWithVariableTriggerCycle()
'VBA69
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With
End Sub

See also
VariableTriggers Object (Listing) (Page 3465)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4009

VBA Reference
6.1 The object model of the Graphics Designer

Add Method (Views Listing)


Description
Creates a copy of the specified picture.

syntax
Expression.Add()
Expression
Necessary. An expression or element which returns an object of the "Views" type.

Parameters
--

Example:
In the following example a copy of the active picture is created and then activated:

Sub CreateViewAndActivateView()
'VBA117
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Views Object (Listing) (Page 3468)
VBA Reference (Page 3124)

AddAction Method
Description
Configures an action on an object or property. This action is triggered when a defined event
occurs.

syntax
Expression.Method(HMIActionCreationType)

4010

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Actions" type.

Parameters
Parameter (Data Type)

Description

HMIActionCreationType (Variant)

Defines the action:


hmiActionCreationTypeCScript: Configures a
C action
hmiActionCreationTypeVBScript: Configures
a VBS action
hmiActionCreationTypeDirectConnection:
Configures a direct connection

Example:
In the following example a VBS action for changing the radius of a circle is configured:

Sub AddActionToPropertyTypeVBScript()
'VBA118
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
'Create circle in picture. By changing of property "Radius"
'a VBS-action will be started:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objVBScript = objEvent.Actions.AddAction(hmiActionCreationTypeVBScript)
End Sub

See also
Event Object (Page 3336)
Actions Object (Listing) (Page 3271)

AddActiveXControl Method
Description
Adds a new ActiveXControl object to the "HMIObjects" listing. The object is inserted in the
upper left corner of the specified picture.

syntax
Expression.AddActiveXControl("ObjectName", "ProgID")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4011

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Required. An expression or element which returns an object of the "HMIObjects" type.

Parameter
Parameter (data type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a
listing.

ProgID (String)

The ActiveX Control that is to be inserted.

Determining the ProgID


To determine the ProgID for an ActiveX control, go to the "Object Palette" in the Graphics
Designer and in the Default tab under "Smart Objects" insert the control object into the picture.
The "Insert a Control" dialog displays the path and ProgID for the selected control:

The following table shows a list of ProgIDs of WinCC controls that are installed by WinCC:

4012

Name of the WinCC control

ProgID

Siemens HMI Symbol Library

SiemensHMI.SymbolLibrary.1

WinCC AlarmControl

CCAxAlarmControl.AxAlarmControl.1

WinCC digital/analog clock control

DACLOCK.DaclockCtrl.1

WinCC FunctionTrendControl

CCAxFunctionTrendControl.AxFunctionTrendControl.1

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Name of the WinCC control

ProgID

WinCC gauge control

XGAUGE.XGaugeCtrl.1

WinCC media control

CCMediaControl.CCMediaControl.1

WinCC OnlineTableControl

CCAxOnlineTableControl.AxOnlineTableControl.1

WinCC OnlineTrendControl

CCAxOnlineTrendControl.AxOnlineTrendControl.1

WinCC push button control

PBUTTON.PbuttonCtrl.1

WinCC slider control

SLIDER.SliderCtrl.1

WinCC RulerControl

CCAxTrendRulerControl.AxRulerControl.1

WinCC UserArchiveControl

CCAxUserArchiveControl.AxUserArchiveControl.1

Example:
In the following example, the ActiveX Control "WinCC Gauge Control" is inserted in the active
picture.

Sub AddActiveXControl()
'VBA119
Dim objActiveXControl As HMIActiveXControl
Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",
"XGAUGE.XGaugeCtrl.1")
With ActiveDocument
.HMIObjects("WinCC_Gauge").Top = 40
.HMIObjects("WinCC_Gauge").Left = 40
End With
End Sub

Note
After executing the method, the Graphics Designer will not be fully shut down. The
"Grafexe.exe" file remains in the memory. In order to restart the Graphics Designer, exit the
"Grafexe.exe" application in the Task Manager.

See also
ActiveX controls (Page 3064)
HMIObjects Object (Listing) (Page 3359)
ActiveXControl Object (Page 3273)
VBA Reference (Page 3124)

AddDotNetControl method
Description
Adds a new ".Net-Control" object to the "HMIObjects" listing.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4013

VBA Reference
6.1 The object model of the Graphics Designer

Syntax
Expression.AddDotNetControl(ObjectName, ControlType, InGAC,
AssemblyInfo)
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a listing.

ControlType (String)

The namespace of the object.

InGAC (String)

TRUE: The object is registered in the Global Assembly Cache.


FALSE: The object is not registered in the Global Assembly Cache.

AssemblyInfo (String)

If "InGAC=TRUE", then the following information will be specified:


Assembly
Version
Culture
PublicKeyToken
If "InGAC=FALSE", only the path of the object is specified in "Assembly".

Example
In the following example, the ".NETControl" object from the Global Assembly Cache is inserted
in the active picture.

'VBA851
Dim DotNetControl As HMIDotNetControl
Set DotNetControl = ActiveDocument.HMIObjects.AddDotNetControl("MyVBAControl",
"System.Windows.Forms.Label", True,"Assembly=System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089")

AddFolder Method
Description
Creates a new folder in the components library. The FolderItem object of the "Folder" type is
added to the FolderItems listing.
The new folder created in this way receives the internal name "FolderX", where "X" stands for
a consecutive number, starting with 1. Use the internal name to address the folder in the
FolderItems listing.

4014

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.AddFolder(DefaultName)
Expression
Necessary. An expression or element which returns an object of the "FolderItems" type.

Parameters
Parameter (Data Type)

Description

DefaultName (String)

The name of the folder that is to be created.

Example:
In the following example the folder "My Folder" will be created in the "Project Library":

Sub AddNewFolderToProjectLibrary()
'VBA120
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder")
End Sub

See also
SymbolLibrary Object (Page 3440)
FolderItems Object (Listing) (Page 3343)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

AddFromClipboard Method
Description
Copies an object from the clipboard into a folder in the Components Library. The FolderItem
object of the "Item" type is added to the FolderItems listing.
Note
The clipboard must contain objects from the Graphics Designer. Other contents (such as
ASCII text) will not be pasted.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4015

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.AddFromClipboard(DefaultName)
Expression
Necessary. An expression or element which returns an object of the "FolderItems" type.

Parameters
Parameter (Data Type)

Description

DefaultName (String)

The name to be given to the object pasted into the


components library.

Example:
In the following example the object "PC" from the "Global Library" will be copied into the folder
"Folder 3" in the "Project Library":

Sub CopyObjectFromGlobalLibraryToProjectLibrary()
'VBA121
Dim objGlobalLib As HMISymbolLibrary
Dim objProjectLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder3")
'
'copy object from "Global Library" to clipboard
With objGlobalLib
.FolderItems(2).Folder.Item(2).Folder.Item(1).CopyToClipboard
End With
'
'paste object from clipboard into "Project Library"
objProjectLib.FolderItems(objProjectLib.FindByDisplayName("My
Folder3").Name).Folder.AddFromClipBoard ("Copy of PC/PLC")
End Sub

See also
FolderItems Object (Listing) (Page 3343)
SymbolLibrary Object (Page 3440)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

4016

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AddHMIObject Method
Description
Adds a new standard, smart or Windows object to the "HMIObjects" listing. The object is
inserted in the upper left corner of the specified picture.
Note
Use the AddActiveXControl method to insert an ActiveXControl.
Use the AddOLEObject method to insert an OLE Element.

syntax
Expression.AddHMIObject("ObjectName", "ProgID")
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the


object by its name in a listing.

ProgID (String)

The object type that is to be inserted. "Obtain the


"ProgID" by prefixing the VBA object name with
"HMI" "(e.g. HMICircle or HMIRectangle)

Example:
In the following example a circle will be inserted into the active picture and its background color
set to "Red":

Sub AddCircleToActiveDocument()
'VBA122
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("VBA_Circle", "HMICircle")
objCircle.BackColor = RGB(255, 0, 0)
End Sub

See also
PieSegment Object (Page 3399)
TextList Object (Page 3441)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4017

VBA Reference
6.1 The object model of the Graphics Designer
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
PictureWindow Object (Page 3396)
OptionGroup Object (Page 3393)
HMIObjects Object (Listing) (Page 3359)
Line Object (Page 3373)
IOField Object (Page 3361)
GraphicObject Object (Page 3345)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)
ApplicationWindow Object (Page 3284)
AddOLEObject Method (Page 3182)
AddActiveXControl Method (Page 3174)
VBA Reference (Page 3124)

AddItem Method
Description
Copies an object from the specified picture into a folder in the Components Library. The
FolderItem object of the "Item" type is added to the FolderItems listing.

syntax
Expression.Folder.AddItem "DefaultName", pHMIObject

4018

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "FolderItems" type.

Parameters
Parameter (Data Type)

Description

DefaultName (String)

The name to be given to the object pasted into the


components library.

pHMIObject (HMIObject)

The object that is to be inserted into the


Components Library from the specified picture.

Example:
In the following example a circle will be copied into the "Project Library". For this purpose the
circle will be pasted into the active picture and the folder "My Folder 2" will

Sub VBA123()
'VBA123
Dim objProjectLib As HMISymbolLibrary
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder2")
objProjectLib.FindByDisplayName("My Folder2").Folder.AddItem "ProjectLib Circle",
ActiveDocument.HMIObjects("Circle")
End Sub

See also
FolderItems Object (Listing) (Page 3343)
SymbolLibrary Object (Page 3440)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

AddOLEObject Method
Description
Adds a new OLE Element to the "HMIObjects" listing. The object is inserted in the upper left
corner of the specified picture.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4019

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.AddOLEObject(ObjectName, ServerName, [CreationType],
[UseSymbol])
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a listing.

ServerName (String)

The name of the application which is to contain the OLE Element, or the file
name complete with path. The value for "ServerName" corresponds to the
"Object Type" in the "Insert Object" dialog:

6HUYHU1DPH

CreationType
(HMIOLEObjectCreation
Type-)

Defines whether the OLE Element will be newly created or an existing file
will be used:
HMIOLEObjectCreationTypeDirect: Corresponds to setting "Create
New". This setting is used if you do not specify the parameter.
HMIOLEObjectCreationTypeByLink: Corresponds to setting "Create
from File". This creates a copy of the file. Any changes made to the OLE
Element have no effect on the original file. Assign a name to the file via
the "ServerName" parameter.
HMIOLEObjectCreationTypeByLinkWithReference: Same as above,
except that changes in OLE Element affect the original file. Assign a
name to the file via the "ServerName" parameter.

UseSymbol (Boolean)

4020

TRUE if the standard icon for the file type is to be used. Double clicking on
the icon then opens the associated application. The default setting for this
parameter is FALSE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example, an OLE Element containing a Wordpad document will be inserted
into the active picture:

Sub AddOLEObjectToActiveDocument()
'VBA124
Dim objOLEObject As HMIOLEObject
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("MS Wordpad Document",
"Wordpad.Document.1")
End Sub

In the following example, the AddOLEObject method will be used and the
"HMIOLEObjectCreationTypeByLink" parameter will be specified:

Sub AddOLEObjectByLink()
'VBA805
Dim objOLEObject As HMIOLEObject
Dim strFilename As String
'
'Add OLEObject by filename. In this case, the filename has to
'contain filename and path.
'Replace the definition of strFilename with a filename with path
'existing on your system
strFilename = Application.ApplicationDataPath & "Test.bmp"
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("OLEObject1", strFilename,
hmiOLEObjectCreationTypeByLink, False)
End Sub

In the following example, the AddOLEObject method will be used and the
"HMIOLEObjectCreationTypeByLinkWithReference" parameter will be specified:

Sub AddOLEObjectByLinkWithReference()
'VBA806
Dim objOLEObject As HMIOLEObject
Dim strFilename As String
'
'Add OLEObject by filename. In this case, the filename has to
'contain filename and path.
'Replace the definition of strFilename with a filename with path
'existing on your system
strFilename = Application.ApplicationDataPath & "Test.bmp"
Set objOLEObject = ActiveDocument.HMIObjects.AddOLEObject("OLEObject1", strFilename,
hmiOLEObjectCreationTypeByLinkWithReference, True)
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4021

VBA Reference
6.1 The object model of the Graphics Designer

See also
OLEObject Object (Page 3391)
HMIObjects Object (Listing) (Page 3359)
VBA Reference (Page 3124)

AddWPFControl method
Description
Adds a new "WPF-Control" object to the "HMIObjects" listing.

Syntax
Expression.AddWPFControl(ObjectName, ControlType, InGAC,
AssemblyInfo)
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
Parameter (Data Type)

Description

ObjectName (String)

The name of the object. You can address the object by its name in a listing.

ControlType (String)

The namespace of the object.

InGAC (String)

TRUE: The object is registered in the Global Assembly Cache.


FALSE: The object is not registered in the Global Assembly Cache.

AssemblyInfo (String)

If "InGAC=TRUE", then the following information will be specified:


Assembly
Version
Culture
PublicKeyToken
If "InGAC=FALSE", only the path of the object is specified in "Assembly".

Example
In the following example, the "WPF Control" object outside the Global Assembly Cache is
inserted in the active picture.

'VBA852
Dim WPFControl As HMIWPFControl
Set WPFControl = ActiveDocument.HMIObjects.AddWPFControl("MyWPFVBAControl",
"WinCCWPFControl.TestControl", False, "Assembly=Z:\TestControl\WinCCWPFControl.dll")

4022

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AlignBottom Method
Description
Aligns the objects selected in the specified picture with In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignBottom()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned with the bottom:

Sub AlignSelectedObjectsBottom()
'VBA125
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignBottom
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4023

VBA Reference
6.1 The object model of the Graphics Designer

AlignLeft Method
Description
Left-justifies the objects selected in the specified picture. In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignLeft()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned to the left:

Sub AlignSelectedObjectsLeft()
'VBA126
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignLeft
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

4024

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AlignRight Method
Description
Right-justifies the objects selected in the specified picture. In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignRight()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned to the right:

Sub AlignSelectedObjectsRight()
'VBA127
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignRight
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4025

VBA Reference
6.1 The object model of the Graphics Designer

AlignTop Method
Description
Aligns the objects selected in the specified picture with In so doing the alignment is oriented
on the first object that you select.

syntax
Expression.AlignTop()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then aligned with the top:

Sub AlignSelectedObjectsTop()
'VBA128
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.AlignTop
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

4026

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ArrangeMinimizedWindows Method
Description
Arranges all minimized pictures on the lower margin of the Graphics Designer.

syntax
Expression.ArrangeMinimizedWindows()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all minimized pictures are arranged on the lower margin of the
Graphics Designer. For this example to work, you must have minimized a number of pictures
in the Graphics Designer:

Sub ArrangeMinimizedWindows()
'VBA129
Application.ArrangeMinimizedWindows
End Sub

See also
Application Object (Page 3282)
VBA Reference (Page 3124)

BackwardOneLevel Method
Description
Moves the selected objects one level backward within their current layer.

syntax
Expression.BackwardOneLevel()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4027

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted last
is then moved backward one level:

Sub MoveObjectOneLevelBackward()
'VBA173
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = False
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.BackwardOneLevel
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

BringToFront Method
Description
Brings the selected objects right to the front within their current layer.
Note
If the "BringToFront" method is used, the sequence of HMI objects can change in the
HMIObjects listing.

4028

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Syntax
Expression.BringToFront()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted last
is then brought to the front:

Sub MoveObjectToFront()
'VBA198
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = False
End With
MsgBox "The objects circle and rectangle are created" & vbCrLf & "Only the circle is
selected!"
ActiveDocument.Selection.BringToFront
MsgBox "The selection is moved to the front."
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4029

VBA Reference
6.1 The object model of the Graphics Designer

CascadeWindows Method
Description
Arranges all open pictures in the Graphics Designer in a cascade (i.e. overlapping).

syntax
Expression.Methode(Parameter)
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are arranged in a cascade.
For this example to work, you must have opened a number of pictures in the Graphics Designer:

Sub CascadeWindows()
'VBA130
Application.CascadeWindows
End Sub

See also
VBA Reference (Page 3124)
Application Object (Page 3282)

CenterHorizontally Method
Description
Using this method, the objects selected in the specified picture are centered horizontally.

syntax
Expression.CenterHorizontally()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

4030

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then centered horizontally:

Sub CenterSelectedObjectsHorizontally()
'VBA131
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.CenterHorizontally
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

CenterVertically Method
Description
Using this method, the objects selected in the specified picture are centered vertically.

syntax
Expression.CenterVertically()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4031

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then centered vertically:

Sub CenterSelectedObjectsVertically()
'VBA132
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.CenterVertically
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

CheckSyntax Method
Description
Checks whether the syntax of the specified C script is correct.
Use the CheckSyntax method in conjunction with the Compiled Property.

syntax
Expression.CheckSyntax(CheckOK, Error)
Expression
Necessary. An expression or element which returns an object of the "DynamicDialog" type.

4032

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

CheckOK (Boolean)

TRUE if the syntax of the specified C script is


correct.

Error (String)

The message text that is output if the C script is


incorrect.

Example:
--

See also
DynamicDialog Object (Page 3325)
VBA Reference (Page 3124)

Close Method
Description
Closes the specified picture and removes it from the document listing.
Note
Changes that have not been saved will be lost.

Syntax 1
Expression.Close(FileName)
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Syntax 2
Expression.Close()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4033

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDL file to be closed.

Example:
In the following example the picture "Test.PDL" will For this example to work, you must have
opened the picture "Test.PDL":

Sub CloseDocumentUsingTheFileName()
'VBA134
Dim strFile As String
strFile = Application.ApplicationDataPath & "test.pdl"
Application.Documents.Close (strFile)
End Sub
In the following example the active picture in the Graphics Designer will be closed:
Sub CloseDocumentUsingActiveDocument()
'VBA135
ActiveDocument.Close
End Sub

See also
Document Object (Page 3319)
ActiveDocument Property (Page 3472)
Documents Object (Listing) (Page 3322)
VBA Reference (Page 3124)

CloseAll Method
Description
Closes all the pictures opened in the Graphics Designer and removes them from the
documents listing.
Note
Changes that have not been saved will be lost.

syntax
Expression.CloseAll()

4034

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are closed:

Sub CloseAllDocuments()
'VBA136
Application.Documents.CloseAll
End Sub

See also
Documents Object (Listing) (Page 3322)
VBA Reference (Page 3124)

ConvertToScript Method
Description
Converts the specified Dynamic dialog into a C script.
On conversion the associated DynamicDialog object is deleted.
Note
You cannot undo the conversion.

syntax
Expression.ConvertToScript()
Expression
Necessary. An expression or element which returns an object of the "DynamicDialog" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4035

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example a circle will be inserted into the active picture and its radius will be
dynamically configured using the Dynamic dialog. The Dynamic dialog will then be converted
into a C script.

Sub ConvertDynamicDialogToScript()
'VBA137
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
'
'Create dynamic
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
'
'configure dynamic. "ResultType" defines the valuerange-type:
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
MsgBox "The dynamic-dialog will be changed into a C-script."
.ConvertToScript
End With
End Sub

See also
DynamicDialog Object (Page 3325)
VBA Reference (Page 3124)

ConvertWM method
Description
Is used internally for PowerCC.

CopySelection Method
Description
Using this method, the objects selected in the picture are copied to the clipboard.

syntax
Expression.CopySelection()

4036

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Document" or "Selection"
type.

Parameters
--

Example:
In the following example two of the objects inserted in the active picture are selected. The
selection is copied and pasted to a new picture:

Sub CopySelectionToNewDocument()
'VBA138
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim iNewDoc As Integer
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
'Instead of "ActiveDocument.CopySelection" you can also write:
'"ActiveDocument.Selection.CopySelection".
ActiveDocument.CopySelection
Application.Documents.Add hmiOpenDocumentTypeVisible
iNewDoc = Application.Documents.Count
Application.Documents(iNewDoc).PasteClipboard
End Sub

See also
Document Object (Page 3319)
ActiveDocument Property (Page 3472)
SelectedObjects object (Listing) (Page 3426)
PasteClipboard Method (Page 3243)
Add Method (Documents Listing) (Page 3169)
Activate Method (Page 3165)
VBA Reference (Page 3124)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4037

VBA Reference
6.1 The object model of the Graphics Designer

CopyToClipboard Method
Description
Copies an object from a folder in the Components Library to the clipboard.

Syntax
Expression.CopyToClipboard()
Expression
Necessary. An expression or element which returns a FolderItem object of the "Item" type.

Parameters
--

Example:
In the following example the object "PC" from the "Global Library" will be copied into the folder
"My Folder3" in the "Project Library":

Sub CopyObjectFromGlobalLibraryToProjectLibrary()
'VBA139
Dim objGlobalLib As HMISymbolLibrary
Dim objProjectLib As HMISymbolLibrary
Dim objFolderItem As HMIFolderItem
Set objGlobalLib = Application.SymbolLibraries(1)
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder3")
'
'copy object from "Global Library" to clipboard
With objGlobalLib
.FolderItems(2).Folder.Item(2).Folder.Item(1).CopyToClipboard
End With
'
'paste object from clipboard into "Project Library"
Set objFolderItem = objProjectLib.FindByDisplayName("My Folder3")
objFolderItem.Folder.AddFromClipBoard ("Copy of PC/PLC")
End Sub

See also
SymbolLibrary Object (Page 3440)
FolderItem Object (Page 3342)

4038

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)

CreateCustomizedObject Method
Description
Creates a customized object from the objects selected in the specified picture. You then have
to configure the customized object in the "Configuration Dialog".
For further information on this topic please refer to "Customized Objects" in this documentation
and "Customized Object" in the WinCC documentation.

syntax
Expression.CreateCustomizedObject()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and a customized object is then created:

Sub CreateCustomizedObject()
'VBA140
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objCustObject As HMICustomizedObject
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objCustObject = ActiveDocument.Selection.CreateCustomizedObject
objCustObject.ObjectName = "myCustomizedObject"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4039

VBA Reference
6.1 The object model of the Graphics Designer

End Sub

See also
SelectedObjects object (Listing) (Page 3426)
CustomizedObject Object (Page 3310)
VBA Reference (Page 3124)
Customized Objects (Page 3074)

CreateDynamicDialog method
Description
Dynamizing properties of pictures and objects depending on specific value ranges or variable
statuses.

Syntax
Expression.CreateDynamicDialog([Code as String],iResultType as Long)
Expression
Required. An expression or element which returns an object of the "Property" type.

Parameter
Parameter (Data Type)

Description

Code (String)

Defines the function or tag that is used for dynamic


purposes. Also specify the tag name in single
quotation marks: "Tag name"

iResultType (Long)

Defines the type of value range:


hmiResultTypeDirect = 0
hmiResultTypeAnalog= 1
hmiResultTypeBool = 2
hmiResultTypeBit = 3

Example
In the following example the radius of a circle is given dynamics with the dynamic dialog. A
tag name and a "ResultType" are assigned to the dynamic dialog.

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA820

4040

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Dim objDynDialog As HMIDynamicDialog


Dim objCircle As HMICircle
'Create Object
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("myCircle","HMICircle")
'Create dynamic (Tag "myTest" must be exist")
Set objDynDialog = objCircle.Radius.CreateDynamicDialog("'myTest'",1)
End Sub

See also
FaceplateProperty object (Page 3341)

CreateDynamic Method
Description
Makes the specified property dynamic.

syntax
Expression.CreateDynamic(DynamicType, [SourceCode])
Expression
Necessary. An expression or element which returns an object of the "Property" type.

Parameters
You only need use the "SourceCode" parameter if you want to make the specified property
dynamic with the aid of the Dynamic dialog.
In all other types of dynamics you can omit the parameter.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4041

VBA Reference
6.1 The object model of the Graphics Designer
Parameter (Data Type)

Description

DynamicType (HMIDynamicCreationType)

Defines the type of dynamics:


hmiDynamicCreationTypeVariableDirect:
Dynamics with a tag
hmiDynamicCreationTypeVariableIndirect:
Dynamics with a tag In this type of dynamics
you specify only the name of the tag whose
value will be used for dynamic purposes.
hmiDynamicCreationTypeScript: Dynamics
with a script (C, VB).
hmiDynamicCreationTypeDynamicDialog:
Dynamizing with the dynamic dialog box:

SourceCode (String)

Defines the function or tag that will be used for


dynamic purposes.
Also specify the tag name in single quote marks:
"Tag name"

Example:
In this example a circle property "Top" will be made dynamic with the aid of the tag
"NewDynamic":

Sub AddDynamicAsVariableDirectToProperty()
'VBA141
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("MyCircle", "HMICircle")
'Make property "Top" dynamic:
Set objVariableTrigger = objCircle.Top.CreateDynamic(hmiDynamicCreationTypeVariableDirect,
"NewDynamic")
'
'Define cycle-time
With objVariableTrigger
.CycleType = hmiCycleType_2s
End With
End Sub

See also
Property Object (Page 3409)
DeleteDynamic Method (Page 3210)
VBA Reference (Page 3124)

4042

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

CreateGroup Method
Description
Creates a group object from the objects selected in the specified picture.
For further information on this topic please refer to "Group Objects" in this documentation and
"Group Object" in the WinCC documentation.

syntax
Expression.CreateGroup()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and a group object is then created:

Sub CreateGroup()
'VBA142
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "myGroup"
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4043

VBA Reference
6.1 The object model of the Graphics Designer

See also
SelectedObjects object (Listing) (Page 3426)
Group Object (Page 3348)
VBA Reference (Page 3124)
Group Objects (Page 3067)

6.1.6.2

D-M

GetDeclutterObjectSize method
Description
Reads the limits displaying and hiding objects (decluttering) in the specified picture.

Syntax
Expression.GetDeclutterObjectSize(Min, Max)
Expression
Required. An expression or element which returns an object of the "Document" type.

Parameter
Parameter (data type)

Description

Min (Long)

Lower size range in pixels.

Max (Long)

Upper size range in pixels.

Example
In the following example, the decluttering limits of the active picture are read and output:

Sub ReadSettingsOfPicture()
'VBA848
Dim objectsize_min As Long, objectsize_max As Long
ActiveDocument.GetDeclutterObjectSize objectsize_min, objectsize_max
MsgBox objectsize_min & " " & objectsize_max
End Sub

4044

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Delete Method
Description
Deletes the specified object and removes it from the listing.

syntax
Expression.Delete()
Expression
Necessary. An expression or element which returns objects of the following types.
Assignment
FolderItem
LanguageText
Menu
MenuItem
Object
Toolbar
ToolbarItem
VariableTrigger
View

Parameters
--

Example:
In the following example the first object in the active picture will be deleted. For this example
to work, you must have created at least one object in the active picture:

Sub ObjectDelete()
'VBA143
ActiveDocument.HMIObjects(1).Delete
End Sub

See also
LanguageText Object (Page 3368)
View Object (Page 3466)
VariableTrigger Object (Page 3464)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4045

VBA Reference
6.1 The object model of the Graphics Designer
ToolbarItem Object (Page 3448)
FolderItem Object (Page 3342)
HMIObject Object (Page 3357)
MenuItem Object (Page 3382)
Menu Object (Page 3378)
VBA Reference (Page 3124)

DeleteAll Method
Description
Deletes all selected objects in the specified picture and removes them from the "Selection"
and "HMIObjects" listings.

syntax
Expression.DeleteAll()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and then selected and deleted:

Sub DeleteAllSelectedObjects()
'VBA145
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With

4046

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

MsgBox "Objects selected!"


ActiveDocument.Selection.DeleteAll
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

DeleteDynamic Method
Description
Removes the dynamic characteristic from the specified property.

syntax
Expression.DeleteDynamic
Expression
Necessary. An expression or element which returns an object of the "Property" type.

Parameters
--

Example:
In the following example the dynamic characteristic created with the aid of the CreateDynamic
Method will be

Sub DeleteDynamicFromObjectMeinKreis()
'VBA146
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects("MyCircle")
objCircle.Top.DeleteDynamic
End Sub

See also
Property Object (Page 3409)
CreateDynamic Method (Page 3204)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4047

VBA Reference
6.1 The object model of the Graphics Designer

DeselectAll Method
Description
Deselects all selected objects in the specified picture and removes them from the Selection
listing.

syntax
Expression.DeselectAll()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and selected. All selected objects are then deselected:

Sub SelectObjectsAndDeselectThemAgain()
'VBA147
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.DeselectAll
MsgBox "Objects deselected!"
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

4048

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Destroy Method
Description
Ungroups the specified customized object. The objects remain intact.

Syntax
Expression.Destroy()
Expression
An expression or element which returns objects of the "CustomizedObject" types.

Parameters
--

Example:
An example showing how to use the Destroy Method can be found in this documentation under
the heading "Editing a Customized Object with VBA".

See also
CustomizedObject Object (Page 3310)
Destroy Method (Page 3212)
Delete Method (Page 3208)
CreateCustomizedObject Method (Page 3202)
How to Edit a Customized Object with VBA (Page 3076)

DuplicateSelection Method
Description
Duplicates the objects selected in the specified picture. The objects created in this way are
added to the HMIObjects listing. The names of new objects are numbered consecutively with
each duplication.
For instance if you duplicate an object called "Circle", the duplicate object is called "Circle1".
If you duplicate the object called "Circle" once more, the resulting object is called "Circle2" and
so on.

syntax
Expression.DuplicateSelection()

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4049

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted at different positions in the current picture
and selected. They are then duplicated:

Sub DuplicateSelectedObjects()
'VBA149
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.DuplicateSelection
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
VBA Reference (Page 3124)

EvenlySpaceHorizontally Method
Description
Using this method, the objects selected in the specified picture are spaced horizontally at an
even distance from one another.

4050

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.EvenlySpaceHorizontally()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects are inserted at different positions in the current picture
and selected. They are then positioned horizontally at an even distance from one another:

Sub EvenlySpaceObjectsHorizontally()
'VBA150
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.EvenlySpaceHorizontally
End Sub

See also
VBA Reference (Page 3124)
SelectedObjects object (Listing) (Page 3426)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4051

VBA Reference
6.1 The object model of the Graphics Designer

EvenlySpaceVertically Method
Description
Using this method, the objects selected in the specified picture are spaced vertically at an even
distance from one another.

syntax
Expression.EvenlySpaceVertically()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects are inserted at different positions in the current picture
and selected. They are then positioned vertically at an even distance from one another:

Sub EvenlySpaceObjectsVertically()
'VBA151
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects created and selected"
ActiveDocument.Selection.EvenlySpaceVertically
End Sub

4052

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

Export Method
Description
Saves the specified picture as an EMF file.

Syntax
Expression.Export(Type, Path)
Expression
Required. An expression or element which returns an object of the "Document" type.

Parameter
Parameter (Data Type)

Description

Type (HMIImportExportType)

Defines the format in which the exported picture


will be saved.

Path (String)

The path in which the picture is going to be


exported. The path must exist.

Example

Sub ExportAllPicturesAsPDL()
'VBA152
Dim iPictureCounter As Integer
Dim strPath As String
strPath = "C:\WinCC_PDL_Export\"
'Count Pictures in Graphics Designer...
For iPictureCounter = 1 To grafexe.Documents.Count
'...and export each picture as PDL-file to specified path:
grafexe.Documents(iPictureCounter).Export hmiImportExportTypePDL,
strPath
Next iPictureCounter
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4053

VBA Reference
6.1 The object model of the Graphics Designer

See also
View Object (Page 3466)
Document Object (Page 3319)

Find Method
Description
Searches for objects in the specified picture and returns the search result as a collection object.
You can search for the following object properties:
Type
Name
Property

syntax
Expression.Find([ObjectType], [ObjectName], [PropertyName])
Expression
Necessary. An expression or element which returns an object of the "HMIObjects" type.

Parameters
You must specify at least one of the three parameters.
Parameter (Data Type)

Description

ObjectType (String)

The object type that is to be searched for. Specify


the "ProgID" of the object concerned. "Obtain the
"ProgID" by prefixing the VBA object name with
"HMI" "(e.g. HMICircle or HMIRectangle)

ObjectName (String)

The name of the object that is to be searched for.


You can use placeholders (?,*) in the object name
in order to find objects with similar names.

PropertyName (String)

The name of the object property that is to be


searched for. Specify the VBA property name
concerned (e.g. "BackColor" in place of
"Background Color").

Example:
In the following example, objects of the "HMICircle" type will be searched for in the active
picture and the search result will be output:

Sub FindObjectsByType()

4054

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'VBA153
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
Set colSearchResults = ActiveDocument.HMIObjects.Find(ObjectType:="HMICircle")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "objectname: " & strName)
Next objMember
End Sub

Note
Further information on using the Find Method can be found in this documentation under the
heading "Editing Standard Objects, Smart Objects and Windows Objects".

See also
Type Property (Page 3790)
Name Property (Page 3694)
Property Object (Page 3409)
HMIObjects Object (Listing) (Page 3359)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
VBA Reference (Page 3124)

FindByDisplayName Method
Description
Searches the entire Components Library for the specified object. A FolderItem object is
returned as the search result.
Note
The display name of the object is language-dependent. Only the language currently set will
be taken into account when searching. The search ends with the first object found.

syntax
Expression.FindByDisplayName(DisplayName)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4055

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "SymbolLibrary" type or
the "FolderItems" listing.

Parameters
Parameter (Data Type)

Description

DisplayName (String)

The display name of the object that is to be


searched for in the Components Library.

Example:
In the following example the entire library will be searched for the object "PC" and its display
name will be output:

Sub FindObjectInSymbolLibrary()
'VBA154
Dim objGlobalLib As HMISymbolLibrary
Dim objFItem As HMIFolderItem
Set objGlobalLib = Application.SymbolLibraries(1)
Set objFItem = objGlobalLib.FindByDisplayName("PC")
MsgBox objFItem.DisplayName
End Sub

See also
FolderItem Object (Page 3342)
Accessing the component library with VBA (Page 3040)

FireConnectionEvents method
Description
Is used internally by the Graphics Designer.

FlipHorizontally Method
Description
Mirrors the selected objects in the specified picture along the horizontal midline.
The object type determines whether it is allowed to be mirrored (for instance an OLE Element
cannot be mirrored). The properties are appropriately modified when mirroring is performed.
For example, if you mirror an object of the "StaticText" type along the horizontal midline, the
value of the "AlignmentTop" property changes from "0" to "2".

4056

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.FlipHorizontally()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a StaticText object will be inserted into the active picture and mirrored
along the horizontal midline:

Sub FlipObjectHorizontally()
'VBA155
Dim objStaticText As HMIStaticText
Dim strPropertyName As String
Dim iPropertyValue As Integer
Set objStaticText = ActiveDocument.HMIObjects.AddHMIObject("Textfield", "HMIStaticText")
strPropertyName = objStaticText.Properties("Text").Name
With objStaticText
.Width = 120
.Text = "Sample Text"
.Selected = True
iPropertyValue = .AlignmentTop
MsgBox "Value of '" & strPropertyName & "' before flip: " & iPropertyValue
ActiveDocument.Selection.FlipHorizontally
iPropertyValue = objStaticText.AlignmentTop
MsgBox "Value of '" & strPropertyName & "' after flip: " & iPropertyValue
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

FlipVertically Method
Description
Mirrors the selected objects in the specified picture along the vertical midline.
The object type determines whether it is allowed to be mirrored (for instance an OLE Element
cannot be mirrored). The properties are appropriately modified when mirroring is performed.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4057

VBA Reference
6.1 The object model of the Graphics Designer
For example if you mirror an object of the "StaticText" type along the vertical midline, the value
of the "AlignmentLeft" property changes from "0" to "2".

syntax
Expression.FlipVertically()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a StaticText object will be inserted into the active picture and mirrored
along the vertical midline:

Sub FlipObjectVertically()
'VBA156
Dim objStaticText As HMIStaticText
Dim strPropertyName As String
Dim iPropertyValue As Integer
Set objStaticText = ActiveDocument.HMIObjects.AddHMIObject("Textfield", "HMIStaticText")
strPropertyName = objStaticText.Properties("Text").Name
With objStaticText
.Width = 120
.Text = "Sample Text"
.Selected = True
.AlignmentLeft = 0
iPropertyValue = .AlignmentLeft
MsgBox "Value of '" & strPropertyName & "' before flip: " & iPropertyValue
ActiveDocument.Selection.FlipVertically
iPropertyValue = objStaticText.AlignmentLeft
MsgBox "Value of '" & strPropertyName & "' after flip: " & iPropertyValue
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

4058

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ForwardOneLevel Method
Description
Moves the selected objects one level forward within their current layer.

syntax
Expression.ForwardOneLevel()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted first
is then moved forward one level:

Sub MoveObjectOneLevelForward()
'VBA174
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = False
End With
MsgBox "Objects created and selected!"
ActiveDocument.Selection.ForwardOneLevel
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4059

VBA Reference
6.1 The object model of the Graphics Designer

GetItemByPath Method
Description
Returns a FolderItem object (folder or object) located on the specified internal access path in
the Components Library.
Note
To obtain the internal access path, select the "Copy Path" command from The internal access
path to the folder or object will then be copied to the clipboard.

syntax
Expression.GetItemByPath(PathName)
Expression
Necessary. An expression or element which returns an object of the "SymbolLibrary" type.

Parameters
Parameter (Data Type)

Description

PathName (String)

The internal access path on which the object is


located in the Components Library.

Example:
In this example one object from the entire library will be returned and its display name will be
output:

Sub ShowDisplayName()
'VBA157
Dim objGlobalLib As HMISymbolLibrary
Dim objFItem As HMIFolderItem
Set objGlobalLib = Application.SymbolLibraries(1)
Set objFItem = objGlobalLib.GetItemByPath("\Folder1\Folder2\Object1")
MsgBox objFItem.DisplayName
End Sub

See also
SymbolLibrary Object (Page 3440)
FolderItem Object (Page 3342)
Accessing the component library with VBA (Page 3040)

4060

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

InsertFromMenuItem Method
Description
Inserts into an existing, user-defined toolbar a new icon that references an existing menu entry
in a user-defined menu.
Use this method if you wish to set up a toolbar so that it contains the same commands as an
existing user-defined menu.

Syntax
Expression.InsertFromMenuItem(Position, Key, pMenuItem,
DefaultToolTipText)
Expression
Required. An expression or element which returns an object of the "ToolbarItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the icon within the userdefined toolbar.

Key (Variant)

Identifies the symbol. Use unique names for "Key"


"(e.g. tItem1_1).

pMenuItem (HMIMenuItem)

The MenuItem object that is intended to be


referenced.

DefaultToolTipText (String)

Defines for the icon concerned the tool tip text that
will be displayed when you move the mouse over
the icon.

Example:
In this example a user-defined menu and a user-defined toolbar will be inserted in the active
picture. The icon calls up the menu entry "Hello World" from the user-defined menu:

Sub ToolbarItem_InsertFromMenuItem()
'VBA158
Dim objMenu As HMIMenu
Dim objToolbarItem As HMIToolbarItem
Dim objToolbar As HMIToolbar
Dim objMenuItem As HMIMenuItem
Set objMenu = Application.CustomMenus.InsertMenu(1, "Menu1", "TestMenu")
'
'*************************************************
'* Note:
'* The object-reference has to be unique.
'*************************************************

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4061

VBA Reference
6.1 The object model of the Graphics Designer

'
Set objMenuItem = Application.CustomMenus(1).MenuItems.InsertMenuItem(1, "MenuItem1",
"Hello World")
Application.CustomMenus(1).MenuItems(1).Macro = "HelloWorld"
Set objToolbar = Application.CustomToolbars.Add("Toolbar1")
Set objToolbarItem = Application.CustomToolbars(1).ToolbarItems.InsertFromMenuItem(1,
"ToolbarItem1", objMenuItem, "Call's Hello World of TestMenu")
End Sub
Sub HelloWorld()
MsgBox "Procedure 'HelloWorld()' is execute."
End Sub

See also
ToolbarItems Object (Listing) (Page 3450)
InsertSeparator Method (Page 3228)
Add Method (CustomToolbars Listing) (Page 3168)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertMenu Method
Description
Creates a new, user-defined menu. There is a difference between application-specific and
picture-specific user-defined menus:
Application-specific menu: This is linked to the Graphics Designer and is also only visible
when all the pictures in the Graphics Designer are closed. "Place the VBA code in the
document called "GlobalTemplateDocument" or "ProjectTemplateDocument" and use the
Application property.
Picture-specific menu: Is linked with a specific picture and remains visible as long as the
picture is visible. Place the VBA code in the document called "ThisDocument" for the desired
picture and use the ActiveDocument property.

syntax
Expression.InsertMenu(Position, Key, DefaultLabel)
Expression
Necessary. An expression or element which returns an object of the "CustomMenus" type.

4062

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the user-defined menu


within the menu bar. However, picture-specific
menus are always positioned to the right of
application-specific menus.

Key (Variant)

Identifies the user-defined menu. Use unique


names for "Key" (e.g. "DocMenu1")

DefaultLabel (String)

The name of the user-defined menu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA159
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "First MenuItem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "Second MenuItem")
'
'Insert a dividing rule into custumized menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "First SubMenu")
'
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "First item in submenu")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "Second item in submenu")
End Sub

The diagram shows the generated menu structure.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4063

VBA Reference
6.1 The object model of the Graphics Designer

See also
Menus Object (Listing) (Page 3380)
InsertSubmenu Method (Page 3229)
InsertSeparator Method (Page 3228)
InsertMenuItem Method (Page 3227)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertMenuItem Method
Description
Inserts a new entry in a user-defined menu.

syntax
Expression.InsertMenuItem(Position, Key, DefaultLabel)
Expression
Necessary. An expression or element which returns an object of the "MenuItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the submenu within the


user-defined menu.

Key (Variant)

Identifies the submenu. Use unique names for


"Key" "(e.g. dSubMenu1_4).

DefaultLabel (String)

Defines the name of the submenu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA160
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")

4064

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "First MenuItem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "Second MenuItem")
'
'Insert a dividing rule into customized menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "First SubMenu")
'
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "First item in submenu")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "Second item in submenu")
End Sub

The diagram shows the menu structure.

See also
MenuItems Object (Listing) (Page 3384)
MenuItem Object (Page 3382)
InsertSubmenu Method (Page 3229)
InsertSeparator Method (Page 3228)
InsertMenu Method (Page 3225)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertSeparator Method
Description
Inserts a dividing line in a user-defined menu or user-defined toolbar.

syntax
Expression.InsertSeparator(Position, Key)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4065

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "MenuItems" or
"ToolbarItems" type.

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the dividing line within the


user-defined menu or user-defined toolbar.

Key (Variant)

Identifies the dividing line. Use unique names for


"Key" (e.g. "tSeparator1_2").

Example:
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA161
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")
'Add toolbar-item to userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "First
symbol-icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "Second
symbol-icon")
'
'Insert dividing rule between first and second symbol-icon
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
ToolbarItems Object (Listing) (Page 3450)
MenuItems Object (Listing) (Page 3384)
InsertToolbarItem Method (Page 3231)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertSubmenu Method
Description
Inserts a submenu into an existing user-defined menu.

4066

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.InsertSubmenu(Position, Key, DefaultLabel)
Expression
Necessary. An expression or element which returns an object of the "MenuItem" type

Parameters
Parameter (Data Type)

Description

Position (Long)

Defines the position of the submenu within the


user-defined menu.

Key (Variant)

Identifies the submenu. Use unique names for


"Key" "(e.g. dSubMenu1_4).

DefaultLabel (String)

Defines the name of the submenu.

Example:
In the following example, a user-defined menu with two menus entries and a submenu with
two entries will be created in the active picture. The submenu will be visually distinguished by
a dividing line:

Sub CreateDocumentMenus()
'VBA162
Dim objDocMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim objSubMenu As HMIMenuItem
'
Set objDocMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DocMenu1", "Doc_Menu_1")
'
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(1, "dmItem1_1", "First MenuItem")
Set objMenuItem = objDocMenu.MenuItems.InsertMenuItem(2, "dmItem1_2", "Second MenuItem")
'
'Insert a dividing rule into customized menu:
Set objMenuItem = objDocMenu.MenuItems.InsertSeparator(3, "dSeparator1_3")
'
Set objSubMenu = objDocMenu.MenuItems.InsertSubMenu(4, "dSubMenu1_4", "First SubMenu")
'
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(5, "dmItem1_5", "First item in submenu")
Set objMenuItem = objSubMenu.SubMenu.InsertMenuItem(6, "dmItem1_6", "Second item in submenu")
End Sub

The diagram shows the menu structure:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4067

VBA Reference
6.1 The object model of the Graphics Designer

See also
MenuItem Object (Page 3382)
InsertSeparator Method (Page 3228)
InsertMenuItem Method (Page 3227)
InsertMenu Method (Page 3225)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

InsertToolbarItem Method
Description
Inserts a new icon in an existing user-defined toolbar.

syntax
Expression.InsertToolbarItem(Position, Key, DefaultToolTipText)
Expression
Necessary. An expression or element which returns an object of the "ToolbarItems" type.

Parameters

4068

Parameter (Data Type)

Description

Position (Long)

Defines the position of the icon within the userdefined toolbar.

Key (Variant)

Identifies the symbol. Use unique names for "Key"


"(e.g. tItem1_1).

DefaultToolTipText (String)

Defines for the icon concerned the tool tip text that
will be displayed when you move the mouse over
the icon.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example a user-defined toolbar with two icons is created in the active picture.
These icons are separated by a dividing line:

Sub AddDocumentSpecificCustomToolbar()
'VBA163
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("DocToolbar")
'Add toolbar-item to userdefined toolbar
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "tItem1_1", "First
symbol-icon")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(3, "tItem1_3", "Second
symbol-icon")
'
'Insert dividing rule between first and second symbol-icon
Set objToolbarItem = objToolbar.ToolbarItems.InsertSeparator(2, "tSeparator1_2")
End Sub

See also
ToolbarItems Object (Listing) (Page 3450)
InsertSeparator Method (Page 3228)
Add Method (CustomToolbars Listing) (Page 3168)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)

IsCSLayerVisible Method
Description
Returns TRUE if the specified CS layer is visible.

syntax
Expression.IsCSLayerVisible(Index)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4069

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the CS layer. Value range from 1 to 32.


Layer0 corresponds to the index value "1".

Example:
The following example determines whether CS layer 1 in the copy of the active picture is visible
and outputs the result:

Sub IsCSLayerVisible()
'VBA164
Dim objView As HMIView
Dim strLayerName As String
Dim iLayerIdx As Integer
Set objView = ActiveDocument.Views(1)
objView.Activate
iLayerIdx = 2
strLayerName = ActiveDocument.Layers(iLayerIdx).Name
If objView.IsCSLayerVisible(iLayerIdx) = True Then
MsgBox "CS " & strLayerName & " is visible"
Else
MsgBox "CS " & strLayerName & " is invisible"
End If
End Sub

See also
Document Object (Page 3319)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

IsRTLayerVisible Method
Description
Returns TRUE if the specified RT layer is visible.

syntax
Expression.IsRTLayerVisible(Index)

4070

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the RT layer. Value range from 1 to 32.


Layer0 corresponds to the index value "1".

Example:
The following example determines whether RT layer 1 is visible and outputs the result:

Sub RTLayerVisibility()
'VBA165
Dim strLayerName As String
Dim iLayerIdx As Integer
iLayerIdx = 2
strLayerName = ActiveDocument.Layers(iLayerIdx).Name
If ActiveDocument.IsRTLayerVisible(iLayerIdx) = True Then
MsgBox "RT " & strLayerName & " is visible"
Else
MsgBox "RT " & strLayerName & " is invisible"
End If
End Sub

See also
Document Object (Page 3319)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

Item Method
Description
Returns an element from a listing.

syntax
Expression.Item(Index)
Expression
Necessary. An expression or element which returns an object.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4071

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
Parameter (Data Type)

Description

Index (Variant)

The name or index number of an element from the


listing.
You can use the Object Name as the name. As the
index number you can use a numerical expression
(from 1 up to the value of the Count property of the
listing).
If the entered value fails to match any element in
the listing, this counts as an error.

Example:
Note
The Item Method is the default method for listings. Both the following examples give the same
result.
In the following example the name of the first picture in the Graphics Designer is output:

Sub ShowDocumentNameLongVersion()
'VBA166
Dim strDocName As String
strDocName = Application.Documents.Item(3).Name
MsgBox strDocName
End Sub
Sub ShowDocumentNameShortVersion()
'VBA167
Dim strDocName As String
strDocName = Application.Documents(3).Name
MsgBox strDocName
End Sub

See also
VariableStateValues Object (Listing) (Page 3462)
Count Property (Page 3560)
Views Object (Listing) (Page 3468)
VariableTriggers Object (Listing) (Page 3465)
ToolbarItems Object (Listing) (Page 3450)
Toolbars Object (Listing) (Page 3446)
SymbolLibraries Object (Listing) (Page 3439)
SelectedObjects object (Listing) (Page 3426)

4072

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Properties Object (Listing) (Page 3408)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
MenuItems Object (Listing) (Page 3384)
Menus Object (Listing) (Page 3380)
Layers Object (Listing) (Page 3371)
LanguageTexts Object (Listing) (Page 3369)
LanguageFonts Object (Listing) (Page 3366)
GroupedObjects Object (Listing) (Page 3353)
FolderItems Object (Listing) (Page 3343)
Events Object (Listing) (Page 3337)
Documents Object (Listing) (Page 3322)
DataLanguages Object (Listing) (Page 3314)
ConnectionPoints Object (Listing) (Page 3308)
AnalogResultInfos Object (Listing) (Page 3281)
Actions Object (Listing) (Page 3271)
VBA Reference (Page 3124)

ItemByLcid Method
Description
Selects the language for which you wish to enter the font settings. Read only access.
Note
You can only select languages in which you have already configured.

Syntax
Expression.ItemByLcid(LangID)
Expression
Required. An expression or element which returns an object of the "LanguageFonts" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4073

VBA Reference
6.1 The object model of the Graphics Designer

Parameter
Parameter (Data Type)

Description

LangID (Long)

This is the language identifier. The list of language


identifiers is contained, for example, in the
"Languages.csv" file that is found in the index of
the WinCC documentation.

Example
The following example sets the font attributes of a button for French and English. In contrast
to English, French is displayed on the button in a smaller font with a constant tracking (Courier
New, 12pt):

Sub ExampleForLanguageFonts()
'VBA168
Dim objLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "Hello"
Set objLangFonts = objButton.LDFonts
'
'To make fontsettings for English:
With objLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
'
'To make fontsettings for French:
With objLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
End Sub

See also
LanguageFonts Object (Listing) (Page 3366)

4074

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

LoadDefaultConfig Method
Description
Loads the file in which the default settings for objects are saved. The PDD file is located in the
"GraCS" folder of the current project.

syntax
Expression.LoadDefaultConfig(FileName)
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDD file which it is intended to


load.

Example:
In the following example the file "Test.PDD" will be loaded. For this example to work, you must
have previously saved the file. You can do this with the aid of the SaveDefaultConfig Method:

Sub LoadDefaultConfig()
'VBA169
Application.LoadDefaultConfig ("Test.PDD")
End Sub

See also
Application Object (Page 3282)
SaveDefaultConfig Method (Page 3255)
VBA Reference (Page 3124)

MoveOneLayerDown Method
Description
Moves the selected object in the specified picture into the next lowest layer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4075

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.MoveOneLayerDown()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a circle in the active picture is inserted in the third layer and then
moved to the next lowest layer:

Sub MoveObjectOneLayerDown()
'VBA170
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
.Layer = 3
MsgBox "Circle is inserted into layer" & Str(.Layer)
ActiveDocument.Selection.MoveOneLayerDown
MsgBox "Circle is moved into layer" & Str(.Layer)
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

MoveOneLayerUp Method
Description
Moves the selected object in the specified picture into the next highest layer.

syntax
Expression.MoveOneLayerUp()

4076

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example a circle in the active picture is inserted in the third layer and then
moved to the next highest layer:

Sub MoveObjectOneLayerUp()
'VBA171
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
.Layer = 3
MsgBox "Circle is inserted into layer" & Str(.Layer)
ActiveDocument.Selection.MoveOneLayerUp
MsgBox "Circle is moved into layer" & Str(.Layer)
End With
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

MoveSelection Method
Description
Moves one or more objects selected in the picture by the specified coordinates.
Note
When you want to reposition one or more selected objects, use the properties "Left" and
"Top".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4077

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.MoveSelection(PosX, PosY)
Expression
Required. An expression or element which returns an object of the "Document" or "Selection"
type.

Parameters
Parameter (Data Type)

Description

PosX (Long)

The number of pixels by which the selection is to


be moved horizontally.

PosY (Long)

The number of pixels by which the selection is to


be moved vertically.

Example:
In the following example two objects are inserted at different positions in the current picture
and selected. The selection is then moved 30 pixels to the right and 40 pixels down:

Sub MoveSelectionToNewPostion()
'VBA172
Dim nPosX As Long
Dim nPosY As Long
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 80
.Selected = True
End With
MsgBox "Objects selected!"
nPosX = 30
nPosY = 40
ActiveDocument.MoveSelection nPosX, nPosY
End Sub

See also
Top Property (Page 3785)
Left Property (Page 3657)

4078

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Document Object (Page 3319)
VBA Reference (Page 3124)

6.1.6.3

O-Z

Open Method
Description
Opens an existing picture in the Graphics Designer and adds it to the documents listing.

syntax
Expression.Open(FileName, [HMIOpenDocumentType])
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDL file to be opened.


Unless you saved the PDL file in the "GraCS"
folder of the open project, you must also specify
the path at the same time.

HMIOpenDocumentType (HMIDocumentType)

Defines how the picture will be opened:


HMIDocumentTypeVisible: Opens the picture
for direct processing. This is the default setting
if you do not specify the parameter.
HMIDocumentTypeInvisible: Opens the
picture in invisible mode, i.e. it is not displayed
in the Graphics Designer. You can only
address the picture via the Documents listing,
and make it visible again by means of the Hide
property.

Example:
In the following example the picture "Test" will be opened. For this example to work, you must
have previously saved a picture with the name "Test" in the "GraCS" folder of the open project.

Sub OpenDocument()
'VBA175
Application.Documents.Open "Test.PDL", hmiOpenDocumentTypeVisible

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4079

VBA Reference
6.1 The object model of the Graphics Designer

End Sub

See also
Hide Property (Page 3625)
Documents Object (Listing) (Page 3322)
VBA Reference (Page 3124)

PasteClipboard Method
Description
Pastes the contents of the clipboard into the specified picture.
Note
The clipboard must contain objects from the Graphics Designer. Other contents (such as
ASCII text) will not be pasted.

syntax
Expression.PasteClipboard()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
--

Example:
In the following example all the objects selected in the active picture are copied to the clipboard
and then pasted into a new picture. For this example to work, you must have selected at least
one object in the active picture:

Sub CopySelectionToNewDocument()
'VBA176
Dim iNewDoc As String
ActiveDocument.CopySelection
Application.Documents.Add hmiOpenDocumentTypeVisible
iNewDoc = Application.Documents.Count
Application.Documents(iNewDoc).PasteClipboard
End Sub

4080

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
ActiveDocument Property (Page 3472)
Document Object (Page 3319)
CopySelection Method (Page 3199)
Add Method (Documents Listing) (Page 3169)
Activate Method (Page 3165)
VBA Reference (Page 3124)

PrintDocument Method
Description
Prints the specified copy of the picture using the current printer settings.

syntax
Expression.PrintDocument()
Expression
Necessary. An expression or element which returns an object of the "View" type.

Parameters
--

Example:
In the following example a copy of the active picture is created and then activated and printed:

Sub CreateAndPrintView()
'VBA177
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
objView.PrintDocument
End Sub

See also
View Object (Page 3466)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4081

VBA Reference
6.1 The object model of the Graphics Designer

PrintProjectDocumentation Method
Description
Prints out the project documentation for the current picture complete with all the objects it
contains and their properties via the reporting system in WinCC (Report Designer).
You must first have set the print settings (such as page range) in the "Print Job Properties"
dialog. To do this, go to the Graphics Designer and select the menu command "File" > "Project
Documentation - Setup".
Note
The project documentation will be output on the printer that was set up in the Report Designer.
You can design the print layout to suit your needs with the aid of the Report Designer.

syntax
Expression.PrintProjectDocumentation()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
--

Example:
In the following example the project documentation for the active picture will be printed:

Sub ToPrintProjectDocumentation()
'VBA178
ActiveDocument.PrintProjectDocumentation
End Sub

See also
Document Object (Page 3319)
VBA Reference (Page 3124)

4082

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Remove Method
Description
Removes an object from a selection of objects or from a group object.

syntax
Expression.Remove(Index)
Expression
Necessary. An expression or element which returns an object of the "GroupedObjects" or
"Selection" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

The name or index number of the object that is


intended to be removed.
You can use the Object Name as the name. As the
index number you can use a numerical expression
(from 1 up to the value of the Count property of the
listing).
If the entered value fails to match any element in
the listing, this counts as an error.

Example:
In the following example three objects will first be inserted in the active picture and selected.
Then one object will be removed from the selection and the remaining objects will be grouped.
Then the first object will be removed from the group object:

Sub RemoveObjectFromGroup()
'VBA179
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4083

VBA Reference
6.1 The object model of the Graphics Designer

.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
MsgBox "Group-object is created."
objGroup.GroupedHMIObjects.Remove ("sEllipse")
MsgBox "The ellipse is removed from group-object."
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
GroupedObjects Object (Listing) (Page 3353)
VBA Reference (Page 3124)

Rotate Method
Description
Rotates the object selected in the specified picture by 90 clockwise.

syntax
Expression.Rotate()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects will be inserted in the active picture and then grouped.
The group object will then be rotated once:

Sub RotateGroupObject()

4084

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'VBA180
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objGroup As HMIGroup
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
With objRectangle
.Top = 30
.Left = 30
.Width = 80
.Height = 40
.Selected = True
End With
With objCircle
.Top = 30
.Left = 30
.BackColor = RGB(255, 255, 255)
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
MsgBox "Group-object created."
objGroup.Selected = True
ActiveDocument.Selection.Rotate
End Sub

See also
VBA Reference (Page 3124)
SelectedObjects object (Listing) (Page 3426)

SameHeight Method
Description
Sets the "Height" property for all selected objects in the specified picture to the smallest
available value.

syntax
Expression.SameHeight()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4085

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same height:

Sub ApplySameHeightToSelectedObjects()
'VBA181
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Height = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Height = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.Height = 120
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameHeight
End Sub

See also
Height Property (Page 3624)
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

4086

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

SameWidth Method
Description
Sets the "Width" property for all selected objects in the specified picture to the smallest
available value.

syntax
Expression.SameWidth()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same width:

Sub ApplySameWidthToSelectedObjects()
'VBA182
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Width = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 120
.BackColor = RGB(255, 0, 0)
.Selected = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4087

VBA Reference
6.1 The object model of the Graphics Designer

End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameWidth
End Sub

See also
Width Property (Page 3881)
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

SameWidthAndHeight Method
Description
Sets the "Height" and "Width" properties for all selected objects in the specified picture to the
smallest available value.

syntax
Expression.SameWidthAndHeight()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same height:

Sub ApplySameWidthAndHeightToSelectedObjects()
'VBA183
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0

4088

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

.Height = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 25
.Height = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.Height = 120
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameWidthAndHeight
End Sub

See also
Width Property (Page 3881)
Height Property (Page 3624)
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

Save Method
Description
Saves the specified picture under its current name.

syntax
Expression.Save()
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
--

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4089

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example the active picture in the Graphics Designer will be saved:

Sub SaveDocument()
'VBA184
ActiveDocument.Save
End Sub

See also
ActiveDocument Property (Page 3472)
Document Object (Page 3319)
VBA Reference (Page 3124)

SaveAll Method
Description
Saves all the open pictures in the Graphics Designer under their current names.

syntax
Expression.SaveAll()
Expression
Necessary. An expression or element which returns an object of the "Documents" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are saved:

Sub SaveAllDocuments()
'VBA185
Application.Documents.SaveAll
End Sub

4090

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
Documents Object (Listing) (Page 3322)
VBA Reference (Page 3124)

SaveAs Method
Description
Saves the specified picture under a new name.
If a previously existing picture is to be overwritten, it must be ascertained prior to the SaveAs
method call that this picture is permitted to be overwritten. You must inquire the
LockedByCreatorID property of the picture to be overwritten to do so. Otherwise an error will
be triggered in VBA.

syntax
Expression.SaveAs(FileName)
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The file name under which the picture is to be


saved.

Example:
In the following example the active picture will be saved under the name "Test2.PDL":

Sub SaveDocumentAs()
'VBA186
ActiveDocument.SaveAs ("Test2.PDL")
End Sub

See also
LockedByCreatorID Property (Page 3665)
ActiveDocument Property (Page 3472)
Document Object (Page 3319)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4091

VBA Reference
6.1 The object model of the Graphics Designer

SaveDefaultConfig Method
Description
Saves the default settings for objects to a PDD file. The file is saved to the "GraCS" folder of
the current project.

syntax
Expression.SaveDefaultConfig(FileName)
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
Parameter (Data Type)

Description

FileName (String)

The name of the PDD file.

Example:
In the following example the default settings for objects are saved to the file "Test.PDD".

Sub SaveDefaultConfig()
'VBA187
Application.SaveDefaultConfig ("Test.PDD")
End Sub

See also
Application Object (Page 3282)
LoadDefaultConfig Method (Page 3238)
VBA Reference (Page 3124)

SelectAll Method
Description
Selects all the objects in the specified picture and adds them to the selection listing.

syntax
Expression.SelectAll()

4092

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example three objects will be inserted in the active picture and then selected.

Sub SelectAllObjectsInActiveDocument()
'VBA188
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Height = 15
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 25
.Height = 40
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.Height = 120
.BackColor = RGB(255, 0, 0)
End With
ActiveDocument.Selection.SelectAll
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4093

VBA Reference
6.1 The object model of the Graphics Designer

SendToBack Method
Description
Sends the selected objects right to the back within their current layer.
Note
If the "SendToBack" method is used, the sequence of HMI objects can change in the
HMIObjects listing.

Syntax
Expression.SendToBack()
Expression
Necessary. An expression or element which returns an object of the "Selection" type.

Parameters
--

Example:
In the following example two objects are inserted in the active picture. The object inserted first
is then sent to the back:

Sub SendObjectToBack()
'VBA197
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
With objCircle
.Top = 40
.Left = 40
.Selected = False
End With
With objRectangle
.Top = 40
.Left = 40
.Width = 100
.Height = 50
.BackColor = RGB(255, 0, 255)
.Selected = True
End With
MsgBox "The objects circle and rectangle are created" & vbCrLf & "Only the rectangle is
selected!"
ActiveDocument.Selection.SendToBack

4094

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

MsgBox "The selection is moved to the back."


End Sub

See also
SelectedObjects object (Listing) (Page 3426)
VBA Reference (Page 3124)

SetCSLayerVisible Method
Description
Shows or hides the specified CS layer.

syntax
Expression.SetCSLayerVisible(Index, Val)
Expression
Necessary. An expression or element which returns an object of the "View" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the CS layer that is going to be shown or


hidden. Value range from 1 up to 32.

Val (Boolean)

TRUE if the specified CS layer is intended to be


visible.

Example:
In the following example the second CS layer in the copy of the active picture is hidden (i.e.
made invisible):

Sub SetCSLayerVisible()
'VBA189
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
objView.SetCSLayerVisible 2, False
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4095

VBA Reference
6.1 The object model of the Graphics Designer

See also
Document Object (Page 3319)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

SetOpenContext method
Description
The SetOpenContext method sets the password. Password-protected process pictures or
faceplate types can then be opened.

Syntax
Expression.SetOpenContext (Password)
Expression
Required. An expression or element which returns an object of the "Documents" type.

Parameter
Parameter (Data Type)

Description

Password (String)

Password of the available picture.

Example
Several pictures ("A.pdl", "B.pdl" und "C.pdl") are opened in the following example using the
same password string "Test123". Enter the password for the pictures to open these. Terminate
the SetOpenContext method with an empty string "" to prevent further access to the password.

Sub OpenProtectedPicture()
'VBA853
Documents.SetOpenContext ("Test123")
Documents.Open ("A.pdl")
Documents.Open ("B.pdl")
Documents.Open ("C.pdl")
Documents.SetOpenContext ("")
End Sub

4096

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

SetDeclutterObjectSize Method
Description
Specifies the size area for fading in and out of objects in the specified picture. If height and
width of the object are outside the specified size area, the objects are faded out.
The "ObjectSizeDecluttering" property must be set to TRUE.

syntax
Expression.SetDeclutterObjectSize(Min, Max)
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Min (Long)

Lower size range in pixels.

Max (Long)

Upper size range in pixels.

Example:
In the following example the settings for the lowest layer are configured in the active picture:

Sub ConfigureSettingsOfLayer()
'VBA190
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'Configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
'Define decluttering of objects:
With ActiveDocument
.LayerDecluttering = True
.ObjectSizeDecluttering = True
.SetDeclutterObjectSize 50, 100
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4097

VBA Reference
6.1 The object model of the Graphics Designer

See also
ObjectSizeDecluttering Property (Page 3700)
Document Object (Page 3319)
VBA Reference (Page 3124)

SetRTLayerVisible Method
Description
Shows or hides the specified RT layer.

syntax
Expression.SetRTLayerVisible(Index, Val)
Expression
Necessary. An expression or element which returns an object of the "Document" type.

Parameters
Parameter (Data Type)

Description

Index (Variant)

Defines the RT layer that is going to be shown or


hidden. Value range from 1 to 32.

Val (Boolean)

TRUE if the specified RT layer is intended to be


visible.

Example:
In the following example the first RT layer in the active picture will be made visible:

Sub SetRTLayerVisibleWithVBA()
'VBA191
ActiveDocument.SetRTLayerVisible 1, False
End Sub

See also
Document Object (Page 3319)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)

4098

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ShowPropertiesDialog Method
Description
Opens the "Object Properties" dialog.

syntax
Expression.ShowPropertiesDialog()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example the "Object Properties" dialog is opened:

Sub ShowPropertiesDialog()
'VBA192
Application.ShowPropertiesDialog
End Sub

See also
Application Object (Page 3282)
VBA Reference (Page 3124)

ShowSymbolLibraryDialog Method
Description
Opens the Components Library.

syntax
Expression.ShowSymbolLibraryDialog()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4099

VBA Reference
6.1 The object model of the Graphics Designer

Parameters
--

Example:
In the following example the Components Library is opened:

Sub ShowSymbolLibraryDialog()
'VBA193
Application.ShowSymbolLibraryDialog
End Sub

See also
Application Object (Page 3282)
VBA Reference (Page 3124)

ShowTagDialog Method
Description
Opens the "Tags" dialog.

syntax
Expression.ShowTagDialog()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example the "Tags" dialog is opened:

Sub ShowTagDialog()
'VBA194
Application.ShowTagDialog
End Sub

4100

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
Application Object (Page 3282)
VBA Reference (Page 3124)

TileWindowsHorizontally Method
Description
Arranges all open pictures in the Graphics Designer so that they are tiled horizontally.

syntax
Expression.Methode()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are tiled horizontally. For
this example to work, you must have opened a number of pictures in the Graphics Designer:

Sub TileWindowsHorizontally()
'VBA195
Application.TileWindowsHorizontally
End Sub

See also
Application Object (Page 3282)
VBA Reference (Page 3124)

TileWindowsVertically Method
Description
Arranges all open pictures in the Graphics Designer so that they are tiled vertically.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4101

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.Methode()
Expression
Necessary. An expression or element which returns an object of the "Application" type.

Parameters
--

Example:
In the following example all open pictures in the Graphics Designer are tiled vertically. For this
example to work, you must have opened a number of pictures in the Graphics Designer:

Sub TileWindowsVertically()
'VBA196
Application.TileWindowsVertically
End Sub

See also
Application Object (Page 3282)
VBA Reference (Page 3124)

TransformDisplayCoordinate method
Description
Is used internally for PowerCC.

TransformPixelCoordinate method
Description
Is used internally for PowerCC.

Ungroup Method
Description
Ungroups a group object. The objects remain intact.

4102

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

syntax
Expression.Ungroup(Parameter)
Expression
Necessary. An expression or element which returns an object of the "Group" type.

Parameters
--

Example:
In the following example three objects are created in the current picture and a group object is
then created from them: The group object is then moved and ungrouped.

Sub DissolveGroup()
'VBA199
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Dim objGroup As HMIGroup
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
.Width = 40
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
Set objGroup = ActiveDocument.Selection.CreateGroup
MsgBox "Group-object is created."
With objGroup
.Left = 120
.Top = 300
MsgBox "Group-object is moved."
.UnGroup
MsgBox "Group is dissolved."
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4103

VBA Reference
6.1 The object model of the Graphics Designer

See also
Group Object (Page 3348)
CreateGroup Method (Page 3206)
VBA Reference (Page 3124)
Group Objects (Page 3067)

6.1.7

Objects and Lists

6.1.7.1

0-9, A-C

3DBarGraph Object
Description

Represents the "3D Bar" object. The 3DBarGraph object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMI3DBarGraph

Application
Use the Add method to create a new "3D Bar" object in a picture:

Sub Add3DBarGraph()
'VBA200
Dim obj3DBarGraph As HMI3DBarGraph
Set obj3DBarGraph = ActiveDocument.HMIObjects.AddHMIObject("3DBar", "HMI3DBarGraph")
End Sub

4104

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub Edit3DBarGraph()
'VBA201
Dim obj3DBarGraph As HMI3DBarGraph
Set obj3DBarGraph = ActiveDocument.HMIObjects("3DBar")
obj3DBarGraph.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA202
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Object properties
The 3D Bar object possesses the following properties:
AngleAlpha
AngleBeta
Application
Axe
BackColor
Background
BarDepth
BarHeight
BarWidth
BaseX
BaseY
BorderColor
BorderStyle
BorderWidth
Direction
FillColor
FillStyle
GlobalColorScheme
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4105

VBA Reference
6.1 The object model of the Graphics Designer
GlobalShadow
GroupParent
Height
Layer
Layer00Checked ... Layer10Checked
Layer00Color ... Layer10Color
Layer00FillColor ... Layer10FillColor
Layer00FillStyle ... Layer10FillStyle
Layer00Value ... Layer10Value
Left
LightEffect
Max.
Min.
ObjectName
Operation
Parent
PasswordLevel
PredefinedAngles
Process
Selected
ShowBadTagState
TabOrderAlpha
TabOrderSwitch
ToolTipText
Top
Transparency
Type
Visible
Width
ZeroPointValue

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)

4106

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
ZeroPointValue Property (Page 3886)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
Process Property (Page 3730)
PredefinedAngels Property (Page 3728)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Name Property (Page 3694)
Min Property (Page 3691)
Max Property (Page 3673)
LightEffect Property (Page 3658)
Left Property (Page 3657)
Layer Property (Page 3646)
Layer00..10Value property (Page 3648)
Height Property (Page 3624)
Direction Property (Page 3571)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderColor Property (Page 3515)
BaseY Property (Page 3509)
BaseX Property (Page 3508)
BarWidth Property (Page 3505)
BarHeight Property (Page 3504)
BarDepth Property (Page 3504)
Background Property (Page 3502)
Axe Property (Page 3491)
AngleBeta Property (Page 3484)
AngleAlpha Property (Page 3483)
Layer00..10Checked property (Page 3646)
Layer00..10Color property (Page 3647)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4107

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
BackColor Property (Page 3494)
FillColor Property (Page 3588)
FillStyle Property (Page 3592)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
Layer00..10FillColor property (Page 3648)
Layer00..10FillStyle property (Page 3648)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

Actions Object (Listing)


Description

Displays a listing of the actions that are configured on an event.

VBA Object Name


HMIActions

4108

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the AddAction method to configure one or more actions on an event. In this example a
button and a circle will be inserted in the active picture. In runtime the radius of the circle
enlarges every time you click the button:

Sub CreateVBActionToClickedEvent()
'VBA203
Dim objButton As HMIButton
Dim objCircle As HMICircle
Dim objVBScript As HMIScriptInfo
Dim strVBCode As String
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircle
.Top = 100
.Left = 100
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "Increase Radius"
End With
'define event and assign sourcecode to it:
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
strVBCode = "Dim myCircle" & vbCrLf & "Set myCircle = "
strVBCode = strVBCode & "HMIRuntime.ActiveScreen.ScreenItems(""Circle_VB"")"
strVBCode = strVBCode & vbCrLf & "myCircle.Radius = myCircle.Radius + 5"
With objVBScript
.SourceCode = strVBCode
End With
End Sub

See also
AddAction Method (Page 3173)
Configuring Event-Driven Actions with VBA (Page 3092)
Parent Property (Page 3708)
Item Property (Page 3637)
Count Property (Page 3560)
Application Property (Page 3484)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4109

VBA Reference
6.1 The object model of the Graphics Designer

ActiveXControl Object
Description

Represents the ActiveX Control object. The ActiveXControl object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIActiveXControl

Usage
Use the AddActiveXControl method to insert an ActiveX Control in a picture, for instance. In
the following example the ActiveX Control "WinCC Gauge Control" is inserted in the active
picture.

Sub AddActiveXControl()
'VBA204
Dim objActiveXControl As HMIActiveXControl
Set objActiveXControl = ActiveDocument.HMIObjects.AddActiveXControl("WinCC_Gauge",
"XGAUGE.XGaugeCtrl.1")
With ActiveDocument
.HMIObjects("WinCC_Gauge").Top = 40
.HMIObjects("WinCC_Gauge").Left = 40
End With
End Sub

See also
ServerName Property (Page 3758)
AddActiveXControl Method (Page 3174)
VBA Reference (Page 3124)
ActiveX controls (Page 3064)
ProgID Property (Page 3732)

4110

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Transparency property (Page 3787)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

AdvancedAnalogDisplay object
Description
Represents the "Analog Display (Advanced)" object. The "AdvancedAnalogDisplay" object is
an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4111

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMIAdvancedAnalogDisplay

Application
Use the AddHMIObject method to create a new "Analog Display (Advanced)" object in a
picture:

Sub AddAdvancedAnalogDisplay()
'VBA857
Dim objAdvancedAnalogDisplay As HMIAdvancedAnalogDisplay
Set objAdvancedAnalogDisplay = ActiveDocument.HMIObjects.AddHMIObject("Analogdisplay1",
"HMIAdvancedAnalogDisplay")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditAdvancedAnalogDisplay()
'VBA858
Dim objAdvancedAnalogDisplay As HMIAdvancedAnalogDisplay
Set objAdvancedAnalogDisplay = ActiveDocument.HMIObjects("Analogdisplay1")
objAdvancedAnalogDisplay.BackColor_Simulation = RGB(255, 0, 0)
End Sub

See also
AlarmGoneVisible property (Page 3478)
AlignmentLeft Property (Page 3480)
AlignmentTop Property (Page 3481)
Application Property (Page 3484)
BackColor Property (Page 3494)
BackColor_Alarm.._Warning property (Page 3496)
BackFillColor property (Page 3498)
BackFillColor_OK property (Page 3499)
BackFillColor_Simulation property (Page 3499)
BackFillStyle property (Page 3499)
BackFillStyle_OK property (Page 3499)
BackFillStyle_Simulation property (Page 3500)
BorderColor Property (Page 3515)
BorderWidth Property (Page 3523)

4112

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
UseGlobalAlarmClasses property (Page 3803)
CBackColorOff..ColorOn property (Page 3531)
CBackFlash property (Page 3531)
CollectValue property (Page 3542)
CornerRadius property (Page 3560)
CQBackColorOff..ColorOn property (Page 3562)
CQBackFlash property (Page 3562)
CQTextColorOff..ColorOn property (Page 3562)
CTextColorOff..ColorOn property (Page 3563)
CQTextFlash property (Page 3563)
CTextFlash property (Page 3563)
EventQuitMask property (Page 3580)
EnableFlashing property (Page 3579)
Events Property (Page 3581)
FontBold Property (Page 3611)
FontItalic Property (Page 3612)
FontName Property (Page 3613)
FontSize Property (Page 3613)
FontUnderline Property (Page 3614)
ForeColor Property (Page 3615)
Format property (Page 3618)
ForeColor_Alarm.._Warning property (Page 3616)
GlobalShadow property (Page 3619)
GNQBackColorOff..ColorOn property (Page 3619)
GNQBackFlash property (Page 3620)
GNQTextColorOff..ColorOn property (Page 3620)
GNQTextFlash property (Page 3620)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
MessageClass Property (Page 3690)
ObjectName Property (Page 3698)
Operation Property (Page 3703)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4113

VBA Reference
6.1 The object model of the Graphics Designer
Orientation Property (Page 3705)
OutputValue property (Page 3708)
PaintColor_QualityCodeBad property (Page 3708)
PaintColor_QualityCodeUnCertain property (Page 3708)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
PrioAlarm..Warning property (Page 3730)
PrioBit16..31 property (Page 3730)
Properties Property (Page 3734)
Relevant Property (Page 3742)
Selected Property (Page 3756)
ServerName Property (Page 3758)
ShowBadTagState property (Page 3761)
Simulation property (Page 3762)
SimulationBit property (Page 3762)
Tag property (Page 3776)
tagname property (Page 3776)
tagtype property (Page 3778)
trend property (Page 3788)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Transparency property (Page 3787)
Type Property (Page 3790)
UseValueText property (Page 3807)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectionPoints property (Page 3558)
FlashState property (Page 3608)
ConnectorObjects property (Page 3558)

4114

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AdvancedStateDisplay object
Description
Represents the "State Display (Advanced)" object. The "AdvancedStateDisplay" object is an
element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIAdvancedStateDisplay

Application
Use the AddHMIObject method to create a new "State Display (Advanced)" object in a picture:

Sub AddAdvancedStateDisplay()
'VBA859
Dim objAdvancedStateDisplay As HMIAdvancedStateDisplay
Set objAdvancedStateDisplay = ActiveDocument.HMIObjects.AddHMIObject("Statedisplay1",
"HMIAdvancedStateDisplay")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditAdvancedStateDisplay()
'VBA860
Dim objAdvancedStateDisplay As HMIAdvancedStateDisplay
Set objAdvancedStateDisplay = ActiveDocument.HMIObjects("Statedisplay1")
objAdvancedStateDisplay.PaintColor_QualityCodeBad = RGB(255, 0, 0)
End Sub

See also
UseGlobalAlarmClasses property (Page 3803)
EventQuitMask property (Page 3580)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Tag property (Page 3776)
tagname property (Page 3776)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4115

VBA Reference
6.1 The object model of the Graphics Designer
tagtype property (Page 3778)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Transparency property (Page 3787)
trend property (Page 3788)
Type Property (Page 3790)
UseEventState property (Page 3802)
Visible Property (Page 3878)
Width Property (Page 3881)
Selected Property (Page 3756)
ServerName Property (Page 3758)
ShowBadTagState property (Page 3761)
Properties Property (Page 3734)
Relevant Property (Page 3742)
Process property (Page 3731)
Process1 property (Page 3731)
Process2 property (Page 3731)
Process3 property (Page 3732)
PaintColor_QualityCodeBad property (Page 3708)
PaintColor_QualityCodeUnCertain property (Page 3708)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
PrioAlarm..Warning property (Page 3730)
PrioBit16..31 property (Page 3730)
MaxIndex property (Page 3674)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Index Property (Page 3631)
Events Property (Page 3581)

4116

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
CollectValue property (Page 3542)
AlarmGoneVisible property (Page 3478)
Application Property (Page 3484)
BasePicture property (Page 3507)
BitPosition0..3 property (Page 3511)
BitSelect0..3 property (Page 3512)
ConnectionPoints property (Page 3558)
FlashPictureState property (Page 3602)
NibbleSelect property (Page 3696)
ConnectorObjects property (Page 3558)

AnalogResultInfo Object
Description

Displays an analog value range and associated property value in the Dynamic dialog. The
AnalogResultInfo object is an element of the AnalogResultInfos listing:

VBA Object Name


HMIAnalogResultInfo

Usage
Use the AnalogResultInfo object to return an individual value range and property value. For a
detailed example, please refer to "AnalogResultInfos Object (Listing)" in this documentation.

See also
AnalogResultInfos Object (Listing) (Page 3281)
Delete Method (Page 3208)
Value Property (Page 3807)
RangeTo Property (Page 3740)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4117

VBA Reference
6.1 The object model of the Graphics Designer
Parent Property (Page 3708)
Application Property (Page 3484)

AnalogResultInfos Object (Listing)


Description

A listing of AnalogResultInfo objects that contain all the analog value ranges and the associated
property value in the Dynamic dialog.

VBA Object Name


HMIAnalogResultInfos

Usage
Use the Add method to add a new value range in the Dynamic dialog. In the following example
the radius of a circle will be dynamically configured using the Dynamic dialog, a tag name will
be assigned and three analog value ranges will be created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA206
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

Use AnalogResultInfos to return the AnalogResultInfos listing. In this example the value ranges
created in the above example will be output:

Sub ShowAnalogResultInfosOfCircleRadius()

4118

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'VBA207
Dim colAResultInfos As HMIAnalogResultInfos
Dim objAResultInfo As HMIAnalogResultInfo
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Dim iAnswer As Integer
Dim varRange As Variant
Dim varValue As Variant
Set objCircle = ActiveDocument.HMIObjects("Circle_A")
Set objDynDialog = objCircle.Radius.Dynamic
Set colAResultInfos = objDynDialog.AnalogResultInfos
For Each objAResultInfo In colAResultInfos
varRange = objAResultInfo.RangeTo
varValue = objAResultInfo.value
iAnswer = MsgBox("Ranges of values from Circle_A-Radius:" & vbCrLf & "Range of value to: "
& varRange & vbCrLf & "Value of property: " & varValue, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objAResultInfo
End Sub

See also
Add Method (AnalogResultInfos Listing) (Page 3166)
Parent Property (Page 3708)
Item Property (Page 3637)
ElseCase Property (Page 3578)
Count Property (Page 3560)
Application Property (Page 3484)

Application Object
Description

Represents the Graphics Designer editor. The Application object contains properties and
methods that return objects from the top layer. For example ActiveDocument returns a
Document object.

VBA Object Name


HMIApplication

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4119

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use Application to return the Application object. In the following example the application
version is output:

Sub ShowApplicationVersion()
'VBA208
MsgBox Application.Version
End Sub

See also
ShowTagDialog Method (Page 3263)
CurrentDesktopLanguage Property (Page 3564)
TileWindowsVertically Method (Page 3264)
TileWindowsHorizontally Method (Page 3264)
ShowSymbolLibraryDialog Method (Page 3262)
ShowPropertiesDialog Method (Page 3262)
SaveDefaultConfig Method (Page 3255)
LoadDefaultConfig Method (Page 3238)
CascadeWindows Method (Page 3193)
ArrangeMinimizedWindows Method (Page 3190)
Activate Method (Page 3165)
VBA Reference (Page 3124)
WindowState Property (Page 3885)
Visible Property (Page 3878)
Version Property (Page 3877)
VBE Property (Page 3877)
VBAVersion Property (Page 3877)
SymbolLibraries Property (Page 3770)
ProjectType Property (Page 3734)
ProjectName Property (Page 3733)
ProfileName Property (Page 3732)
Parent Property (Page 3708)
Name Property (Page 3694)
IsConnectedToProject Property (Page 3634)
Documents Property (Page 3575)
DefaultHMIObjects Property (Page 3569)

4120

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
CustomToolbars Property (Page 3566)
CustomMenus Property (Page 3566)
CurrentDataLanguage Property (Page 3563)
ConfigurationFileName Property (Page 3557)
AvailableDataLanguages Property (Page 3490)
ApplicationDataPath Property (Page 3485)
Application Property (Page 3484)
ActiveDocument Property (Page 3472)
CommandLine Property (Page 3555)
DisableVBAEvents Property (Page 3572)
AddIns property (Page 3477)
CopyPasteSettings property (Page 3560)
DisablePerformanceWarnings property (Page 3572)

ApplicationWindow Object
Description

Represents the "Application Window" object. The ApplicationWindow object is an element of


the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIApplicationWindow

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4121

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Add method to create a new "Application Window" object in a picture:

Sub AddApplicationWindow()
'VBA209
Dim objApplicationWindow As HMIApplicationWindow
Set objApplicationWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow",
"HMIApplicationWindow")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditApplicationWindow()
'VBA210
Dim objApplicationWindow As HMIApplicationWindow
Set objApplicationWindow = ActiveDocument.HMIObjects("AppWindow")
objApplicationWindow.Sizeable = True
End Sub
Use "Selection"(Index) to return an object from the Selection listing:
Sub ShowNameOfFirstSelectedObject()
'VBA211
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Caption Property (Page 3529)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
WindowBorder Property (Page 3882)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
Sizeable Property (Page 3763)
OnTop Property (Page 3702)

4122

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Name Property (Page 3694)
Moveable Property (Page 3693)
MaximizeButton Property (Page 3674)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
CloseButton Property (Page 3541)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
ConnectionPoints property (Page 3558)
Template property (Page 3778)
ConnectorObjects property (Page 3558)

BarGraph Object
Description

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4123

VBA Reference
6.1 The object model of the Graphics Designer
Represents the "Bar" object. The BarGraph object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default settings of property values of all Standard,
Windows and Smart objects.

VBA Object Name


HMIBarGraph

Application
Use the Add method to create a new "Bar" object in a picture:

Sub AddBarGraph()
'VBA212
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditBarGraph()
'VBA213
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects("Bar1")
objBarGraph.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA214
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
TypeWarningHigh Property (Page 3797)
Max Property (Page 3673)
FillColor Property (Page 3588)

4124

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
BorderStyle Property (Page 3522)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
ZeroPointValue Property (Page 3886)
ZeroPoint Property (Page 3885)
Width Property (Page 3881)
WarningLow Property (Page 3880)
WarningHigh Property (Page 3879)
Visible Property (Page 3878)
TypeWarningLow Property (Page 3798)
TypeToleranceLow Property (Page 3796)
TypeToleranceHigh Property (Page 3795)
TypeLimitLow4 Property (Page 3794)
TypeLimitHigh4 Property (Page 3792)
TypeAlarmLow Property (Page 3791)
TypeAlarmHigh Property (Page 3791)
Trend Property (Page 3788)
TrendColor Property (Page 3788)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
ToleranceLow Property (Page 3782)
ToleranceHigh Property (Page 3782)
ScalingType Property (Page 3750)
Scaling Property (Page 3749)
ScaleTicks Property (Page 3748)
ScaleColor Property (Page 3747)
RightComma Property (Page 3744)
Process Property (Page 3730)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Name Property (Page 3694)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4125

VBA Reference
6.1 The object model of the Graphics Designer
Min Property (Page 3691)
Marker Property (Page 3672)
LongStrokesTextEach Property (Page 3671)
LongStrokesSize Property (Page 3670)
LongStrokesOnly Property (Page 3670)
LongStrokesBold Property (Page 3669)
LimitLow4 Property (Page 3661)
LimitHigh4 Property (Page 3659)
Left Property (Page 3657)
LeftComma Property (Page 3658)
Layer Property (Page 3646)
HysteresisRange Property (Page 3629)
Hysteresis Property (Page 3628)
Height Property (Page 3624)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontBold Property (Page 3611)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
Exponent Property (Page 3584)
Direction Property (Page 3571)
ColorWarningLow Property (Page 3553)
ColorWarningHigh Property (Page 3552)
ColorToleranceLow Property (Page 3550)
ColorToleranceHigh Property (Page 3549)
ColorLimitLow4 Property (Page 3547)
ColorLimitHigh4 Property (Page 3545)
ColorChangeType Property (Page 3545)
ColorAlarmLow Property (Page 3543)
ColorAlarmHigh Property (Page 3542)
CheckWarningLow Property (Page 3539)
CheckWarningHigh Property (Page 3539)

4126

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
CheckToleranceLow Property (Page 3538)
CheckToleranceHigh Property (Page 3537)
CheckLimitLow4 Property (Page 3535)
CheckLimitHigh4 Property (Page 3534)
CheckAlarmLow Property (Page 3532)
CheckAlarmHigh Property (Page 3531)
BorderWidth Property (Page 3523)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
BackColor3 Property (Page 3496)
BackColor2 Property (Page 3495)
AxisSection Property (Page 3492)
Average Property (Page 3491)
Alignment Property (Page 3480)
AlarmLow Property (Page 3479)
AlarmHigh Property (Page 3478)
FillStyle2 Property (Page 3594)
Application Property (Page 3484)
Events Property (Page 3581)
ObjectName Property (Page 3698)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4127

VBA Reference
6.1 The object model of the Graphics Designer

BinaryResultInfo Object
Description

Displays both the binary (boolean) value ranges and the associated property values in the
Dynamic dialog.

VBA Object Name


HMIBinaryResultInfo

Usage
Use BinaryResultInfo to return the BinaryResultInfo object. In the following example the radius
of a circle will be dynamically configured using the Dynamic dialog, a tag name will be assigned
and the associated property values will be assigned to both the binary value ranges:

Sub AddDynamicDialogToCircleRadiusTypeBinary()
'VBA215
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_C", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBool
.BinaryResultInfo.NegativeValue = 20
.BinaryResultInfo.PositiveValue = 40
End With
End Sub

See also
VBA Reference (Page 3124)
PositiveValue Property (Page 3728)
Parent Property (Page 3708)
NegativeValue Property (Page 3695)
Application Property (Page 3484)

4128

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BitResultInfo Object
Description

Displays both the value ranges for bit set/not set and the associated property values in the
Dynamic dialog.

VBA Object Name


HMIBitResultInfo

Usage
Use BitResultInfo to return a BitResultInfo object. In the following example the radius of a circle
will be dynamically configured using the Dynamic dialog, a tag name will be assigned, the bit
to be set will be defined and the associated property values will be assigned to the "set"/"not
set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA216
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
'Tag "NewDynmic1" must exist
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

See also
Delete Method (Page 3208)
VBA Reference (Page 3124)
BitSetValue Property (Page 3512)
BitNumber Property (Page 3510)
BitNotSetValue Property (Page 3510)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4129

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
Parent Property (Page 3708)

Button Object
Description

Represents the "Button" object. The Button object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default settings of property values of all Standard,
Windows and Smart objects.

VBA Object Name


HMIButton

Application
Use the Add method to create a new "Button" object in a picture:

Sub AddButton()
'VBA217
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button", "HMIButton")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditButton()
'VBA218
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects("Button")

4130

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

objButton.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA219
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ForeFlashColorOn Property (Page 3617)
BorderColorBottom Property (Page 3516)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
Text Property (Page 3779)
PictureUp Property (Page 3722)
PictureDown Property (Page 3720)
PasswordLevel Property (Page 3711)
Orientation Property (Page 3705)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Hotkey Property (Page 3627)
Height Property (Page 3624)
ForeFlashColorOff Property (Page 3616)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4131

VBA Reference
6.1 The object model of the Graphics Designer
ForeColor Property (Page 3615)
FontUnderline Property (Page 3614)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontItalic Property (Page 3612)
FontBold Property (Page 3611)
FlashRateForeColor Property (Page 3607)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashForeColor Property (Page 3599)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
DisplayOptions Property (Page 3574)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColorTop Property (Page 3517)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
BackBorderWidth Property (Page 3493)
AlignmentTop Property (Page 3481)
AlignmentLeft Property (Page 3480)
AdaptBorder Property (Page 3475)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)

4132

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
PicDownReferenced Property (Page 3716)
PicDownTransparent Property (Page 3717)
PicDownUseTransColor Property (Page 3717)
PictAlignment property (Page 3719)
PicUpReferenced Property (Page 3723)
PicUpTransparent Property (Page 3723)
PicUpUseTransColor Property (Page 3724)
PicUseTransColor Property (Page 3725)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
WinCCStyle property (Page 3882)
WindowsStyle property (Page 3884)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4133

VBA Reference
6.1 The object model of the Graphics Designer

CheckBox Object
Description

Represents the "Check Box" object. The CheckBox object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default settings of property values of all Standard,
Windows and Smart objects.

VBA Object Name


HMICheckBox

Application
Use the Add method to create a new "Check Box" object in a picture:

Sub AddCheckBox()
'VBA220
Dim objCheckBox As HMICheckBox
Set objCheckBox = ActiveDocument.HMIObjects.AddHMIObject("CheckBox", "HMICheckBox")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

Sub EditCheckBox()
'VBA221
Dim objCheckBox As HMICheckBox
Set objCheckBox = ActiveDocument.HMIObjects("CheckBox")
objCheckBox.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection(Index)" to return an object from the Selection listing:

4134

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub ShowNameOfFirstSelectedObject()
'VBA222
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Application Property (Page 3484)
AdaptBorder Property (Page 3475)
AlignmentLeft Property (Page 3480)
AlignmentTop Property (Page 3481)
BackColor Property (Page 3494)
BackFlashColorOff Property (Page 3500)
BackFlashColorOn Property (Page 3501)
BorderBackColor Property (Page 3514)
BorderColor Property (Page 3515)
BorderFlashColorOff Property (Page 3519)
BorderFlashColorOn Property (Page 3520)
BorderStyle Property (Page 3522)
BorderWidth Property (Page 3523)
BoxAlignment Property (Page 3525)
BoxCount Property (Page 3526)
Events Property (Page 3581)
FillColor Property (Page 3588)
Filling Property (Page 3590)
FillingIndex Property (Page 3591)
FillStyle Property (Page 3592)
FlashBackColor Property (Page 3596)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4135

VBA Reference
6.1 The object model of the Graphics Designer
FlashBorderColor Property (Page 3597)
FlashForeColor Property (Page 3599)
FlashRateBackColor Property (Page 3604)
FlashRateBorderColor Property (Page 3605)
FlashRateForeColor Property (Page 3607)
FontBold Property (Page 3611)
FontItalic Property (Page 3612)
FontName Property (Page 3613)
FontSize Property (Page 3613)
FontUnderline Property (Page 3614)
ForeColor Property (Page 3615)
ForeFlashColorOff Property (Page 3616)
ForeFlashColorOn Property (Page 3617)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Index Property (Page 3631)
Layer Property (Page 3646)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
OperationMessage Property (Page 3704)
Orientation Property (Page 3705)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Process Property (Page 3730)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Text Property (Page 3779)

4136

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Transparency property (Page 3787)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
WindowsStyle property (Page 3884)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

Circle Object
Description

Represents the "Circle" object. The Circle object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMICircle

Usage
Use the Add method to create a new "Circle" object in a picture:

Sub AddCircle()
'VBA223

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4137

VBA Reference
6.1 The object model of the Graphics Designer

Dim objCircle As HMICircle


Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditCircle()
'VBA224
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects("Circle")
objCircle.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA225
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
FillColor Property (Page 3588)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
Radius Property (Page 3738)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)

4138

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4139

VBA Reference
6.1 The object model of the Graphics Designer

CircularArc Object
Description

Represents the "Circular Arc" object. The CircularArc object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMICircularArc

Usage
Use the Add method to create a new "Circular Arc" object in a picture:

Sub AddCiruclarArc()
'VBA226
Dim objCiruclarArc As HMICircularArc
Set objCiruclarArc = ActiveDocument.HMIObjects.AddHMIObject("CircularArc",
"HMICircularArc")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditCiruclarArc()
'VBA227
Dim objCiruclarArc As HMICircularArc
Set objCiruclarArc = ActiveDocument.HMIObjects("CircularArc")
objCiruclarArc.BorderColor = RGB(255, 0, 0)
End Sub

4140

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA228
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
HMIObjects Object (Listing) (Page 3359)
BorderBackColor Property (Page 3514)
SelectedObjects object (Listing) (Page 3426)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
StartAngle Property (Page 3767)
Radius Property (Page 3738)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashBorderColor Property (Page 3597)
EndAngle Property (Page 3580)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4141

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

Collection object
Description
Allows access to a listing of objects of the same type, for example, "Documents" objects.

See also
Application Property (Page 3484)
Count Property (Page 3560)
Item Property (Page 3637)
Parent Property (Page 3708)

4142

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ComboBox object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

&RPER%R[

6HOHFWLRQ
Represents the "ComboBox" object. The ComboBox object is an element of the following lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMIComboBox

Usage
Use the Add method to create a new "ComboBox" object in a picture:

Sub AddComboBox()
'VBA822
Dim objComboBox As HMIComboBox
Set objComboBox = ActiveDocument.HMIObjects.AddHMIObject("ComboBox", "HMIComboBox")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditComboBox()
'VBA850
Dim objComboBox As HMIComboBox
Set objComboBox = ActiveDocument.HMIObjects("ComboBox")
objComboBox.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4143

VBA Reference
6.1 The object model of the Graphics Designer

Sub ShowNameOfFirstSelectedObject()
'VBA824
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Left Property (Page 3657)
Layer Property (Page 3646)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
NumberLines Property (Page 3697)
ForeColor Property (Page 3615)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackColor Property (Page 3494)
BorderStyle Property (Page 3522)
BorderWidth Property (Page 3523)
FillColor Property (Page 3588)
FillStyle Property (Page 3592)
FontName Property (Page 3613)
FontSize Property (Page 3613)
FontBold Property (Page 3611)
FontItalic Property (Page 3612)
FontUnderline Property (Page 3614)
AlignmentLeft Property (Page 3480)
GlobalShadow property (Page 3619)
Index Property (Page 3631)
Text Property (Page 3779)
Operation Property (Page 3703)
PasswordLevel Property (Page 3711)
Visible Property (Page 3878)

4144

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
ToolTipText Property (Page 3784)
SelText property (Page 3757)
SelIndex property (Page 3757)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GroupParent Property (Page 3623)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

ConnectionPoints Object (Listing)


Description

The listing returns the number of points to which the connector can be appended in the
specified object.

VBA object name


HMIConnectionPoints

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4145

VBA Reference
6.1 The object model of the Graphics Designer

Object properties
The ConnectionPoints object possesses the following properties:
Application
Count
Item
Parent

Example 1
In this example, a rectangle is inserted and the number of connection points is output:

Sub CountConnectionPoints()
'VBA229
Dim objRectangle As HMIRectangle
Dim objConnPoints As HMIConnectionPoints
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
Set objConnPoints = ActiveDocument.HMIObjects("Rectangle1").ConnectionPoints
MsgBox "Rectangle1 has " & objConnPoints.Count & " connectionpoints."
End Sub

Example 2:
In this example, a text field is inserted and the connection points are accessed via
"ConnectionPoints.Item". The coordinates of the connection points are shown in an output
window.

Sub GetConnectionPoints()
'VBA825
Dim xPos As Long
Dim yPos As Long
Dim objConnPoints As HMIConnectionPoints
Set objDoc = Application.ActiveDocument
Set objObject = objDoc.HMIObjects.AddHMIObject("Text","HMIStaticText")
Set objConnPoints = ActiveDocument.HMIObjects("Text").ConnectionPoints
For i = 1 To objConnPoints.Count
xPos = objObject.ConnectionPoints.Item(i)(0)
yPos = objObject.ConnectionPoints.Item(i)(1)
MsgBox "Coordinates " & i & ". ConnectionPoint:" & Chr(13) & "x: " & xPos & Chr(13) &
"y: " & yPos
Next
End Sub

The diagram below shows the positions of the 4 connection points of the text field.

4146

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer






Note
If you activate the connection points of a connector with VBA, the connection point index
begins with "1".
If you determine the connection points in the property window of the connector in the graphical
interface, the connection point index begins with "0".
The index numbers e.g. of the lower connection point in the picture are assigned as follows:
VBA: Index = 3
Graphical interface: Index = 2

See also
Parent Property (Page 3708)
Item Property (Page 3637)
Count Property (Page 3560)
Application Property (Page 3484)

CustomizedObject Object
Description

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4147

VBA Reference
6.1 The object model of the Graphics Designer
Represents the object called "Customized Object". The CustomizedObject object is an element
of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
In the case of the CustomizedObject object, the only properties that are available in the object
are those that you have selected in the "Configuration" dialog for the customized object
concerned.
Note
You cannot configure the CustomizedObject object with VBA.
Further information regarding customized objects can be found in the WinCC documentation
under "Customized Object".

VBA Object Name


HMICustomizedObject

Application
Use the CreateCustomizedObject Method with the Selection listing to create a new
"Customized Object" object in a picture:

Sub CreateCustomizedObject()
'VBA230
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objCustomizedObject As HMICustomizedObject
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
With objCircle
.Left = 10
.Top = 10
.Selected = True
End With
With objRectangle
.Left = 50
.Top = 50
.Selected = True
End With
MsgBox "objects created and selected!"
Set objCustomizedObject = ActiveDocument.Selection.CreateCustomizedObject
objCustomizedObject.ObjectName = "Customer-Object"
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name:

4148

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub EditCustomizedObject()
'VBA231
Dim objCustomizedObject As HMICustomizedObject
Set objCustomizedObject = ActiveDocument.HMIObjects("Customer-Object")
MsgBox objCustomizedObject.ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
Destroy Method (Page 3212)
Delete Method (Page 3208)
CreateCustomizedObject Method (Page 3202)
How to Edit a Customized Object with VBA (Page 3076)
VBA Reference (Page 3124)
Customized Objects (Page 3074)
Editing Objects with VBA (Page 3053)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
Height Property (Page 3624)
InheritState property (Page 3633)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Type Property (Page 3790)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4149

VBA Reference
6.1 The object model of the Graphics Designer
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectionPoints property (Page 3558)
HMIUdoObjects property (Page 3627)
ConnectorObjects property (Page 3558)

6.1.7.2

D-I

DataLanguage Object
Description

Represents the installed project language, which is identified by its name and language
identifier. The DataLanguage object is an element of the DataLanguages listing:
The list of language codes is available in the WinCC documentation (Index > Language Code).
The hexadecimal value specified in the list has to be converted to its equivalent decimal value.

VBA Object Name


HMIDataLanguage

Usage
Use the DataLanguages property to return an individual DataLanguage object. In the following
example the first installed project language is output:

Sub ShowFirstObjectOfCollection()
'VBA232
Dim strName As String
strName = ActiveDocument.Application.AvailableDataLanguages(1).LanguageName
MsgBox strName
End Sub

4150

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
DataLanguages Object (Listing) (Page 3314)
VBA Reference (Page 3124)
Language-Dependent Configuration with VBA (Page 3018)
Parent Property (Page 3708)
LanguageName Property (Page 3644)
LanguageID Property (Page 3643)
Application Property (Page 3484)

DataLanguages Object (Listing)


Description

A listing of the DataLanguage objects that represent all the installed project languages.

VBA Object Name


HMIDataLanguages

Usage
Use the AvailableDataLanguages property to return the DataLanguages listing. In the following
example the installed project language is output:

Sub ShowDataLanguage()
'VBA233
Dim colDataLanguages As HMIDataLanguages
Dim objDataLanguage As HMIDataLanguage
Dim strLanguages As String
Dim iCount As Integer
iCount = 0
Set colDataLanguages = Application.AvailableDataLanguages
For Each objDataLanguage In colDataLanguages
If "" <> strLanguages Then strLanguages = strLanguages & "/"
strLanguages = strLanguages & objDataLanguage.LanguageName & " "
'Every 15 items of datalanguages output in a messagebox
If 0 = iCount Mod 15 And 0 <> iCount Then
MsgBox strLanguages

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4151

VBA Reference
6.1 The object model of the Graphics Designer

strLanguages = ""
End If
iCount = iCount + 1
Next objDataLanguage
MsgBox strLanguages
End Sub

See also
Language-Dependent Configuration with VBA (Page 3018)
DataLanguage Object (Page 3313)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

DataSetObj object
Description
The "DataSetObj" object serves as a container for the internal storage of data of the user
objects or faceplate types. The DataSetObj object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIDataSetObj

See also
Application Property (Page 3484)
ConnectionPoints property (Page 3558)
Events Property (Page 3581)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDFonts Property (Page 3651)
Left Property (Page 3657)

4152

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectorObjects property (Page 3558)

DestLink Object
Description

Represents the destination for a direct connection.

VBA Object Name


HMIDestLink

Usage
Use the DestinationLink property to return the DestLink object. In the following example the X
position of "Rectangle_A" is copied to the Y position of "Rectangle_B" in Runtime by clicking
on the button:

Sub DirectConnection()
'VBA234

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4153

VBA Reference
6.1 The object model of the Graphics Designer

Dim objButton As HMIButton


Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 90
.Height = 50
.Text = "SetPosition"
End With
'
'Directconnection is initiated on mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of "Rectangle_A"
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of "Rectangle_B"
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DirectConnection Object (Page 3318)
VBA Reference (Page 3124)
Type Property (Page 3790)
ObjectName Property (Page 3698)
AutomationName Property (Page 3488)
Parent Property (Page 3708)

4154

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

DirectConnection Object
Description

Represents a direct connection.

VBA Object Name


HMIDirectConnection

Usage
Use the DestinationLink and SourceLink properties to configure the source and destination of
a direct connection. In the following example the X position of "Rectangle_A" is copied to the
Y position of "Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA235
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 90
.Height = 50
.Text = "SetPosition"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4155

VBA Reference
6.1 The object model of the Graphics Designer

End With
'
'Directconnection is initiated on mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Property "Top" of "Rectangle_A"
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Property "Left" of "Rectangle_B"
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DestinationLink Property (Page 3570)
SourceLink Object (Page 3431)
DestLink Object (Page 3316)
VBA Reference (Page 3124)
SourceLink Property (Page 3765)
Application Property (Page 3484)
Parent Property (Page 3708)

Document Object
Description

Displays a picture in Graphics Designer. The document object is an element of the documents
listing.

4156

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMIDocument

Usage
Use Documents(Index) to return an individual document object. In the following example the
file name of the first picture is displayed:

Sub ShowFirstObjectOfCollection()
'VBA236
Dim strName As String
strName = Application.Documents(3).Name
MsgBox strName
End Sub

You may also use the object "Me" if you wish to address the current document:

Sub ShowDocumentName()
'VBA812
Dim obj As Document
set obj = Me
MsgBox obj.Name
End Sub

For example, use the SaveAs method to save the picture under a different name. In the
following example the first picture will be saved under the name "CopyOfPicture1":

Sub SaveDocumentAs()
'VBA237
Application.Documents(3).SaveAs ("CopyOfPicture1")
End Sub

See also
Editing Pictures with VBA (Page 3047)
GridHeight Property (Page 3622)
Documents Object (Listing) (Page 3322)
SetRTLayerVisible Method (Page 3261)
SaveAs Method (Page 3254)
Save Method (Page 3252)
PrintProjectDocumentation Method (Page 3245)
PasteClipboard Method (Page 3243)
MoveSelection Method (Page 3240)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4157

VBA Reference
6.1 The object model of the Graphics Designer
IsRTLayerVisible Method (Page 3233)
Export Method (Page 3216)
CopySelection Method (Page 3199)
Close Method (Page 3196)
VBA Reference (Page 3124)
ExtendedZoomingEnable Property (Page 3585)
Width Property (Page 3881)
Visible Property (Page 3878)
Views Property (Page 3878)
UpdateCycle Property (Page 3801)
TabOrderOtherAction Property (Page 3773)
TabOrderMouse Property (Page 3773)
TabOrderKeyboard Property (Page 3772)
TabOrderAllHMIObjects Property (Page 3771)
SnapToGrid Property (Page 3764)
HMIDefaultObjects Object (Listing) (Page 3354)
Selection Property (Page 3757)
Properties Property (Page 3734)
Path Property (Page 3712)
PasswordLevel Property (Page 3711)
Parent Property (Page 3708)
Operation Property (Page 3703)
Name Property (Page 3694)
LockedByCreatorID Property (Page 3665)
LastChange Property (Page 3645)
HMIObjects Property (Page 3626)
Hide Property (Page 3625)
Height Property (Page 3624)
GridWidth Property (Page 3622)
GridColor Property (Page 3621)
Grid Property (Page 3620)
FillStyle Property (Page 3592)
Events Property (Page 3581)
CustomToolbars Property (Page 3566)
CustomMenus Property (Page 3566)

4158

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
CursorMode Property (Page 3565)
BackColor Property (Page 3494)
Application Property (Page 3484)
BackPictureAlignment property (Page 3503)
BackPictureName property (Page 3503)
CommonVBSCode Property (Page 3554)
CommonVBSEventArea property (Page 3554)
CommonVBSPropertyArea property (Page 3555)
GlobalColorScheme property (Page 3619)
LayerDecluttering Property (Page 3649)
Layers Property (Page 3650)
Modified Property (Page 3693)
ObjectSizeDecluttering Property (Page 3700)
PdlProtection property (Page 3713)
GetDeclutterObjectSize method (Page 3207)
SetDeclutterObjectSize Method (Page 3260)
FireConnectionEvents method (Page 3219)
TransformDisplayCoordinate method (Page 3265)
TransformPixelCoordinate method (Page 3265)
FillBackColor property (Page 3588)

Documents Object (Listing)


Description

VBA Object Name


HMIDocuments

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4159

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Note
Use the "ActiveDocument" property if you wish to refer to the active picture.
Use the Documents property to return the Documents listing. In the following example the
names of all open pictures are output:

Sub ShowDocuments()
'VBA238
Dim colDocuments As Documents
Dim objDocument As Document
Set colDocuments = Application.Documents
For Each objDocument In colDocuments
MsgBox objDocument.Name
Next objDocument
End Sub

Use the Add method to add a new Document object to the Documents listing. In the following
example a new picture is created:

Sub AddNewDocument()
'VBA239
Dim objDocument As Document
Set objDocument = Application.Documents.Add
End Sub

See also
Add Method (Page 3166)
Document Object (Page 3319)
SaveAll Method (Page 3253)
Open Method (Page 3242)
CloseAll Method (Page 3197)
Close Method (Page 3196)
VBA Reference (Page 3124)
Editing Pictures with VBA (Page 3047)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)
ActiveDocument Property (Page 3472)
Item Property (Page 3637)

4160

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
SetOpenContext method (Page 3259)
ConvertWM method (Page 3199)

DotNetControl object
Description
Represents the "DotNetControl" object. The DotNetControl object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIDotNetControl

Application
Use the AddDotNetControl method to insert a DotNetControl in a picture.
In the following example, the ".NETControl" object from the Global Assembly Cache is inserted
in the active picture.

'VBA851
Dim DotNetControl As HMIDotNetControl
Set DotNetControl = ActiveDocument.HMIObjects.AddDotNetControl("MyVBAControl",
"System.Windows.Forms.Label", True,"Assembly=System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089")

See also
AddDotNetControl method (Page 3176)
Delete Method (Page 3208)
Application Property (Page 3484)
AssemblyInfo property (Page 3486)
ControlType property (Page 3560)
Events Property (Page 3581)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4161

VBA Reference
6.1 The object model of the Graphics Designer
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

DynamicDialog Object
Description

Represents the Dynamic dialog. You can use the dynamic dialog to make the properties of
pictures and objects respond dynamically to different value ranges.
Define the value range with the aid of the ResultType property.

VBA Object Name


HMIDynamicDialog

4162

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the DynamicDialog object to make an object property dynamic. In the following example
the radius of a circle will be dynamically configured using the Dynamic dialog, a tag name will
be assigned and three analog value ranges will be created:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA240
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.Trigger.VariableTriggers.Add "NewDynamic2", hmiVariableCycleType_5s
.AnalogResultInfos.Add 50, 40
.AnalogResultInfos.Add 100, 80
.AnalogResultInfos.ElseCase = 100
End With
End Sub

See also
Delete Method (Page 3208)
ConvertToScript Method (Page 3198)
CheckSyntax Method (Page 3195)
VariableStateValues Property (Page 3874)
VariableStateChecked Property (Page 3872)
Trigger Property (Page 3789)
SourceCode Property (Page 3766)
ScriptType Property (Page 3751)
ResultType Property (Page 3743)
Parent Property (Page 3708)
Compiled Property (Page 3556)
BitResultInfo Property (Page 3511)
BinaryResultInfo Property (Page 3509)
Application Property (Page 3484)
AnalogResultInfos Property (Page 3482)
Prototype Property (Page 3735)
QualityCodeStateChecked Properties (Page 3736)
QualityCodeStateValues Property (Page 3737)
UsedLanguage property (Page 3802)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4163

VBA Reference
6.1 The object model of the Graphics Designer
VariablesExist Property (Page 3872)
VariableStateType Property (Page 3874)

Ellipse Object
Description

Represents the "Ellipse" object. The Ellipse object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIEllipse

Usage
Use the Add method to create a new "Ellipse" object in a picture:

Sub AddEllipse()
'VBA241
Dim objEllipse As HMIEllipse
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("Ellipse", "HMIEllipse")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditEllipse()
'VBA242
Dim objEllipse As HMIEllipse
Set objEllipse = ActiveDocument.HMIObjects("Ellipse")

4164

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

objEllipse.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing.

Sub ShowNameOfFirstSelectedObject()
'VBA243
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
FillingIndex Property (Page 3591)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
RadiusWidth Property (Page 3740)
RadiusHeight Property (Page 3739)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4165

VBA Reference
6.1 The object model of the Graphics Designer
Filling Property (Page 3590)
FillColor Property (Page 3588)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

4166

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

EllipseArc Object
Description

Represents the "Ellipse Arc" object. The EllipseArc object is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIEllipseArc

Usage
Use the Add method to create a new "Ellipse Arc" object in a picture:

Sub AddEllipseArc()
'VBA244
Dim objEllipseArc As HMIEllipseArc
Set objEllipseArc = ActiveDocument.HMIObjects.AddHMIObject("EllipseArc", "HMIEllipseArc")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditEllipseArc()
'VBA245
Dim objEllipseArc As HMIEllipseArc
Set objEllipseArc = ActiveDocument.HMIObjects("EllipseArc")
objEllipseArc.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4167

VBA Reference
6.1 The object model of the Graphics Designer

Sub ShowNameOfFirstSelectedObject()
'VBA246
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Use the "HMIDefaultObjects(Index)" to return an object from the HMIDefaultObjects Listing:

Sub EditDefaultPropertiesOfEllipseArc()
'VBA247
Dim objEllipseArc As HMIEllipseArc
Set objEllipseArc = Application.DefaultHMIObjects("HMIEllipseArc")
objEllipseArc.BorderColor = RGB(255, 255, 0)
'create new "EllipseArc"-object
Set objEllipseArc = ActiveDocument.HMIObjects.AddHMIObject("EllipseArc2", "HMIEllipseArc")
End Sub

See also
ToolTipText Property (Page 3784)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
StartAngle Property (Page 3767)
RadiusWidth Property (Page 3740)
RadiusHeight Property (Page 3739)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashBorderColor Property (Page 3597)

4168

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
EndAngle Property (Page 3580)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4169

VBA Reference
6.1 The object model of the Graphics Designer

EllipseSegment Object
Description

Represents the "Ellipse Segment" object. The EllipseSegment object is an element of the
following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIEllipseSegment

Usage
Use the Add method to create a new "Ellipse Segment" object in a picture:

Sub AddEllipseSegment()
'VBA248
Dim objEllipseSegment As HMIEllipseSegment
Set objEllipseSegment = ActiveDocument.HMIObjects.AddHMIObject("EllipseSegment",
"HMIEllipseSegment")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditEllipseSegment()
'VBA249
Dim objEllipseSegment As HMIEllipseSegment
Set objEllipseSegment = ActiveDocument.HMIObjects("EllipseSegment")
objEllipseSegment.BorderColor = RGB(255, 0, 0)
End Sub

4170

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA250
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3784)
BackFlashColorOn Property (Page 3501)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
StartAngle Property (Page 3767)
RadiusWidth Property (Page 3740)
RadiusHeight Property (Page 3739)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4171

VBA Reference
6.1 The object model of the Graphics Designer
FillColor Property (Page 3588)
EndAngle Property (Page 3580)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

4172

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Event Object
Description

Represents an event that triggers one or more actions in Runtime (e.g. a direct connection).
An event can be configured onto an object and a property.

VBA Object Name


HMIEvent

Usage
Use the AddAction method to configure an action on an event. In this example a C action is
to be triggered in the event of a change of radius in Runtime:

Sub AddActionToPropertyTypeCScript()
'VBA251
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
'Create circle in the picture. If property "Radius" is changed,
'a C-action is added:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
End Sub

See also
Application Property (Page 3484)
Delete Method (Page 3208)
AddAction Method (Page 3173)
VBA Reference (Page 3124)
Parent Property (Page 3708)
EventType Property (Page 3583)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4173

VBA Reference
6.1 The object model of the Graphics Designer
Actions Property (Page 3470)
EventName property (Page 3582)

Events Object (Listing)


Description

A listing of the Event objects that represent all the events configured onto an object. Use the
Item method to define the event that is intended to be configured:
You configure an action on a property with VBA by using the "Events(1)" property, where
the index "1" stands for the event "Upon change":
To configure an action onto an object with the aid of VBA, use the "Events(Index)" property,
where "Index" stands for the trigger event (see table):
Index

EventType (depending upon the object used)

hmiEventTypeNotDefined

hmiEventTypeMouseClick

hmiEventTypeMouseLButtonDown

hmiEventTypeMouseLButtonUp

hmiEventTypeMouseRButtonDown

hmiEventTypeMouseRButtonUp

hmiEventTypeKeyboardDown

hmiEventTypeKeyboardUp

hmiEventTypeFocusEnter

hmiEventTypeObjectChange

10

hmiEventTypePictureOpen

VBA Object Name


HMIEvents

4174

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Item method to return an individual Event object. In this example the event names
and event types of all objects in the active pictures are put out. In order for this example to
work, insert some objects into the active picture and configure different events.

Sub ShowEventsOfAllObjectsInActiveDocument()
'VBA252
Dim colEvents As HMIEvents
Dim objEvent As HMIEvent
Dim iMax As Integer
Dim iIndex As Integer
Dim iAnswer As Integer
Dim strEventName As String
Dim strObjectName As String
Dim varEventType As Variant
iIndex = 1
iMax = ActiveDocument.HMIObjects.Count
For iIndex = 1 To iMax
Set colEvents = ActiveDocument.HMIObjects(iIndex).Events
strObjectName = ActiveDocument.HMIObjects(iIndex).ObjectName
For Each objEvent In colEvents
strEventName = objEvent.EventName
varEventType = objEvent.EventType
iAnswer = MsgBox("Objectname: " & strObjectName & vbCrLf & "Eventtype: " & varEventType &
vbCrLf & "Eventname: " & strEventName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objEvent
If vbCancel = iAnswer Then Exit For
Next iIndex
End Sub

See also
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

ExternalShapeInfo object
Description
Is used for internal purposes in Graphics Designer.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4175

VBA Reference
6.1 The object model of the Graphics Designer

FaceplateObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

)DFHSODWH2EMHFW

6HOHFWLRQ
Represents the "faceplate instance" object. The FaceplateObject object is an element of the
following lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMIFaceplateObject

Usage
Use the Add method to create a new "faceplate instance" object in a picture:

Sub AddFaceplateInstance()
'VBA826
Dim objFaceplateInstance As HMIFaceplateObject
Set objFaceplateInstance = ActiveDocument.HMIObjects.AddHMIObject("faceplate instance",
"HMIFaceplateObject")
objFaceplateInstance.Properties.Item(3).value = "Faceplate1.fpt"
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditFaceplateInstance()
'VBA827
Dim objFaceplateInstance As HMIFaceplateObject
Set objFaceplateInstance = ActiveDocument.HMIObjects("faceplate instance")
objFaceplateInstance.visible = True

4176

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA828
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Layer Property (Page 3646)
Left Property (Page 3657)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
Operation Property (Page 3703)
PasswordLevel Property (Page 3711)
Visible Property (Page 3878)
ToolTipText Property (Page 3784)
ScalingMode property (Page 3749)
FaceplateType property (Page 3586)
Delete Method (Page 3208)
Destroy Method (Page 3212)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
InheritState property (Page 3633)
LDTooltipTexts Property (Page 3656)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4177

VBA Reference
6.1 The object model of the Graphics Designer
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

FaceplateObjects object
Description
A listing of the HMIFaceplateObject objects that represent all faceplate objects in the picture.

VBA Object Name


HMIFaceplateObjects

See also
Parent Property (Page 3708)
OriginalPropertyName property (Page 3706)

FaceplateProperty object
Description
Represents the property of a faceplate object. In the case of the FaceplateProperty object, the
use of the Value property is set as the default. For this reason you can use the following
notation, for example, to assign a new value to an object property:
<FaceplateObject>.<FaceplateProperty> = <Value>
You can use the "Dynamic" property to make an object property dynamic with VBA. Use the
"Events" listing to configure actions with VBA.

See also
CreateDynamic Method (Page 3204)
DeleteDynamic Method (Page 3210)
Application Property (Page 3484)
DisplayName Property (Page 3573)
Dynamic Property (Page 3576)
Events Property (Page 3581)
IsDynamicable Property (Page 3635)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)

4178

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Name Property (Page 3694)
Parent Property (Page 3708)
Value Property (Page 3807)
IsPublished property (Page 3636)
LDFontsType property (Page 3652)
ParentCookie property (Page 3711)

FolderItem Object
Description

Represents a folder or object in the Components Library. A FolderItem object of the "Folder"
type is an element of the FolderItems listing. A FolderItem object of the "Item" type is an element
of the Folder listing.

VBA Object Name


HMIFolderItem

Usage
Use the FolderItems property to return the FolderItems listing. In the following example the
names of folders in the "Global Library will be output:

Sub ShowFolderItemsOfGlobalLibrary()
'VBA253
Dim colFolderItems As HMIFolderItems
Dim objFolderItem As HMIFolderItem
Set colFolderItems = Application.SymbolLibraries(1).FolderItems
For Each objFolderItem In colFolderItems
MsgBox objFolderItem.Name
Next objFolderItem
End Sub

Use the CopyToClipboard method to copy a "FolderItem" object of the "Item" type to the
clipboard. In the following example the object "PC" will be copied to the clipboard.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4179

VBA Reference
6.1 The object model of the Graphics Designer

Sub CopyFolderItemToClipboard()
'VBA254
Dim objGlobalLib As HMISymbolLibrary
Set objGlobalLib = Application.SymbolLibraries(1)
objGlobalLib.FolderItems("Folder2").Folder("Folder2").Folder.Item("Object1").CopyToClipboa
rd
End Sub

See also
Type Property (Page 3790)
FolderItems Object (Listing) (Page 3343)
Delete Method (Page 3208)
CopyToClipboard Method (Page 3201)
How to paste an object from the object library into a picture with VBA (Page 3045)
How to edit the component library with VBA (Page 3043)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3708)
Name Property (Page 3694)
LDNames Property (Page 3653)
Folder Property (Page 3608)
Application Property (Page 3484)
DisplayName Property (Page 3573)
Pathname Property (Page 3713)

FolderItems Object (Listing)


Description

A listing of the FolderItem objects that represent all the folders and objects in the Components
Library.

4180

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMIFolderItems

Usage
Use the FolderItems property to return the FolderItems listing. In the following example the
names of folders in the "Global Library will be output:

Sub ShowFolderItemsOfGlobalLibrary()
'VBA255
Dim colFolderItems As HMIFolderItems
Dim objFolderItem As HMIFolderItem
Set colFolderItems = Application.SymbolLibraries(1).FolderItems
For Each objFolderItem In colFolderItems
MsgBox objFolderItem.Name
Next objFolderItem
End Sub

Use the AddFolder method, for instance, to create a new folder in the Components Library. In
the following example the folder "Project Folder" will be created in the "Project Library":

Sub AddNewFolderToProjectLibrary()
'VBA256
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
objProjectLib.FolderItems.AddFolder ("My Folder")
End Sub

See also
AddItem Method (Page 3181)
SymbolLibrary Object (Page 3440)
FolderItem Object (Page 3342)
AddFromClipboard Method (Page 3178)
AddFolder Method (Page 3177)
How to paste an object from the object library into a picture with VBA (Page 3045)
How to edit the component library with VBA (Page 3043)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4181

VBA Reference
6.1 The object model of the Graphics Designer
FindByDisplayName Method (Page 3218)
Item Property (Page 3637)

GraphicObject Object
Description

Represents the object called "Graphic Object". The GraphicObject object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIGraphicObject

Usage
Use the Add method to create a new "Graphic Object" object in a picture:

Sub AddGraphicObject()
'VBA257
Dim objGraphicObject As HMIGraphicObject
Set objGraphicObject = ActiveDocument.HMIObjects.AddHMIObject("Graphic-Object",
"HMIGraphicObject")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditGraphicObject()
'VBA258

4182

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Dim objGraphicObject As HMIGraphicObject


Set objGraphicObject = ActiveDocument.HMIObjects("Graphic-Object")
objGraphicObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA259
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Left Property (Page 3657)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
PicUseTransColor Property (Page 3725)
PictureName Property (Page 3721)
PicTransColor Property (Page 3719)
PicReferenced Property (Page 3718)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Name Property (Page 3694)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4183

VBA Reference
6.1 The object model of the Graphics Designer
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

4184

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Group Object
Description

Represents the object called "Group Object". The Group Object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
A group object is created from the objects selected in a picture. The objects in the Group Object
are also saved in the "GroupedHMIObjects" listing and index numbers are newly allocated.
You have unrestricted access to the properties of all objects in the Group Object.
Further information regarding group objects can be found in the WinCC documentation under
"Group Object".

VBA Object Name


HMIGroup

Usage
Use the CreateGroup Method with the Selection listing to create a new "Group Object" object
in a picture:

Sub DoCreateGroup()
'VBA260
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.Selection.CreateGroup
objGroup.ObjectName = "Group-Object"
End Sub

Use the following methods to edit an existing Group Object:


Methode "Add(Index)": Adds a new object to the group object.
Methode "Remove(Index)": Removes a object from the group object.
"UnGroup()" method: Ungroups the group object (ungroup).
"Delete()" Method: Deletes the group object and the objects that it contains.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4185

VBA Reference
6.1 The object model of the Graphics Designer
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditGroup()
'VBA261
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("Group-Object")
MsgBox objGroup.ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
GroupedObjects Object (Listing) (Page 3353)
Ungroup Method (Page 3265)
Remove Method (Page 3246)
Delete Method (Page 3208)
Add Method (GroupedObjects Listing) (Page 3170)
How to Edit Objects in Group Objects Using VBA (Page 3072)
How to Edit the Group Objects Using VBA (Page 3069)
VBA Reference (Page 3124)
Group Objects (Page 3067)
Editing Objects with VBA (Page 3053)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
GroupedHMIObjects Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)

4186

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

GroupDisplay Object
Description

Represents the "Group Display" object. The GroupDisplay object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIGroupDisplay

Usage
Use the Add method to create a new "Group Display" object in a picture:

Sub AddGroupDisplay()
'VBA262
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("Groupdisplay",
"HMIGroupDisplay")
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4187

VBA Reference
6.1 The object model of the Graphics Designer
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditGroupDisplay()
'VBA263
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects("Groupdisplay")
objGroupDisplay.BackColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA264
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
MCText Property (Page 3687)
Height Property (Page 3624)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
UserValue1 Property (Page 3804)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
SignificantMask Property (Page 3761)
SameSize Property (Page 3747)
Relevant Property (Page 3742)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
MessageClass Property (Page 3690)
MCGUTextFlash Property (Page 3679)

4188

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
MCGUTextColorOn Property (Page 3678)
MCGUTextColorOff Property (Page 3677)
MCGUBackFlash Property (Page 3677)
MCGUBackColorOn Property (Page 3676)
MCGUBackColorOff-Eigenschaft (Page 3675)
LockText Property (Page 3668)
LockTextColor Property (Page 3668)
LockStatus Property (Page 3667)
LockBackColor Property (Page 3665)
Left Property (Page 3657)
Layer Property (Page 3646)
FontUnderline Property (Page 3614)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontItalic Property (Page 3612)
FontBold Property (Page 3611)
FlashRate Property (Page 3603)
Button1..8Width property (Page 3528)
BackColor Property (Page 3494)
BackBorderWidth Property (Page 3493)
AlignmentTop Property (Page 3481)
AlignmentLeft Property (Page 3480)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4189

VBA Reference
6.1 The object model of the Graphics Designer
Type Property (Page 3790)
Button1..8MessageClasses (Page 3527)
UseGlobalAlarmClasses property (Page 3803)
UseGlobalSettings property (Page 3804)
CollectValue property (Page 3542)
EventQuitMask property (Page 3580)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

GroupedObjects Object (Listing)


Description

A listing of the HMIObject objects that represent all the objects in the group object.

VBA Object Name


HMIGroupedObjects

Usage
Use the GroupedHMIObjects property to return the GroupedObjects listing. In the following
example all the objects in the first group object are output in the active picture. The group
object called "Group1" must first have been created:

Sub ShowGroupedObjectsOfFirstGroup()
'VBA265
Dim colGroupedObjects As HMIGroupedObjects
Dim objObject As HMIObject
Set colGroupedObjects = ActiveDocument.HMIObjects("Group1").GroupedHMIObjects
For Each objObject In colGroupedObjects
MsgBox objObject.ObjectName
Next objObject
End Sub

Use the Remove method, for instance, to remove an object from the group object. In the
following example the first object will be removed from the group object called "Group1":

4190

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub RemoveObjectFromGroup()
'VBA266
Dim objGroup As HMIGroup
Set objGroup = ActiveDocument.HMIObjects("Group1")
objGroup.GroupedHMIObjects.Remove (1)
End Sub

See also
Group Object (Page 3348)
Remove Method (Page 3246)
Add Method (GroupedObjects Listing) (Page 3170)
How to Edit the Group Objects Using VBA (Page 3069)
VBA Reference (Page 3124)
Group Objects (Page 3067)
Parent Property (Page 3708)
GroupedHMIObjects Property (Page 3623)
Count Property (Page 3560)
Application Property (Page 3484)
Item Property (Page 3637)

HMIDefaultObjects Object (Listing)


Description

A listing of the following HMIObject objects:


Object

VBA object name

Line

HMILine

Polygon

HMIPolygon

Polyline

HMIPolyLine

Ellipse

HMIEllipse

Circle

HMICircle

Ellipse segment

HMIEllipseSegment

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4191

VBA Reference
6.1 The object model of the Graphics Designer
Object

VBA object name

Pie segment

HMIPieSegment

Ellipse arc

HMIEllipseArc

Circular arc

HMICircularArc

Rectangle

HMIRectangle

Rounded rectangle

HMIRoundRectangle

Application window

HMIApplicationWindow

Screen Window

HMIPictureWindow

Static text

HMIStaticText

I/O Field

HMIIOField

Button

HMIButton

Check box

HMICheckBox

Radio box

HMIOptionGroup

Round button

HMIRoundButton

Bar

HMIBarGraph

Slider object

HMISlider

Graphic Object

HMIGraphicObject

Status display

HMIStatusDisplay

Text list

HMITextList

Connector

HMIObjConnection

Multiple row text

HMIMultiLineEdit

Combo box

HMIComboBox

List box

HMIListBox

Polygon tube

HMITubePolyline

T-piece

HMITubeTeeObject

Double T-piece

HMITubeDoubleTeeObject

Tube bend

HMITubeArcObject

3D bar

HMI3DBarGraph

Group display

HMIGroupDisplay

Faceplate instance

HMIFaceplateObject

VBA object name


HMIDefaultObjects

Usage
Use the DefaultHMIObjects property to change the default property values of the included
objects. In this example all the objects contained in the listing will be output:

Sub ShowDefaultObjects()
'VBA267
Dim strType As String
Dim strName As String

4192

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Dim strMessage As String


Dim iMax As Integer
Dim iIndex As Integer
iMax = Application.DefaultHMIObjects.Count
iIndex = 1
For iIndex = 1 To iMax
With Application.DefaultHMIObjects(iIndex)
strType = .Type
strName = .ObjectName
strMessage = strMessage & "Element: " & iIndex & " / Objecttype: " & strType & " /
Objectname: " & strName
End With
If 0 = iIndex Mod 10 Then
MsgBox strMessage
strMessage = ""
Else
strMessage = strMessage & vbCrLf & vbCrLf
End If
Next iIndex
MsgBox "Element: " & iIndex & vbCrLf & "Objecttype: " & strType & vbCrLf & "Objectname: "
& strName
End Sub

See also
Button Object (Page 3293)
TextList Object (Page 3441)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
PictureWindow Object (Page 3396)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4193

VBA Reference
6.1 The object model of the Graphics Designer
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
BarGraph Object (Page 3286)
ApplicationWindow Object (Page 3284)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Count Property (Page 3560)
DefaultHMIObjects Property (Page 3569)
Application Property (Page 3484)
Item Property (Page 3637)

HMIObject Object
Description

Represents an object from the Object Palette of the Graphics Designer. The HMIObject object
is an element of the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.
This object contains the object properties that apply to all standard, smart and Windows objects
(incl. Width, Height, Top and Left).

VBA Object Name


HMIObject

4194

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use HMIObjects(Index), for instance, to return an individual HMIObject object. "For Index you
can use either the index number or the name of the object. In the following example the name
of the first object in the active picture is output:

Sub ShowFirstObjectOfCollection()
'VBA268
Dim strName As String
strName = ActiveDocument.HMIObjects(1).ObjectName
MsgBox strName
End Sub

Use the Delete method to remove an object from the HMIObjects listing. In the following
example the first object in the active picture will be removed:

Sub DeleteObject()
'VBA269
ActiveDocument.HMIObjects(1).Delete
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
Delete Method (Page 3208)
VBA Reference (Page 3124)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Type Property (Page 3790)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
TabOrderAlpha Property (Page 3771)
TabOrderSwitch Property (Page 3774)
Selected Property (Page 3756)
Properties Property (Page 3734)
PasswordLevel Property (Page 3711)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4195

VBA Reference
6.1 The object model of the Graphics Designer
Parent Property (Page 3708)
Operation Property (Page 3703)
Left Property (Page 3657)
LDTooltipTexts Property (Page 3656)
Layer Property (Page 3646)
Height Property (Page 3624)
GroupParent Property (Page 3623)
Events Property (Page 3581)
Application Property (Page 3484)
ObjectName Property (Page 3698)
ConnectionPoints property (Page 3558)

HMIObjects Object (Listing)


Description

A listing of the HMIObject objects that represent all the objects in the picture.

VBA Object Name


HMIObjects
Note
The sequence of HMI objects in the HMIObjects list can be altered by adding and/or deleting
HMI objects.
The sequence of listing can also change if HMI objects are processed in the current listing.
This behavior can occur if the Layers property is modified and/or if the methods "SendToBack"
and "BringToFront" are used.

4196

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the HMIObjects property to return the HMIObjects listing. In the following example all the
object names in the active picture are output:

Sub ShowObjectsOfDocument()
'VBA270
Dim colObjects As HMIObjects
Dim objObject As HMIObject
Set colObjects = ActiveDocument.HMIObjects
For Each objObject In colObjects
MsgBox objObject.ObjectName
Next objObject
End Sub

Use the AddHMIObject method to create a new object in the picture. In the following example
a circle will be inserted into the active picture:

Sub AddCircle()
'VBA271
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_1", "HMICircle")
End Sub

Use the Find method to search for one or more objects in the picture. In the following example,
objects of the "HMICircle" type will be searched for in the active picture:

Sub FindObjectsByType()
'VBA272
Dim colSearchResults As HMICollection
Dim objMember As HMIObject
Dim iResult As Integer
Dim strName As String
Set colSearchResults = ActiveDocument.HMIObjects.Find(ObjectType:="HMICircle")
For Each objMember In colSearchResults
iResult = colSearchResults.Count
strName = objMember.ObjectName
MsgBox "Found: " & CStr(iResult) & vbCrLf & "Objectname: " & strName
Next objMember
End Sub

See also
Count Property (Page 3560)
HMIDefaultObjects Object (Listing) (Page 3354)
SelectedObjects object (Listing) (Page 3426)
Find Method (Page 3217)
AddOLEObject Method (Page 3182)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4197

VBA Reference
6.1 The object model of the Graphics Designer
AddHMIObject Method (Page 3180)
AddActiveXControl Method (Page 3174)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
VBA Reference (Page 3124)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)
Parent Property (Page 3708)
Application Property (Page 3484)
AddDotNetControl method (Page 3176)
AddWPFControl method (Page 3185)
Item Property (Page 3637)

IOField Object
Description

Represents the "I/O Field" object. The IOField object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIIOField

4198

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Add method to create a new "I/O Field" object in a picture:

Sub AddIOField()
'VBA273
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IO-Field", "HMIIOField")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditIOField()
'VBA274
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects("IO-Field")
objIOField.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA275
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Use the "HMIDefaultObjects(Index)" to return an object from the HMIDefaultObjects Listing:

Sub EditDefaultPropertiesOfIOField()
'VBA276
Dim objIOField As HMIIOField
Set objIOField = Application.DefaultHMIObjects("HMIIOField")
objIOField.BorderColor = RGB(255, 255, 0)
End Sub

See also
LimitMin Property (Page 3663)
ClearOnNew Property (Page 3541)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4199

VBA Reference
6.1 The object model of the Graphics Designer
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
PasswordLevel Property (Page 3711)
OutputValue Property (Page 3707)
OutputFormat Property (Page 3706)
Orientation Property (Page 3705)
OperationReport Property (Page 3704)
OperationMessage Property (Page 3704)
Operation Property (Page 3703)
LimitMax Property (Page 3662)
Left Property (Page 3657)
Layer Property (Page 3646)
HiddenInput Property (Page 3626)
Height Property (Page 3624)
ForeFlashColorOn Property (Page 3617)
ForeFlashColorOff Property (Page 3616)
ForeColor Property (Page 3615)
FontUnderline Property (Page 3614)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontItalic Property (Page 3612)
FontBold Property (Page 3611)
FlashRateForeColor Property (Page 3607)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashForeColor Property (Page 3599)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
EditAtOnce Property (Page 3577)

4200

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
DataFormat Property (Page 3569)
CursorControl Property (Page 3564)
ClearOnError Property (Page 3540)
BoxType Property (Page 3527)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
AssumeOnFull Property (Page 3487)
AssumeOnExit Property (Page 3486)
AlignmentTop Property (Page 3481)
AlignmentLeft Property (Page 3480)
AdaptBorder Property (Page 3475)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
InputValue property (Page 3633)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4201

VBA Reference
6.1 The object model of the Graphics Designer

6.1.7.3

L-Q

LanguageFont Object
Description

Contains the font settings for the project language. The LanguageFont object is an element of
the LanguageFonts listing.

VBA Object Name


HMILanguageFont

Usage
Use LDFonts(Index) to return an individual LanguageFont object. In the following example a
Button object will be created and the name of the first configured font will be output:

Sub ShowFirstObjectOfCollection()
'VBA277
Dim strName As String
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button", "HMIButton")
strName = objButton.LDFonts(1).Family
MsgBox strName
End Sub

Object properties
The LanguageFont object possesses the following properties:

See also
LanguageFonts Object (Listing) (Page 3366)
VBA Reference (Page 3124)
Underlined Property (Page 3799)
Size Property (Page 3762)

4202

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Parent Property (Page 3708)
LanguageID Property (Page 3643)
Italic Property (Page 3636)
Family Property (Page 3587)
Bold Property (Page 3513)
Application Property (Page 3484)

LanguageFonts Object (Listing)


Description

A listing of the LanguageFont objects that represent all the language-dependent fonts in an
object.

VBA Object Name


HMILanguageFonts

Usage
Use the LDFonts property to return the LanguageFonts listing. In the following example the
language identifiers of the configured fonts will be output:

Sub ShowLanguageFont()
'VBA278
Dim colLanguageFonts As HMILanguageFonts
Dim objLanguageFont As HMILanguageFont
Dim objButton As HMIButton
Dim iMax As Integer
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
Set colLanguageFonts = objButton.LDFonts
iMax = colLanguageFonts.Count
For Each objLanguageFont In colLanguageFonts
MsgBox "Planned fonts: " & iMax & vbCrLf & "Language-ID: " & objLanguageFont.LanguageID
Next objLanguageFont
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4203

VBA Reference
6.1 The object model of the Graphics Designer
Use the ItemByLcid method to define the language for which it is intended to enter font settings.
The following example sets the font attributes of a button for French and English.
Note
For this example to work, you must already have configured in the languages concerned.

Sub ExampleForLanguageFonts()
'VBA279
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "DefText"
Set colLangFonts = objButton.LDFonts
'Adjust fontsettings for french:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'Adjust fontsettings for english:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

See also
LanguageFont Object (Page 3365)
ItemByLcid Method (Page 3236)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

4204

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

LanguageText Object
Description

Contains the multilingual labels for an object. The LanguageText object is an element of the
LanguageTexts listing.

VBA Object Name


HMILanguageText

Usage
In the following example a German label and an English label will be assigned to the button
called "myButton":

Sub AddLanguagesToButton()
'VBA280
Dim objLabelText As HMILanguageText
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'Add text in actual datalanguage:
objButton.Text = "Actual-Language Text"
'
'Add english text:
Set objLabelText = ActiveDocument.HMIObjects("myButton").LDTexts.Add(1033, "English Text")
End Sub

See also
LanguageTexts Object (Listing) (Page 3369)
Delete Method (Page 3208)
VBA Reference (Page 3124)
Parent Property (Page 3708)
LanguageID Property (Page 3643)
DisplayText Property (Page 3574)
Application Property (Page 3484)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4205

VBA Reference
6.1 The object model of the Graphics Designer

LanguageTexts Object (Listing)


Description

A listing of the LanguageText objects that represent all the multilingual texts in an object.

VBA Object Name


HMILanguageTexts

Usage
Use one of the following properties to return the LanguageTexts listing:
LDLabelTexts Property
LDNames Property
LDStatusTexts Property
LDTexts Property
LDTooltipTexts Property
An example showing how to use the LanguageTexts listing can be found in this documentation
under the heading "LDStatusTexts Property".
Use the Add method to add multilingual texts to an object. In the following example a German
label and an English label will be assigned to the button called "myButton":

Sub AddLanguagesToButton()
'VBA281
Dim objLabelText As HMILanguageText
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'Add text in actual datalanguage:
objButton.Text = "Actual-Language Text"
'
'Add english text:
Set objLabelText = ActiveDocument.HMIObjects("myButton").LDTexts.Add(1033, "English Text")
End Sub

4206

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
LanguageText Object (Page 3368)
ItemByLcid Method (Page 3236)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3708)
LDTooltipTexts Property (Page 3656)
LDTexts Property (Page 3655)
LDStatusTexts Property (Page 3654)
LDNames Property (Page 3653)
LDLabelTexts Property (Page 3652)
Count Property (Page 3560)
Application Property (Page 3484)

Layer Object
Description

Represents one of the 32 layers that are available in the picture.

VBA Object Name


HMILayer

Usage
Use the Layer object to define a name and the minimum and maximum zoom for a layer. You
define the visibility of layers separately by CS and RT layers:
Document Object: Controls the visibility of the RT layers.
View Object: Controls the visibility of the RT layers.
Use the Layers listing to return a Layer object. In the following example the settings for the
lowest layer are configured in the active picture:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4207

VBA Reference
6.1 The object model of the Graphics Designer

Sub ConfigureSettingsOfLayer()
'VBA282
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
End Sub

See also
Layers Property (Page 3650)
VBA Reference (Page 3124)
Editing Layers with VBA (Page 3050)
Visible Property (Page 3878)
Number Property (Page 3696)
Name Property (Page 3694)
MinZoom Property (Page 3692)
MaxZoom Property (Page 3674)
LDNames Property (Page 3653)
ActiveLayer Property (Page 3472)

Layers Object (Listing)


Description

A listing of the Layer objects that represent the 32 layers in the picture.

VBA Object Name


HMILayer

4208

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the LayersCS or LayersRT property to return the Layers listing. In the following example
the layer names in the copy of the active picture will be output:

Sub ShowLayer()
'VBA283
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim strLayerList As String
Dim iCounter As Integer
iCounter = 1
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
If 1 = iCounter Mod 2 And 32 > iCounter Then
strLayerList = strLayerList & vbCrLf
ElseIf 11 > iCounter Then
strLayerList = strLayerList & "
"
Else
strLayerList = strLayerList & "
"
End If
strLayerList = strLayerList & objLayer.Name
iCounter = iCounter + 1
Next objLayer
MsgBox strLayerList
End Sub

See also
Layer Object (Page 3370)
Item Method (Page 3234)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4209

VBA Reference
6.1 The object model of the Graphics Designer

Line Object
Description

Represents the "Line" object. The Line object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMILine

Usage
Use the Add method to create a new "Line" object in a picture:

Sub AddLine()
'VBA285
Dim objLine As HMILine
Set objLine = ActiveDocument.HMIObjects.AddHMIObject("Line1", "HMILine")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditLine()
'VBA286
Dim objLine As HMILine
Set objLine = ActiveDocument.HMIObjects("Line1")
objLine.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

4210

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub ShowNameOfFirstSelectedObject()
'VBA287
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
AddHMIObject Method (Page 3180)
BorderBackColor Property (Page 3514)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
RotationAngle Property (Page 3744)
ReferenceRotationTop Property (Page 3742)
ReferenceRotationLeft Property (Page 3741)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Index Property (Page 3631)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashBorderColor Property (Page 3597)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderEndStyle Property (Page 3518)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4211

VBA Reference
6.1 The object model of the Graphics Designer
BorderColor Property (Page 3515)
ActualPointTop Property (Page 3474)
ActualPointLeft Property (Page 3473)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

ListBox object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

/LVW%R[

6HOHFWLRQ
Represents the "ListBox" object. The ListBox object is an element of the following listings:

4212

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMIListBox

Usage
Use the Add method to create a new "ListBox" object in a picture:

Sub AddListBox()
'VBA829
Dim objListBox As HMIListBox
Set objListBox = ActiveDocument.HMIObjects.AddHMIObject("ListBox", "HMIListBox")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditListBox()
'VBA830
Dim objListBox As HMIListBox
Set objListBox = ActiveDocument.HMIObjects("ListBox")
objListBox.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA831
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Layer Property (Page 3646)
Left Property (Page 3657)
Top Property (Page 3785)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4213

VBA Reference
6.1 The object model of the Graphics Designer
Width Property (Page 3881)
Height Property (Page 3624)
NumberLines Property (Page 3697)
ForeColor Property (Page 3615)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackColor Property (Page 3494)
FillColor Property (Page 3588)
BorderStyle Property (Page 3522)
BorderWidth Property (Page 3523)
FillStyle Property (Page 3592)
GlobalShadow property (Page 3619)
FontName Property (Page 3613)
FontSize Property (Page 3613)
FontBold Property (Page 3611)
FontItalic Property (Page 3612)
FontUnderline Property (Page 3614)
AlignmentLeft Property (Page 3480)
Index Property (Page 3631)
Text Property (Page 3779)
Operation Property (Page 3703)
PasswordLevel Property (Page 3711)
Visible Property (Page 3878)
ToolTipText Property (Page 3784)
OperationMessage Property (Page 3704)
OperationReport Property (Page 3704)
SelIndex property (Page 3757)
SelText property (Page 3757)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
Parent Property (Page 3708)

4214

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

Menu Object
Description

Represents the "User Defined Menu" object. The Menu object is an element of the
CustomMenus listing.

VBA Object Name


HMIMenu

Usage
Use CustomMenus(Index) to return an individual Menu object. "For Index you can use either
the index number or the name of the object. In order for the following example to work, create
a user defined menu. For an example of this, please refer to "Creating a New ApplicationSpecific Menu" in this documentation. In the following example the name of the first userdefined menu in the active picture will be output:

Sub ShowFirstMenuOfMenucollection()
'VBA288
Dim strName As String
strName = ActiveDocument.CustomMenus(1).Label
MsgBox strName
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4215

VBA Reference
6.1 The object model of the Graphics Designer
Use the Delete method to remove a "Menu" object from the "CustomMenus" listing. In the
following example the first user-defined menu in the active picture will be removed:

Sub DeleteMenu()
'VBA289
Dim objMenu As HMIMenu
Set objMenu = ActiveDocument.CustomMenus(1)
objMenu.Delete
End Sub

See also
Menus Object (Listing) (Page 3380)
Delete Method (Page 3208)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create a New Application-Specific Menu (Page 3023)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3878)
StatusText Property (Page 3768)
Position Property (Page 3727)
Parent Property (Page 3708)
MenuItems Property (Page 3688)
LDStatusTexts Property (Page 3654)
LDLabelTexts Property (Page 3652)
Label Property (Page 3642)
Key Property (Page 3641)
Enabled Property (Page 3579)
Application Property (Page 3484)

4216

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Menus Object (Listing)


Description

A listing of the Menu objects that represent all the user-defined menus in the Graphics
Designer.

VBA Object Name


HMIMenus

Usage
Use the CustomMenus property to return the Menus listing. In the following example all the
user-defined menus in the active picture will be output.
Note
The Menus listing does not distinguish between application-specific and picture-specific
menus in the output.

Sub ShowCustomMenusOfDocument()
'VBA290
Dim colMenus As HMIMenus
Dim objMenu As HMIMenu
Dim strMenuList As String
Set colMenus = ActiveDocument.CustomMenus
For Each objMenu In colMenus
strMenuList = strMenuList & objMenu.Label & vbCrLf
Next objMenu
MsgBox strMenuList
End Sub

Use the Application property and the InsertMenu method if you want to create an applicationspecific menu. Create the VBA code in either the "Project Template" document or the "Global

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4217

VBA Reference
6.1 The object model of the Graphics Designer
Template" document. In the following example a user-defined menu called
"myApplicationMenu" will be created:

Sub InsertApplicationSpecificMenu()
'VBA291
Dim objMenu As HMIMenu
Set objMenu = Application.CustomMenus.InsertMenu(1, "a_Menu1", "myApplicationMenu")
End Sub

Use the ActiveDocument property and the InsertMenu method if you want to create a picturespecific menu. Create the VBA code in the document called "ThisDocument": In the following
example a picture-specific menu called "myDocumentMenu" will be created:;

Sub InsertDocumentSpecificMenu()
'VBA292
Dim objMenu As HMIMenu
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "d_Menu1", "myDocumentMenu")
End Sub

See also
Menu Object (Page 3378)
Item Method (Page 3234)
InsertMenu Method (Page 3225)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create a New Application-Specific Menu (Page 3023)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

4218

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

MenuItem Object
Description

Represents a menu entry for a user-defined menu in the Graphics Designer. The MenuItem
object is an element of the MenuItems listing.

VBA Object Name


HMIMenuItem

Usage
Note
In order for the examples to work, first create a user-defined menu. For an example of this,
please refer to "Adding a New Entry to the Menu" in this documentation.
Use MenuItems(Index) to return an individual MenuItem object. "For Index you can use either
the index number or the name of the object. In the following example the first entry in the first
user-defined menu in the active picture will be output:

Sub ShowFirstObjectOfCollection()
'VBA293
Dim strName As String
strName = ActiveDocument.CustomMenus(1).MenuItems(1).Label
MsgBox strName
End Sub

Use the Delete method to remove an object from the "MenuItems" listing. In the following
example the first entry in the first user-defined menu in the active picture will be deleted:

Sub DeleteMenuItem()
'VBA294
ActiveDocument.CustomMenus(1).MenuItems(1).Delete

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4219

VBA Reference
6.1 The object model of the Graphics Designer

End Sub

See also
Parent Property (Page 3708)
MenuItems Object (Listing) (Page 3384)
Delete Method (Page 3208)
Configuring Menus and Toolbars (Page 3020)
How to assign VBA macros to menus and toolbars (Page 3036)
How to assign help texts to menus and toolbars (Page 3033)
How to add a new menu entry to a menu (Page 3025)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3878)
Tag Property (Page 3775)
SubMenu Property (Page 3769)
StatusText Property (Page 3768)
ShortCut Property (Page 3760)
Position Property (Page 3727)
MenuItemType Property (Page 3689)
Macro Property (Page 3671)
LDStatusTexts Property (Page 3654)
LDLabelTexts Property (Page 3652)
Label Property (Page 3642)
Key Property (Page 3641)
Icon Property (Page 3629)
Enabled Property (Page 3579)
Checked Property (Page 3533)
Application Property (Page 3484)

4220

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

MenuItems Object (Listing)


Description

A listing of the MenuItem objects that represent all the entries in a user-defined menu.

Usage
Note
In order for the examples to work, first create a user-defined menu. For an example of this,
please refer to "Adding a New Entry to the Menu" in this documentation.
Use the MenuItems property to return the MenuItems listing. In the following example all the
entries in the first user-defined menu in the active picture will be output:
Note
The MenuItems listing does not distinguish between an application-specific and a picturespecific menu in the output.

Sub ShowMenuItems()
'VBA295
Dim colMenuItems As HMIMenuItems
Dim objMenuItem As HMIMenuItem
Dim strItemList As String
Set colMenuItems = ActiveDocument.CustomMenus(1).MenuItems
For Each objMenuItem In colMenuItems
strItemList = strItemList & objMenuItem.Label & vbCrLf
Next objMenuItem
MsgBox strItemList
End Sub

Use the InsertMenuItem method, for instance, to insert an entry into an existing user-defined
menu. In the following example the picture-specific menu "DocMenu2" will be created in the
active picture and the menu entry "MenuItem1" is inserted:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4221

VBA Reference
6.1 The object model of the Graphics Designer

Sub InsertMenuItem()
'VBA296
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(2, "d_Menu2", "DocMenu2")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "m_Item2_1", "MenuItem 1")
End Sub

See also
InsertSubmenu Method (Page 3229)
MenuItem Object (Page 3382)
InsertSeparator Method (Page 3228)
InsertMenuItem Method (Page 3227)
How to add a new menu entry to a menu (Page 3025)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

MultiLineEdit object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

0XOWL/LQH(GLW

6HOHFWLRQ
Represents the "MultiLineEdit" object. The MultiLineEdit object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

4222

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

VBA object name


HMIMultiLineEdit

Usage
Use the Add method to create a new "MultiLineEdit" object in a picture:

Sub AddMultiLineEdit()
'VBA832
Dim objMultiLineEdit As HMIMultiLineEdit
Set objMultiLineEdit = ActiveDocument.HMIObjects.AddHMIObject("MultiLineEdit",
"HMIMultiLineEdit")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditMultiLineEdit()
'VBA833
Dim objMultiLineEdit As HMIMultiLineEdit
Set objMultiLineEdit = ActiveDocument.HMIObjects("MultiLineEdit")
objMultiLineEdit.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA834
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Layer Property (Page 3646)
Left Property (Page 3657)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BorderStyle Property (Page 3522)
BorderWidth Property (Page 3523)
BackColor Property (Page 3494)
FontName Property (Page 3613)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4223

VBA Reference
6.1 The object model of the Graphics Designer
FontSize Property (Page 3613)
FontBold Property (Page 3611)
FontItalic Property (Page 3612)
FontUnderline Property (Page 3614)
ForeColor Property (Page 3615)
AlignmentLeft Property (Page 3480)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
Text Property (Page 3779)
Operation Property (Page 3703)
PasswordLevel Property (Page 3711)
Visible Property (Page 3878)
ToolTipText Property (Page 3784)
ObjectName Property (Page 3698)
GlobalShadow property (Page 3619)
Application Property (Page 3484)
GroupParent Property (Page 3623)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

4224

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ObjConnection object
Description
Represents the "Connector" object. The ObjConnection object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
Note
You have read-only access to the properties of the ObjConnection object.

VBA Object Name


HMIObjConnection

Application
From the properties of the ObjConnection object you can find out which objects are connected.

Example
In order for the following example to work you must have connected two objects to the
connector in the active picture of the Graphics Designer. You can find the Connector object in
the Graphics Designer in the Object Palette under "Standard Objects". For this example to
work, give the connector the name "Connector1".
In the user-defined menu "Connector Info" you can click on the "Connector Info" entry and
display the objects connected via the connector:

Sub ShowConnectorInfo_Menu()
'VBA297
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
Dim strDocName As String
strDocName = Application.ApplicationDataPath & ActiveDocument.Name
Set objMenu = Documents(strDocName).CustomMenus.InsertMenu(1, "ConnectorMenu",
"Connector_Info")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "ShowConnectInfo", "Info Connector")
End Sub
Sub
Dim
Dim
Dim
Dim
Dim

ShowConnectorInfo()
objConnector As HMIObjConnection
iStart As Integer
iEnd As Integer
strStart As String
strEnd As String

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4225

VBA Reference
6.1 The object model of the Graphics Designer

Dim strObjStart As String


Dim strObjEnd As String
Set objConnector = ActiveDocument.HMIObjects("Connector1")
iStart = objConnector.BottomConnectedConnectionPointIndex
iEnd = objConnector.TopConnectedConnectionPointIndex
strObjStart = objConnector.BottomConnectedObjectName
strObjEnd = objConnector.TopConnectedObjectName
Select Case iStart
Case 0
strStart = "top"
Case 1
strStart = "right"
Case 2
strStart = "bottom"
Case 3
strStart = "left"
End Select
Select Case iEnd
Case 0
strEnd = "top"
Case 1
strEnd = "right"
Case 2
strEnd = "bottom"
Case 3
strEnd = "left"
End Select
MsgBox "The selected connector links the objects " & vbCrLf & "'" & strObjStart & "' and '"
& strObjEnd & "'" & vbCrLf & "Connected points: " & vbCrLf & strObjStart & ": " & strStart
& vbCrLf & strObjEnd & ": " & strEnd
End Sub
Private Sub Document_MenuItemClicked(ByVal MenuItem As IHMIMenuItem)
Select Case MenuItem.Key
Case "ShowConnectInfo"
Call ShowConnectorInfo
End Select
End Sub

See also
TopConnectedConnectionPointIndex Property (Page 3786)
TopConnectedObjectName Property (Page 3786)
BottomConnectedConnectionPointIndex Property (Page 3524)
BottomConnectedObjectName Property (Page 3524)
Application Property (Page 3484)
BorderBackColor Property (Page 3514)
BorderColor Property (Page 3515)
BorderEndStyle Property (Page 3518)
BorderFlashColorOff Property (Page 3519)

4226

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
BorderFlashColorOn Property (Page 3520)
BorderStyle Property (Page 3522)
BorderWidth Property (Page 3523)
Events Property (Page 3581)
FlashBorderColor Property (Page 3597)
FlashRateBorderColor Property (Page 3605)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Orientation Property (Page 3705)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Transparency property (Page 3787)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectorType property (Page 3560)
ConnectionPoints property (Page 3558)
Display property (Page 3573)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4227

VBA Reference
6.1 The object model of the Graphics Designer

OLEObject Object
Description

Represents the object called "OLE Element". The OLEObject object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIOLEObject

Usage
Use the AddOLEObject method to create a new "OLE Element" object in a picture: In the
following example an OLE Element containing a Wordpad document will be inserted into the
active picture:

Sub AddOLEObjectToActiveDocument()
'VBA298
Dim objOleObject As HMIOLEObject
Set objOleObject = ActiveDocument.HMIObjects.AddOLEObject("Wordpad Document",
"Wordpad.Document.1")
End Sub

Use "HMIObjects(Index)" to return an object from the HMIObjects listing, where "Index" in this
case identifies the object by name: In this example the X coordinate of the OLE Element
"Wordpad Document" is set to 140:

Sub EditOLEObject()
'VBA299
Dim objOleObject As HMIOLEObject
Set objOleObject = ActiveDocument.HMIObjects("Wordpad Document")
objOleObject.Left = 140
End Sub

4228

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "Selection(Index)" to return an object from the Selection listing. "For Index you can use
either the index number or the name of the object. In this example the name of the first selected
object will be output:

Sub ShowNameOfFirstSelectedObject()
'VBA300
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
How to Create Picture-specific Menus and Toolbars (Page 3048)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
Delete Method (Page 3208)
AddOLEObject Method (Page 3182)
How to Create an Application-specific Toolbar (Page 3029)
VBA Reference (Page 3124)
OLE Objects (Page 3062)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4229

VBA Reference
6.1 The object model of the Graphics Designer
Top Property (Page 3785)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

OptionGroup Object
Description

Represents the "Radio Box" object. The OptionGroup object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIOptionGroup

Usage
Use the Add method to create a new "Option Group" object in a picture:

Sub AddOptionGroup()
'VBA301
Dim objOptionGroup As HMIOptionGroup
Set objOptionGroup = ActiveDocument.HMIObjects.AddHMIObject("Radio-Box", "HMIOptionGroup")
End Sub

4230

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditOptionGroup()
'VBA302
Dim objOptionGroup As HMIOptionGroup
Set objOptionGroup = ActiveDocument.HMIObjects("Radio-Box")
objOptionGroup.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA303
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Left Property (Page 3657)
BorderStyle Property (Page 3522)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
Text Property (Page 3779)
Process Property (Page 3730)
PasswordLevel Property (Page 3711)
Orientation Property (Page 3705)
OperationMessage Property (Page 3704)
Operation Property (Page 3703)
Layer Property (Page 3646)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4231

VBA Reference
6.1 The object model of the Graphics Designer
Index Property (Page 3631)
Height Property (Page 3624)
ForeFlashColorOn Property (Page 3617)
ForeFlashColorOff Property (Page 3616)
ForeColor Property (Page 3615)
FontUnderline Property (Page 3614)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontItalic Property (Page 3612)
FontBold Property (Page 3611)
FlashRateForeColor Property (Page 3607)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashForeColor Property (Page 3599)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
BoxCount Property (Page 3526)
BoxAlignment Property (Page 3525)
BorderWidth Property (Page 3523)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
AlignmentTop Property (Page 3481)
AlignmentLeft Property (Page 3480)
AdaptBorder Property (Page 3475)
Application Property (Page 3484)
Events Property (Page 3581)

4232

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
WindowsStyle property (Page 3884)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

PictureWindow Object
Description

Represents the "Picture Window" object. The PictureWindow object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4233

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMIPictureWindow

Usage
Use the Add method to create a new "Picture Window" object in a picture:

Sub AddPictureWindow()
'VBA304
Dim objPictureWindow As HMIPictureWindow
Set objPictureWindow = ActiveDocument.HMIObjects.AddHMIObject("PictureWindow1",
"HMIPictureWindow")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditPictureWindow()
'VBA305
Dim objPictureWindow As HMIPictureWindow
Set objPictureWindow = ActiveDocument.HMIObjects("PictureWindow1")
objPictureWindow.Sizeable = True
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA306
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
MaximizeButton Property (Page 3674)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Zoom Property (Page 3887)

4234

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
WindowBorder Property (Page 3882)
Width Property (Page 3881)
Visible Property (Page 3878)
UpdateCycle Property (Page 3801)
Top Property (Page 3785)
TagPrefix Property (Page 3776)
Sizeable Property (Page 3763)
ServerPrefix Property (Page 3759)
ScrollPositionY Property (Page 3753)
ScrollPositionX Property (Page 3752)
ScrollBars Property (Page 3752)
PictureName Property (Page 3721)
OnTop Property (Page 3702)
OffsetTop Property (Page 3701)
OffsetLeft Property (Page 3701)
Moveable Property (Page 3693)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
CloseButton Property (Page 3541)
CaptionText Property (Page 3530)
Caption Property (Page 3529)
AdaptSize Property (Page 3477)
AdaptPicture Property (Page 3476)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
IndependentWindow property (Page 3630)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4235

VBA Reference
6.1 The object model of the Graphics Designer
ToolTipText Property (Page 3784)
Type Property (Page 3790)
WindowMonitorNumber property (Page 3883)
WindowPositionMode property (Page 3884)
ConnectionPoints property (Page 3558)
MenuToolBarConfig Property (Page 3690)
TitleBackColorActiveEnd property (Page 3780)
TitleBackColorActiveStart property (Page 3780)
TitleBackColorInactiveEnd property (Page 3780)
TitleBackColorInactiveStart property (Page 3780)
TitleForeColorActive property (Page 3781)
TitleForeColorInactive property (Page 3781)
Pinnable property (Page 3725)
Pinned property (Page 3726)
ConnectorObjects property (Page 3558)

PieSegment Object
Description

Represents the "Pie Segment" object. The PieSegment object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIPieSegment

4236

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Add method to create a new "Pie Segment" object in a picture:

Sub AddPieSegment()
'VBA307
Dim objPieSegment As HMIPieSegment
Set objPieSegment = ActiveDocument.HMIObjects.AddHMIObject("PieSegment1", "HMIPieSegment")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditPieSegment()
'VBA308
Dim objPieSegment As HMIPieSegment
Set objPieSegment = ActiveDocument.HMIObjects("PieSegment1")
objPieSegment.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA309
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Filling Property (Page 3590)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
StartAngle Property (Page 3767)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4237

VBA Reference
6.1 The object model of the Graphics Designer
Radius Property (Page 3738)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
FillColor Property (Page 3588)
EndAngle Property (Page 3580)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)

4238

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

Polygon Object
Description

Represents the "Polygon" object. The Polygon object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIPolygon

Usage
Use the Add method to create a new "Polygon" object in a picture:

Sub AddPolygon()
'VBA310
Dim objPolygon As HMIPolygon
Set objPolygon = ActiveDocument.HMIObjects.AddHMIObject("Polygon", "HMIPolygon")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4239

VBA Reference
6.1 The object model of the Graphics Designer

Sub EditPolygon()
'VBA311
Dim objPolygon As HMIPolygon
Set objPolygon = ActiveDocument.HMIObjects("Polygon")
objPolygon.BorderColor = RGB (255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA312
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3784)
BorderBackColor Property (Page 3514)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
RotationAngle Property (Page 3744)
ReferenceRotationTop Property (Page 3742)
ReferenceRotationLeft Property (Page 3741)
PointCount Property (Page 3726)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Index Property (Page 3631)
Height Property (Page 3624)

4240

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
ActualPointTop Property (Page 3474)
ActualPointLeft Property (Page 3473)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4241

VBA Reference
6.1 The object model of the Graphics Designer

PolyLine Object
Description

Represents the "Polyline" object. The PolyLine object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIPolyLine

Usage
Use the Add method to create a new "Polyline" object in a picture:

Sub AddPolyLine()
'VBA313
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects.AddHMIObject("PolyLine1", "HMIPolyLine")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditPolyLine()
'VBA314
Dim objPolyLine As HMIPolyLine
Set objPolyLine = ActiveDocument.HMIObjects("PolyLine1")
objPolyLine.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

4242

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub ShowNameOfFirstSelectedObject()
'VBA315
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

Use the "HMIDefaultObjects(Index)" to return an object from the HMIDefaultObjects Listing:

Sub EditDefaultPropertiesOfPolyLine()
'VBA316
Dim objPolyLine As HMIPolyLine
Set objPolyLine = Application.DefaultHMIObjects("HMIPolyLine")
objPolyLine.BorderColor = RGB(255, 255, 0)
End Sub

See also
HMIDefaultObjects Object (Listing) (Page 3354)
BorderEndStyle Property (Page 3518)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
RotationAngle Property (Page 3744)
ReferenceRotationTop Property (Page 3742)
ReferenceRotationLeft Property (Page 3741)
PointCount Property (Page 3726)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Index Property (Page 3631)
Height Property (Page 3624)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4243

VBA Reference
6.1 The object model of the Graphics Designer
FlashRateBorderColor Property (Page 3605)
FlashBorderColor Property (Page 3597)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
ActualPointTop Property (Page 3474)
ActualPointLeft Property (Page 3473)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

4244

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Properties Object (Listing)


Description

A listing of the Property objects that represent all the properties of an object.

VBA Object Name


HMIProperties

Usage
Use the Properties(Index) property in order to return a Property object if you cannot access
an object property directly. For "Index" you can use either the index number or the VBA property
name of the object. In the following example the Properties property has to be used to access
the individual properties of a circle. The circle will be inserted into the picture as an HMIObject
object:

Sub AddObject()
'VBA319
Dim objObject As HMIObject
Set objObject = ActiveDocument.HMIObjects.AddHMIObject("CircleAsHMIObject", "HMICircle")
'
'Standard properties (e.g. "Position") are available every time:
objObject.Top = 40
objObject.Left = 40
'
'Individual properties have to be called using
'property "Properties":
objObject.Properties("FlashBackColor") = True
End Sub

See also
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Parent Property (Page 3708)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4245

VBA Reference
6.1 The object model of the Graphics Designer
Count Property (Page 3560)
Application Property (Page 3484)
Item Property (Page 3637)

Property Object
Description

Represents the property of an object. In the case of the Property object the use of the Value
property is set as the default. For this reason you can use the following notation in order for
example to assign a new value to an object property:
<Object>.<Property> = <Value>
You can use the "Dynamic" property in order to make an object property dynamic with VBA.
Use the "Events" listing in order to configure actions with VBA.
The Property object is an element of the Properties listing.

VBA Object Name


HMIProperty

Usage
Use Properties(Index) to return an individual Property object. For "Index" you can use either
the index number or the name of the object property. In the following example the name of the
first property of the Circle object will be output:

Sub ShowFirstObjectOfCollection()
'VBA317
Dim objCircle As HMICircle
Dim strName As String
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle", "HMICircle")
strName = objCircle.Properties(1).Name
MsgBox strName
End Sub

4246

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use the CreateDynamic method to make an object property dynamic. In the following example
the "Radius" property of a circle object will be made dynamic with the aid of the tag "Otto",
which is updated every two seconds:

Sub DynamicToRadiusOfNewCircle()
'VBA318
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects("Circle")
Set objVariableTrigger =
objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVariableDirect, "NewDynamic1")
objVariableTrigger.CycleType = hmiCycleType_2s
End Sub

See also
DisplayName Property (Page 3573)
Properties Object (Listing) (Page 3408)
DeleteDynamic Method (Page 3210)
CreateDynamic Method (Page 3204)
VBA Reference (Page 3124)
Creating Dynamics with VBA (Page 3079)
Editing Objects with VBA (Page 3053)
Value Property (Page 3807)
Parent Property (Page 3708)
Name Property (Page 3694)
IsDynamicable Property (Page 3635)
Events Property (Page 3581)
Dynamic Property (Page 3576)
Application Property (Page 3484)
IsPublished property (Page 3636)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4247

VBA Reference
6.1 The object model of the Graphics Designer

QualityCodeStateValue Object
Description

Represents the quality code of a tag which is assigned in the dynamic dialog and used for
dynamization.

VBA Object Name


HMIQualityCodeStateValue

Object properties
The object QualityCodeStateValue has the following properties:
Application
Parent
VALUE_BAD_COMMLUV
VALUE_BAD_COMMLUV
VALUE_BAD_CONFERROR
VALUE_BAD_DEVICE
VALUE_BAD_MISCSTATES
VALUE_BAD_NONSPECIFIC
VALUE_BAD_NOTCONNECTED
VALUE_BAD_OUTOFSERV
VALUE_BAD_PROCRELNOM
VALUE_BAD_PROCRELSUB
VALUE_HIGHLIMITED
VALUE_LOWLIMITED
VALUE_UNCERT_ENGVHIGHLIM
VALUE_UNCERT_ENGVLOWLIM
VALUE_UNCERT_ENGVONLIM
VALUE_UNCERT_INITVAL
VALUE_UNCERT_LUV

4248

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
VALUE_UNCERT_MAINTDEM
VALUE_UNCERT_MISCSTATES
VALUE_UNCERT_NONSPECIFIC
VALUE_UNCERT_PROCRELNOM
VALUE_UNCERT_SIMVAL
VALUE_UNCERT_SUBSTSET
VarName

See also
VALUE_BAD_CONFERROR Property (Page 3815)
VBA Reference (Page 3124)
VarName Property (Page 3876)
VALUE_UNCERT_SUBSTSET Property (Page 3870)
VALUE_UNCERT_SIMVAL Property (Page 3868)
VALUE_UNCERT_PROCRELNOM Property (Page 3866)
VALUE_UNCERT_NONSPECIFIC Property (Page 3864)
VALUE_UNCERT_MISCSTATES Property (Page 3863)
VALUE_UNCERT_MAINTDEM Property (Page 3861)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4249

VBA Reference
6.1 The object model of the Graphics Designer
Parent Property (Page 3708)
Application Property (Page 3484)

QualityCodeStateValues Object (Listing)


Description

A listing of QualityCodeStateValue objects which contain all quality codes in Dynamic dialog
and are used for dynamization.

VBA Object Name


HMIQualityCodeStateValues

Application
For example, use the Item property to define values in Dynamic dialog which will be used for
dynamization when the specified tag returns the configured quality code. In the following
example the radius of a circle is given dynamics with the dynamic dialog. Dynamization uses
the analysis of the quality code of a tag. If the tag fails to return a quality code, a substitute
value (ElseCase property) is defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA813
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'Activate qualitycode-statecheck
.QualityCodeStateChecked = True
End With
With objDynDialog.QualityCodeStateValues(1)
'define a value for every state:
.VALUE_BAD_COMMLUV = 20
.VALUE_BAD_COMMNUV = 30
.VALUE_BAD_CONFERROR = 40
.VALUE_BAD_DEVICE = 60

4250

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

.VALUE_BAD_MISCSTATES = 70
.VALUE_BAD_NONSPECIFIC = 80
.VALUE_BAD_NOTCONNECTED = 90
.VALUE_BAD_OUTOFSERV = 100
.VALUE_BAD_PROCRELNOM = 110
.VALUE_BAD_PROCRELSUB = 120
.VALUE_HIGHLIMITED = 130
.VALUE_LOWLIMITED = 140
.VALUE_UNCERT_ENGVHIGHLIM = 150
.VALUE_UNCERT_ENGVLOWLIM = 160
.VALUE_UNCERT_INITVAL = 170
.VALUE_UNCERT_LUV = 180
.VALUE_UNCERT_MAINTDEM = 190
.VALUE_UNCERT_MISCSTATES = 200
.VALUE_UNCERT_NONSPECIFIC = 210
.VALUE_UNCERT_PROCRELNOM = 220
.VALUE_UNCERT_SIMVAL = 230
.VALUE_UNCERT_SUBSTSET = 240
End With
End Sub

Object properties
The object QualityCodeStateValues has the following properties:
Application
Count
Item
Parent

See also
VALUE_UNCERT_MAINTDEM Property (Page 3861)
VBA Reference (Page 3124)
VarName Property (Page 3876)
VALUE_UNCERT_SUBSTSET Property (Page 3870)
VALUE_UNCERT_SIMVAL Property (Page 3868)
VALUE_UNCERT_PROCRELNOM Property (Page 3866)
VALUE_UNCERT_NONSPECIFIC Property (Page 3864)
VALUE_UNCERT_MISCSTATES Property (Page 3863)
VALUE_UNCERT_LUV Property (Page 3859)
VALUE_UNCERT_INITVAL Property (Page 3857)
VALUE_UNCERT_ENGVONLIM Property (Page 3855)
VALUE_UNCERT_ENGVLOWLIM Property (Page 3853)
VALUE_UNCERT_ENGVHIGHLIM Property (Page 3851)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4251

VBA Reference
6.1 The object model of the Graphics Designer
VALUE_LOWLIMITED Property (Page 3838)
VALUE_HIGHLIMITED Property (Page 3834)
VALUE_BAD_PROCRELSUB Property (Page 3828)
VALUE_BAD_PROCRELNOM Property (Page 3826)
VALUE_BAD_OUTOFSERV Property (Page 3824)
VALUE_BAD_NOTCONNECTED Property (Page 3822)
VALUE_BAD_NONSPECIFIC Property (Page 3820)
VALUE_BAD_MISCSTATES Property (Page 3818)
VALUE_BAD_DEVICE Property (Page 3817)
VALUE_BAD_CONFERROR Property (Page 3815)
VALUE_BAD_COMMNUV Property (Page 3813)
VALUE_BAD_COMMLUV Property (Page 3811)
Parent Property (Page 3708)
Item Property (Page 3637)
Count Property (Page 3560)
Application Property (Page 3484)

6.1.7.4

R-Z

Rectangle Object
Description

Represents the "Rectangle" object. The Rectangle object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

4252

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMIRectangle

Usage
Use the Add method to create a new "Rectangle" object in a picture:

Sub AddRectangle()
'VBA320
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditRectangle()
'VBA321
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects("Rectangle1")
objRectangle.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA322
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4253

VBA Reference
6.1 The object model of the Graphics Designer
ToolTipText Property (Page 3784)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)

4254

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

RoundButton Object
Description

Represents the "Round Button" object. The RoundButton object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIRoundButton

Usage
Use the Add method to create a new "Round Button" object in a picture:

Sub AddRoundButton()
'VBA323
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects.AddHMIObject("Roundbutton1",
"HMIRoundButton")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4255

VBA Reference
6.1 The object model of the Graphics Designer

Sub EditRoundButton()
'VBA324
Dim objRoundButton As HMIRoundButton
Set objRoundButton = ActiveDocument.HMIObjects("Roundbutton1")
objRoundButton.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing.:

Sub ShowNameOfFirstSelectedObject()
'VBA325
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3784)
FlashBackColor Property (Page 3596)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
Toggle Property (Page 3781)
Radius Property (Page 3738)
Pressed Property (Page 3729)
PicUpUseTransColor Property (Page 3724)
PicUpTransparent Property (Page 3723)
PicUpReferenced Property (Page 3723)
PictureUp Property (Page 3722)
PictureDown Property (Page 3720)
PictureDeactivated Property (Page 3720)
PicDownUseTransColor Property (Page 3717)

4256

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
PicDownTransparent Property (Page 3717)
PicDownReferenced Property (Page 3716)
PicDeactUseTransColor Property (Page 3715)
PicDeactTransparent Property (Page 3715)
PicDeactReferenced-Eigenschaft (Page 3714)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColorTop Property (Page 3517)
BorderColor Property (Page 3515)
BorderColorBottom Property (Page 3516)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
BackBorderWidth Property (Page 3493)
AlignmentLeft Property (Page 3480)
AlignmentTop Property (Page 3481)
Application Property (Page 3484)
DisplayOptions Property (Page 3574)
Events Property (Page 3581)
FontBold Property (Page 3611)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4257

VBA Reference
6.1 The object model of the Graphics Designer
FontItalic Property (Page 3612)
FontName Property (Page 3613)
FontSize Property (Page 3613)
FontUnderline Property (Page 3614)
ForeColor Property (Page 3615)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
PictAlignment property (Page 3719)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Text Property (Page 3779)
Transparency property (Page 3787)
Type Property (Page 3790)
WinCCStyle property (Page 3882)
WindowsStyle property (Page 3884)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

4258

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

RoundRectangle Object
Description

Represents the "Rounded Rectangle" object. The RoundRectangle object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIRoundRectangle

Usage
Use the Add method to create a new "Rounded Rectangle" object in a picture:

Sub AddRoundRectangle()
'VBA326
Dim objRoundRectangle As HMIRoundRectangle
Set objRoundRectangle = ActiveDocument.HMIObjects.AddHMIObject("Roundrectangle1",
"HMIRoundRectangle")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditRoundRectangle()
'VBA327
Dim objRoundRectangle As HMIRoundRectangle
Set objRoundRectangle = ActiveDocument.HMIObjects("Roundrectangle1")
objRoundRectangle.BorderColor = RGB(255, 0, 0)
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4259

VBA Reference
6.1 The object model of the Graphics Designer
Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA328
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Width Property (Page 3881)
BorderBackColor Property (Page 3514)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
RoundCornerWidth Property (Page 3746)
RoundCornerHeight Property (Page 3745)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)

4260

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

ScriptInfo Object
Description

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4261

VBA Reference
6.1 The object model of the Graphics Designer
Represents a script (C, VB) that is configured for adding dynamics to a property or action to
an event.

VBA Object Name


HMIScriptInfo

Usage
Use the CreateDynamic method to make a property dynamic with the aid of a script. In the
following example...

Sub AddDynamicAsCSkriptToProperty()
'VBA329
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set objCScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeCScript)
'
'Define triggertype and cycletime:
With objCScript
.SourceCode = ""
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub

Use the AddAction method to configure an action on an event. In the following example...

Sub AddActionToPropertyTypeCScript()
'VBA330
Dim objEvent As HMIEvent
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
'Add circle to picture. By changing of property "Radius"
'a C-action is added:
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_AB", "HMICircle")
Set objEvent = objCircle.Radius.Events(1)
Set objCScript = objEvent.Actions.AddAction(hmiActionCreationTypeCScript)
End Sub

See also
Prototype Property (Page 3735)
Delete Method (Page 3208)
VBA Reference (Page 3124)
Creating Dynamics with VBA (Page 3079)

4262

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Trigger Property (Page 3789)
SourceCode Property (Page 3766)
ScriptType Property (Page 3751)
Parent Property (Page 3708)
Compiled Property (Page 3556)
Application Property (Page 3484)
UsedLanguage property (Page 3802)

SelectedObjects object (Listing)


Description

A listing of the HMIObject objects that represent all the selected objects in a picture.

VBA Object Name


HMISelectedObjects

Usage
Use the Selection property to return the Selection listing. In the following example the names
of all the selected objects in the active picture will be output:

Sub ShowSelectionOfDocument()
'VBA331
Dim colSelection As HMISelectedObjects
Dim objObject As HMIObject
Dim strObjectList As String
Set colSelection = ActiveDocument.Selection
If colSelection.Count <> 0 Then
strObjectList = "List of selected objects:"
For Each objObject In colSelection
strObjectList = strObjectList & vbCrLf & objObject.ObjectName
Next objObject
Else

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4263

VBA Reference
6.1 The object model of the Graphics Designer

strObjectList = "No objects selected"


End If
MsgBox strObjectList
End Sub

Use the SelectAll method, for example, to select all the objects in the picture. In the following
example all the objects in the active picture are selected:

Sub SelectAllObjects()
'VBA332
ActiveDocument.Selection.SelectAll
End Sub

See also
HMIObjects Object (Listing) (Page 3359)
AlignTop Method (Page 3189)
HMIDefaultObjects Object (Listing) (Page 3354)
BringToFront Method (Page 3191)
SendToBack Method (Page 3257)
SelectAll Method (Page 3255)
SameWidthAndHeight Method (Page 3251)
SameWidth Method (Page 3250)
SameHeight Method (Page 3248)
Rotate Method (Page 3247)
Remove Method (Page 3246)
ForwardOneLevel Method (Page 3222)
BackwardOneLevel Method (Page 3190)
MoveSelection Method (Page 3240)
Item Method (Page 3234)
FlipVertically Method (Page 3220)
FlipHorizontally Method (Page 3219)
EvenlySpaceVertically Method (Page 3215)
EvenlySpaceHorizontally Method (Page 3213)
DuplicateSelection Method (Page 3212)
DeselectAll Method (Page 3211)
DeleteAll Method (Page 3209)
CreateGroup Method (Page 3206)

4264

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
CreateCustomizedObject Method (Page 3202)
CopySelection Method (Page 3199)
CenterVertically Method (Page 3194)
CenterHorizontally Method (Page 3193)
AlignRight Method (Page 3188)
AlignLeft Method (Page 3187)
AlignBottom Method (Page 3186)
How to Edit a Customized Object with VBA (Page 3076)
How to Edit the Group Objects Using VBA (Page 3069)
How to edit Default objects, Smart objects, Windows objects and Tube objects (Page 3057)
VBA Reference (Page 3124)
Customized Objects (Page 3074)
Group Objects (Page 3067)
Default objects, Smart objects, Windows objects and Tube objects (Page 3055)
Editing Objects with VBA (Page 3053)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

Slider object
Description

Represents the object called "Slider Object". The Slider object is an element of the following
listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4265

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMISlider

Usage
Use the Add method to create a new "Slider Object" object in a picture:

Sub AddSlider()
'VBA333
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("Slider1", "HMISlider")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditSlider()
'VBA334
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects("Slider1")
objSlider.ButtonColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA335
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
OperationReport Property (Page 3704)
BorderFlashColorOff Property (Page 3519)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)

4266

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
SmallChange Property (Page 3764)
Process Property (Page 3730)
PasswordLevel Property (Page 3711)
OperationMessage Property (Page 3704)
Operation Property (Page 3703)
Min Property (Page 3691)
Max Property (Page 3673)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
ExtendedOperation Property (Page 3585)
Direction Property (Page 3571)
ColorTop Property (Page 3551)
ColorBottom Property (Page 3544)
ButtonColor Property (Page 3528)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColorTop Property (Page 3498)
BackColor Property (Page 3494)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4267

VBA Reference
6.1 The object model of the Graphics Designer
BackColorBottom Property (Page 3497)
BackBorderWidth Property (Page 3493)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
WinCCStyle property (Page 3882)
WindowsStyle property (Page 3884)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

SourceLink Object
Description

Represents the source for a direct connection.

VBA Object Name


HMISourceLink

4268

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the SourceLink property to return the SourceLink object. In the following example the X
position of "Rectangle_A" is copied to the Y position of "Rectangle_B" in Runtime by clicking
on the button:

Sub DirectConnection()
'VBA336
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent
Dim objDirConnection As HMIDirectConnection
'
'Add objects to active document:
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "SetPosition"
End With
'
'Initiation of directconnection by mouseclick:
Set objDirConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDirConnection
'Sourceobject: Top-property of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Left-property of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DirectConnection Object (Page 3318)
VBA Reference (Page 3124)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4269

VBA Reference
6.1 The object model of the Graphics Designer
Type Property (Page 3790)
SourceLink Property (Page 3765)
ObjectName Property (Page 3698)
AutomationName Property (Page 3488)
Application Property (Page 3484)
Parent Property (Page 3708)

StaticText Object
Description

Represents the "Static Text" object. The StaticText object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIStaticText

Usage
Use the Add method to create a new "Static Text" object in a picture:

Sub AddStaticText()
'VBA337
Dim objStaticText As HMIStaticText
Set objStaticText = ActiveDocument.HMIObjects.AddHMIObject("Static_Text1", "HMIStaticText")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

4270

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub EditStaticText()
'VBA338
Dim objStaticText As HMIStaticText
Set objStaticText = ActiveDocument.HMIObjects("Static_Text1")
objStaticText.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA339
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
SelectedObjects object (Listing) (Page 3426)
FontBold Property (Page 3611)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
Text Property (Page 3779)
PasswordLevel Property (Page 3711)
Orientation Property (Page 3705)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Height Property (Page 3624)
ForeFlashColorOn Property (Page 3617)
ForeFlashColorOff Property (Page 3616)
ForeColor Property (Page 3615)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4271

VBA Reference
6.1 The object model of the Graphics Designer
FontUnderline Property (Page 3614)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontItalic Property (Page 3612)
FlashRateForeColor Property (Page 3607)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashForeColor Property (Page 3599)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillingIndex Property (Page 3591)
Filling Property (Page 3590)
FillColor Property (Page 3588)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
AlignmentTop Property (Page 3481)
AlignmentLeft Property (Page 3480)
AdaptBorder Property (Page 3475)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDFonts Property (Page 3651)
LDTexts Property (Page 3655)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)

4272

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Parent Property (Page 3708)
Properties Property (Page 3734)
ReferenceRotationLeft Property (Page 3741)
ReferenceRotationTop Property (Page 3742)
RotationAngle Property (Page 3744)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

StatusDisplay Object
Description

Represents the "Status Display" object. The "StatusDisplay" object is an element of the
following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMIStatusDisplay

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4273

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Add method to create a new "Status Display" object in a picture:

Sub AddStatusDisplay()
'VBA340
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditStatusDisplay()
'VBA341
Dim objStatusDisplay As HMIStatusDisplay
Set objStatusDisplay = ActiveDocument.HMIObjects("Statusdisplay1")
objStatusDisplay.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA342
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ToolTipText Property (Page 3784)
BasePicReferenced Property (Page 3505)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Width Property (Page 3881)
Visible Property (Page 3878)
Top Property (Page 3785)

4274

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Left Property (Page 3657)
Layer Property (Page 3646)
Index Property (Page 3631)
Height Property (Page 3624)
FlashRateFlashPic Property (Page 3606)
FlashRateBorderColor Property (Page 3605)
FlashPicUseTransColor Property (Page 3602)
FlashPicture Property (Page 3601)
FlashPicTransColor Property (Page 3600)
FlashPicReferenced Property (Page 3599)
FlashFlashPicture Property (Page 3598)
FlashBorderColor Property (Page 3597)
BorderWidth Property (Page 3523)
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BasePicUseTransColor Property (Page 3508)
BasePicture Property (Page 3507)
BasePicTransColor Property (Page 3506)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4275

VBA Reference
6.1 The object model of the Graphics Designer
Transparency property (Page 3787)
Type Property (Page 3790)
DrawInsideFrame property (Page 3576)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

SymbolLibraries Object (Listing)


Description

A listing of the SymbolLibrary objects that represent the Components Library. The listing
contains two objects: The first object is the "Global Library" and the second object is the "Project
Library".

VBA Object Name


HMISymbolLibraries

Usage
Use the SymbolLibraries property to return the SymbolLibraries listing. In the following example
the names of the libraries will be output:

Sub ShowSymbolLibraries()
'VBA344
Dim colSymbolLibraries As HMISymbolLibraries
Dim objSymbolLibrary As HMISymbolLibrary
Dim strLibraryList As String
Set colSymbolLibraries = Application.SymbolLibraries
For Each objSymbolLibrary In colSymbolLibraries
strLibraryList = strLibraryList & objSymbolLibrary.Name & vbCrLf
Next objSymbolLibrary
MsgBox strLibraryList
End Sub

4276

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
SymbolLibrary Object (Page 3440)
Item Method (Page 3234)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

SymbolLibrary Object
Description

Represents the "Global Library" or "Project Library". The SymbolLibrary object is an element
of the SymbolLibraries listing.

VBA Object Name


HMISymbolLibrary

Usage
Use SymbolLibraries(Index) to return an individual SymbolLibrary object. "For Index you can
use either the index number or the name of the object. In the following example the name of
the "Global Library" will be output:

Sub ShowFirstObjectOfCollection()
'VBA343
Dim strName As String
strName = Application.SymbolLibraries(1).Name
MsgBox strName
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4277

VBA Reference
6.1 The object model of the Graphics Designer

See also
SymbolLibraries Object (Listing) (Page 3439)
GetItemByPath Method (Page 3223)
FindByDisplayName Method (Page 3218)
VBA Reference (Page 3124)
Accessing the component library with VBA (Page 3040)
Parent Property (Page 3708)
Name Property (Page 3694)
FolderItems Property (Page 3610)
Application Property (Page 3484)

TextList Object
Description

Represents the "Text List" object. The TextList object is an element of the following listings:
Objects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all standard, Windows, and
smart objects.

VBA Object Name


HMITextList

Usage
Use the Add method to create a new "Text List" object in a picture:

Sub AddTextList()
'VBA345

4278

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Dim objTextList As HMITextList


Set objTextList = ActiveDocument.HMIObjects.AddHMIObject("Textlist1", "HMITextList")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTextList()
'VBA346
Dim objTextList As HMITextList
Set objTextList = ActiveDocument.HMIObjects("Textlist1")
objTextList.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA347
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name of the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
Width Property (Page 3881)
ForeFlashColorOn Property (Page 3617)
BitNumber Property (Page 3510)
SelectedObjects object (Listing) (Page 3426)
HMIObjects Object (Listing) (Page 3359)
HMIDefaultObjects Object (Listing) (Page 3354)
AddHMIObject Method (Page 3180)
VBA Reference (Page 3124)
Editing Objects with VBA (Page 3053)
Visible Property (Page 3878)
UnselTextColor Property (Page 3800)
UnselBGColor Property (Page 3800)
Top Property (Page 3785)
ToolTipText Property (Page 3784)
SelTextColor Property (Page 3758)
SelBGColor Property (Page 3755)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4279

VBA Reference
6.1 The object model of the Graphics Designer
PasswordLevel Property (Page 3711)
OutputValue Property (Page 3707)
Orientation Property (Page 3705)
OperationReport Property (Page 3704)
OperationMessage Property (Page 3704)
Operation Property (Page 3703)
NumberLines Property (Page 3697)
ListType Property (Page 3664)
Left Property (Page 3657)
Layer Property (Page 3646)
LanguageSwitch Property (Page 3644)
ItemBorderWidth Property (Page 3640)
ItemBorderStyle Property (Page 3639)
ItemBorderColor Property (Page 3638)
ItemBorderBackColor Property (Page 3638)
Height Property (Page 3624)
ForeFlashColorOff Property (Page 3616)
ForeColor Property (Page 3615)
FontUnderline Property (Page 3614)
FontSize Property (Page 3613)
FontName Property (Page 3613)
FontItalic Property (Page 3612)
FontBold Property (Page 3611)
FlashRateForeColor Property (Page 3607)
FlashRateBorderColor Property (Page 3605)
FlashRateBackColor Property (Page 3604)
FlashForeColor Property (Page 3599)
FlashBorderColor Property (Page 3597)
FlashBackColor Property (Page 3596)
FillStyle Property (Page 3592)
FillColor Property (Page 3588)
EditAtOnce Property (Page 3577)
CursorControl Property (Page 3564)
BoxType Property (Page 3527)
BorderWidth Property (Page 3523)

4280

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
BorderStyle Property (Page 3522)
BorderFlashColorOn Property (Page 3520)
BorderFlashColorOff Property (Page 3519)
BorderColor Property (Page 3515)
BorderBackColor Property (Page 3514)
BackFlashColorOn Property (Page 3501)
BackFlashColorOff Property (Page 3500)
BackColor Property (Page 3494)
AssumeOnExit Property (Page 3486)
Assignments Property (Page 3486)
AlignmentTop Property (Page 3481)
AlignmentLeft Property (Page 3480)
AdaptBorder Property (Page 3475)
Application Property (Page 3484)
Events Property (Page 3581)
GlobalColorScheme property (Page 3619)
GlobalShadow property (Page 3619)
GroupParent Property (Page 3623)
InputValue property (Page 3633)
LDTooltipTexts Property (Page 3656)
ObjectName Property (Page 3698)
Parent Property (Page 3708)
Properties Property (Page 3734)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Transparency property (Page 3787)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
DropDownListStyle property (Page 3576)
LDAssignments property (Page 3651)
TextBiblIDs property (Page 3779)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4281

VBA Reference
6.1 The object model of the Graphics Designer

Toolbar Object
Description

Represents the "User Defined Toolbar" object. The Toolbar object is an element of the
CustomToolbars listing.

VBA Object Name


HMIToolbar

Usage
Use CustomToolbars(Index) to return an individual Toolbar object. "For Index you can use
either the index number or the name of the object. In the following example the "Key" parameter
of the first user-defined toolbar in the active picture will be output:

Sub ShowFirstObjectOfCollection()
'VBA348
Dim strName As String
strName = ActiveDocument.CustomToolbars(1).Key
MsgBox strName
End Sub

Use the Delete method to remove a "Toolbar" object from the "CustomToolbars" listing. In the
following example the first user-defined toolbar in the active picture will be removed:

Sub DeleteToolbar()
'VBA349
Dim objToolbar As HMIToolbar
Set objToolbar = ActiveDocument.CustomToolbars(1)
objToolbar.Delete
End Sub

4282

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
Key Property (Page 3641)
Toolbars Object (Listing) (Page 3446)
Delete Method (Page 3208)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create an Application-specific Toolbar (Page 3029)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3878)
ToolbarItems Property (Page 3783)
Parent Property (Page 3708)
Application Property (Page 3484)

Toolbars Object (Listing)


Description

A listing of the Toolbar objects that represent all the user-defined toolbars in the Graphics
Designer.

VBA Object Name


HMICustomToolbars

Usage
Note
In order for the examples to work, first create a user-defined toolbar. For an example of this,
please refer to "Creating a New Application-Specific Toolbar" in this documentation.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4283

VBA Reference
6.1 The object model of the Graphics Designer
Use the CustomToolbars property to return the Toolbars listing. In the following example,
values for the "Key" property of all user-defined toolbars in the active picture will be output:
Note
The Toolbars listing does not distinguish between application-specific and picture-specific
toolbars in the output.

Sub ShowCustomToolbarsOfDocument()
'VBA350
Dim colToolbars As HMIToolbars
Dim objToolbar As HMIToolbar
Dim strToolbarList As String
Set colToolbars = ActiveDocument.CustomToolbars
If 0 <> colToolbars.Count Then
For Each objToolbar In colToolbars
strToolbarList = strToolbarList & objToolbar.Key & vbCrLf
Next objToolbar
Else
strToolbarList = "No toolbars existing"
End If
MsgBox strToolbarList
End Sub

Use the Application property and the Add method if you want to create an application-specific
toolbar. Create the VBA code in either the "Project Template" document or the "Global
Template" document.

Sub InsertApplicationSpecificToolbar()
'VBA351
Dim objToolbar As HMIToolbar
Set objToolbar = Application.CustomToolbars.Add("a_Toolbar1")
End Sub

Use the ActiveDocument property and the Add method if you want to create a picture-specific
toolbar. Create the VBA code in the document called "ThisDocument":

Sub InsertDocumentSpecificToolbar()
'VBA352
Dim objToolbar As HMIToolbar
Set objToolbar = ActiveDocument.CustomToolbars.Add("d_Toolbar1")
End Sub

See also
Toolbar Object (Page 3445)
Item Method (Page 3234)

4284

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Add Method (Page 3166)
How to Create Picture-specific Menus and Toolbars (Page 3048)
How to Create an Application-specific Toolbar (Page 3029)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

ToolbarItem Object
Description

Represents an object (icon or dividing line) in a user-defined toolbar in the GraphicsDesigner.


The ToolbarItem object is an element of the ToolbarItems listing.

VBA Object Name


HMIToolbarItem

Usage
Note
In order for the examples to work, first create a user-defined toolbar. For an example of this,
please refer to "Creating a New Application-Specific Toolbar" in this documentation.
Use ToolbarItems(Index) to return an individual ToolbarItem object. "For Index you can use
either the index number or the name of the object. In the following example the type of the first
object in the first user-defined toolbar in the active picture will be output:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4285

VBA Reference
6.1 The object model of the Graphics Designer

Sub ShowFirstObjectOfCollection()
'VBA353
Dim strType As String
strType = ActiveDocument.CustomToolbars(1).ToolbarItems(1).ToolbarItemType
MsgBox strType
End Sub

Use the Delete method to remove an object from the "ToolbarItems" listing. In the following
example the first object will be deleted from the first user-defined toolbar in the active picture:

Sub DeleteToolbarItem()
'VBA354
ActiveDocument.CustomToolbars(1).ToolbarItems(1).Delete
End Sub

See also
Macro Property (Page 3671)
ToolbarItems Object (Listing) (Page 3450)
Delete Method (Page 3208)
Configuring Menus and Toolbars (Page 3020)
How to assign VBA macros to menus and toolbars (Page 3036)
How to assign help texts to menus and toolbars (Page 3033)
How to Add a New Icon to the Toolbar (Page 3031)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Visible Property (Page 3878)
Type Property (Page 3790)
ToolTipText Property (Page 3784)
Tag Property (Page 3775)
StatusText Property (Page 3768)
ShortCut Property (Page 3760)
Position Property (Page 3727)
Parent Property (Page 3708)
LDTooltipTexts Property (Page 3656)
LDStatusTexts Property (Page 3654)
Key Property (Page 3641)
Icon Property (Page 3629)
Enabled Property (Page 3579)

4286

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
ToolbarItemType property (Page 3784)

ToolbarItems Object (Listing)


Description

A listing of the ToolbarItem objects that represent all the objects in a user-defined toolbar.

VBA Object Name


HMIToolbarItems

Usage
Use the ToolbarItems property to return the ToolbarItems listing. In the following example, all
object types in the first user-defined toolbar in the active picture will be output:
Note
The ToolbarItems listing does not distinguish between application-specific and picturespecific toolbars in the output.

Sub ShowToolbarItems()
'VBA355
Dim colToolbarItems As HMIToolbarItems
Dim objToolbarItem As HMIToolbarItem
Dim strTypeList As String
Set colToolbarItems = ActiveDocument.CustomToolbars(1).ToolbarItems
If 0 <> colToolbarItems.Count Then
For Each objToolbarItem In colToolbarItems
strTypeList = strTypeList & objToolbarItem.ToolbarItemType & vbCrLf
Next objToolbarItem
Else
strTypeList = "No Toolbaritems existing"

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4287

VBA Reference
6.1 The object model of the Graphics Designer

End If
MsgBox strTypeList
End Sub

Use the InsertToolbarItem method, for instance, to insert an icon into an existing user-defined
toolbar. In the following example a picture-specific toolbar will be created in the active picture
and an icon will be added:

Sub InsertToolbarItem()
'VBA356
Dim objToolbar As HMIToolbar
Dim objToolbarItem As HMIToolbarItem
Set objToolbar = ActiveDocument.CustomToolbars.Add("d_Toolbar2")
Set objToolbarItem = objToolbar.ToolbarItems.InsertToolbarItem(1, "t_Item2_1",
"ToolbarItem 1")
End Sub

See also
ToolbarItem Object (Page 3448)
InsertToolbarItem Method (Page 3231)
InsertSeparator Method (Page 3228)
InsertFromMenuItem Method (Page 3224)
How to Add a New Icon to the Toolbar (Page 3031)
VBA Reference (Page 3124)
Creating Customized Menus and Toolbars (Page 3021)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

4288

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Trigger Object
Description

Represents the trigger (e.g. Picture Cycle) that is necessary for adding dynamics to properties
with the aid of scripts. A trigger can possess multiple tag triggers.

VBA Object Name


HMITrigger

Usage
Use the Trigger property to return the Trigger object. In this example the "Radius" property of
a circle will be made dynamic with the aid of a VB script (the output value sets the radius):

Sub AddDynamicAsVBSkriptToProperty()
'VBA357
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
'
'Define cycletime and sourcecode
With objVBScript
.SourceCode = ""
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub

See also
Delete Method (Page 3208)
VBA Reference (Page 3124)
VariableTriggers Property (Page 3875)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4289

VBA Reference
6.1 The object model of the Graphics Designer
Type Property (Page 3790)
Trigger Property (Page 3789)
Parent Property (Page 3708)
Name Property (Page 3694)
CycleType Property (Page 3568)
Application Property (Page 3484)

TubeArcObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH$UF2EMHFW

6HOHFWLRQ
Represents the "Tube arc" object. The TubeArcObject object is an element of the following
lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubeArcObject

Usage
Use the Add method to create a new "Tube arc" object in a picture:

Sub AddTubeArcObject()
'VBA835
Dim objTubeArcObject As HMITubeArcObject
Set objTubeArcObject = ActiveDocument.HMIObjects.AddHMIObject("TubeArcObject",
"HMITubeArcObject")
End Sub

4290

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTubeArcObject()
'VBA836
Dim objTubeArcObject As HMITubeArcObject
Set objTubeArcObject = ActiveDocument.HMIObjects("TubeArcObject")
objTubeArcObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA837
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Left Property (Page 3657)
Layer Property (Page 3646)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
BorderColor Property (Page 3515)
BorderWidth Property (Page 3523)
ToolTipText Property (Page 3784)
Visible Property (Page 3878)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Transparency property (Page 3787)
GlobalShadow property (Page 3619)
GlobalColorScheme property (Page 3619)
StartAngle Property (Page 3767)
EndAngle Property (Page 3580)
RadiusHeight Property (Page 3739)
RadiusWidth Property (Page 3740)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4291

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

TubeDoubleTeeObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH'RXEOH7HH2EMHFW

6HOHFWLRQ
Represents the "Double T-piece" object. The TubeDoubleTeeObject object is an element of
the following listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubeDoubleTeeObject

Usage
Use the Add method to create a new "Double T-piece" object in a picture:

Sub AddTubeDoubleTeeObject()
'VBA838
Dim objTubeDoubleTeeObject As HMITubeDoubleTeeObject
Set objTubeDoubleTeeObject = ActiveDocument.HMIObjects.AddHMIObject("Double T-piece",
"HMITubeDoubleTeeObject")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

4292

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Sub EditTubeDoubleTeeObject()
'VBA839
Dim objTubeDoubleTeeObject As HMITubeDoubleTeeObject
Set objTubeDoubleTeeObject = ActiveDocument.HMIObjects("Double T-piece")
objTubeDoubleTeeObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA840
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Left Property (Page 3657)
Layer Property (Page 3646)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
BorderColor Property (Page 3515)
BorderWidth Property (Page 3523)
ToolTipText Property (Page 3784)
Visible Property (Page 3878)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Transparency property (Page 3787)
GlobalShadow property (Page 3619)
GlobalColorScheme property (Page 3619)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
Parent Property (Page 3708)
Properties Property (Page 3734)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4293

VBA Reference
6.1 The object model of the Graphics Designer
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

TubePolyline object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH3RO\OLQH

6HOHFWLRQ
Represents the "TubePolyline" object. The TubePolyline object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubePolyline

Usage
Use the Add method to create a new "TubePolyline" object in a picture:

Sub AddTubePolyline()
'VBA841
Dim objTubePolyline As HMITubePolyline
Set objTubePolyline = ActiveDocument.HMIObjects.AddHMIObject("TubePolyline",
"HMITubePolyline")
End Sub

4294

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTubePolyline()
'VBA842
Dim objTubePolyline As HMITubePolyline
Set objTubePolyline = ActiveDocument.HMIObjects("TubePolyline")
objTubePolyline.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA843
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Left Property (Page 3657)
Layer Property (Page 3646)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
BorderColor Property (Page 3515)
BorderWidth Property (Page 3523)
ToolTipText Property (Page 3784)
Visible Property (Page 3878)
PasswordLevel Property (Page 3711)
Operation Property (Page 3703)
Transparency property (Page 3787)
GlobalShadow property (Page 3619)
GlobalColorScheme property (Page 3619)
PointCount Property (Page 3726)
ActualPointLeft Property (Page 3473)
ActualPointTop Property (Page 3474)
Index Property (Page 3631)
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4295

VBA Reference
6.1 The object model of the Graphics Designer
Application Property (Page 3484)
Events Property (Page 3581)
BorderStyle Property (Page 3522)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

TubeTeeObject object
Description
0XOWLSOH2EMHFWV

+0,'HIDXOW2EMHFWV
+0,2EMHFWV

7XEH7HH2EMHFW

6HOHFWLRQ
Represents the "T-piece" object. The TubeTeeObject object is an element of the following lists:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.
HMIDefaultObjects: Contains the default property values of all default, smart, window and
tube objects.

VBA object name


HMITubeTeeObject

4296

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Add method to create a new "T-piece" object in a picture:

Sub AddTubeTeeObject()
'VBA844
Dim objTubeTeeObject As HMITubeTeeObject
Set objTubeTeeObject = ActiveDocument.HMIObjects.AddHMIObject("T-piece",
"HMITubeTeeObject")
End Sub

Use "HMIObjects"(Index)" to return an object from the HMIObjects listing, where Index in this
case identifies the object by name:

Sub EditTubeTeeObject()
'VBA845
Dim objTubeTeeObject As HMITubeTeeObject
Set objTubeTeeObject = ActiveDocument.HMIObjects("T-piece")
objTubeTeeObject.BorderColor = RGB(255, 0, 0)
End Sub

Use "Selection"(Index) to return an object from the Selection listing:

Sub ShowNameOfFirstSelectedObject()
'VBA846
'Select all objects in the picture:
ActiveDocument.Selection.SelectAll
'Get the name from the first object of the selection:
MsgBox ActiveDocument.Selection(1).ObjectName
End Sub

See also
ObjectName Property (Page 3698)
Left Property (Page 3657)
Layer Property (Page 3646)
Top Property (Page 3785)
Width Property (Page 3881)
Height Property (Page 3624)
BorderColor Property (Page 3515)
BorderWidth Property (Page 3523)
ToolTipText Property (Page 3784)
Visible Property (Page 3878)
PasswordLevel Property (Page 3711)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4297

VBA Reference
6.1 The object model of the Graphics Designer
Operation Property (Page 3703)
Transparency property (Page 3787)
GlobalShadow property (Page 3619)
GlobalColorScheme property (Page 3619)
RotationAngle Property (Page 3744)
Application Property (Page 3484)
Events Property (Page 3581)
GroupParent Property (Page 3623)
LDTooltipTexts Property (Page 3656)
Parent Property (Page 3708)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
Type Property (Page 3790)
ConnectionPoints property (Page 3558)
ConnectorObjects property (Page 3558)

VariableStateValue Object
Description

Represents the state of a tag, the value of which is assigned in the Dynamic dialog and used

VBA Object Name


HMIVariableStateValue

See also
VALUE_SERVERDOWN Property (Page 3847)
VBA Reference (Page 3124)
VarName Property (Page 3876)

4298

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
VALUE_TIMEOUT Property (Page 3850)
VALUE_STARTUP_VALUE Property (Page 3848)
VALUE_NOT_ESTABLISHED Property (Page 3845)
VALUE_MIN_RANGE Property (Page 3844)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_RANGE Property (Page 3841)
VALUE_MAX_LIMIT Property (Page 3839)
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
Parent Property (Page 3708)
Application Property (Page 3484)

VariableStateValues Object (Listing)


Description

A listing of VariableStateValue objects containing all tag statuses in Dynamic dialog to be used
for dynamization.

VBA Object Name


HMIVariableStateValues

Usage
Use the Item property in the Dynamic dialog to define values that will be used for creating
dynamics when the specified tag returns the configured state. In the following example the
radius of a circle is given dynamics with the The dynamization takes place be evaluating the

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4299

VBA Reference
6.1 The object model of the Graphics Designer
status of a tag. If the tag does not return a status, a substitute value (ElseCase property) is
defined:

Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA358
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'Activate variable-statecheck
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub

See also
VALUE_MAX_RANGE Property (Page 3841)
VBA Reference (Page 3124)
VarName Property (Page 3876)
VALUE_TIMEOUT Property (Page 3850)
VALUE_STARTUP_VALUE Property (Page 3848)
VALUE_SERVERDOWN Property (Page 3847)
VALUE_NOT_ESTABLISHED Property (Page 3845)
VALUE_MIN_RANGE Property (Page 3844)
VALUE_MIN_LIMIT Property (Page 3842)
VALUE_MAX_LIMIT Property (Page 3839)

4300

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
VALUE_INVALID_KEY Property (Page 3836)
VALUE_HARDWARE_ERROR Property (Page 3833)
VALUE_HANDSHAKE_ERROR Property (Page 3831)
VALUE_CONVERSION_ERROR Property (Page 3830)
VALUE_ADDRESS_ERROR Property (Page 3809)
VALUE_ACCESS_FAULT Property (Page 3808)
Parent Property (Page 3708)
Item Property (Page 3637)
Application Property (Page 3484)

VariableTrigger Object
Description

Represents a tag trigger.

VBA Object Name


HMIVariableTrigger

Application
Use the VariableTrigger object in order to edit or delete an existing tag trigger. In this example
a circle property "Top" is made dynamic with the aid of the tag "NewDynamic1":

Sub AddDynamicAsVariableDirectToProperty()
'VBA359
Dim objVariableTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
Set objVariableTrigger = objCircle.Top.CreateDynamic(hmiDynamicCreationTypeVariableDirect,
"'NewDynamic1'")
'

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4301

VBA Reference
6.1 The object model of the Graphics Designer

'Define cycletime
With objVariableTrigger
.CycleType = hmiCycleType_2s
End With
End Sub

See also
Delete Method (Page 3208)
VariableTriggers Object (Listing) (Page 3465)
VBA Reference (Page 3124)
VariableTriggers Property (Page 3875)
Type Property (Page 3790)
Parent Property (Page 3708)
Name Property (Page 3694)
CycleType Property (Page 3568)
Application Property (Page 3484)
CycleName Property (Page 3567)
CycleTime Property (Page 3567)
VarName Property (Page 3876)

VariableTriggers Object (Listing)


Description

A listing of the VariableTrigger objects that represent all the tag triggers in use.

VBA Object Name


HMIVariableTriggers

4302

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Usage
Use the Add method to create a new tag trigger. In the following example the radius of a circle
is made dynamic with the aid of a VB script. A tag trigger is used as the trigger:

Sub DynamicWithVariableTriggerCycle()
'VBA360
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
'Definition of triggername and cycletime is to do with the Add-methode
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With
End Sub

See also
Add Method (TagTriggers Listing) (Page 3172)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Item Property (Page 3637)
Count Property (Page 3560)
Application Property (Page 3484)

View Object
Description

Represents a copy of a picture. The View object is an element of the Views listing.
You can use the properties of the View object among other things to control the visibility of the
CS layers and to define the zoom.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4303

VBA Reference
6.1 The object model of the Graphics Designer

VBA Object Name


HMIView

Usage
Use Views(Index) to return an individual View object. In the following example the number of
copies of the active picture will be output:

Sub ShowNumberOfExistingViews()
'VBA361
Dim iMaxViews As Integer
iMaxViews = ActiveDocument.Views.Count
MsgBox "Number of copies from active document: " & iMaxViews
End Sub

Use the Add method to add a new View object to the "Views" listing. In the following example
a copy of the active picture is created and then activated:

Sub AddView()
'VBA362
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Height Property (Page 3624)
Views Object (Listing) (Page 3468)
SetCSLayerVisible Method (Page 3258)
PrintDocument Method (Page 3244)
IsCSLayerVisible Method (Page 3232)
Delete Method (Page 3208)
Add Method (Views Listing) (Page 3173)
Activate Method (Page 3165)
VBA Reference (Page 3124)
Editing a Copy of a Picture with VBA (Page 3051)
Editing Layers with VBA (Page 3050)
ExtendedZoomingEnable Property (Page 3585)
Zoom Property (Page 3887)
WindowState Property (Page 3885)

4304

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Width Property (Page 3881)
Top Property (Page 3785)
ScrollPosY Property (Page 3755)
ScrollPosX Property (Page 3754)
Parent Property (Page 3708)
Left Property (Page 3657)
IsActive Property (Page 3633)
Application Property (Page 3484)
ActiveLayer Property (Page 3472)

Views Object (Listing)


Description

A listing of the View objects that represent a copy of a picture.

VBA Object Name


HMIViews

Usage
Use the Views listing to return a View object. In the following example the number of existing
copies of the active picture will be output:

Sub ShowNumberOfExistingViews()
'VBA363
Dim iMaxViews As Integer
iMaxViews = ActiveDocument.Views.Count
MsgBox "Number of copies from active document: " & iMaxViews
End Sub

Use the Add method to create a copy of a picture. In the following example a copy of the active
picture is created and then activated:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4305

VBA Reference
6.1 The object model of the Graphics Designer

Sub AddViewToActiveDocument()
'VBA364
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub

See also
Item Method (Page 3234)
View Object (Page 3466)
Add Method (Page 3166)
VBA Reference (Page 3124)
Parent Property (Page 3708)
Count Property (Page 3560)
Application Property (Page 3484)

WPFControl object
Description
Represents the "WPFControl" object. The WPFControl object is an element of the following
listings:
HMIObjects: Contains all objects of a picture.
Selection: Contains all selected objects of a picture.

VBA Object Name


HMIWPFControl

Application
Use the AddWPFControl method to insert a WPFControl in a picture.
In the following example, the "WPF Control" object outside the Global Assembly Cache is
inserted in the active picture.

'VBA852
Dim WPFControl As HMIWPFControl
Set WPFControl = ActiveDocument.HMIObjects.AddWPFControl("MyWPFVBAControl",
"WinCCWPFControl.TestControl", False, "Assembly=Z:\TestControl\WinCCWPFControl.dll")

4306

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
AddWPFControl method (Page 3185)
Delete Method (Page 3208)
Application Property (Page 3484)
AssemblyInfo property (Page 3486)
ControlType property (Page 3560)
Events Property (Page 3581)
GroupParent Property (Page 3623)
Height Property (Page 3624)
Layer Property (Page 3646)
LDTooltipTexts Property (Page 3656)
Left Property (Page 3657)
ObjectName Property (Page 3698)
Operation Property (Page 3703)
Parent Property (Page 3708)
PasswordLevel Property (Page 3711)
Properties Property (Page 3734)
Selected Property (Page 3756)
TabOrderSwitch Property (Page 3774)
TabOrderAlpha Property (Page 3771)
ToolTipText Property (Page 3784)
Top Property (Page 3785)
Type Property (Page 3790)
Visible Property (Page 3878)
Width Property (Page 3881)
ConnectorObjects property (Page 3558)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4307

VBA Reference
6.1 The object model of the Graphics Designer

6.1.8

Properties

6.1.8.1

Actions Property
Description
Returns the Actions listing. Use the Actions property to configure an event-driven action.

Example:
In this example a button and a circle will be inserted in the active picture. In Runtime the radius
of the circle enlarges every time you click the button:

Sub CreateVBActionToClickedEvent()
'VBA365
Dim objButton As HMIButton
Dim objCircle As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircle
.Top = 100
.Left = 100
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Width = 120
.Text = "Increase Radius"
End With
'Define event and assign sourcecode:
Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
With objVBScript
.SourceCode = "Dim myCircle" & vbCrLf & _
"Set myCircle = HMIRuntime.ActiveScreen.ScreenItems(""Circle_VB"")" & _
vbCrLf & "myCircle.Radius = myCircle.Radius + 5"
End With
End Sub

See also
Actions Object (Listing) (Page 3271)
AddAction Method (Page 3173)
Configuring Event-Driven Actions with VBA (Page 3092)

4308

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ActionType property
Description
Only used internally.

See also
VBA Reference: ActionDynamic (Page 3126)

ActiveDocument Property
Description
Returns an object of the "Document" type which represents the active picture in the Graphics
Designer. If there is no open or active picture in the Graphics Designer, you receive an error
message.
Note
The "ActiveDocument" property refers to the window that possesses the input focus. If other
editors (e.g. CrossReference) access a picture, the input focus can change. To prevent this
situation leading to errors, reference the picture unambiguously via the Documents listing.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles").

Sub CreateMenuItem()
'VBA366
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
'
'Create new menu "Delete Objects":
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete Objects")
'
'Add two menuitems to the menu "Delete Objects
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
Rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete Circles")
End Sub

See also
Documents Object (Listing) (Page 3322)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4309

VBA Reference
6.1 The object model of the Graphics Designer

ActiveLayer Property
Description
Defines or returns the active layer for the View object. The value range is from 0 to 31, where
"0" represents the uppermost layer and "31" the lowest layer.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example a new View object is created and layer 1 is set to
"Active":

Sub ActiveDocumentConfiguration()
'VBA367
Application.ActiveDocument.Views.Add
Application.ActiveDocument.Views(1).ActiveLayer = 2
End Sub

See also
View Object (Page 3466)

ActualPointLeft Property
Description
Defines or returns the X coordinate of the current corner point by reference to the picture origin
(top left) for the objects "Polygon" and "Polyline". Each corner point is identified by an index
which is derived from the number ("PointCount") of corner point available.
A change of the value can affect the properties "Width" (object width) and "Left" (x-coordinate
of the object position).

Example:
The "PolygonCoordinatesOutput()" procedure outputs the coordinates of all the corner points
in the first polyline in the current picture:

Sub PolygonCoordinatesOutput()
'VBA368
Dim objPolyline As HMIPolyLine
Dim iPosX As Integer
Dim iPosY As Integer
Dim iCounter As Integer
Dim strResult As String
iCounter = 1

4310

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Set objPolyline = ActiveDocument.HMIObjects.AddHMIObject("Polyline1", "HMIPolyLine")


For iCounter = 1 To objPolyline.PointCount
With objPolyline
.index = iCounter
iPosX = .ActualPointLeft
iPosY = .ActualPointTop
End With
strResult = strResult & vbCrLf & "Corner " & iCounter & ": x=" & iPosX & " y=" & iPosY
Next iCounter
MsgBox strResult
End Sub

See also
PointCount Property (Page 3726)
Index Property (Page 3631)
ActualPointTop Property (Page 3474)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

ActualPointTop Property
Description
Defines or returns the Y coordinate of the current corner point by reference to the picture origin
(top left) for the objects "Polygon" and "Polyline". Each corner point is identified by an index
which is derived from the number ("PointCount") of corner point available.
A change of the value can affect the properties "Height" (object height) and "Top" (y-coordinate
of the position).

Example:
The "Polygon()" procedure outputs the coordinates of all the corner points in the first polyline
in the current picture:

Sub PolygonCoordinatesOutput()
'VBA369
Dim objPolyline As HMIPolyLine
Dim iPosX As Integer
Dim iPosY As Integer
Dim iCounter As Integer
Dim strResult As String
iCounter = 1
Set objPolyline = ActiveDocument.HMIObjects.AddHMIObject("Polyline1", "HMIPolyLine")

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4311

VBA Reference
6.1 The object model of the Graphics Designer

For iCounter = 1 To objPolyline.PointCount


With objPolyline
.index = iCounter
iPosX = .ActualPointLeft
iPosY = .ActualPointTop
End With
strResult = strResult & vbCrLf & "Corner " & iCounter & ": x=" & iPosX & " y=" & iPosY
Next iCounter
MsgBox strResult
End Sub

See also
PointCount Property (Page 3726)
Index Property (Page 3631)
ActualPointLeft Property (Page 3473)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
Line Object (Page 3373)

AdaptBorder Property
Description
TRUE if the field border is intended to adapt dynamically to the size of the text. BOOLEAN
write-read access.
Note
Changing the contents of a field dynamically can cause pumping in the field.
Performance is improved in Runtime by using "AdaptBorder = False".

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text size is dynamically adapted to the field size.

Sub IOFieldConfiguration()
'VBA372
Dim objIOField As HMIIOField
'
'Add new IO-Feld to active document:
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField

4312

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

.AdaptBorder = True
End With
End Sub

See also
OptionGroup Object (Page 3393)
TextList Object (Page 3441)
StaticText Object (Page 3433)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

AdaptPicture Property
Description
TRUE if the picture size is to be adapted to the picture window size. BOOLEAN write-read
access.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA373
Dim objPicWindow As HMIPictureWindow
'
'Add new picturewindow into active document:
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4313

VBA Reference
6.1 The object model of the Graphics Designer

.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

AdaptSize Property
Description
TRUE if the picture window size is to be adapted to the picture size. BOOLEAN write-read
access.

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will be configured:

Sub PictureWindowConfig()
'VBA374
Dim objPicWindow As HMIPictureWindow
'
'Add new picturewindow into active document:
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

See also
PictureWindow Object (Page 3396)

4314

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AddIns property
Description
Only used internally.

See also
Application Object (Page 3282)

AlarmGoneVisible property
Description
Defines whether an outgoing state is visible.
Assigned Value

Description

True

The outgoing state is visible.

False

The outgoing state is suppressed.

AlarmHigh Property
Description
Defines the top limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmHigh" property.
The "CheckAlarmHigh" property defines whether the monitoring function for the limit value is
activated.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50".

Sub BarGraphLimitConfiguration()
'VBA375
Dim objBarGraph As HMIBarGraph
'
'Add new BarGraph to active document:
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolut
.TypeAlarmHigh = False
'Activate monitoring

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4315

VBA Reference
6.1 The object model of the Graphics Designer

.CheckAlarmHigh = True
'Set barcolor to "yellow"
.ColorAlarmHigh = RGB(255, 255, 0)
'set upper limit to "50"
.AlarmHigh = 50
End With
End Sub

See also
TypeAlarmHigh Property (Page 3791)
ColorAlarmHigh Property (Page 3542)
CheckAlarmHigh Property (Page 3531)
BarGraph Object (Page 3286)

AlarmLow Property
Description
Defines the bottom limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the "TypeAlarmLow" property.
The "CheckAlarmLow" property defines whether the monitoring function for the limit value is
activated.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10".

Sub BarGraphLimitConfiguration()
'VBA376
Dim objBarGraph As HMIBarGraph
'
'Add new BarGraph to active document:
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolut
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set Barcolor to "yellow"
.ColorAlarmLow = RGB(255, 255, 0)
'set lower limit to "10"
.AlarmLow = 10
End With

4316

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

End Sub

See also
TypeAlarmLow Property (Page 3791)
ColorAlarmLow Property (Page 3543)
CheckAlarmLow Property (Page 3532)
BarGraph Object (Page 3286)

Alignment Property
Description
Defines or returns the scale display (left/right or top/bottom) depending on the position of the
BarGraph object. The Scaling property must be set to TRUE for the scale to be displayed.
Display

Assigned Value

Right or bottom

TRUE

Left or top

FALSE

Example:
The "BarGraphConfiguration()" procedure configures In this example the scale is to be located
to the right of the bar:

Sub BarGraphConfiguration()
'VBA377
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Alignment = True
.Scaling = True
End With
End Sub

See also
Scaling Property (Page 3749)
Direction Property (Page 3571)
BarGraph Object (Page 3286)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4317

VBA Reference
6.1 The object model of the Graphics Designer

AlignmentLeft Property
Description
Defines or returns the horizontal alignment of the text. Value range from 0 to 2.
Horizontal Alignment

Assigned Value

Left

Centered

Right

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text in the I/O field will be centered horizontally:

Sub IOFieldConfiguration()
'VBA378
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AlignmentLeft = 1
End With
End Sub

Related topics
See also
AlignmentTop Property (Page 3481)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

4318

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AlignmentTop Property
Description
Defines or returns the vertical alignment of the text. Value range from 0 to 2.
Horizontal Alignment

Assigned Value

Up

Centered

Down

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text in the I/O field will be centered in the middle:

Sub IOFieldConfiguration()
'VBA379
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AlignmentLeft = 1
.AlignmentTop = 1
End With
End Sub

See also
AlignmentLeft Property (Page 3480)
TextList Object (Page 3441)
StaticText Object (Page 3433)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
IOField Object (Page 3361)
CheckBox Object (Page 3297)
Button Object (Page 3293)

AnalogResultInfos Property
Description
Returns the AnalogResultInfos listing. Use the AnalogResultInfos property to define value
ranges and property values in the Dynamic dialog.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4319

VBA Reference
6.1 The object model of the Graphics Designer

Example:
An example showing how to use the AnalogResultInfos property can be found in this
documentation under the heading "AnalogResultInfos Object (Listing)".

See also
DynamicDialog Object (Page 3325)
AnalogResultInfos Object (Listing) (Page 3281)

AngleAlpha Property
Description
Defines or returns depth angle a for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example depth angles A and B will be assigned the values "15" and 45:

Sub HMI3DBarGraphConfiguration()
'VBA380
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
'Depth-angle a = 15 degrees
.AngleAlpha = 15
'Depth-angle b = 45 degrees
.AngleBeta = 45
End With
End Sub

See also
AngleBeta Property (Page 3484)
3DBarGraph Object (Page 3267)

4320

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AngleBeta Property
Description
Defines or returns depth angle b for the 3D-effect of the "3DBarGraph" object. Value range in
degrees from 0 to 90.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example depth angles A and B will be assigned the values "15" and 45:

Sub HMI3DBarGraphConfiguration()
'VBA381
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
'Depth-angle a = 15 degrees
.AngleAlpha = 15
'Depth-angle b = 45 degrees
.AngleBeta = 45
End With
End Sub

See also
AngleAlpha Property (Page 3483)
3DBarGraph Object (Page 3267)

Application Property
Description
Returns the Graphics Designer application when the application property is used without an
object identifier. If the application property is used with object identifier, it returns an application
object which displays the application with which the defined object was created. Read only
access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4321

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In this example an Excel object is created and the application name is output:

Sub CreateExcelApplication()
'VBA382
'
'Open Excel invisible
Dim objExcelApp As New Excel.Application
MsgBox objExcelApp
'Delete the reference to Excel and close it
Set objExcelApp = Nothing
End Sub

See also
Application Object (Page 3282)

ApplicationDataPath Property
Description
Returns the complete path of the active picture in the Graphics Designer. Read-only access.

Example:
The "ShowApplicationDataPath()" procedure outputs the path of the current picture:
Sub ShowApplicationDataPath()
'VBA383
MsgBox Application.ApplicationDataPath
End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)

4322

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AssemblyInfo property
Description
Displays the information of the object registered in the Global Assembly Cache. The
information is made up of "Assembly", "Version", "Culture" and "PublicKeyToken".
If the object is not registered in the Global Assembly Cache, the path of the object is only
displayed in "Assembly".

Assignments Property
Description
A list which contains the assignments between the output values and the actual output texts
to be output.
The assignments are dependent on the list type set. The list type is defined with the ListType
property.
The number of entries depends on the total length of the string passed to the "Assignments"
property. This string cannot be longer than 500,000 bytes. This may be checked prior to
dropping access to the "Assignments" property by using the function LenB().

Example:
--

See also
ListType Property (Page 3664)
TextList Object (Page 3441)

AssumeOnExit Property
Description
TRUE, if the entered text is assumed after exiting the input field (by using the <TAB> key or
mouse click, for example). BOOLEAN write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text that has been entered will be taken over as input on exit from the input field.

Sub IOFieldConfiguration()
'VBA385

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4323

VBA Reference
6.1 The object model of the Graphics Designer

Dim objIOField As HMIIOField


Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AssumeOnExit = True
End With
End Sub

See also
TextList Object (Page 3441)
IOField Object (Page 3361)

AssumeOnFull Property
Description
TRUE, when the content of the input field is full (specified number of characters have been
entered) and should be exited automatically and the input accepted. BOOLEAN write-read
access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the text that has been entered will be taken over as input on exit from the input field.

Sub IOFieldConfiguration()
'VBA386
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.AssumeOnFull = True
End With
End Sub

See also
OutputFormat Property (Page 3706)
DataFormat Property (Page 3569)
IOField Object (Page 3361)

4324

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AutomationName Property
Description
Depending on the source and destination object types for the direct connection, either defines
or returns the name of a property.
The two tables show you when you must use the AutomationName property. A "--" means that
the property is assigned an empty string (") by default when the DirectConnection object is
created.
Source object type (SourceLink Property)
Type Property

AutomationName Property

ObjectName Property

hmiSourceTypeConstant

--

Name of the constant (e.g. the


picture name)

hmiSourceTypeProperty

Property of the source object


(e.g. "Top")

Name of the source object (e.g.


"Rectangle_A")

hmiSourceTypePropertyOfThisObj -ect

--

hmiSourceTypeVariableDirect

--

Tag name

hmiSourceTypeVariableIndirect

--

Tag name

Destination object type (DestinationLink Property)


Type Property

AutomationName Property

ObjectName Property

hmiDestTypeProperty

Property of the destination


object (e.g. "Left")

Name of the destination object


(e.g. "Rectangle_A")

hmiDestTypePropertyOfThisObject --

--

hmiDestTypePropertyOfActualWin
dow

Property of the destination


object (e.g. "Left")

--

hmiDestTypeVariableDirect

--

Tag name

hmiDestTypeVariableIndirect

--

Tag name

hmiDestTypeDirectMessage

--

Tag name

hmiDestTypeIndirectMessage

--

Tag name

Example:
In the following example the X position of "Rectangle_A" is copied to the Y position of
"Rectangle_B" in Runtime by clicking on the button:

Sub DirectConnection()
'VBA387
Dim objButton As HMIButton
Dim objRectangleA As HMIRectangle
Dim objRectangleB As HMIRectangle
Dim objEvent As HMIEvent

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4325

VBA Reference
6.1 The object model of the Graphics Designer

Dim objDynConnection As HMIDirectConnection


'
'Add objects to active document:
Set objRectangleA = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_A", "HMIRectangle")
Set objRectangleB = ActiveDocument.HMIObjects.AddHMIObject("Rectangle_B", "HMIRectangle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
'
'to position and configure objects:
With objRectangleA
.Top = 100
.Left = 100
End With
With objRectangleB
.Top = 250
.Left = 400
.BackColor = RGB(255, 0, 0)
End With
With objButton
.Top = 10
.Left = 10
.Text = "SetPosition"
End With
'
'Directconnection is initiate by mouseclick:
Set objDynConnection =
objButton.Events(1).Actions.AddAction(hmiActionCreationTypeDirectConnection)
With objDynConnection
'Sourceobject: Top-Property of Rectangle_A
.SourceLink.Type = hmiSourceTypeProperty
.SourceLink.ObjectName = "Rectangle_A"
.SourceLink.AutomationName = "Top"
'
'Targetobject: Left-Property of Rectangle_B
.DestinationLink.Type = hmiDestTypeProperty
.DestinationLink.ObjectName = "Rectangle_B"
.DestinationLink.AutomationName = "Left"
End With
End Sub

See also
DestinationLink Property (Page 3570)
Type Property (Page 3790)
SourceLink Property (Page 3765)
ObjectName Property (Page 3698)
SourceLink Object (Page 3431)
DestLink Object (Page 3316)

4326

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

AvailableDataLanguages Property
Description
Returns a listing of the available project languages.

Example:
The "AusgabetDataLanguages()" procedure outputs all the existing project languages together
with their language identifiers (as a decimal value):

Sub OutputDataLanguages()
'VBA388
Dim colDataLang As HMIDataLanguages
Dim objDataLang As HMIDataLanguage
Dim strLangList As String
Dim iCounter As Integer
'
'Save collection of datalanguages
'into variable "colDataLang"
Set colDataLang = Application.AvailableDataLanguages
iCounter = 1
'
'Get every languagename and the assigned ID
For Each objDataLang In colDataLang
With objDataLang
If 0 = iCounter Mod 3 Or 1 = iCounter Then
strLangList = strLangList & vbCrLf & .LanguageID & " " & .LanguageName
Else
strLangList = strLangList & " / " & .LanguageID & " " & .LanguageName
End If
End With
iCounter = iCounter + 1
Next objDataLang
MsgBox strLangList
End Sub

See also
LanguageName Property (Page 3644)
LanguageID Property (Page 3643)
How to assign help texts to menus and toolbars (Page 3033)
How to create menus in multiple languages (Page 3027)
Language-Dependent Configuration with VBA (Page 3018)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4327

VBA Reference
6.1 The object model of the Graphics Designer

Average Property
Description
TRUE, if the mean value is calculated based on the last 10 values. A value change is
conditional for calculation of a new mean value. The mean value is reset when you change a
picture. If only one value is available when you change the picture, the following mean value
is calculated: (5+0+0+0+0+0+0+0+0+0)/10=0,5.
BOOLEAN write-read access.

Example
The "BarGraphConfiguration()" procedure configures In this example, value averaging will be
activated:

Sub BarGraphConfiguration()
'VBA389
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.Average = True
End With
End Sub

See also
BarGraph Object (Page 3286)

Axe Property
Description
Defines or returns the axis for displaying the measured value. Value range from 0 to 2.

4328

Axis

Assigned Value

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the Y axis for displaying the measured value will be defined:

Sub HMI3DBarGraphConfiguration()
'VBA390
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Axe = 1
End With
End Sub

See also
3DBarGraph Object (Page 3267)

AxisSection Property
Description
Defines or returns the distance between two long axis sections. The information on the distance
is given in scale units and is dependent on the minimum and maximum values configured.

BarGraph Object (Minimum/Maximum Value: -5/5; AxisSection = 2)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4329

VBA Reference
6.1 The object model of the Graphics Designer

Example
The "BarGraphConfiguration()" procedure accesses the properties of the BarGraph object. In
this example the axis section will be set to "2".
Sub BarGraphConfiguration()
'VBA391
Dim objBar As HMIBarGraph
Set objBar = ActiveDocument.HMIObjects.AddHMIObject("Bar1",
"HMIBarGraph")
With objBar
.AxisSection = 2
End With
End Sub

See also
BarGraph Object (Page 3286)

6.1.8.2

BackBorderWidth Property
Description
Defines or returns the width of the 3D border in pixels. The value for the width is dependent
on the size of the object.
Slider
Defines or returns the width of the border in pixels. BackBorderWidth = 0 prevents the border
being displayed on the Slider object.

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the width of the 3D border will be set to "2".

Sub ButtonConfiguration()
'VBA392
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.BackBorderWidth = 2
End With
End Sub

4330

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
Slider object (Page 3428)
RoundButton Object (Page 3418)
GroupDisplay Object (Page 3350)
Button Object (Page 3293)

BackColor Property
Description
Defines or returns the background color for the object. LONG read-write access.
The background color is not displayed if "transparent" is defined as the fill pattern.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the background color will be set to "Yellow".

Sub RectangleConfiguration()
'VBA393
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BackColor = RGB(255, 255, 0)
End With
End Sub

See also
EllipseSegment Object (Page 3333)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4331

VBA Reference
6.1 The object model of the Graphics Designer
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GroupDisplay Object (Page 3350)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
Ellipse Object (Page 3327)
Document Object (Page 3319)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

BackColor2 Property
Description
Defines or returns the bar color for the display of the current value. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphConfiguration()" procedure configures In this example the bar color for
displaying the current value will be set to "Yellow":

Sub BarGraphConfiguration()
'VBA394
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.BackColor2 = RGB(255, 255, 0)
End With
End Sub

4332

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
BarGraph Object (Page 3286)

BackColor3 Property
Description
Defines or returns the color of the bar background. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphConfiguration()" procedure configures In this example the color of the bar
background will be set to "Blue":

Sub BarGraphConfiguration()
'VBA395
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.BackColor3 = RGB(0, 0, 255)
End With
End Sub

See also
BarGraph Object (Page 3286)

BackColor_Alarm.._Warning property
Description
Defines the color used for the background of one of the following states or message types:
Alarm
Warning
Tolerance
AS Process Control Error
AS Control System Fault

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4333

VBA Reference
6.1 The object model of the Graphics Designer
Operator request
OK
Simulation
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

BackColorBottom Property
Description
Defines or returns the color for the bottom/right part of the slider. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color of the bottom part of the slider will be set to "Blue":

Sub SliderConfiguration()
'VBA396
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.BackColorBottom = RGB(0, 0, 255)
End With
End Sub

See also
Slider object (Page 3428)

4334

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BackColorTop Property
Description
Defines or returns the color for the top/left part of the slider. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color of the top part of the slider will be set to "Yellow":

Sub SliderConfiguration()
'VBA397
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.BackColorTop = RGB(255, 255, 0)
End With
End Sub

See also
Slider object (Page 3428)

BackFillColor property
Description
Defines the color with which the background is filled at an advanced analog display.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4335

VBA Reference
6.1 The object model of the Graphics Designer

BackFillColor_OK property
Description
Defines the color with which the background is filled at the state "OK".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

BackFillColor_Simulation property
Description
Defines the color with which the background is filled at the "Simulation" state.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

BackFillStyle property
Description
Defines the pattern with which the background is filled at an advanced analog display.
There is a choice of 50 fill patterns. The fill pattern 0 "Solid" fills the object with the set
background color; the fill pattern 1 "Transparent" defines that neither a background nor a fill
pattern is displayed.

BackFillStyle_OK property
Description
Defines the pattern with which the background is displayed at the state "OK".
There is a choice of 50 fill patterns. The fill pattern 0 "Solid" fills the object with the set
background color; the fill pattern 1 "Transparent" defines that neither a background nor a fill
pattern is displayed.

4336

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BackFillStyle_Simulation property
Description
Defines the pattern with which the background is displayed at the "Simulation" state.
There is a choice of 50 fill patterns. The fill pattern 0 "Solid" fills the object with the set
background color; the fill pattern 1 "Transparent" defines that neither a background nor a fill
pattern is displayed.

BackFlashColorOff Property
Description
Defines or returns the color of the object background for the flash status "Off". LONG writeread access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "Off" will be set to "Yellow":

Sub RectangleConfiguration()
'VBA398
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BackFlashColorOff = RGB(255, 255, 0)
End With
End Sub

See also
BarGraph Object (Page 3286)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4337

VBA Reference
6.1 The object model of the Graphics Designer
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

BackFlashColorOn Property
Description
Defines or returns the color of the object background for the flash status "On". LONG writeread access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "On" will be set to "Blue":

Sub RectangleConfiguration()
'VBA399
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BackFlashColorOn = RGB(0, 0, 255)
End With
End Suba

4338

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
RoundButton Object (Page 3418)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

Background Property
Description
TRUE, when the background of the 3D-bar graph object should be visible. BOOLEAN writeread access.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the background will be set to "Transparent":

Sub HMI3DBarGraphConfiguration()
'VBA400
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Background = False
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4339

VBA Reference
6.1 The object model of the Graphics Designer

See also
3DBarGraph Object (Page 3267)

BackPictureAlignment property
Description
As the "Display type" attribute, defines the position and scaling for the background image of
the process picture.
normal
Stretched
(window)
Tiled
Stretched
(picture)

The background picture is centered in the original size. When opening the
picture in runtime, it remains in the location.
The background picture is scaled to the runtime window and process picture
of the larger of the two windows. In runtime, it is scaled to the size of the
runtime window and is scaled when you resize the picture.
Graphics Designer and process picture are exhibited with the picture in its
original size.
The background picture is scaled to the configured size of the process
picture. When opening the picture in runtime, it retains its size.

BackPictureName property
Description
Defines or returns the path and name of the file used as the background image in the process
picture.
Files of format EMF, WMF, DB, BMP, GIF, JPG, JPEG and ICO are suitable.
If no path is specified, the file is searched for in the subdirectory \GraCS. If you specify a
different path, a copy is created in the \GraCS directory.
Path specifications
The following path specification formats are possible:
Absolute: z.B. "C:\Siemens\WinCC\Icons\myIcon.ICO.
Relative: The starting folder for relative path specification is the "GraCS" folder of the current
project.
<global>: Refers to the installation path for WinCC. The path specification "<global>\Icons
\myIcon" is the same as the path specification under "Absolute".
<project>: Refers to the current project directory.

4340

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BarDepth Property
Description
Defines or returns the depth of the bar in pixels.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the bar depth will be set to "40":

Sub HMI3DBarGraphConfiguration()
'VBA401
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BarDepth = 40
End With
End Sub

See also
3DBarGraph Object (Page 3267)

BarHeight Property
Description
Defines or returns the height of the bar in pixels.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the bar height will be set to "60":

Sub HMI3DBarGraphConfiguration()
'VBA402
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BarHeight = 60
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4341

VBA Reference
6.1 The object model of the Graphics Designer

See also
3DBarGraph Object (Page 3267)

BarWidth Property
Description
Defines or returns the width of the bar in pixels.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the bar width will be set to "80":

Sub HMI3DBarGraphConfiguration()
'VBA403
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BarWidth = 80
End With
End Sub

See also
3DBarGraph Object (Page 3267)

BasePicReferenced Property
Description
TRUE, when the picture assigned in the object status display should be saved. Otherwise,
only the associated object reference is saved. BOOLEAN write-read access.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the picture assigned in the Status Display object is to be saved.

Sub StatusDisplayConfiguration()
'VBA404
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp

4342

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

.BasePicReferenced = True
End With
End Sub

See also
StatusDisplay Object (Page 3436)

BasePicTransColor Property
Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be set to
"transparent". LONG write-read access.
The color is only set to "Transparent" if the value of the "BasePicUseTransColor" property is
"True".
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the color "Yellow" will be set to "Transparent".

Sub StatusDisplayConfiguration()
'VBA405
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp
.BasePicTransColor = RGB(255, 255, 0)
.BasePicUseTransColor = True
End With
End Sub

See also
BasePicUseTransColor Property (Page 3508)
StatusDisplay Object (Page 3436)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4343

VBA Reference
6.1 The object model of the Graphics Designer

BasePicture Property
Description
Defines or returns the basic picture for the Status Display object.
The picture (*.BMP or *.DIB) must be located in the "GraCS" directory of the current project
so that it can be integrated.
In this context, the "BasePicReferenced" property defines whether the basic picture should be
saved together with the object status display or referenced.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the picture "Testpicture.BMP" will be used as the basic picture:

Sub StatusDisplayConfiguration()
'VBA406
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp
'
'To use this example copy a Bitmap-Graphic
'to the "GraCS"-Folder of the actual project.
'Replace the picturename "Testpicture.BMP" with the name of
'the picture you copied
.BasePicture = "Testpicture.BMP"
End With
End Sub

See also
BasePicReferenced Property (Page 3505)
StatusDisplay Object (Page 3436)

BasePicture property
Description
Specifies which picture is to be displayed for the currently selected status. Pictures with the
following formats can be inserted: EMF, WMF, BMP, GIF, JPG.
If no picture that you want to display is defined for a status, the symbol for the status display
is shown as a placeholder.

4344

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BasePicUseTransColor Property
Description
TRUE, when the configured color ("BasePicTransColor" property) of the bitmap objects should
be set to "transparent". BOOLEAN write-read access.

Example:
The "StatusDisplayConfiguration()" procedure accesses the properties of the Status Display.
In this example the color "Yellow" will be set to "Transparent":

Sub StatusDisplayConfiguration()
'VBA407
Dim objStatDisp As HMIStatusDisplay
Set objStatDisp = ActiveDocument.HMIObjects.AddHMIObject("Statusdisplay1",
"HMIStatusDisplay")
With objStatDisp
.BasePicTransColor = RGB(255, 255, 0)
.BasePicUseTransColor = True
End With
End Sub

See also
BasePicTransColor Property (Page 3506)
StatusDisplay Object (Page 3436)

BaseX Property
Description
Defines or returns for the 3DBarGraph object the horizontal distance in pixels between the
right-hand border of the bar and the left-hand border of the object field.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the horizontal distance will be set to "80".

Sub HMI3DBarGraphConfiguration()
'VBA408
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BaseX = 80

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4345

VBA Reference
6.1 The object model of the Graphics Designer

End With
End Sub

See also
3DBarGraph Object (Page 3267)

BaseY Property
Description
Defines or returns for the 3DBarGraph object the vertical distance in pixels between the lower
border of the bar and the upper border of the object field.

Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the vertical distance will be set to "100".

Sub HMI3DBarGraphConfiguration()
'VBA409
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.BaseY = 100
End With
End Sub

See also
3DBarGraph Object (Page 3267)

BinaryResultInfo Property
Description
Returns the BinaryResultInfo object.

Example:
An example showing how to use the BinaryResultInfo property can be found in this
documentation under the heading "BinaryResultInfo Object".

4346

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
BinaryResultInfo Object (Page 3291)

BitNotSetValue Property
Description
Defines or returns the value for the dynamic property if the specified bit of a configured tag is
not set.
To define which bit must be set in order to trigger a change of value, use the BitNumber
property.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned, the bit to be set will be defined and the associated property
values will be assigned to the "set"/"not set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA410
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.Trigger.VariableTriggers(1).CycleType = hmiVariableCycleType_5s
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

See also
BitNumber Property (Page 3510)
BitResultInfo Object (Page 3292)

BitNumber Property
Description
Defines or returns the bit whose status must change in order to trigger a change of value. The
tag used must be of the type BYTE, WORD or DWORD.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4347

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned, the bit to be set will be defined and the associated property
values will be assigned to the "set"/"not set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA411
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

See also
BitResultInfo Object (Page 3292)
VBA Reference (Page 3124)

BitPosition0..3 property
Description
Specifies the bit position of the selected tag for which the respective bit (0 to 3) of the status
value is used. The content is only evaluated when a tag is selected for the respective property
"BitSelect0..3". The tags are specified using "Process" and "Process1..3".
You can enter a value from "0" to "31". Each value can only be assigned once.

BitResultInfo Property
Description
Returns the BitResultInfo object.

Example:
An example showing how to use the BitResultInfo property can be found in this documentation
under the heading "BitResultInfo Object".

4348

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
BitResultInfo Object (Page 3292)

BitSelect0..3 property
Description
Specifies the status tag for which the respective (first to fourth) bit of the status value is
specified. The tags are specified using the properties "Process" and "Process1..3".
0

The respective bit of the status value is not evaluated. No status tag is used.

Status tag "Process" is used for the respective bit of the status value.

Status tag "Process1" is used for the respective bit of the status value.

Status tag "Process2" is used for the respective bit of the status value.

Status tag "Process3" is used for the respective bit of the status value.

BitSetValue Property
Description
Defines or returns the value for the dynamic property if the specified bit of a configured tag is
set.
To define which bit must be set in order to trigger a change of value, use the BitNumber
property.

Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog, a tag name will be assigned, the bit to be set will be defined and the associated property
values will be assigned to the "set"/"not set" states:

Sub AddDynamicDialogToCircleRadiusTypeBit()
'VBA412
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_B", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeBit
.BitResultInfo.BitNumber = 1
.BitResultInfo.BitSetValue = 40
.BitResultInfo.BitNotSetValue = 80
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4349

VBA Reference
6.1 The object model of the Graphics Designer

See also
BitNumber Property (Page 3510)
BitResultInfo Object (Page 3292)

Bold Property
Description
TRUE if the font attribute "Bold" is set for the language-dependent text in the object. BOOLEAN
write-read access.

Example:
Note
For this example to work, you must already have configured in the languages concerned.
The following example sets the font attributes of a button for French and English:

Sub ExampleForLanguageFonts()
'VBA413
Dim colLangFonts As HMILanguageFonts
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
objButton.Text = "Displaytext"
Set colLangFonts = objButton.LDFonts
'Set french fontproperties:
With colLangFonts.ItemByLCID(1036)
.Family = "Courier New"
.Bold = True
.Italic = False
.Underlined = True
.Size = 12
End With
'Set english fontproperties:
With colLangFonts.ItemByLCID(1033)
.Family = "Times New Roman"
.Bold = False
.Italic = True
.Underlined = False
.Size = 14
End With
End Sub

4350

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
Underlined Property (Page 3799)
Size Property (Page 3762)
Parent Property (Page 3708)
LanguageID Property (Page 3643)
Italic Property (Page 3636)
Family Property (Page 3587)
Application Property (Page 3484)
LanguageFont Object (Page 3365)

BorderBackColor Property
Description
Defines or returns the background color of the line for the object. LONG write-read access.
The background color is only visible if the BorderStyle property is set >0.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the background color for the line will be set to "Yellow":

Sub RectangleConfiguration()
'VBA415
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderBackColor = RGB(255, 255, 0)
End With
End Sub

See also
PieSegment Object (Page 3399)
BorderStyle Property (Page 3522)
TextList Object (Page 3441)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4351

VBA Reference
6.1 The object model of the Graphics Designer
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
IOField Object (Page 3361)
GraphicObject Object (Page 3345)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

BorderColor Property
Description
Defines or returns the line color for the object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the line color will be set to "Blue":

Sub RectangleConfiguration()
'VBA416

4352

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Dim objRectangle As HMIRectangle


Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderColor = RGB(0, 0, 255)
End With
End Sub

See also
GraphicObject Object (Page 3345)
TextList Object (Page 3441)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
IOField Object (Page 3361)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)

BorderColorBottom Property
Description
Defines or returns the color for the bottom right-hand part of the 3D-border. LONG write-read
access.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4353

VBA Reference
6.1 The object model of the Graphics Designer
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the 3D-border color will be defined:

Sub ButtonConfiguration()
'VBA417
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.BorderColorBottom = RGB(255, 0, 0)
.BorderColorTop = RGB(0, 0, 255)
End With
End Sub

See also
RoundButton Object (Page 3418)
Button Object (Page 3293)

BorderColorTop Property
Description
Defines or returns the color for the top left-hand part of the 3D-border. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "ButtonConfiguration()" procedure accesses the properties of the button. In this example
the 3D-border color will be defined:

Sub ButtonConfiguration()

4354

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'VBA418
Dim objButton As HMIButton
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("Button1", "HMIButton")
With objButton
.BorderColorBottom = RGB(255, 0, 0)
.BorderColorTop = RGB(0, 0, 255)
End With
End Sub

See also
RoundButton Object (Page 3418)
Button Object (Page 3293)

BorderEndStyle Property
Description
Defines or returns the line end style of the object. LONG read-write access.
Determination of Line End Style
Determine the line end type with the aid of a five-character hexadecimal value which you then
convert into its equivalent decimal value.

To determine the line ends for the object, go to the "Line End Style" window and proceed as
follows:
Left column: Configures the start of the line. Value range (from the top down) 0 to 6. The
start of the line corresponds to the first character in the hexadecimal value. In the
configuration shown, the value of the first character is "3".
Right Column: Configures the end of the line. Value range (from the top down) 0 to 6. The
line end corresponds to the fifth character in the hexadecimal value. In the configuration
shown, the value of the fifth character is "6".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4355

VBA Reference
6.1 The object model of the Graphics Designer
This gives a hexadecimal value of "60003". This corresponds to a decimal value of "393219",
which you then assign to the BorderEndStyle property.

Example:
The "LineConfiguration()" procedure accesses the properties of the line. In this example the
type of line end will be set to the configuration illustrated above:

Sub LineConfiguration()
'VBA419
Dim objLine As HMILine
Set objLine = ActiveDocument.HMIObjects.AddHMIObject("Line1", "HMILine")
With objLine
.BorderEndStyle = 393219
End With
End Sub

See also
PolyLine Object (Page 3405)
Line Object (Page 3373)

BorderFlashColorOff Property
Description
Defines or returns the color of the object lines for the flashing status "Off". LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "Off" will be set to "Black":

Sub RectangleConfiguration()
'VBA420
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle

4356

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

.BorderFlashColorOff = RGB(0, 0, 0)
End With
End Sub

See also
RoundButton Object (Page 3418)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

BorderFlashColorOn Property
Description
Defines or returns the color of the object lines for the flashing status "On". LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4357

VBA Reference
6.1 The object model of the Graphics Designer
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the color when the flash status is "On" will be set to "Red":

Sub RectangleConfiguration()
'VBA421
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderFlashColorOn = RGB(255, 0, 0)
End With
End Sub

See also
StaticText Object (Page 3433)
StatusDisplay Object (Page 3436)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
IOField Object (Page 3361)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

4358

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

BorderStyle Property
Description
Defines or returns the line style for the object. Value range from 0 to 4:
Line style

Assigned Value
0
1
2
3
4

Example:
The "RectangleConfiguration()" procedure accesses the properties of the rectangle. In this
example the line style will be set to "1":

Sub RectangleConfiguration()
'VBA422
Dim objRectangle As HMIRectangle
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
With objRectangle
.BorderStyle = 1
End With
End Sub

See also
IOField Object (Page 3361)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)
Rectangle Object (Page 3415)
Polygon Object (Page 3402)
PolyLine Object (Page 3405)
TextList Object (Page 3441)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4359

VBA Reference
6.1 The object model of the Graphics Designer
Line Object (Page 3373)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)
BarGraph Object (Page 3286)
3DBarGraph Object (Page 3267)

BorderWidth Property
Description
Defines or returns the line weight (in pixels) for the object.

Example:
in the following example the line weight of a newly added circle will be set to "2".

Sub CircleConfiguration()
'VBA423
Dim objCircle As IHMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1", "HMICircle")
With objCircle
.BorderWidth = 2
End With
End Sub

See also
IOField Object (Page 3361)
StatusDisplay Object (Page 3436)
StaticText Object (Page 3433)
Slider object (Page 3428)
TextList Object (Page 3441)
RoundRectangle Object (Page 3422)
RoundButton Object (Page 3418)

4360

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Rectangle Object (Page 3415)
PolyLine Object (Page 3405)
Polygon Object (Page 3402)
PieSegment Object (Page 3399)
OptionGroup Object (Page 3393)
Line Object (Page 3373)
GraphicObject Object (Page 3345)
EllipseSegment Object (Page 3333)
EllipseArc Object (Page 3330)
Ellipse Object (Page 3327)
CircularArc Object (Page 3303)
Circle Object (Page 3300)
CheckBox Object (Page 3297)
Button Object (Page 3293)

BottomConnectedObjectName Property
Description
Returns the name of the starting object to which the connector is Read only access.

Example:
An example showing how to use the BottomConnectedObjectName property can be found in
this documentation under the heading "ObjConnection Object".

See also
ObjConnection object (Page 3388)

BottomConnectedConnectionPointIndex Property
Description
Returns the connection point on the object to which the connector is connected.
Connection Point

Assigned Value

Up

Right

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4361

VBA Reference
6.1 The object model of the Graphics Designer
Connection Point

Assigned Value

Down

Left

Example:
An example showing how to use the BottomConnectedObjectName property can be found in
this documentation under the heading "ObjConnection Object".

See also
ObjConnection object (Page 3388)

BoxAlignment Property
Description
TRUE, when the fields are arranged aligned to the right. BOOLEAN write-read access.

Example:
The "CreateOptionGroup()" procedure creates the OptionGroup object with four option
buttons. Each option button is assigned the default name "myCustomText<Nummer>":

Sub CreateOptionGroup()
'VBA424
Dim objRadioBox As HMIOptionGroup
Dim iCounter As Integer
Set objRadioBox = ActiveDocument.HMIObjects.AddHMIObject("RadioBox_1", "HMIOptionGroup")
iCounter = 1
With objRadioBox
.Height = 100
.Width = 180
.BoxCount = 4
.BoxAlignment = False
For iCounter = 1 To .BoxCount
.index = iCounter
.Text = "CustomText" & .index
Next iCounter

4362

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

End With
End Sub

See also
BoxCount Property (Page 3526)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)

BoxCount Property
Description
Defines or returns the number of fields. Value range from 1 to 32.

Example:
The "CreateOptionGroup()" procedure creates the OptionGroup object with four option
buttons. Each option button is assigned the default name "myCustomText<Nummer>":

Sub CreateOptionGroup()
'VBA425
Dim objRadioBox As HMIOptionGroup
Dim iCounter As Integer
Set objRadioBox = ActiveDocument.HMIObjects.AddHMIObject("RadioBox_1", "HMIOptionGroup")
iCounter = 1
With objRadioBox
.Height = 100
.Width = 180
.BoxCount = 4
.BoxAlignment = True
For iCounter = 1 To .BoxCount
.index = iCounter
.Text = "CustomText" & .index
Next iCounter
End With
End Sub

See also
BoxAlignment Property (Page 3525)
OptionGroup Object (Page 3393)
CheckBox Object (Page 3297)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4363

VBA Reference
6.1 The object model of the Graphics Designer

BoxType Property
Description
Defines or returns the field type. Value range from 0 to 2.
Field type

Assigned Value

Edition

Input

I/O field

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the field type is configured as "Input":

Sub IOFieldConfiguration()
'VBA426
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.BoxType = 1
End With
End Sub

See also
IOField Object (Page 3361)

Button1..8MessageClasses
Description
Defines one or more message events in the group display for representing the respective
command button. This is done by entering the numbers of the bits in the collective value.
If you want to assign several message events, delimit the numbers with a comma. The order
of assignment defines the priority. If there is more than one selected event for one button, the
event that has been entered first is displayed.
The same event can be visualized simultaneously in several buttons.

4364

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Button1..8Width property
Description
Defines or returns for the "Group Display" object the width of the respective button in pixels.
When the "SameSize" property is set to "TRUE", all buttons are set to the same width.

Example
The "GroupDisplayConfiguration()" procedure accesses the properties of the Group Display.
In this example the width of button "1" is set to "50":

Sub GroupDisplayConfiguration()
'VBA427
Dim objGroupDisplay As HMIGroupDisplay
Set objGroupDisplay = ActiveDocument.HMIObjects.AddHMIObject("GroupDisplay1",
"HMIGroupDisplay")
With objGroupDisplay
.Button1Width = 50
End With
End Sub

See also
SameSize Property (Page 3747)
GroupDisplay Object (Page 3350)

ButtonColor Property
Description
Defines or returns the color of the slider for the Slider object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4365

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color of the slider will be set to "Yellow".

Sub SliderConfiguration()
'VBA431
Dim objSlider As HMISlider
Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.ButtonColor = RGB(255, 255, 0)
End With
End Sub

See also
Slider object (Page 3428)

6.1.8.3

Caption Property
Description
TRUE, when the application or picture window has a title bar in Runtime. BOOLEAN write-read
access.
The Caption property must be set to "True" if the intention is that the application window or
picture window shall have Maximize and Close buttons.

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will

Sub ApplicationWindowConfig()
'VBA432
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow",
"HMIApplicationWindow")
With objAppWindow
.Caption = True
.CloseButton = False
.Height = 200
.Left = 10
.MaximizeButton = True
.Moveable = False
.OnTop = True

4366

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

.Sizeable = True
.Top = 20
.Visible = True
.Width = 250
.WindowBorder = True
End With
End Sub

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

CaptionText Property
Description
Defines or returns the window title that will be displayed for the PictureWindow object in
Runtime.
The Caption property must be set to TRUE."

Example:
The "PictureWindowConfig" procedure accesses the properties of the picture window. In this
example the picture window will

Sub PictureWindowConfig()
'VBA433
Dim objPicWindow As HMIPictureWindow
Set objPicWindow = ActiveDocument.HMIObjects.AddHMIObject("PicWindow1", "HMIPictureWindow")
With objPicWindow
.AdaptPicture = False
.AdaptSize = False
.Caption = True
.CaptionText = "Picturewindow in runtime"
.OffsetLeft = 5
.OffsetTop = 10
'Replace the picturename "Test.PDL" with the name of
'an existing document from your "GraCS"-Folder of your active project
.PictureName = "Test.PDL"
.ScrollBars = True
.ServerPrefix = ""
.TagPrefix = "Struct."
.UpdateCycle = 5
.Zoom = 100
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4367

VBA Reference
6.1 The object model of the Graphics Designer

See also
PictureWindow Object (Page 3396)

CBackColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In" which color the background
of the value to be displayed assumes for flashing status "Off" (CBackColorOff) or "On"
(CBackColorOn).
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CBackFlash property
Description
Specifies for the selected message type and status "Came In" whether the background of the
value to be displayed flashes when a message is received.

CheckAlarmHigh Property
Description
TRUE if the "Alarm High" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties AlarmHigh, ColorAlarmHigh and TypeAlarmHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50".

Sub BarGraphLimitConfiguration()
'VBA434
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph

4368

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'Set analysis to absolute


.TypeAlarmHigh = False
'Activate monitoring
.CheckAlarmHigh = True
'Set barcolor to "yellow"
.ColorAlarmHigh = RGB(255, 255, 0)
'Set upper limit to "50"
.AlarmHigh = 50
End With
End Sub

See also
TypeAlarmHigh Property (Page 3791)
ColorAlarmHigh Property (Page 3542)
AlarmHigh Property (Page 3478)
BarGraph Object (Page 3286)

CheckAlarmLow Property
Description
TRUE if the "Alarm Low" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties AlarmLow, ColorAlarmLow and TypeAlarmLow.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10".

Sub BarGraphLimitConfiguration()
'VBA435
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set barcolor to "yellow"
.ColorAlarmLow = RGB(255, 255, 0)
'Set lower limit to "10"
.AlarmLow = 10
End With

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4369

VBA Reference
6.1 The object model of the Graphics Designer

End Sub

See also
ColorAlarmLow Property (Page 3543)
TypeAlarmLow Property (Page 3791)
AlarmLow Property (Page 3479)
BarGraph Object (Page 3286)

Checked Property
Description
TRUE if a check mark is to appear in front of the user-defined menu entry. BOOLEAN writeread access.

Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"): The first menu entry is also marked with a
tick:

Sub CreateMenuItem()
'VBA436
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
Rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete Circles")
With objMenu.MenuItems
.Item("DeleteAllRectangles").Checked = True
End With
End Sub

See also
MenuItems Property (Page 3688)
Configuring Menus and Toolbars (Page 3020)

4370

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

CheckLimitHigh4 Property
Description
TRUE if the "Reserve 4" high limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitHigh4, ColorLimitHigh4 and TypeLimitHigh4.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "70".

Sub BarGraphLimitConfiguration()
'VBA437
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh4 = False
'Activate monitoring
.CheckLimitHigh4 = True
'set barcolor to "red"
.ColorLimitHigh4 = RGB(255, 0, 0)
'Set upper limit to "70"
.LimitHigh4 = 70
End With
End Sub

See also
TypeLimitHigh4 Property (Page 3792)
LimitHigh4 Property (Page 3659)
ColorLimitHigh4 Property (Page 3545)
BarGraph Object (Page 3286)

CheckLimitHigh5 Property
Description
TRUE if the "Reserve 5" high limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitHigh5, ColorLimitHigh5 and TypeLimitHigh5.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4371

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "80".

Sub BarGraphLimitConfiguration()
'VBA438
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh5 = False
'Activate monitoring
.CheckLimitHigh5 = True
'set barcolor to "black"
.ColorLimitHigh5 = RGB(0, 0, 0)
'Set upper limit to "80"
.LimitHigh5 = 80
End With
End Sub

See also
ColorLimitHigh5 Property (Page 3546)
TypeLimitHigh5 Property (Page 3793)
LimitHigh4 Property (Page 3659)
BarGraph Object (Page 3286)

CheckLimitLow4 Property
Description
TRUE if the "Reserve 4" low limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitLow4, ColorLimitLow4 and TypeLimitLow4.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "5".

Sub BarGraphLimitConfiguration()
'VBA439

4372

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Dim objBarGraph As HMIBarGraph


Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow4 = False
'Activate monitoring
.CheckLimitLow4 = True
'Set barcolor to "green"
.ColorLimitLow4 = RGB(0, 255, 0)
'set lower limit to "5"
.LimitLow4 = 5
End With
End Sub

See also
TypeLimitLow4 Property (Page 3794)
LimitLow4 Property (Page 3661)
ColorLimitLow4 Property (Page 3547)
BarGraph Object (Page 3286)

CheckLimitLow5 Property
Description
TRUE if the "Reserve 5" low limit value of the bar graph object is to be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties LimitLow5, ColorLimitLow5 and TypeLimitLow5.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "0".

Sub BarGraphLimitConfiguration()
'VBA440
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow5 = False
'Activate monitoring
.CheckLimitLow5 = True
'Set barcolor to "white"
.ColorLimitLow5 = RGB(255, 255, 255)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4373

VBA Reference
6.1 The object model of the Graphics Designer

'set lower limit to "0"


.LimitLow5 = 0
End With
End Sub

See also
TypeLimitLow5 Property (Page 3795)
LimitLow5 Property (Page 3661)
ColorLimitLow5 Property (Page 3548)
BarGraph Object (Page 3286)

CheckToleranceHigh Property
Description
TRUE if the "Tolerance High" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties ToleranceHigh, ColorToleranceHigh and TypeToleranceHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "45".

Sub BarGraphLimitConfiguration()
'VBA441
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceHigh = False
'Activate monitoring
.CheckToleranceHigh = True
'Set barcolor to "yellow"
.ColorToleranceHigh = RGB(255, 255, 0)
'Set upper limit to "45"
.ToleranceHigh = 45
End With
End Sub

4374

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
TypeToleranceHigh Property (Page 3795)
ToleranceHigh Property (Page 3782)
ColorToleranceHigh Property (Page 3549)
BarGraph Object (Page 3286)

CheckToleranceLow Property
Description
TRUE if the "Tolerance Low" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties ToleranceLow, ColorToleranceLow and TypeToleranceLow.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "15".

Sub BarGraphLimitConfiguration()
'VBA442
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceLow = False
'Activate monitoring
.CheckToleranceLow = True
'Set barcolor to "yellow"
.ColorToleranceLow = RGB(255, 255, 0)
'Set lower limit to "15"
.ToleranceLow = 15
End With
End Sub

See also
BarGraph Object (Page 3286)
TypeToleranceLow Property (Page 3796)
ToleranceLow Property (Page 3782)
ColorToleranceLow Property (Page 3550)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4375

VBA Reference
6.1 The object model of the Graphics Designer

CheckWarningHigh Property
Description
TRUE if the "Warning High" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties WarningHigh, ColorWarningHigh and TypeWarningHigh.

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75".

Sub BarGraphLimitConfiguration()
'VBA443
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor to "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit to "75"
.WarningHigh = 75
End With
End Sub

See also
WarningHigh Property (Page 3879)
TypeWarningHigh Property (Page 3797)
ColorWarningHigh Property (Page 3552)
BarGraph Object (Page 3286)

CheckWarningLow Property
Description
TRUE if the "Warning Low" limit value is being monitored for the BarGraph object. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation are defined
via the properties WarningLow, ColorWarningLow and TypeWarningLow.

4376

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12".

Sub BarGraphLimitConfiguration()
'VBA444
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True
'Set barcolor to "magenta"
.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit to "12"
.WarningLow = 12
End With
End Sub

See also
WarningLow Property (Page 3880)
TypeWarningLow Property (Page 3798)
ColorWarningLow Property (Page 3553)
BarGraph Object (Page 3286)

ClearOnError Property
Description
TRUE if the entry in the I/O field is automatically deleted when the input is incorrect. BOOLEAN
write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the I/O field is to be cleared when the input is incorrect:

Sub IOFieldConfiguration()
'VBA445
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.ClearOnError = True

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4377

VBA Reference
6.1 The object model of the Graphics Designer

End With
End Sub

See also
IOField Object (Page 3361)

ClearOnNew Property
Description
TRUE if the entry in the I/O field is deleted as soon as the I/O field gets the focus. BOOLEAN
write-read access.

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the entry in the I/O field is deleted as soon as the field gets the focus:

Sub IOFieldConfiguration()
'VBA446
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
With objIOField
.ClearOnNew = True
End With
End Sub

See also
IOField Object (Page 3361)

CloseButton Property
Description
TRUE if the ApplicationWindow and PictureWindow objects possess a "Close" button in
Runtime. BOOLEAN write-read access.

4378

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will have a "Close" button in Runtime:

Sub ApplicationWindowConfig()
'VBA447
Dim objAppWindow As HMIApplicationWindow
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow1",
"HMIApplicationWindow")
With objAppWindow
.CloseButton = True
End With
End Sub

See also
PictureWindow Object (Page 3396)
ApplicationWindow Object (Page 3284)

CollectValue property
Description
The CollectValue property specifies as an initial value the current status of the active message
classes in each case.
The "Relevant" property has to have the value "TRUE" so that the advanced analog display
is taken into account when forming the group display .

ColorAlarmHigh Property
Description
Defines or returns the bar color for the "Alarm High" limit value. LONG write-read access.
The "CheckAlarmHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4379

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "50 " and the bar color will change to Red.

Sub BarGraphLimitConfiguration()
'VBA449
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeAlarmHigh = False
'Activate monitoring
.CheckAlarmHigh = True
'Set barcolor to "red"
.ColorAlarmHigh = RGB(255, 0, 0)
'Set upper limit to "50"
.AlarmHigh = 50
End With
End Sub

See also
CheckAlarmHigh Property (Page 3531)
BarGraph Object (Page 3286)

ColorAlarmLow Property
Description
Defines or returns the bar color for the "Alarm Low" limit value. LONG write-read access.
The "CheckAlarmLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

4380

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "10 " and the bar color will change to Red.

Sub BarGraphLimitConfiguration()
'VBA450
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeAlarmLow = False
'Activate monitoring
.CheckAlarmLow = True
'Set barcolor to "red"
.ColorAlarmLow = RGB(255, 0, 0)
'Set lower limit to "10"
.AlarmLow = 10
End With
End Sub

See also
CheckAlarmLow Property (Page 3532)
BarGraph Object (Page 3286)

ColorBottom Property
Description
Defines or returns the color for the bottom/right stop of the slider object. LONG write-read
access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color for the lower/right view will be set to "Red":

Sub SliderConfiguration()
'VBA451

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4381

VBA Reference
6.1 The object model of the Graphics Designer

Dim objSlider As HMISlider


Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")
With objSlider
.ColorBottom = RGB(255, 0, 0)
End With
End Sub

See also
Slider object (Page 3428)

ColorChangeType Property
Description
TRUE if a color change in the BarGraph object (for instance when a limit value is reached) is
to take place segment by segment. If set to FALSE, it defines the change of color for the entire
bar. BOOLEAN write-read access.

Example:
The "BarGraphLimitConfiguration()" procedure configures In this example the color change
will apply to the whole bar:

Sub BarGraphLimitConfiguration()
'VBA452
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
.ColorChangeType = False
End With
End Sub

See also
BarGraph Object (Page 3286)

ColorLimitHigh4 Property
Description
Defines or returns the color for the "Reserve 4" upper limit value. LONG write-read access.
The "CheckLimitHigh4" property must have been set to TRUE if the bar color should change
on reaching the limit value.

4382

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "70 " and the bar color will change to Red.

Sub BarGraphLimitConfiguration()
'VBA453
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh4 = False
'Activate monitoring
.CheckLimitHigh4 = True
'Set barcolor to "red"
.ColorLimitHigh4 = RGB(255, 0, 0)
'Set upper limit to "70"
.LimitHigh4 = 70
End With
End Sub

See also
CheckLimitHigh4 Property (Page 3534)
BarGraph Object (Page 3286)

ColorLimitHigh5 Property
Description
Defines or returns the color for the "Reserve 5" upper limit value. LONG write-read access.
The "CheckLimitHigh5" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4383

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "80" and the bar color will change to "Black".

Sub BarGraphLimitConfiguration()
'VBA454
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitHigh5 = False
'Activate monitoring
.CheckLimitHigh5 = True
'Set barcolor to "black"
.ColorLimitHigh5 = RGB(0, 0, 0)
'Set upper limit to "80"
.LimitHigh5 = 80
End With
End Sub

See also
CheckLimitHigh5 Property (Page 3534)
BarGraph Object (Page 3286)

ColorLimitLow4 Property
Description
Defines or returns the color for the "Reserve 4" lower limit value. LONG write-read access.
The "CheckLimitLow4" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

4384

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "5" and the bar color will change to "Green".

Sub BarGraphLimitConfiguration()
'VBA455
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow4 = False
'Activate monitoring
.CheckLimitLow4 = True
'Set barcolor to "green"
.ColorLimitLow4 = RGB(0, 255, 0)
'Set lower limit to "5"
.LimitLow4 = 5
End With
End Sub

See also
CheckLimitLow4 Property (Page 3535)
BarGraph Object (Page 3286)

ColorLimitLow5 Property
Description
Defines or returns the color for the "Reserve 5" lower limit value. LONG write-read access.
The "CheckLimitLow5" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4385

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "0" and the bar color will change to "White".

Sub BarGraphLimitConfiguration()
'VBA456
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeLimitLow5 = False
'Activate monitoring
.CheckLimitLow5 = True
'Set barcolor to "white"
.ColorLimitLow5 = RGB(255, 255, 255)
'Set lower limit to "0"
.LimitLow5 = 0
End With
End Sub

See also
CheckLimitLow5 Property (Page 3536)
BarGraph Object (Page 3286)

ColorToleranceHigh Property
Description
Defines or returns the color for the "Tolerance High" high limit value. LONG write-read access.
The "CheckToleranceHigh" property must have been set to TRUE if the bar color should
change on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

4386

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "45" and the bar color will change to "Yellow".

Sub BarGraphLimitConfiguration()
'VBA457
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceHigh = False
'Activate monitoring
.CheckToleranceHigh = True
'Set barcolor to "yellow"
.ColorToleranceHigh = RGB(255, 255, 0)
'Set upper limit to "45"
.ToleranceHigh = 45
End With
End Sub

See also
CheckToleranceHigh Property (Page 3537)
BarGraph Object (Page 3286)

ColorToleranceLow Property
Description
Defines or returns the color for the "Tolerance Low" low limit value. LONG write-read access.
The "CheckToleranceLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4387

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12" and the bar color will change to "Yellow".

Sub BarGraphLimitConfiguration()
'VBA458
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeToleranceLow = False
'Activate monitoring
.CheckToleranceLow = True
'Set barcolor to "yellow"
.ColorToleranceLow = RGB(255, 255, 0)
'Set lower limit to "15"
.ToleranceLow = 15
End With
End Sub

See also
CheckToleranceLow Property (Page 3538)
BarGraph Object (Page 3286)

ColorTop Property
Description
Defines or returns the color for the top/left stop of the slider object. LONG write-read access.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "SliderConfiguration()" procedure accesses the properties of the slider. In this example
the color for the upper/left view will be set to "Orange":

Sub SliderConfiguration()
'VBA459
Dim objSlider As HMISlider

4388

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Set objSlider = ActiveDocument.HMIObjects.AddHMIObject("SliderObject1", "HMISlider")


With objSlider
.ColorTop = RGB(255, 128, 0)
End With
End Sub

See also
Slider object (Page 3428)

ColorWarningHigh Property
Description
Defines or returns the color for the "Warning High" high limit value. LONG write-read access.
The "CheckWarningHigh" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75" and the bar color will change to "Red".

Sub BarGraphLimitConfiguration()
'VBA460
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor to "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit to "75"
.WarningHigh = 75
End With
End Sub

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4389

VBA Reference
6.1 The object model of the Graphics Designer

See also
CheckWarningHigh Property (Page 3539)
BarGraph Object (Page 3286)

ColorWarningLow Property
Description
Defines or returns the color for the "Warning Low" low limit value. LONG write-read access.
The "CheckWarningLow" property must have been set to TRUE if the bar color should change
on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)

Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12" and the bar color will change to "Magenta".

Sub BarGraphLimitConfiguration()
'VBA461
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis to absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True
'Set barcolor to "magenta"
.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit to "12"
.WarningLow = 12
End With
End Sub

See also
CheckWarningLow Property (Page 3539)
BarGraph Object (Page 3286)

4390

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

CommonVBSCode Property
Description
Defines the higher-level common declaration section of the actions for the active picture or
returns it.
The action editor of the Graphics Designer is used to configure actions at events and
properties. In the declaration section of the actions, you can declare tags for a process image
as well as create functions and procedures. In Runtime, each VBS action can access these
tags, functions and procedures if the picture is active.
If you set "CommonVBSCode", the string is copied to the "Event" and "Property" declaration
sections in the action editor. Any code there is overwritten. Therefore, set "CommonVBSCode"
first before setting the subordinate declaration sections with "CommonVBSEventArea" or
"CommonVBSPropertyArea".

Example
In the following example, a tag that is common to all picture objects is declared in the active
picture. The common declaration section is then output :

Sub DefineTagInActiveDocument
ActiveDocument.CommonVBSCode = "DIM actionIsdone" & vbCrLf
MsgBox ActiveDocument.CommonVBSCode
End Sub

See also
Document Object (Page 3319)

CommonVBSEventArea property
Description
Defines the "Event" declaration section of the actions for the active picture or returns it.
The action editor of the Graphics Designer is used to configure actions, for example, at events.
To this purpose, you can declare tags for a process image as well as create functions and
procedures in the "Event" declaration section of the actions. In Runtime each VBS action that
was configured for an event can access these tags, functions and procedures if the picture is
active.
If you set "CommonVBSEventArea", the string is copied to the "Event" declaration section in
the action editor. Any code there is overwritten. Therefore, first read the code set, for example
with "CommonVBSCode" before you set the declaration section with
"CommonVBSEventArea".

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4391

VBA Reference
6.1 The object model of the Graphics Designer

Example
In the following example, two tags are declared in the active picture. The "Event" declaration
section is the output:

Sub DefineTagInActiveDocument
ActiveDocument.CommonVBSCode = "DIM actionIsdone" & vbCrLf
ActiveDocument.CommonVBSEventArea = ActiveDocument.CommonVBSEventArea & "DIM
"eventHasOccurred"
MsgBox ActiveDocument.CommonVBSEventArea
End Sub

CommonVBSPropertyArea property
Description
Defines the "Property" declaration section of the actions for the active picture or returns it.
The action editor of the Graphics Designer is used to configure actions for example at
properties. To this purpose you can declare tags for a process image as well as create functions
and procedures in the "Property" declaration section of the actions. In Runtime each VBS
action that was configured for a property can access these tags, functions and procedures if
the picture is active.
If you set "CommonVBSPropertyArea", the string is copied to the "Property" declaration section
in the action editor. Any code there is overwritten. Therefore, first read the code set, for example
with "CommonVBSCode" before you set the declaration section with
"CommonVBSPropertyArea".

Example
In the following example, two tags are declared in the active picture. The "Property" declaration
section is then output:

Sub DefineTagInActiveDocument
ActiveDocument.CommonVBSCode = "DIM actionIsdone" & vbCrLf
ActiveDocument CommonVBSPropertyArea = ActiveDocument.CommonVBSPropertyArea & "DIM
propertyIsChanged"
MsgBox ActiveDocument.CommonVBSPropertyArea
End Sub

CommandLine Property
Description
Returns the start parameter as a string if the application is opened via Start>Execute
"Grafexe.exe start parameter". Read only access.

4392

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In this example a message containing the start parameter is output on opening the document.

Sub Document_Opened(CancelForwarding As Boolean)


'VBA462
MsgBox Application.Commandline
End Sub

See also
Application Object (Page 3282)

Compiled Property
Description
TRUE if the source code of a C script or VB script was successfully compiled. BOOLEAN read
access.

Example:
In the following example a button and a circle will be inserted in the active picture. In Runtime
the radius of the circle will enlarge every time you click the button. A VB script will be used for
this purpose:

Sub IncreaseCircleRadiusWithVBScript()
'VBA463
Dim objButton As HMIButton
Dim objCircleA As HMICircle
Dim objEvent As HMIEvent
Dim objVBScript As HMIScriptInfo
Dim strCode As String
strCode = "Dim objCircle" & vbCrLf & "Set objCircle = "
strCode = strCode & "hmiRuntime.ActiveScreen.ScreenItems(""CircleVB"")"
strCode = strCode & vbCrLf & "objCircle.Radius = objCircle.Radius + 5"
Set objCircleA = ActiveDocument.HMIObjects.AddHMIObject("CircleVB", "HMICircle")
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
With objCircleA
.Top = 100
.Left = 100
End With
With objButton
.Top = 10
.Left = 10
.Width = 200
.Text = "Increase Radius"
End With
'On every mouseclick the radius will be increased:

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4393

VBA Reference
6.1 The object model of the Graphics Designer

Set objEvent = objButton.Events(1)


Set objVBScript = objButton.Events(1).Actions.AddAction(hmiActionCreationTypeVBScript)
objVBScript.SourceCode = strCode
Select Case objVBScript.Compiled
Case True
MsgBox "Compilation OK!"
Case False
MsgBox "Errors by compilation!"
End Select
End Sub

See also
SourceCode Property (Page 3766)
ScriptInfo Object (Page 3424)

ConfigurationFileName Property
Description
Returns the file name and full path of the configuration file for the open project. STRING read
access.

Example:
The "ShowConfigurationFileName() procedure outputs the configuration file path for the
current picture:
Sub ShowConfigurationFileName()
'VBA464
MsgBox ActiveDocument.Application.ConfigurationFileName
End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)

4394

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ConnectionPoints property
Description
Returns the number of connection points of an object.

Example: Number of connection points of a rectangle


In this example, a rectangle is inserted and the number of connection points is output:

Sub CountConnectionPoints()
'VBA229
Dim objRectangle As HMIRectangle
Dim objConnPoints As HMIConnectionPoints
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("Rectangle1", "HMIRectangle")
Set objConnPoints = ActiveDocument.HMIObjects("Rectangle1").ConnectionPoints
MsgBox "Rectangle1 has " & objConnPoints.Count & " connectionpoints."
End Sub

ConnectorObjects property
Description
Only used internally.

See also
3DBarGraph Object (Page 3267)
ActiveXControl Object (Page 3273)
AdvancedAnalogDisplay object (Page 3274)
AdvancedStateDisplay object (Page 3278)
ApplicationWindow Object (Page 3284)
BarGraph Object (Page 3286)
Button Object (Page 3293)
CheckBox Object (Page 3297)
Circle Object (Page 3300)
CircularArc Object (Page 3303)
ComboBox object (Page 3306)
CustomizedObject Object (Page 3310)
DataSetObj object (Page 3315)
DotNetControl object (Page 3324)

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4395

VBA Reference
6.1 The object model of the Graphics Designer
Ellipse Object (Page 3327)
EllipseArc Object (Page 3330)
EllipseSegment Object (Page 3333)
FaceplateObject object (Page 3339)
GraphicObject Object (Page 3345)
Group Object (Page 3348)
GroupDisplay Object (Page 3350)
IOField Object (Page 3361)
Line Object (Page 3373)
ListBox object (Page 3375)
MultiLineEdit object (Page 3385)
ObjConnection object (Page 3388)
OLEObject Object (Page 3391)
OptionGroup Object (Page 3393)
PictureWindow Object (Page 3396)
PieSegment Object (Page 3399)
Polygon Object (Page 3402)
PolyLine Object (Page 3405)
Rectangle Object (Page 3415)
RoundButton Object (Page 3418)
RoundRectangle Object (Page 3422)
Slider object (Page 3428)
StaticText Object (Page 3433)
StatusDisplay Object (Page 3436)
TextList Object (Page 3441)
TubeArcObject object (Page 3453)
TubeDoubleTeeObject object (Page 3455)
TubePolyline object (Page 3457)
TubeTeeObject object (Page 3459)
WPFControl object (Page 3469)

4396

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

ConnectorType property
Description
Defines the type of connector:
Automatic

Both objects are connected by a polyline made up of horizontal and vertical parts.

Simple

Both objects are connected by a straight line between the connecting points.

ControlType property
Description
Returns the name range of the control.

CopyPasteSettings property
Description
Only used internally.

See also
Application Object (Page 3282)

CornerRadius property
Description
Defines the rounding radius of the rectangle which enclose objects in the advanced analog
display. The values are defined in pixels.
The range of values which can be displayed for the corner radius depends on the values set
for the "height" and "width" properties. The maximum corner radius value which can be
displayed is equivalent to 50% of the lower one of the "height" or "width" values. The maximum
value is used if higher values are entered.

Count Property
Description
Returns the number of elements in the specified listing. LONG read access

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4397

VBA Reference
6.1 The object model of the Graphics Designer

Example:
In the following example a new picture will be created and a pair of objects will be inserted.
The number of inserted objects will be output at the end:

Sub ObjectsInActiveDocument()
'VBA465
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objDocument As Document
Set objDocument = Application.Documents.Add(hmiOpenDocumentTypeVisible)
Dim iIndex As Integer
iIndex = 1
For iIndex = 1 To 5
Set objCircle = objDocument.HMIObjects.AddHMIObject("Circle" & iIndex, "HMICircle")
Set objRectangle = objDocument.HMIObjects.AddHMIObject("Rectangle" & iIndex,
"HMIRectangle")
With objCircle
.Top = (10 * iIndex)
.Left = (10 * iIndex)
End With
With objRectangle
.Top = ((10 * iIndex) + 50)
.Left = (10 * iIndex)
End With
Next iIndex
MsgBox "There are " & objDocument.HMIObjects.Count & " objects in the document"
End Sub

See also
VariableTriggers Object (Listing) (Page 3465)
Views Object (Listing) (Page 3468)
VariableStateValues Object (Listing) (Page 3462)
ToolbarItems Object (Listing) (Page 3450)
Toolbars Object (Listing) (Page 3446)
SymbolLibraries Object (Listing) (Page 3439)
SelectedObjects object (Listing) (Page 3426)
Properties Object (Listing) (Page 3408)
HMIObjects Object (Listing) (Page 3359)
MenuItems Object (Listing) (Page 3384)
Menus Object (Listing) (Page 3380)
Layers Object (Listing) (Page 3371)
LanguageTexts Object (Listing) (Page 3369)
LanguageFonts Object (Listing) (Page 3366)

4398

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer
GroupedObjects Object (Listing) (Page 3353)
FolderItems Object (Listing) (Page 3343)
Events Object (Listing) (Page 3337)
Documents Object (Listing) (Page 3322)
HMIDefaultObjects Object (Listing) (Page 3354)
DataLanguages Object (Listing) (Page 3314)
ConnectionPoints Object (Listing) (Page 3308)
AnalogResultInfos Object (Listing) (Page 3281)
Actions Object (Listing) (Page 3271)

CQBackColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In Acknowledged" which color
the background of the value to be displayed assumes for flashing status "Off" (CBackColorOff)
or "On" (CBackColorOn) when the arrival of a message is acknowledged..
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CQBackFlash property
Description
Specifies for the selected message type and status "Came In Acknowledged" whether the
background of the value to be displayed flashes when the arrival of a message is
acknowledged.

CQTextColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In Acknowledged" which color
the text of the value to be displayed assumes for flashing status "Off" (CTextColorOff) or "On"
(CTextColorOn) when the arrival of a message is acknowledged..
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 06/2014, A5E34329928-AA

4399

VBA Reference
6.1 The object model of the Graphics Designer
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CQTextFlash property
Description
Specifies for the selected message type and status "Came In Acknowledged" whether the
background of the text to be displayed flashes when the arrival of a message is acknowledged.

CTextColorOff..ColorOn property
Description
Specifies for the selected message type and the state "Came In" which color the text of the
value to be displayed assumes for flashing status "Off" (CTextColorOff) or "On"
(CTextColorOn).
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0).

CTextFlash property
Description
Specifies for the selected message type and status "Came In" whether the text of the value to
be displayed flashes when a message is received.

CurrentDataLanguage Property
Description
Defines the project language or returns the language identifier as a decimal value. LONG readwrite access.

Example:
The "ShowDataLanguage()" procedure outputs the currently set project language:

Sub ShowDataLanguage()

4400

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

'VBA466
MsgBox Application.CurrentDataLanguage
End Sub

See also
Application Property (Page 3484)
DataLanguageChanged Event (Page 3141)
Language-Dependent Configuration with VBA (Page 3018)

CurrentDesktopLanguage Property
Description
Returns the language identifier of the currently set user interface language as a decimal value.
LONG read access.

Example:
The "ShowDesktopLanguage()" procedure outputs the currently set user interface language:

Sub ShowDesktopLanguage()
'VBA467
MsgBox Application.CurrentDesktopLanguage
End Sub

See also
Application Property (Page 3484)
Application Object (Page 3282)
DesktopLanguageChanged event (Page 3142)
Language-Dependent Configuration with VBA (Page 3018)

CursorControl Property
Description
TRUE, when Alpha Cursor mode is activated, the cursor skips to the next field in the TAB
sequence after exiting the field. BOOLEAN write-read access.
The CursorMode property must be set to TRUE.

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

4401

VBA Reference
6.1 The object model of the Graphics Designer

Example:
The "IOFieldConfiguration()" procedure accesses the properties of the I/O field. In this example
the cursor will skip into the next field when another field is exited. For this to work, the Cursor
mode property must first be set to TRUE.

Sub IOFieldConfiguration()
'VBA468
Dim objIOField As HMIIOField
Set objIOField = ActiveDocument.HMIObjects.AddHMIObject("IOField1", "HMIIOField")
Application.ActiveDocument.CursorMode = True
With objIOField
.CursorControl = True
End With
End Sub

See also
TabOrderAlpha Property (Page 3771)
TabOrderSwitch Property (Page 3774)
CursorMode Property (Page 3565)
ActiveDocument Property (Page 3472)
TextList Object (Page 3441)
IOField Object (Page 3361)

CursorMode Property
Description
TRUE if the "Alpha Cursor" mode is to be activated. FALSE if the "Tab order" mode is to be
activated. BOOLEAN write-read access.

Example:
The "ActiveDocumentConfiguration()" procedure accesses the properties of the current picture
in the Graphics Designer. In this example the "Alpha Cursor" mode will be activated:

Sub ActiveDocumentConfiguration()
'VBA469
Application.ActiveDocument.CursorMode = True
End Sub

4402

WinCC: Scripting (VBS, ANSI-C, VBA)


System Manual, 06/2014, A5E34329928-AA

VBA Reference
6.1 The object model of the Graphics Designer

See also
CursorControl Property (Page 3564)
ActiveDocument Property (Page 3472)
Documents Object (Listing) (Page 3322)

CustomMenus Property
Description
Returns a listing of the available user-defined menus.

Example:
The "ShowCustomMenuInformation()" procedure outputs the Key and Label of all user-defined
menus in the current picture:

Sub ShowCustomMenuInformation()
'VBA470
Dim strKey As String
Dim strLabel As String
Dim strOutput As String
Dim iIndex As Integer
For iIndex = 1 To ActiveDocument.CustomMenus.Count
strKey = ActiveDocument.CustomMenus(iIndex).Key
strLabel = ActiveDocument.CustomMenus(iIndex).Label
strOutput = strOutput & vbCrLf & "Key: " & strKey & " Label: " & strLabel
Next iIndex
If 0 = ActiveDocument.CustomMenus.Count Then
strOutput = "There are no custommenus for the document created."
End If
MsgBox strOutput
End Sub

See also
Applica

You might also like