0% found this document useful (0 votes)
41 views2,810 pages

WinCC Programming en-US en-US

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2,810 pages

WinCC Programming en-US en-US

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2810

VBS for Creating

Procedures and Actions 1


ANSI-C for Creating
Functions and Actions 2
VBA for Automated
SIMATIC HMI Configuration 3

WinCC V8.0
WinCC: Scripting (VBS, ANSI-C,
VBA)

System Manual

Print of the Online Help

09/2023
A5E52671436-AB
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 A5E52671436-AB Copyright © Siemens AG 2023.


Digital Industries Ⓟ 09/2023 Subject to change All rights reserved
Postfach 48 48
90026 NÜRNBERG
GERMANY
Table of contents

1 VBS for Creating Procedures and Actions ............................................................................................ 11


1.1 VBS for creating procedures and actions ............................................................................. 11
1.2 Using Visual Basic Script in WinCC ...................................................................................... 12
1.3 Modules and Procedures .................................................................................................... 16
1.4 Actions .............................................................................................................................. 19
1.5 Multiple Use of Procedures and Actions .............................................................................. 21
1.6 Use of CrossReference........................................................................................................ 23
1.7 Using Global Tags in VBS .................................................................................................... 25
1.8 VBScript Editors ................................................................................................................. 27
1.8.1 VBScript Editors ................................................................................................................. 27
1.8.2 The Global Script Editor (VBScript) ...................................................................................... 28
1.8.3 Working in the Editing Window .......................................................................................... 32
1.8.4 Working with the Toolbars.................................................................................................. 36
1.8.5 Deleting Actions or Procedures........................................................................................... 39
1.9 Creating and Editing Procedures......................................................................................... 40
1.9.1 Creating and Editing Procedures......................................................................................... 40
1.9.2 Creating a New Procedure .................................................................................................. 44
1.9.3 How to Write Procedure Codes ........................................................................................... 45
1.9.4 Using Standard and Project Procedures............................................................................... 48
1.9.5 How to add module-related information............................................................................. 49
1.9.6 Protecting a Module with a Password ................................................................................. 51
1.9.7 Saving a Procedure ............................................................................................................ 52
1.9.8 Renaming a Procedure or Module....................................................................................... 54
1.10 Creating and Editing Actions .............................................................................................. 56
1.10.1 Creating and Editing Actions .............................................................................................. 56
1.10.2 Creating a New Action ....................................................................................................... 60
1.10.3 How to Edit Actions............................................................................................................ 61
1.10.4 How to add action-related information ............................................................................... 64
1.10.5 Protecting an Action with a Password ................................................................................. 66
1.10.6 Saving Actions ................................................................................................................... 67
1.10.7 Triggers ............................................................................................................................. 68
1.10.7.1 Triggers ............................................................................................................................. 68
1.10.7.2 Animation trigger .............................................................................................................. 72
1.10.7.3 How to add a trigger of the type "Timer"............................................................................. 74
1.10.7.4 How to add a trigger of the type "Tag" ................................................................................ 75
1.10.7.5 How to change a trigger..................................................................................................... 76
1.10.7.6 How to delete a trigger ...................................................................................................... 77
1.10.8 How to Rename an Action.................................................................................................. 78
1.11 How to activate global actions in Runtime .......................................................................... 80
1.12 How to use channel methods ............................................................................................. 81

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


System Manual, 09/2023, A5E52671436-AB 3
Table of contents

1.13 Diagnostics ........................................................................................................................ 82


1.13.1 Diagnostics ........................................................................................................................ 82
1.13.2 GSC Diagnostics................................................................................................................. 83
1.13.2.1 GSC Diagnostics................................................................................................................. 83
1.13.2.2 Inserting the GSC Diagnostics Window into a Picture .......................................................... 84
1.13.2.3 GSC Diagnostics Attributes ................................................................................................. 84
1.13.2.4 GSC Diagnostics Toolbar..................................................................................................... 85
1.13.3 GSC Runtime...................................................................................................................... 86
1.13.3.1 GSC Runtime...................................................................................................................... 86
1.13.3.2 How to insert the GSC Runtime Window into a Picture ........................................................ 87
1.13.3.3 GSC Runtime Attributes...................................................................................................... 88
1.13.4 Testing with the Debugger ................................................................................................. 89
1.13.4.1 Testing with the Debugger ................................................................................................. 89
1.13.4.2 How to Activate the Debugger ........................................................................................... 91
1.13.4.3 Principles of Debugging ..................................................................................................... 92
1.13.4.4 Structure of VBScript Files .................................................................................................. 94
1.13.4.5 Action and Procedure Names in the Debugger .................................................................... 96
1.13.4.6 Selecting a Script for Editing............................................................................................... 97
1.13.4.7 Processing Scripts Step-by-Step .......................................................................................... 98
1.13.4.8 Setting Breakpoints............................................................................................................ 99
1.13.4.9 Deleting Breakpoints ........................................................................................................ 101
1.13.4.10 How to Set Bookmarks in Scripts ...................................................................................... 101
1.13.4.11 How to Determine and Modify Tag and Property Values .................................................... 102
1.13.4.12 Executing Script Commands............................................................................................. 103
1.14 Printing VBScripts............................................................................................................. 105
1.15 VBS Reference.................................................................................................................. 106
1.15.1 VBS Reference.................................................................................................................. 106
1.15.2 Objects and Lists.............................................................................................................. 108
1.15.2.1 Objects and Lists.............................................................................................................. 108
1.15.2.2 Alarm object .................................................................................................................... 111
1.15.2.3 Alarms object (list)........................................................................................................... 111
1.15.2.4 AlarmLogs Object ............................................................................................................ 113
1.15.2.5 DataItem Object............................................................................................................... 114
1.15.2.6 DataLogs Object .............................................................................................................. 115
1.15.2.7 DataSet Object (List) ........................................................................................................ 116
1.15.2.8 HMIRuntime Object.......................................................................................................... 119
1.15.2.9 Item Object...................................................................................................................... 120
1.15.2.10 Layer Object .................................................................................................................... 121
1.15.2.11 Layers Object (Listing)...................................................................................................... 122
1.15.2.12 Logging Object ................................................................................................................ 123
1.15.2.13 ProcessValue Object ......................................................................................................... 124
1.15.2.14 ProcessValues Object (List) ............................................................................................... 125
1.15.2.15 Project Object .................................................................................................................. 125
1.15.2.16 ScreenItem Object ........................................................................................................... 126
1.15.2.17 ScreenItems Object (List) ................................................................................................. 129
1.15.2.18 Screen Object .................................................................................................................. 132
1.15.2.19 Screens Object (List) ........................................................................................................ 135
1.15.2.20 SmartTags Object............................................................................................................. 137
1.15.2.21 Tag Object ....................................................................................................................... 138
1.15.2.22 Tags Object (List) ............................................................................................................. 140
1.15.2.23 TagSet Object (List) .......................................................................................................... 142

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


4 System Manual, 09/2023, A5E52671436-AB
Table of contents

1.15.3 Object types of the ScreenItem object .............................................................................. 144


1.15.3.1 Object types of the ScreenItem object .............................................................................. 144
1.15.3.2 Standard objects .............................................................................................................. 145
1.15.3.3 Smart objects................................................................................................................... 170
1.15.3.4 Windows objects.............................................................................................................. 203
1.15.3.5 Tube objects .................................................................................................................... 217
1.15.3.6 Controls........................................................................................................................... 220
1.15.3.7 Customized Object........................................................................................................... 298
1.15.3.8 Group .............................................................................................................................. 300
1.15.4 Properties ........................................................................................................................ 301
1.15.4.1 Properties ........................................................................................................................ 301
1.15.4.2 A ..................................................................................................................................... 301
1.15.4.3 B ..................................................................................................................................... 322
1.15.4.4 C ..................................................................................................................................... 366
1.15.4.5 D ..................................................................................................................................... 404
1.15.4.6 E ..................................................................................................................................... 415
1.15.4.7 F...................................................................................................................................... 426
1.15.4.8 G ..................................................................................................................................... 450
1.15.4.9 H ..................................................................................................................................... 455
1.15.4.10 I ...................................................................................................................................... 465
1.15.4.11 L...................................................................................................................................... 470
1.15.4.12 M .................................................................................................................................... 501
1.15.4.13 N ..................................................................................................................................... 523
1.15.4.14 O..................................................................................................................................... 526
1.15.4.15 P...................................................................................................................................... 542
1.15.4.16 Q..................................................................................................................................... 561
1.15.4.17 R ..................................................................................................................................... 562
1.15.4.18 S...................................................................................................................................... 573
1.15.4.19 T...................................................................................................................................... 611
1.15.4.20 U ..................................................................................................................................... 690
1.15.4.21 V ..................................................................................................................................... 700
1.15.4.22 W .................................................................................................................................... 717
1.15.4.23 X - Z ................................................................................................................................ 721
1.15.5 Methods .......................................................................................................................... 730
1.15.5.1 Methods .......................................................................................................................... 730
1.15.5.2 Methods A to E ................................................................................................................ 731
1.15.5.3 Get methods.................................................................................................................... 740
1.15.5.4 Methods H to M ............................................................................................................... 788
1.15.5.5 Methods N to R ................................................................................................................ 798
1.15.5.6 Methods S to T................................................................................................................. 817
1.15.5.7 Methods U to Z ................................................................................................................ 833
1.15.6 Appendix ......................................................................................................................... 842
1.15.6.1 Error Messages from Database Area ................................................................................. 842
1.16 Examples of VBScript........................................................................................................ 844
1.16.1 Examples of VBScript........................................................................................................ 844
1.16.2 Examples in WinCC .......................................................................................................... 844
1.16.2.1 Examples in WinCC .......................................................................................................... 844
1.16.2.2 Example: Accessing objects in Graphics Designer.............................................................. 845
1.16.2.3 Example: Defining the color of objects.............................................................................. 846
1.16.2.4 Example: How to Configure Language Changes ................................................................ 846
1.16.2.5 Example: Deactivating Runtime........................................................................................ 847
1.16.2.6 Example: Configuring change picture globally................................................................... 847

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


System Manual, 09/2023, A5E52671436-AB 5
Table of contents

1.16.2.7 Example: Configuring Change Picture Via Property............................................................ 847


1.16.2.8 Example: Configuring diagnostics output via Trace............................................................ 848
1.16.2.9 Example: Writing tag values ............................................................................................. 849
1.16.2.10 Example: How to Read Tag Values .................................................................................... 851
1.16.2.11 Example: Writing Object Properties................................................................................... 854
1.16.2.12 Example: How to Start an Action on the Server (Logging Object) ...................................... 856
1.16.2.13 Example: You connect or disconnect a database backup with VBS ..................................... 858
1.16.2.14 Dynamization of Controls................................................................................................. 861
1.16.3 General Examples ............................................................................................................ 875
1.16.3.1 General examples for VBScript.......................................................................................... 875
1.16.3.2 Example: Configuring a Database Connection with VBS..................................................... 876
1.16.3.3 Example: Using the MS Automation interface ................................................................... 878
1.16.3.4 Example: Starting an external application ......................................................................... 879
1.17 Basic Principles of VBScript ............................................................................................... 881
1.17.1 Basic Principles of VBScript ............................................................................................... 881
1.17.2 VBScript Basics................................................................................................................. 881
2 ANSI-C for Creating Functions and Actions ....................................................................................... 883
2.1 Creating Functions and Actions with ANSI-C ..................................................................... 883
2.2 Creating Functions and Actions ........................................................................................ 884
2.3 Characteristics of Project Functions .................................................................................. 887
2.4 Characteristics of Standard Functions ............................................................................... 888
2.5 Characteristics of Internal Functions ................................................................................. 890
2.6 Characteristics of Local Actions ........................................................................................ 891
2.7 Characteristics of Global Actions....................................................................................... 892
2.8 How to Add Global Script Runtime to a Project's Startup List.............................................. 893
2.9 Use of Global C-Tags......................................................................................................... 894
2.10 Use of DLLs in Functions and Actions................................................................................ 896
2.11 The Global Script Editor.................................................................................................... 898
2.11.1 The Global Script editor (ANSI-C) ...................................................................................... 898
2.11.2 Working in the Edit Window ............................................................................................. 900
2.11.2.1 Working in the Edit Window ............................................................................................. 900
2.11.2.2 Editing Functions with the Keyboard ................................................................................ 902
2.11.2.3 Editing Functions with the Mouse .................................................................................... 903
2.11.3 Working with the Toolbars................................................................................................ 903
2.11.4 How to Set Different Views ............................................................................................... 906
2.11.5 How to Set the Font Style ................................................................................................. 906
2.11.6 How to Use "Save As..." .................................................................................................... 907
2.11.7 How to Delete Actions or Project and Standard Functions.................................................. 908
2.11.8 How to Generate a New Header ....................................................................................... 908
2.11.9 How to Compile All Functions........................................................................................... 909
2.11.10 How to Search in Files ...................................................................................................... 910
2.11.11 Printing Functions and Actions ......................................................................................... 911
2.11.11.1 Printing Functions and Actions ......................................................................................... 911
2.11.11.2 How to Set the Print Parameters ....................................................................................... 911
2.11.11.3 How to Open Page View................................................................................................... 912
2.11.11.4 How to Print the Project Documentation........................................................................... 912

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


6 System Manual, 09/2023, A5E52671436-AB
Table of contents

2.12 Creating and Editing Functions......................................................................................... 913


2.12.1 Creating and Editing Functions......................................................................................... 913
2.12.2 How to Create a New Function ......................................................................................... 916
2.12.3 How to Write Function Code............................................................................................. 917
2.12.4 How to Use Internal Functions.......................................................................................... 918
2.12.5 How to Use Standard and Project Functions ...................................................................... 919
2.12.6 Inserting Additional Function-Related Information ............................................................ 920
2.12.7 How to Protect a Function Against Unauthorized Access ................................................... 921
2.12.8 How to Compile and Save a Function................................................................................ 922
2.12.9 How to Rename a Function .............................................................................................. 924
2.12.10 How to Use Functions from Other Sources........................................................................ 925
2.13 Creating and Editing Actions ............................................................................................ 926
2.13.1 How To Create and Edit Actions ........................................................................................ 926
2.13.2 WinCC Coding Rule .......................................................................................................... 929
2.13.3 How to Create a New Action............................................................................................. 930
2.13.4 How to Edit Actions.......................................................................................................... 931
2.13.5 How to add action-related information ............................................................................. 931
2.13.6 How to Protect an Action Against Unauthorized Access ..................................................... 933
2.13.7 How to Compile and Save an Action ................................................................................. 934
2.13.8 Triggers ........................................................................................................................... 935
2.13.8.1 Triggers ........................................................................................................................... 935
2.13.8.2 How to Add a New Trigger of the "Timer" Type .................................................................. 938
2.13.8.3 How to Add a New Trigger of the "Tag" Type ..................................................................... 939
2.13.8.4 How to change a trigger................................................................................................... 940
2.13.8.5 How to delete a trigger .................................................................................................... 941
2.13.9 How to Assign Authorizations........................................................................................... 942
2.13.10 How to Export an Action .................................................................................................. 942
2.13.11 How to Import an Action .................................................................................................. 943
2.13.12 How to Rename an Action................................................................................................ 943
2.13.13 How to Use Actions From Other Sources........................................................................... 944
2.14 Runtime Behavior of Actions ............................................................................................ 946
2.14.1 Runtime Behavior of Actions ............................................................................................ 946
2.14.2 GSC Runtime.................................................................................................................... 947
2.14.2.1 GSC Runtime.................................................................................................................... 947
2.14.2.2 How to Place GSC Runtime in a Process Picture ................................................................. 950
2.14.2.3 Attributes of GSC Runtime................................................................................................ 951
2.14.2.4 How to Edit Actions.......................................................................................................... 951
2.14.3 GSC Diagnose .................................................................................................................. 952
2.14.3.1 GSC Diagnose .................................................................................................................. 952
2.14.3.2 How to Place GSC Diagnose in a Process Picture? .............................................................. 953
2.14.3.3 Attributes of GSC Diagnose .............................................................................................. 953
2.14.3.4 The Toolbar of GSC Diagnose ........................................................................................... 954
2.15 ANSI-C function descriptions ............................................................................................ 955
2.15.1 lpszPictureName .............................................................................................................. 955
2.15.2 Standard functions........................................................................................................... 955
2.15.2.1 Standard functions - short description .............................................................................. 955
2.15.2.2 Alarm .............................................................................................................................. 956
2.15.2.3 Graphics .......................................................................................................................... 964
2.15.2.4 Options ........................................................................................................................... 969
2.15.2.5 Report ............................................................................................................................. 973

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


System Manual, 09/2023, A5E52671436-AB 7
Table of contents

2.15.2.6 UserArc............................................................................................................................ 975


2.15.2.7 WinCC ........................................................................................................................... 1019
2.15.2.8 Windows ....................................................................................................................... 1026
2.15.2.9 Obsolete functions......................................................................................................... 1027
2.15.3 Internal functions .......................................................................................................... 1094
2.15.3.1 Internal functions - short description .............................................................................. 1094
2.15.3.2 allocate.......................................................................................................................... 1095
2.15.3.3 c_bib ............................................................................................................................. 1096
2.15.3.4 graphics......................................................................................................................... 1180
2.15.3.5 tag ................................................................................................................................ 1498
2.15.3.6 WinCC ........................................................................................................................... 1602
2.15.4 Examples ....................................................................................................................... 1611
2.15.4.1 Examles - A to G............................................................................................................. 1611
2.15.4.2 Examples - GetAlarmHigh to GetPropChar....................................................................... 1612
2.15.4.3 Examples - GetRangeMax to GetWidth............................................................................ 1629
2.15.4.4 Examples - H to S ........................................................................................................... 1653
2.15.4.5 Examples - SetAlarmHigh to SetPropChar........................................................................ 1655
2.15.4.6 Examples - SetRangeMax to SetWidth ............................................................................. 1665
2.15.4.7 Examples of WinCC controls ........................................................................................... 1676
2.15.4.8 Examples - Obsolete functions........................................................................................ 1678
2.15.5 Lists............................................................................................................................... 1686
2.15.5.1 Bar direction .................................................................................................................. 1686
2.15.5.2 Bar Scaling..................................................................................................................... 1686
2.15.5.3 Flash frequencies ........................................................................................................... 1686
2.15.5.4 I/O field, output format .................................................................................................. 1687
2.15.5.5 I/O field, data type of the field content ............................................................................ 1688
2.15.5.6 I/O field, field type .......................................................................................................... 1688
2.15.5.7 Element alignment in check boxes and radio boxes ........................................................ 1688
2.15.5.8 Color chart..................................................................................................................... 1688
2.15.5.9 Format descriptors ......................................................................................................... 1689
2.15.5.10 Fill pattern ..................................................................................................................... 1690
2.15.5.11 Line styles...................................................................................................................... 1691
2.15.5.12 Line end style ................................................................................................................ 1691
2.15.5.13 List types ....................................................................................................................... 1692
2.15.5.14 Language ID .................................................................................................................. 1692
2.15.5.15 Text alignment............................................................................................................... 1693
2.15.5.16 Tag statuses................................................................................................................... 1694
2.15.6 Structure definitions....................................................................................................... 1694
2.15.6.1 Customer-defined structure definitions ........................................................................... 1694
2.15.6.2 Structure definition CCAPErrorExecute ............................................................................ 1695
2.15.6.3 Structure definition CCAPTime........................................................................................ 1696
2.15.6.4 Structure definition CMN_ERROR .................................................................................... 1697
2.15.6.5 Structure definition DM_TYPEREF ................................................................................... 1698
2.15.6.6 Structure definition DM_VAR_UPDATE_STRUCT ............................................................... 1698
2.15.6.7 Structure definition DM_VAR_UPDATE_STRUCTEX ........................................................... 1699
2.15.6.8 Structure definition DM_VARKEY..................................................................................... 1701
2.15.6.9 Structure definition LINKINFO......................................................................................... 1701
2.15.6.10 Structure definition MSG_FILTER_STRUCT ....................................................................... 1703
2.15.6.11 Structure definition MSG_RTDATA_STRUCT...................................................................... 1706
3 VBA for Automated Configuration ................................................................................................... 1709
3.1 Automated configuration ............................................................................................... 1709

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


8 System Manual, 09/2023, A5E52671436-AB
Table of contents

3.2 Introduction: Using VBA in WinCC .................................................................................. 1710


3.2.1 Introduction: Using VBA in WinCC .................................................................................. 1710
3.2.2 Differentiation: Using VBA .............................................................................................. 1710
3.2.3 Organizing VBA Code in a WinCC Project......................................................................... 1711
3.2.4 How to export and import VBA code............................................................................... 1714
3.2.5 Executing VBA Macros in Graphics Designer ................................................................... 1715
3.3 VBA in the Graphics Designer ......................................................................................... 1717
3.3.1 VBA in the Graphics Designer ......................................................................................... 1717
3.3.2 Adapting the Graphics Designer with VBA....................................................................... 1719
3.3.2.1 Adapting the Graphics Designer with VBA....................................................................... 1719
3.3.2.2 Language-Dependent Configuration with VBA ................................................................ 1720
3.3.2.3 Creating Customized Menus and Toolbars ...................................................................... 1722
3.3.2.4 Access to WinCC libraries with VBA ................................................................................. 1742
3.3.3 Editing Pictures with VBA ............................................................................................... 1755
3.3.3.1 Editing Pictures with VBA ............................................................................................... 1755
3.3.3.2 How to Create Picture-specific Menus and Toolbars ......................................................... 1757
3.3.3.3 Editing Layers with VBA.................................................................................................. 1758
3.3.3.4 Editing a Copy of a Picture with VBA ............................................................................... 1760
3.3.4 Editing Objects with VBA................................................................................................ 1762
3.3.4.1 Editing Objects with VBA................................................................................................ 1762
3.3.4.2 Default objects, Smart objects, Windows objects and Tube objects.................................. 1764
3.3.4.3 Group Objects................................................................................................................ 1774
3.3.4.4 Customized Objects ....................................................................................................... 1782
3.3.5 Creating Dynamics with VBA .......................................................................................... 1786
3.3.5.1 Creating Dynamics with VBA .......................................................................................... 1786
3.3.5.2 Configuring Dynamics in the Properties of Pictures and Objects....................................... 1787
3.3.5.3 Configuring Event-Driven Actions with VBA .................................................................... 1799
3.3.5.4 Editing Triggers.............................................................................................................. 1807
3.3.6 Event Handling .............................................................................................................. 1809
3.3.7 Accessing External Applications with VBA ....................................................................... 1813
3.3.7.1 Accessing External Applications with VBA ....................................................................... 1813
3.3.7.2 Example: Accessing MS Excel with VBA........................................................................... 1814
3.4 VBA in the WinCC Configuration Studio........................................................................... 1825
3.4.1 VBA in the WinCC Configuration Studio........................................................................... 1825
3.4.2 Example: VBA in the WinCC Configuration Studio............................................................ 1827
3.5 AddIns ........................................................................................................................... 1834
3.5.1 AddIns ........................................................................................................................... 1834
3.5.2 Linking Add Ins .............................................................................................................. 1834
3.5.3 How to Configure an AddIn in the Graphics Designer ...................................................... 1836
3.5.4 Example: Creating Add Ins.............................................................................................. 1838
3.5.4.1 Example: Creating Add Ins.............................................................................................. 1838
3.5.4.2 Example: Creating an Add In with Visual Basic 6.0 .......................................................... 1838
3.6 VBA Reference ............................................................................................................... 1844
3.6.1 The object model of the Graphics Designer..................................................................... 1844
3.6.1.1 VBA Reference ............................................................................................................... 1844
3.6.1.2 VBA Reference: ActionDynamic ...................................................................................... 1846
3.6.1.3 VBA Reference: HMIObjects............................................................................................ 1848
3.6.1.4 VBA Reference: Languages ............................................................................................. 1850
3.6.1.5 Events ........................................................................................................................... 1851
3.6.1.6 Methods ........................................................................................................................ 1884

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


System Manual, 09/2023, A5E52671436-AB 9
Table of contents

3.6.1.7 Objects and Lists............................................................................................................ 2007


3.6.1.8 Properties ...................................................................................................................... 2227
3.6.2 VBA in Other WinCC Editors............................................................................................ 2684
3.6.2.1 VBA in Other WinCC Editors............................................................................................ 2684
3.6.2.2 VBA in Tag Management ................................................................................................ 2686
3.6.2.3 VBA im Tag Logging ....................................................................................................... 2697
3.6.2.4 VBA in the Text Library ................................................................................................... 2731
3.6.2.5 VBA in Alarm Logging .................................................................................................... 2745
Index ................................................................................................................................................ 2759

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


10 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions 1
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, 09/2023, A5E52671436-AB 11
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 programming language as a
programming interface in order to make the WinCC Runtime environment dynamic.

Target Group of the Documentation


This documentation is aimed at configuration engineers with experience in Visual Basic or
WinCC Scriptings (C) used previously.

Possible applications
VBScript (VBS) provides access to tags and objects of the graphical Runtime system in Runtime
and enables execution of picture-independent actions:
• Tags: Tag values can be read and written, 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.

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


12 System Manual, 09/2023, A5E52671436-AB
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 image, the tags are registered and unregistered
again when you deselect 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 color changes, e.g. cyclically (flashing) or displaying statuses (motor on).
Apart from the specific WinCC applications, the general functionality of VBS can also be used
to customize your 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 for customizing your 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 or WinCC support for the VBS functionality with regard to its adaptation
to the Windows environment.

Differentiation from 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).
• The syntax for path information is different. When addressing object in subdirectories, the
folders are separated by single or double backslashes:
– VBScript: single backslash "\"
– C: double backslash "\\"

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


System Manual, 09/2023, A5E52671436-AB 13
VBS for Creating Procedures and Actions
1.2 Using Visual Basic Script in WinCC

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.
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 include, for example:
• VBS was developed for use on the Internet, VBA for the automation of software applications.
• The data type of VBS tags is always VARIANT. VBA, on the other hand, differentiates between
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: A procedure corresponds to a function in C. You store code in procedures which
you then used at several points in your configuration. Retrieve the code in an action or
another procedure by calling 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. In actions, you can call code that is used several times in the form of procedures.

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


14 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.2 Using Visual Basic Script in WinCC

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


System Manual, 09/2023, A5E52671436-AB 15
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)


16 System Manual, 09/2023, A5E52671436-AB
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.

Module Features
A module is a file in which one or more procedures are 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.

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


System Manual, 09/2023, A5E52671436-AB 17
VBS for Creating Procedures and Actions
1.3 Modules and Procedures

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 installation
directory>\ApLib\ScriptLibStd\<Module name>.bmo
• Project modules: Contain project-specific procedures. Project modules are stored in the
WinCC file system under: <Project folder>\ScriptLib\<Module Name>.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 re-installation in a different directory and copy them
in the relevant WinCC directory after the re-installation 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 40)
VBScript Editors (Page 27)
Basic Principles of VBScript (Page 881)
Actions (Page 19)
Using Visual Basic Script in WinCC (Page 12)

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


18 System Manual, 09/2023, A5E52671436-AB
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).

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


System Manual, 09/2023, A5E52671436-AB 19
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 56)
Basic Principles of VBScript (Page 881)
Modules and Procedures (Page 16)
Using Visual Basic Script in WinCC (Page 12)

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


20 System Manual, 09/2023, A5E52671436-AB
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.

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


System Manual, 09/2023, A5E52671436-AB 21
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 16)
Renaming a Procedure or Module (Page 54)
Saving a Procedure (Page 52)
Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Creating and Editing Procedures (Page 40)

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


22 System Manual, 09/2023, A5E52671436-AB
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.

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


System Manual, 09/2023, A5E52671436-AB 23
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 106)
VBScript Editors (Page 27)
Basic Principles of VBScript (Page 881)
Actions (Page 19)
Modules and Procedures (Page 16)
Using Visual Basic Script in WinCC (Page 12)

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


24 System Manual, 09/2023, A5E52671436-AB
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.

See also
Basic Principles of VBScript (Page 881)
Structure of VBScript Files (Page 94)

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


System Manual, 09/2023, A5E52671436-AB 25
VBS for Creating Procedures and Actions
1.7 Using Global Tags in VBS

Creating and Editing Actions (Page 56)


Creating and Editing Procedures (Page 40)
VBScript Editors (Page 27)
Use of CrossReference (Page 23)
Actions (Page 19)
Modules and Procedures (Page 16)

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


26 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

1.8 VBScript Editors

1.8.1 VBScript Editors

Introduction
You can program VB scripts in two places in WinCC:
• In Global Script:
Global Script is the central editor for VBS programming.
You open it using the WinCC Explorer.

• In Graphics Designer:
In the Graphics Designer, you program actions on object properties or events on graphic
objects.
You open the Action Editor in the Graphics Designer from the shortcut menu in the properties
dialog of a graphic object.

You can find additional information in the WinCC documentation "Dynamization".

Delineation of Global Script - Graphics Designer


In the Graphics Designer, you can program actions and picture-specific procedures, but not
project-wide global procedures.

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


System Manual, 09/2023, A5E52671436-AB 27
VBS for Creating Procedures and Actions
1.8 VBScript Editors

However, you can call global procedures programmed in Global Script.

Note
This documentation primarily describes Global Script and, when appropriate, points out
deviations in the functionality of the Graphics Designer.
You can find a detailed description of the Action Editor in the Graphics Designer under the WinCC
help topic "Dynamization".

No Unicode support
VB scripts do not support Unicode in actions and procedures.

See also
The Global Script Editor (VBScript) (Page 28)

1.8.2 The Global Script Editor (VBScript)

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.

More information
Description of the action editor for the creation of picture-based actions and procedures in
the Graphics Designer:
• "Working with WinCC > Process Picture Dynamics > Dynamizing Using VBS Action"

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


28 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

Starting Global Script


Global Script is started by using the shortcut menu command "Open" in the navigation area of
the WinCC Explorer.

Global Script is also automatically started when a module or action is opened by double-
clicking in WinCC Explorer.

Design of Global Script


Global Script is designed in accordance with the Microsoft Windows standards.
The action editor in the Graphics Designer provides a similar range of functions to that of
Global Script.
More information:
• "Working with WinCC > Process Picture Dynamics > Dynamizing Using VBS Action > Action
Editor in Graphics Designer"

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


System Manual, 09/2023, A5E52671436-AB 29
VBS for Creating Procedures and Actions
1.8 VBScript Editors

1
2

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.
You can move toolbars to any position within the editor.

Navigation window (3)


In the navigation window you can manage your procedures, modules, actions, and channel
methods.
The navigation window contains code templates, which you can insert into your action or
procedure by using drag-and-drop.
To call a procedure in another procedure or action, drag the procedure from the navigation
window and drop it at the relevant point in the code.
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 Channel methods tab displays all methods with activated access from the channels.

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


30 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

Additional functions in the navigation window:


• Create subdirectories for structuring the created scripts.
• Move, copy, paste, delete and rename modules and directories directly.
• Customize the display in the navigation window by using the "View" menu command, for
example:
– Navigation window: Display of all file types, only of script files or of syntactically correct
script files.
– Display or hide a navigation window

Editing window (4)


You can write and edit your procedures and actions in the Editing window.
Each procedures or action will be opened in its own Editing window. Several Editing window
can be open at the same time.
The user is supported by in the Editing window by Highlight Syntax and Intellisense.
All common editing functions are available, e.g.:
• Undo/Redo
• Find/Replace
• Copy/insert/cut
• Show/hide line numbers
• Printer support
• Display ("Options > Options" menu command), e.g.:
– Font settings
– Indent
– Highlight syntax

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.

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


System Manual, 09/2023, A5E52671436-AB 31
VBS for Creating Procedures and Actions
1.8 VBScript Editors

Status bar (6)


The status bar contains information on the currently selected functionality or hints on
programming.

Note
Calling direct help
If information on individual editor commands or icons is required, select the "?" > "Direct help"
menu icon.
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.
You can 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 can automatically hide windows and show them again when needed.

See also
Deleting Actions or Procedures (Page 39)
Working with the Toolbars (Page 36)
Working in the Editing Window (Page 32)
The Global Script editor (ANSI-C) (Page 898)
How to use channel methods (Page 81)

1.8.3 Working in the 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.

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


32 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

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
Declaration area: No executable code
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 "Option explicit" in the code
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:
• Color coding in the Editing window
• Indenting in the Editing window
• Intellisense and highlighted syntax
• General VBS Functions
• Lists of objects, properties and methods
• Code templates
• Selection dialogs
• Bookmark
• Line numbers

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


System Manual, 09/2023, A5E52671436-AB 33
VBS for Creating Procedures and Actions
1.8 VBScript Editors

Color coding in the Editing window


The color coding in the Editing window can be customized via the editor settings.
Select the "Options > Options" menu commands to call up the "Script Editor Options" dialog
to define the settings.
Certain parts of the code have the following default colors:

Color Description Example


blue Keywords Sub, End Sub, Next
Functions
green Comments ' This is a comment.
red Strings (character strings and digits) "Object1"
dark blue Preprocessor statements --
bold black Constants vbTrue, vbFalse
black Other codes --

Indenting in the Editing window


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.
Highlight Syntax can be activated and deactivated in the "Script Editor Options" dialog. You
can call the dialog using the "Options > Options" menu commands.

Intellisense in the Graphics Designer


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.

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


34 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

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 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 can find a selection of
frequently used instructions, such as for loops and conditional instructions.
The templates can be inserted in the procedure code with "Drag&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:

Icon Function
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 browser to select a picture or object whose name is returned as a return value.

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

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

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

Deletes all bookmarks in the active Editing window.

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


System Manual, 09/2023, A5E52671436-AB 35
VBS for Creating Procedures and Actions
1.8 VBScript Editors

Icon Function
Jumps ahead to the next bookmark in the code.

Jumps back to the last bookmark in the code.

Line numbers
The line numbers of the scripts are displayed by default in the Editing window of the editor.
The line numbers are particularly helpful in the case of extensive scripts to identify individual
lines and navigate quickly to the desired line.
Show or hide line numbers:
• Icon "Deactivate/Activate Line Number":
• "View" Menu

"Go to Line" function


Use the function to jump to a line number of the script in the Editing window.
This function is particularly helpful in the case of extensive scripts to navigate quickly to the
desired line.
Jump to a line:
• Icon "Go to Line":
• Shortcut key <CTRL+L>

See also
Structure of VBScript Files (Page 94)
The Global Script Editor (VBScript) (Page 28)

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:
• "Default" toolbar
• "Editor" toolbar
• "Edit" toolbar
• Graphics Designer: Additional buttons in the "Edit" toolbar

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


36 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

"Default" toolbar

Icon 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. <CTRL+S>


This function is only available if an Editing window is open.
After saving, the display in the navigation window is refreshed (only Global Script).
Prints the contents of the active Editing window as project documentation. <CTRL+P>
This function is only available if an Editing window is open.
Cuts the selected text and copies it to the clipboard. <CTRL+X>
This function is only available if text has been selected.
Copies the selected text to the clipboard. <CTRL+C>
This function is only available if text has been selected.
Pastes the contents of the clipboard at the location of the cursor. <CTRL+V>
This function is only available if the clipboard is not empty.
Undoes the last of a maximum of 30 editor actions. <CTRL+Z>
This function is only available if an editor action has been executed.
Redoes the last editor action that was undone. <CTRL+Y>
This function is only available if an editor action has been undone.
Activates the direct help F1

"Editor" toolbar

Icon 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.
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. <CTRL+F9>
Actuating again removed the bookmark from the current line.
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>

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


System Manual, 09/2023, A5E52671436-AB 37
VBS for Creating Procedures and Actions
1.8 VBScript Editors

Icon Function Key combination


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>

Shows or hides the line numbers. --

Jumps to a line number in the script. <CTRL+L>

Opens the "Script editor options" dialog. --

"Edit" toolbar

Icon 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 browser to select a picture or object whose name is returned as a return value. <CTRL+Q>

Opens a picture selection dialog for pictures and returns the picture name, with the <CTRL+B>
server prefix if necessary.
Opens the "Info/Trigger" dialog. <CTRL+T>

Graphics Designer: Additional buttons


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

Icon Function Shortcut keys


Displays the declaration area <CTRL+E>
Hides the declaration area <CTRL+A>

See also
The Global Script Editor (VBScript) (Page 28)

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


38 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.8 VBScript Editors

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 19)
Modules and Procedures (Page 16)
The Global Script Editor (VBScript) (Page 28)

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


System Manual, 09/2023, A5E52671436-AB 39
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 included when
copying a project.
• 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.
In addition to the procedures you have programmed, you can use general VBS functions
(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.

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


40 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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

Note
Global tags: Global Script and Graphics Designer
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.

Changing modules and procedures


If a procedure (module) used in a picture is modified, the modification is applied the next time
the picture is loaded.

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


System Manual, 09/2023, A5E52671436-AB 41
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

This means that a picture currently displayed only works with the modified procedure after
the picture has been reloaded.

Saving a process picture after module change


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. This also applies if
you insert new functions from other modules.
By saving the picture, you activate the information in the picture file by means of the
necessary project modules.
The change is only applied in Runtime after the process picture is saved.

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.

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


42 System Manual, 09/2023, A5E52671436-AB
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.

System behavior if actions or procedures are changed, deleted and saved at Runtime
If a local action or local procedure, which is called in a global action, is saved during Runtime, all
local and global actions are reset on the associated computer.
If a global action or global procedure that is called in a global action is saved during Runtime,
all local and global actions of the entire project are reset, including those on all computers.
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.
If the procedure is not called in a global action, the actions are not reset.

See also
Multiple Use of Procedures and Actions (Page 21)
Renaming a Procedure or Module (Page 54)
Saving a Procedure (Page 52)
Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Examples of VBScript (Page 844)
Modules and Procedures (Page 16)

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


System Manual, 09/2023, A5E52671436-AB 43
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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 continuous number. If the procedure is edited in the editing
window, 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:

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


44 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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" shortcut menu command.
The "New Procedure" dialog appears:
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 <Procedure name>" and conclude with "End
Sub". In the case of procedures with return value, always begin with the instruction "Function
<Procedure name>" and conclude with "End Function". The new procedure is displayed in the
navigation window when the module is saved.

See also
Creating and Editing Procedures (Page 40)
Multiple Use of Procedures and Actions (Page 21)
Renaming a Procedure or Module (Page 54)
Saving a Procedure (Page 52)
Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Modules and Procedures (Page 16)

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.

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


System Manual, 09/2023, A5E52671436-AB 45
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

Functions in Global Script


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

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.

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


46 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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 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 45)
Multiple Use of Procedures and Actions (Page 21)

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


System Manual, 09/2023, A5E52671436-AB 47
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

Renaming a Procedure or Module (Page 54)


Saving a Procedure (Page 52)
Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
Creating a New Procedure (Page 44)
Modules and Procedures (Page 16)
Creating and Editing Procedures (Page 40)

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.

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


48 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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".

See also
Creating and Editing Procedures (Page 40)
Multiple Use of Procedures and Actions (Page 21)
Renaming a Procedure or Module (Page 54)
Saving a Procedure (Page 52)
Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Modules and Procedures (Page 16)

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.

Note
Settings valid for the entire module
Open the dialog for editing the module-related information using the "Info/Trigger" button.
The 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, 09/2023, A5E52671436-AB 49
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

Behavior when creating modules


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"
• "Comment", e.g. functionality of the module/procedures contained in it
You can also enter a password for the module. More information on assigning passwords is
provided in "Protecting a Module with a Password".

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.

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


50 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

See also
Multiple Use of Procedures and Actions (Page 21)
Renaming a Procedure or Module (Page 54)
Saving a Procedure (Page 52)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Modules and Procedures (Page 16)
Creating and Editing Procedures (Page 40)

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.

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


System Manual, 09/2023, A5E52671436-AB 51
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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.

See also
Multiple Use of Procedures and Actions (Page 21)
Renaming a Procedure or Module (Page 54)
Saving a Procedure (Page 52)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Modules and Procedures (Page 16)
Creating and Editing Procedures (Page 40)

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.

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


52 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

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.

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 82)
Multiple Use of Procedures and Actions (Page 21)

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


System Manual, 09/2023, A5E52671436-AB 53
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

Saving a Procedure (Page 52)


Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Modules and Procedures (Page 16)
Creating and Editing Procedures (Page 40)

1.9.8 Renaming a Procedure or Module

Introduction

You rename procedures or modules in the following cases:



When you change the default name (procedure# or Module#) that is assigned automatically
when a new procedure or module is created to a descriptive name.

When you copy a module or procedure in order to, for example, create a new module with
similar content from an existing module.

Note here that procedure names must always be unique within a project. Duplicate
procedure names trigger an error during the syntax check.

In contrast to procedure names, you can use the same names for modules if the modules
involved are stored in different directories.

Note

The module name is always identical to the file name of the module in the WinCC file system. If
you change a module name, e.g. in Windows Explorer, the new module name is applied in the
navigation window of Global Script.

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


54 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.9 Creating and Editing Procedures

Procedure

Renaming a procedure
1.
Open the procedure you want to rename.
2.
Enter the new name in the header of the procedure.
3.
Save the procedure so that the name is applied to the navigation window. Procedure names
are always unique and must not be used more than once.

Renaming a module
1.
Close the module that you want to rename.
2.
Select the module in the navigation window and select the shortcut menu command
"Rename".
3.
Enter the new name in the navigation window. Module names are always unique within the
directory and must not be used more than once.

See also
Multiple Use of Procedures and Actions (Page 21)
Saving a Procedure (Page 52)
Protecting a Module with a Password (Page 51)
How to add module-related information (Page 49)
Using Standard and Project Procedures (Page 48)
How to Write Procedure Codes (Page 45)
Creating a New Procedure (Page 44)
Modules and Procedures (Page 16)
Creating and Editing Procedures (Page 40)

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


System Manual, 09/2023, A5E52671436-AB 55
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.:

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


56 System Manual, 09/2023, A5E52671436-AB
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, 09/2023, A5E52671436-AB 57
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.
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

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


58 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

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 94)
Action and Procedure Names in the Debugger (Page 96)
How to Rename an Action (Page 78)
Saving Actions (Page 67)
Protecting an Action with a Password (Page 66)
How to add action-related information (Page 64)

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


System Manual, 09/2023, A5E52671436-AB 59
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

How to Edit Actions (Page 61)


Creating a New Action (Page 60)
Triggers (Page 68)
Actions (Page 19)

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.

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


60 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

See also
How to Rename an Action (Page 78)
Saving Actions (Page 67)
Protecting an Action with a Password (Page 66)
How to add action-related information (Page 64)
How to Edit Actions (Page 61)
Triggers (Page 68)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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.

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


System Manual, 09/2023, A5E52671436-AB 61
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

In the declaration area, you can also make general settings which you want to use globally
for the current picture, e.g.:
• 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.

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


62 System Manual, 09/2023, A5E52671436-AB
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, 09/2023, A5E52671436-AB 63
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 25)
Testing with the Debugger (Page 89)
Structure of VBScript Files (Page 94)
How to Rename an Action (Page 78)
Saving Actions (Page 67)
Protecting an Action with a Password (Page 66)
How to Edit Actions (Page 61)
Creating a New Action (Page 60)
Triggers (Page 68)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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.

Note
More information can only be made available for actions in Global Script, not for actions in
Graphics Designer.

Behavior when creating modules


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. Version numbers can be individually assigned
when editing an action.

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


64 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

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"
• "Comment", e.g. functionality of the action
It is also possible to define a password for the action. More information on assigning
passwords is provided in "Protecting Actions with a Password".

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 78)
Saving Actions (Page 67)
Protecting an Action with a Password (Page 66)
How to Edit Actions (Page 61)
Creating a New Action (Page 60)
Triggers (Page 68)

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


System Manual, 09/2023, A5E52671436-AB 65
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

Creating and Editing Actions (Page 56)


Actions (Page 19)

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.

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


66 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

See also
How to Rename an Action (Page 78)
Saving Actions (Page 67)
How to add action-related information (Page 64)
How to Edit Actions (Page 61)
Creating a New Action (Page 60)
Triggers (Page 68)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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, 09/2023, A5E52671436-AB 67
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 19)
How to Rename an Action (Page 78)
Protecting an Action with a Password (Page 66)
How to add action-related information (Page 64)
How to Edit Actions (Page 61)
Creating a New Action (Page 60)
Triggers (Page 68)
Creating and Editing Actions (Page 56)

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 are not executed.
The triggers defined for an action are displayed in the Global Script navigation window.

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


68 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

Trigger Types
The following trigger types are available:

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
Cyclic triggers consist of a specified time interval and starting point.
Time-controlled triggers are used for actions in Global Script and for actions to make graphic
objects dynamic.
The following types of cyclic triggers are available:

Cyclic triggers Start of the time interval Interval length


Standard cycle The start of the first time interval coincides with the The length of the interval is
start of Runtime. determined by the cycle.
Hourly Specification of minutes and seconds 1 hour
Daily Specification of time: Hour, minute and second 1 day
Weekly Specification of the weekday (Monday, Tuesday, 1 week
etc.) and the time
Monthly Specification of day and time 1 month
Yearly Specification of day, month and time 1 year

Tag triggers
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.
Tag triggers are used for actions in Global Script and for actions to make graphic objects
dynamic.
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.

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


System Manual, 09/2023, A5E52671436-AB 69
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 type 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.
For more detailed information, refer to "Animation trigger (Page 72)".

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.

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


70 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

Actions in Global Script and Graphics Designer do not affect each other.

Note
Execute action depending on the result
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.

Notes on configuring triggers

Time for cyclic trigger


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) should be implemented on the
automation device.

Improving performance
The tag triggers should preferably be used 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.

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


System Manual, 09/2023, A5E52671436-AB 71
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

Tag triggers in actions in Graphics Designer can be "linked" using CrossReference, i.e.
replaced by other tags at all or selected points.
Further information on CrossReference is available in the WinCC documentation under
"Working with WinCC".

Linking in Graphics Designer


Tags can also be directly linked in Graphics Designer by marking the graphic object and
selecting the "Linking ..." command from the shortcut menu.
Use the following standard formulations to address pictures and tags in your code to ensure
that pictures and tags are detected by the CrossReference:
• HMIRuntime.BaseScreenName = "Screenname"
• HMIRuntime.Tags("Tagname")

See also
Actions (Page 19)
Animation trigger (Page 72)
How to add a trigger of the type "Tag" (Page 75)
How to add a trigger of the type "Timer" (Page 74)
How to delete a trigger (Page 77)
How to change a trigger (Page 76)
Creating and Editing Actions (Page 56)

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

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


72 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

Name Cycle Name Cycle


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:

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.

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


System Manual, 09/2023, A5E52671436-AB 73
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

See also
ActivateDynamic method (Page 732)
Triggers (Page 68)

1.10.7.3 How to add a trigger of the type "Timer"

Add
"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.
– If the "acyclic" trigger type has been selected: Enter a relevant trigger name and define the
time at which the action should be executed.
– 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.
6. 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.

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


74 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

See also
How to delete a trigger (Page 77)
How to add a trigger of the type "Tag" (Page 75)
Triggers (Page 68)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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 is not
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.
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.

See also
How to delete a trigger (Page 77)
How to add a trigger of the type "Tag" (Page 75)

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


System Manual, 09/2023, A5E52671436-AB 75
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

How to add a trigger of the type "Timer" (Page 74)


Triggers (Page 68)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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.

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


76 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.10 Creating and Editing Actions

See also
Triggers (Page 68)
How to delete a trigger (Page 77)
How to add a trigger of the type "Tag" (Page 75)
How to add a trigger of the type "Timer" (Page 74)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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, 09/2023, A5E52671436-AB 77
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 19)
How to change a trigger (Page 76)
How to add a trigger of the type "Tag" (Page 75)
How to add a trigger of the type "Timer" (Page 74)
Triggers (Page 68)
Creating and Editing Actions (Page 56)

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.

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


78 System Manual, 09/2023, A5E52671436-AB
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 66)
Saving Actions (Page 67)
How to add action-related information (Page 64)
How to Edit Actions (Page 61)
Creating a New Action (Page 60)
Triggers (Page 68)
Creating and Editing Actions (Page 56)
Actions (Page 19)

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


System Manual, 09/2023, A5E52671436-AB 79
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.
So that the picture-independent, Global Script global actions can be executed, the "Global
Script Runtime" application must be activated in the startup list of the runtime computer.

Procedure
1. Open the "Computer" editor in the WinCC Configuration Studio.
2. Select the computer name in the navigation area.
The "Processes when starting WinCC Runtime" tab is displayed.
3. Activate the "Global Script Runtime" option.

See also
Creating and Editing Actions (Page 56)
Creating and Editing Procedures (Page 40)
VBScript Editors (Page 27)
Using Visual Basic Script in WinCC (Page 12)

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


80 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.12 How to use channel methods

1.12 How to use channel methods

Channel methods
You can use channel methods to access methods from the following channels:
• OPC UA WinCC Channel
• SinumerikNC

Updating channel methods in the navigation window


In Tag Management you can activate access to channel methods.
To update the channel methods shown in the navigation window, follow these steps:
• Open the shortcut menu of a connection or channel method and click "Update".
• Press <F5>.

Transferring a method call


To transfer a method call to the editing window, follow these steps:
• Open the shortcut menu at a channel method and click "Transfer method call".
• Double-click a channel method
The method call appears in the editing window.

Example

Dim ip_IN1_DINT, ip_IN2_DINT


Dim op_OUT1_DINT, iterator

ip_IN1_DINT=10
ip_IN2_DINT=20

OPCUA_PLC_Method ip_IN1_DINT, ip_IN2_DINT, op_OUT1_DINT

If IsArray(op_OUT1_DINT) Then
For
iterator=0 To UBound(op_OUT1_DINT)
HMIRuntime.Trace "Result of OPCUA Method is "&op_OUT1_DINT(iterator) &vbCrlf
Next
Else
HMIRuntime.Trace "Result of OPCUA Method is "&op_OUT1_DINT &vbCrlf
End If

See also
The Global Script Editor (VBScript) (Page 28)

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


System Manual, 09/2023, A5E52671436-AB 81
VBS for Creating Procedures and Actions
1.13 Diagnostics

1.13 Diagnostics

1.13.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.

Debugger
You can use the "Microsoft Visual Studio 2008" debugger to test your VB scripts in Runtime.
The debugger is included in the WinCC Setup. If another Visual Studio version is already
installed, Microsoft Visual Studio 2010 for example, use the debugger of this version.

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


82 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

See also
Testing with the Debugger (Page 89)
GSC Runtime (Page 86)
GSC Diagnostics (Page 83)
Trace Method (Page 833)

1.13.2 GSC Diagnostics

1.13.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 85)
GSC Diagnostics Attributes (Page 84)
Inserting the GSC Diagnostics Window into a Picture (Page 84)
Trace Method (Page 833)

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


System Manual, 09/2023, A5E52671436-AB 83
VBS for Creating Procedures and Actions
1.13 Diagnostics

1.13.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 85)
GSC Diagnostics Attributes (Page 84)
GSC Diagnostics (Page 83)

1.13.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.

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


84 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 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 85)
Inserting the GSC Diagnostics Window into a Picture (Page 84)
GSC Diagnostics (Page 83)

1.13.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 84)
Inserting the GSC Diagnostics Window into a Picture (Page 84)
GSC Diagnostics (Page 83)

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


System Manual, 09/2023, A5E52671436-AB 85
VBS for Creating Procedures and Actions
1.13 Diagnostics

1.13.3 GSC Runtime

1.13.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!

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


86 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 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 87)
GSC Runtime Attributes (Page 88)

1.13.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.

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".

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


System Manual, 09/2023, A5E52671436-AB 87
VBS for Creating Procedures and Actions
1.13 Diagnostics

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 86)
GSC Runtime Attributes (Page 88)

1.13.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 86)
How to insert the GSC Runtime Window into a Picture (Page 87)

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


88 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

1.13.4 Testing with the Debugger

1.13.4.1 Testing with the Debugger

Overview
You can use the "Microsoft Visual Studio 2008" debugger to test your VB scripts in Runtime.
The debugger is included in the WinCC Setup. If another Visual Studio version is already
installed, Microsoft Visual Studio 2010 for example, use the debugger of this version.

Installing the debugger for WinCC


To use the debugger in WinCC, you must start Setup and specify instance "Visual Studio 2008"
as the default.
During the installation of WinCC, the "VS 2008 Shell Redist" folder is created on a drive of the
PC, for example, as "D:\VS 2008 Shell Redist".

Procedure
1. Start the setup with the following file:
– VS 2008 Shell Redist\Integrated Mode\Vside.enu.exe
2. Follow the instructions and accept the default settings.
The following program is installed:
– Microsoft Visual Studio 2008 Shell (Integrated Mode) - ENU
3. When you start the debugger the first time, the "Visual Studio Just-In-Time Debugger" dialog
opens.
Select the entry "New instance of Visual Studio 2008".
To specify "Visual Studio 2008" as the default debugger, select the "Set the currently selected
debugger as the default." setting.

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


System Manual, 09/2023, A5E52671436-AB 89
VBS for Creating Procedures and Actions
1.13 Diagnostics

Microsoft Visual Studio 2008 Debugger

See also
Principles of Debugging (Page 92)
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Processing Scripts Step-by-Step (Page 98)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
How to Activate the Debugger (Page 91)
Diagnostics (Page 82)

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


90 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

1.13.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 script.

Procedure
The following procedure describes the first two points, activating the debugger in WinCC.
1. Open the "Computer" editor in the WinCC Configuration Studio.
2. Select the "Local settings" entry in the navigation area.
3. Activate the desired options under "VBS debug options" in the "Properties - Local settings"
area.
The debug behavior for actions in Global Script and Graphics Designer can be set
independently of each other.
4. Determine the behavior when an error occurs in runtime:
– "Graphics Debugger" / "Script Debugger":
The debugger is started directly when an error occurs.
– "Graphics error dialog" / "Script error dialog":
When an error occurs, a dialog with information on the error opens.
You start the debugger using a button in the dialog.

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 Graphics
Runtime and "GSCRT.exe" for Global Script System.
The way to open a running script in the debugger is described under "Selecting a script".

Stopping the debugger


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

See also
How to Set Bookmarks in Scripts (Page 101)
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)
Deleting Breakpoints (Page 101)

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


System Manual, 09/2023, A5E52671436-AB 91
VBS for Creating Procedures and Actions
1.13 Diagnostics

Setting Breakpoints (Page 99)


Processing Scripts Step-by-Step (Page 98)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.3 Principles of Debugging

Introduction
You can use the "Microsoft Visual Studio 2008" debugger to test your VB scripts in Runtime.
The debugger is included in the WinCC Setup. If another Visual Studio version is already
installed, Microsoft Visual Studio 2010 for example, use the debugger of this version.
The debugger can be used to:
• View the script source code to be debugged
• Step-by-step processing of the scripts to be checked
• 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

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


92 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

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, write-
protected. 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".
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 89)
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)

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


System Manual, 09/2023, A5E52671436-AB 93
VBS for Creating Procedures and Actions
1.13 Diagnostics

How to Set Bookmarks in Scripts (Page 101)


Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Processing Scripts Step-by-Step (Page 98)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
How to Activate the Debugger (Page 91)
Diagnostics (Page 82)

1.13.4.4 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)


94 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 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 91)
Executing Script Commands (Page 103)

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


System Manual, 09/2023, A5E52671436-AB 95
VBS for Creating Procedures and Actions
1.13 Diagnostics

How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Processing Scripts Step-by-Step (Page 98)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Principles of Debugging (Page 92)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.5 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_OnPropertyState‐
Changed
Picture events Document_OnOpen

Document_OnClosed

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


96 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 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 103)
How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Processing Scripts Step-by-Step (Page 98)
Selecting a Script for Editing (Page 97)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.6 Selecting a Script for Editing

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

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

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


System Manual, 09/2023, A5E52671436-AB 97
VBS for Creating Procedures and Actions
1.13 Diagnostics

Procedure
1. Start Microsoft Visual Studio 2008.
2. Create a new script file:
– File > New > File… > Select script template "Windows Script Host".
3. Start debugging with "Debug > Attach to Process".
Select, for example, gscrt.exe or pdlrt.exe.

See also
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Processing Scripts Step-by-Step (Page 98)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.7 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.

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


98 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

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 92)
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.8 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.

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


System Manual, 09/2023, A5E52671436-AB 99
VBS for Creating Procedures and Actions
1.13 Diagnostics

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 from the
toolbar.
The next executable line will be marked by a red dot.
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.

See also
Deleting Breakpoints (Page 101)
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Setting Breakpoints (Page 99)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

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


100 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

1.13.4.9 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 from the
toolbar.
The next line will be displayed without a mark.
3. To delete all the breakpoints in a script, open the "Debug" menu and select the "Clear all
Breakpoints" entry or the icon from the toolbar.

See also
Executing Script Commands (Page 103)
How to Determine and Modify Tag and Property Values (Page 102)
How to Set Bookmarks in Scripts (Page 101)
Setting Breakpoints (Page 99)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.10 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.

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


System Manual, 09/2023, A5E52671436-AB 101
VBS for Creating Procedures and Actions
1.13 Diagnostics

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 103)
How to Determine and Modify Tag and Property Values (Page 102)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.11 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.

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


102 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.13 Diagnostics

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 92)
Executing Script Commands (Page 103)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

1.13.4.12 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.

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


System Manual, 09/2023, A5E52671436-AB 103
VBS for Creating Procedures and Actions
1.13 Diagnostics

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 102)
How to Set Bookmarks in Scripts (Page 101)
Deleting Breakpoints (Page 101)
Setting Breakpoints (Page 99)
Selecting a Script for Editing (Page 97)
Action and Procedure Names in the Debugger (Page 96)
Structure of VBScript Files (Page 94)
Principles of Debugging (Page 92)
How to Activate the Debugger (Page 91)
Testing with the Debugger (Page 89)
Diagnostics (Page 82)

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


104 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.14 Printing VBScripts

1.14 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 56)
Creating and Editing Procedures (Page 40)
VBScript Editors (Page 27)
Using Visual Basic Script in WinCC (Page 12)

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


System Manual, 09/2023, A5E52671436-AB 105
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15 VBS Reference

1.15.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)


106 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

$FWLYH3URMHFW

7DJV 7DJ6HW

7DJ 7DJ

$FWLYH6FUHHQ
+0,5XQWLPH

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, 09/2023, A5E52671436-AB 107
VBS for Creating Procedures and Actions
1.15 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
Object types of the ScreenItem object (Page 144)
Methods (Page 730)
Properties (Page 301)
Objects and Lists (Page 108)

1.15.2 Objects and Lists

1.15.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)


108 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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.

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


System Manual, 09/2023, A5E52671436-AB 109
VBS for Creating Procedures and Actions
1.15 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 129)
TagSet Object (List) (Page 142)
Tags Object (List) (Page 140)
Tag Object (Page 138)
Screens Object (List) (Page 135)
Screen Object (Page 132)
ScreenItem Object (Page 126)

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


110 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Layers Object (Listing) (Page 122)


Layer Object (Page 121)
Item Object (Page 120)
HMIRuntime Object (Page 119)

1.15.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 111)

1.15.2.3 Alarms object (list)

Description

+0,5XQWLPH

$ODUPV 3URFHVV9DOXHV

$ODUP 3URFHVV9DOXH

Use the alarm object to trigger existing messages.

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


System Manual, 09/2023, A5E52671436-AB 111
VBS for Creating Procedures and Actions
1.15 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)
• Set the status of a message (State property)
• Set 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 the name of the user who triggered the message (UserName property)
• Set the names of the process value blocks (ProcessValues property)
• Set the comment of the message (Comment property)
• Set the server prefix of the message (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 641)
ComputerName property (Page 386)
Context property (Page 387)
State property (Page 603)
AlarmID property (Page 307)
Instance property (Page 468)
Comment property (Alarm Logging) (Page 384)
UserName property (Page 697)
ProcessValue property (Page 560)

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


112 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Alarm object (Page 111)


ProcessValues Object (List) (Page 125)
Create method (Page 736)
Item Method (Page 789)

1.15.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

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


System Manual, 09/2023, A5E52671436-AB 113
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Error Messages from Database Area (Page 842)
Restore Method (Page 814)
Remove Method (Page 809)
DataLogs Object (Page 115)
Logging Object (Page 123)

1.15.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)


114 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 132)
HMIRuntime Object (Page 119)
DataSet Object (List) (Page 116)
Value Property (Page 700)
Name Property (Page 523)

1.15.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.

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


System Manual, 09/2023, A5E52671436-AB 115
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 842)
Restore Method (Page 814)
Remove Method (Page 809)
AlarmLogs Object (Page 113)
Logging Object (Page 123)

1.15.2.7 DataSet Object (List)

Description

+0,5XQWLPH

'DWD6HW

'DWD,WHP

6FUHHQV 'DWD6HW

6FUHHQ 'DWD,WHP

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


116 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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:

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.

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


System Manual, 09/2023, A5E52671436-AB 117
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 114)
RemoveAll Method (Page 812)
Remove Method (Page 809)
Item Method (Page 789)
Count property (listing) (Page 389)
Add Method (Page 733)

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


118 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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, 09/2023, A5E52671436-AB 119
VBS for Creating Procedures and Actions
1.15 VBS Reference

Example:
The following command terminates WinCC Runtime:

'VBS3
HMIRuntime.Stop

See also
Screens Object (List) (Page 135)
TagSet Object (List) (Page 142)
Tags Object (List) (Page 140)
Logging Object (Page 123)
DataSet Object (List) (Page 116)
Visible Property (Page 716)
Trace Method (Page 833)
Tags Property (Page 614)
Stop Method (Page 832)
AlignmentLeft Property (Page 309)
Logging Property (Page 498)
Language Property (Page 472)
DataSet Property (Page 406)
CurrentContext Property (Page 401)
BaseScreenName Property (Page 344)
ActiveProject Property (Page 303)
ActiveScreen Property (Page 303)
MenuToolBarConfig Property (Page 508)
Alarms object (list) (Page 111)

1.15.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)


120 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 108)

1.15.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.

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


System Manual, 09/2023, A5E52671436-AB 121
VBS for Creating Procedures and Actions
1.15 VBS Reference

The "Layer" object can be used to:


• 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 121)
Visible Property (Page 716)
Parent Property (Page 543)
Name Property (Page 523)

1.15.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)


122 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 543)
Item Method (Page 789)
Count property (listing) (Page 389)
Layer Object (Page 121)

1.15.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).

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


System Manual, 09/2023, A5E52671436-AB 123
VBS for Creating Procedures and Actions
1.15 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 842)
DataLogs Object (Page 115)
AlarmLogs Object (Page 113)
Restore Method (Page 814)
Remove Method (Page 809)
DataLogs Property (Page 405)
AlarmLogs Property (Page 308)

1.15.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 125)

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


124 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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 111)
ProcessValue Object (Page 124)
Count property (listing) (Page 389)
Value Property (Page 700)
Item Method (Page 789)

1.15.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.

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


System Manual, 09/2023, A5E52671436-AB 125
VBS for Creating Procedures and Actions
1.15 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 303)
Name Property (Page 523)
Path Property (Page 545)

1.15.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)


126 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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:

Standard ob‐ Smart objects Windows ob‐ Tube ob‐ Controls Others
jects jects jects
Ellipse 3D bar Button Double T- Siemens HMI Sym‐ Customized Ob‐
piece bol Library ject
Ellipse arc Application Check box Polygon tube WinCC AlarmCon‐ Group
window trol
Ellipse seg‐ Bar Radio box Tube bend WinCC digital/
ment analog clock con‐
trol
Circle Picture win‐ Round button T-piece WinCC Function‐
dow TrendControl
Circular arc Control Slider WinCC gauge con‐
trol
Pie segment I/O field WinCC Online‐
TrendControl
Line Faceplate In‐ WinCC OnlineTa‐
stance bleControl
Polygon Graphic object WinCC RulerCon‐
trol
Polyline Combo box WinCC Slider Con‐
trol
Rectangle List box WinCC UserArchi‐
veControl
Rounded rec‐ Multiple row
tangle text
Connector OLE object
Group display
Text list
Status display

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


System Manual, 09/2023, A5E52671436-AB 127
VBS for Creating Procedures and Actions
1.15 VBS Reference

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)


128 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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
Object types of the ScreenItem object (Page 144)
Example: How to Read Tag Values (Page 851)
Example: Writing tag values (Page 849)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
Parent Property (Page 543)
Left Property (Page 489)
Layer Property (Page 474)
Height Property (Page 456)
Enabled Property (Page 416)
Activate Method (Page 731)
Objects and Lists (Page 108)
Properties (Page 301)

1.15.2.17 ScreenItems Object (List)

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

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


System Manual, 09/2023, A5E52671436-AB 129
VBS for Creating Procedures and Actions
1.15 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

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


130 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

See also
Count property (listing) (Page 389)
Example: How to Read Tag Values (Page 851)
Example: Writing tag values (Page 849)
ScreenItem Object (Page 126)
Parent Property (Page 543)
Item Method (Page 789)
Object types of the ScreenItem object (Page 144)

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


System Manual, 09/2023, A5E52671436-AB 131
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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.

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).

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


132 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

• 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.

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

See also
ScreenItems Property (Page 576)
Refresh Method (Page 808)
Activate Method (Page 731)

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


System Manual, 09/2023, A5E52671436-AB 133
VBS for Creating Procedures and Actions
1.15 VBS Reference

Zoom Property (Page 729)


Width Property (Page 718)
Parent Property (Page 543)
ObjectSizeDeclutteringMin Property (Page 528)
ObjectSizeDeclutteringMax Property (Page 528)
ObjectSizeDeclutteringEnable Property (Page 527)
ObjectName Property (Page 526)
Layers Property (Page 489)
DataSet Property (Page 406)
LayerDeclutteringEnable Property (Page 488)
Height Property (Page 456)
FillStyle Property (Page 430)
FillColor Property (Page 428)
ExtendedZoomingEnable Property (Page 426)
Enabled Property (Page 416)
BackColor Property (Page 323)
ActiveScreenItem Property (Page 304)
AccessPath Property (Page 301)

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


134 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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(<Zugriffsschlüssel>) instruction, must fulfill the syntax requirements:
[<Grundbildname>.]<Bildfenstername>[:<Bildname>] ...
.<Bildfenstername>[:<Bildname>]

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


System Manual, 09/2023, A5E52671436-AB 135
VBS for Creating Procedures and Actions
1.15 VBS Reference

This means:
• 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 126)
Refresh Method (Page 808)

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


136 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Item Method (Page 789)


Count property (listing) (Page 389)

1.15.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, 09/2023, A5E52671436-AB 137
VBS for Creating Procedures and Actions
1.15 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 596)

1.15.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".

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


138 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Use
The "Tag" object can be used to:
• Read information for 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-Reference
All the pictures which are addressed with the standard formulation

HMIRuntime.Tags("tag name")

are automatically compiled by the Cross-Reference of WinCC and then listed in the picture
properties.

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


System Manual, 09/2023, A5E52671436-AB 139
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

' 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 Cross-Reference.

See also
Name Property (Page 523)
Example: How to Read Tag Values (Page 851)
Example: Writing tag values (Page 849)
Write Method (Page 835)
Read Method (Page 804)
Value Property (Page 700)
TimeStamp Property (Page 641)
QualityCode Property (Page 561)
LastError Property (Page 472)
ErrorDescription Property (Page 421)
Comment property (Tag Logging) (Page 384)

1.15.2.22 Tags Object (List)

Description

+0,5XQWLPH

7DJV 7DJ6HW

7DJ 7DJ

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


140 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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.

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


System Manual, 09/2023, A5E52671436-AB 141
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 851)
Example: Writing tag values (Page 849)
Item Method (Page 789)
CreateTagSet Method (Page 737)
Tag Object (Page 138)

1.15.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 than single access to
various tags.

Usage
Possible uses of the TagSet object:
• 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)

Access to tags in the list

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

Tags in the list are also called tag objects.

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


142 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

For error-free read or write access to these tag objects, the corresponding tags must be
created in the 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.

Tag access via index


You can access the tag objects within the list both via the index and via the tag name.
In the TagSet object, the tags are sorted alphabetically according to the tag name.
Accordingly, the index is assigned to the alphabetically sorted tags.
The order in which the tags are added has no influence on the index.

Synchronous reading/writing
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 you how to generate a TagSet object, add tags and 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

See also
LastError Property (Page 472)
Example: How to Read Tag Values (Page 851)
Example: Writing tag values (Page 849)
Write Method (Page 835)
RemoveAll Method (Page 812)
Remove Method (Page 809)
Read Method (Page 804)

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


System Manual, 09/2023, A5E52671436-AB 143
VBS for Creating Procedures and Actions
1.15 VBS Reference

Item Method (Page 789)


ErrorDescription Property (Page 421)
Count property (listing) (Page 389)
Add Method (Page 733)
Tags Object (List) (Page 140)
Tag Object (Page 138)

1.15.3 Object types of the ScreenItem object

1.15.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 129)
ScreenItem Object (Page 126)
Group (Page 300)
Customized Object (Page 298)
Controls (Page 220)

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


144 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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 430)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)

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


System Manual, 09/2023, A5E52671436-AB 145
VBS for Creating Procedures and Actions
1.15 VBS Reference

RadiusWidth Property (Page 562)


RadiusHeight Property (Page 562)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 474)

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


146 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 562)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
StartAngle Property (Page 603)
RadiusWidth Property (Page 562)

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


System Manual, 09/2023, A5E52671436-AB 147
VBS for Creating Procedures and Actions
1.15 VBS Reference

PasswordLevel Property (Page 545)


Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashBorderColor Property (Page 435)
EndAngle Property (Page 419)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
Layer Property (Page 474)

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)


148 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 121)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
StartAngle Property (Page 603)
RadiusWidth Property (Page 562)
RadiusHeight Property (Page 562)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)

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


System Manual, 09/2023, A5E52671436-AB 149
VBS for Creating Procedures and Actions
1.15 VBS Reference

EndAngle Property (Page 419)


Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 474)

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)


150 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Properties (Page 301)
BorderStyle Property (Page 359)
Activate Method (Page 731)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Radius Property (Page 562)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)

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


System Manual, 09/2023, A5E52671436-AB 151
VBS for Creating Procedures and Actions
1.15 VBS Reference

BackColor Property (Page 323)


Layer Property (Page 474)

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 603)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)

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


152 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ToolTipText Property (Page 660)


Radius Property (Page 562)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashBorderColor Property (Page 435)
EndAngle Property (Page 419)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
Layer Property (Page 474)

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, 09/2023, A5E52671436-AB 153
VBS for Creating Procedures and Actions
1.15 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 686)
BorderColor Property (Page 357)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Top Property (Page 662)
ToolTipText Property (Page 660)
StartAngle Property (Page 603)
Radius Property (Page 562)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)

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


154 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

EndAngle Property (Page 419)


Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 474)

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, 09/2023, A5E52671436-AB 155
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
PasswordLevel Property (Page 545)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
RotationAngle Property (Page 567)
ReferenceRotationTop Property (Page 564)
ReferenceRotationLeft Property (Page 564)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashBorderColor Property (Page 435)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderEndStyle Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
Layer Property (Page 474)

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


156 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 564)
BackFlashColorOn Property (Page 325)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
RotationAngle Property (Page 567)

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


System Manual, 09/2023, A5E52671436-AB 157
VBS for Creating Procedures and Actions
1.15 VBS Reference

ReferenceRotationLeft Property (Page 564)


PointCount Property (Page 556)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Index Property (Page 465)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
ActualPointTop Property (Page 305)
ActualPointLeft Property (Page 305)
Layer Property (Page 474)

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


158 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 121)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
RotationAngle Property (Page 567)
ReferenceRotationTop Property (Page 564)

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


System Manual, 09/2023, A5E52671436-AB 159
VBS for Creating Procedures and Actions
1.15 VBS Reference

ReferenceRotationLeft Property (Page 564)


PointCount Property (Page 556)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Index Property (Page 465)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashBorderColor Property (Page 435)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderEndStyle Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
ActualPointTop Property (Page 305)
ActualPointLeft Property (Page 305)
Layer Property (Page 474)

Rectangle

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

Object Type of ScreenItem Object. Represents the graphic object "Rectangle"

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


160 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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, 09/2023, A5E52671436-AB 161
VBS for Creating Procedures and Actions
1.15 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 301)
BorderFlashColorOn Property (Page 359)
Activate Method (Page 731)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)

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


162 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

FlashBorderColor Property (Page 435)


FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 474)

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, 09/2023, A5E52671436-AB 163
VBS for Creating Procedures and Actions
1.15 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.

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


164 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Examples of error handling

Sub OnClick(ByVal Item)


'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 435)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FillStyle Property (Page 430)

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


System Manual, 09/2023, A5E52671436-AB 165
VBS for Creating Procedures and Actions
1.15 VBS Reference

FillingIndex Property (Page 429)


Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
Layer Property (Page 474)
RoundCornerHeight Property (Page 568)
RoundCornerWidth Property (Page 568)
CornerRadiusMode property (Page 388)

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

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


166 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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")
objStaticText.Left = objStaticText.Left + 10

See also
ObjectName Property (Page 526)
BorderFlashColorOn Property (Page 359)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Text list (Page 199)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
Orientation Property (Page 540)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
ForeFlashColorOn Property (Page 448)
ForeFlashColorOff Property (Page 447)
ForeColor Property (Page 446)
FontUnderline Property (Page 446)
FontSize Property (Page 445)
FontName Property (Page 444)
FontItalic Property (Page 444)
FontBold Property (Page 443)
FlashRateForeColor Property (Page 439)

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


System Manual, 09/2023, A5E52671436-AB 167
VBS for Creating Procedures and Actions
1.15 VBS Reference

FlashRateBorderColor Property (Page 438)


FlashRateBackColor Property (Page 438)
FlashForeColor Property (Page 436)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)
AdaptBorder Property (Page 306)
Layer Property (Page 474)

Connector

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

Object Type of ScreenItem Object. Represents the graphic object "Connector"

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


168 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Type Identifier in VBS


HMIConnector

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 129)
Activate Method (Page 731)
Properties (Page 301)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
TopConnectedObjectName Property (Page 663)
TopConnectedConnectionPointIndex Property (Page 663)
Top Property (Page 662)
ToolTipText Property (Page 660)
Parent Property (Page 543)
Orientation Property (Page 540)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Property (Page 474)
Height Property (Page 456)
Enabled Property (Page 416)
BottomConnectedObjectName Property (Page 360)
BottomConnectedConnectionPointIndex Property (Page 360)

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


System Manual, 09/2023, A5E52671436-AB 169
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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.

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


170 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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

'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 686)
Layer08Color Property (Page 480)

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


System Manual, 09/2023, A5E52671436-AB 171
VBS for Creating Procedures and Actions
1.15 VBS Reference

BorderStyle Property (Page 359)


Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
ZeroPointValue Property (Page 729)
Width Property (Page 718)
Visible Property (Page 716)
Top Property (Page 662)
ToolTipText Property (Page 660)
Process Property (Page 559)
PredefinedAngles Property (Page 558)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Min Property (Page 520)
Max Property (Page 502)
LightEffect Property (Page 490)
Left Property (Page 489)
Layer10Value Property (Page 488)
Layer09Value Property (Page 488)
Layer08Value Property (Page 488)
Layer07Value Property (Page 487)
Layer06Value Property (Page 487)
Layer05Value Property (Page 487)
Layer04Value Property (Page 486)
Layer03Value Property (Page 486)
Layer02Value Property (Page 486)
Layer01Value Property (Page 486)
Layer00Value Property (Page 485)
Layer10Color Property (Page 481)
Layer09Color Property (Page 481)
Layer07Color Property (Page 480)
Layer06Color Property (Page 480)
Layer05Color Property (Page 479)

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


172 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Layer04Color Property (Page 479)


Layer03Color Property (Page 479)
Layer02Color Property (Page 478)
Layer01Color Property (Page 478)
Layer00Color Property (Page 478)
Layer10Checked Property (Page 477)
Layer09Checked Property (Page 477)
Layer08Checked Property (Page 477)
Layer07Checked Property (Page 477)
Layer06Checked Property (Page 476)
Layer05Checked Property (Page 476)
Layer04Checked Property (Page 476)
Layer03Checked Property (Page 475)
Layer02Checked Property (Page 475)
Layer01Checked Property (Page 475)
Layer00Checked Property (Page 475)
Layer Object (Page 121)
Height Property (Page 456)
Enabled Property (Page 416)
Direction Property (Page 413)
BorderWidth Property (Page 359)
BorderColor Property (Page 357)
BaseY Property (Page 345)
BaseX Property (Page 345)
BarWidth Property (Page 342)
BarHeight Property (Page 330)
BarDepth Property (Page 330)
Background Property (Page 326)
BackColor Property (Page 323)
Axe Property (Page 322)
AngleBeta Property (Page 312)
AngleAlpha Property (Page 312)

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


System Manual, 09/2023, A5E52671436-AB 173
VBS for Creating Procedures and Actions
1.15 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 301)
Activate Method (Page 731)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
WindowBorder Property (Page 719)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
Template Property (Page 615)
Parent Property (Page 543)
OnTop Property (Page 531)

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


174 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ObjectName Property (Page 526)


Moveable Property (Page 522)
MaximizeButton Property (Page 502)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
Enabled Property (Page 416)
CloseButton Property (Page 375)
Caption Property (Page 366)
Application Property (Page 314)

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, 09/2023, A5E52671436-AB 175
VBS for Creating Procedures and Actions
1.15 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.

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


176 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

See also
ToolTipText Property (Page 660)
Layer Object (Page 121)
ColorChangeType Property (Page 379)
Average Property (Page 321)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
ZeroPointValue Property (Page 729)
ZeroPoint Property (Page 729)
Width Property (Page 718)
WarningLow Property (Page 718)
WarningHigh Property (Page 717)
Visible Property (Page 716)
TypeWarningLow Property (Page 690)
TypeWarningHigh Property (Page 690)
TypeToleranceLow Property (Page 689)
TypeToleranceHigh Property (Page 689)

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


System Manual, 09/2023, A5E52671436-AB 177
VBS for Creating Procedures and Actions
1.15 VBS Reference

TypeLimitLow5 Property (Page 689)


TypeLimitLow4 Property (Page 689)
TypeLimitHigh5 Property (Page 688)
TypeLimitHigh4 Property (Page 688)
TypeAlarmLow Property (Page 688)
TypeAlarmHigh Property (Page 687)
Type Property (Page 686)
LTrendColor property (before WinCC V7) (Page 666)
Trend Property (Page 664)
Top Property (Page 662)
ToleranceLow Property (Page 647)
ToleranceHigh Property (Page 647)
ScalingType Property (Page 574)
Scaling Property (Page 574)
ScaleTicks Property (Page 573)
ScaleColor Property (Page 573)
RightComma Property (Page 566)
Process Property (Page 559)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Min Property (Page 520)
Max Property (Page 502)
Marker Property (Page 501)
LongStrokesTextEach Property (Page 499)
LongStrokesSize Property (Page 499)
LongStrokesOnly Property (Page 498)
LongStrokesBold Property (Page 498)
LimitLow5 Property (Page 492)
LimitLow4 Property (Page 492)
LimitHigh5 Property (Page 491)
LimitHigh4 Property (Page 491)
LeftComma Property (Page 490)
Left Property (Page 489)
HysteresisRange Property (Page 464)

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


178 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Hysteresis Property (Page 464)


Height Property (Page 456)
FontSize Property (Page 445)
FontName Property (Page 444)
FontBold Property (Page 443)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle2 Property (Page 431)
FillStyle Property (Page 430)
FillColor Property (Page 428)
Exponent Property (Page 422)
Enabled Property (Page 416)
Direction Property (Page 413)
ColorWarningLow Property (Page 383)
ColorWarningHigh Property (Page 383)
ColorToleranceLow Property (Page 382)
ColorToleranceHigh Property (Page 382)
ColorLimitLow5 Property (Page 380)
ColorLimitLow4 Property (Page 380)
ColorLimitHigh5 Property (Page 380)
ColorLimitHigh4 Property (Page 379)
ColorAlarmLow Property (Page 379)
ColorAlarmHigh Property (Page 378)
CheckWarningLow Property (Page 374)
CheckWarningHigh Property (Page 373)
CheckToleranceLow Property (Page 373)
CheckToleranceHigh Property (Page 373)
CheckLimitLow5 Property (Page 372)
CheckLimitLow4 Property (Page 372)
CheckLimitHigh5 Property (Page 372)
CheckLimitHigh4 Property (Page 371)
CheckAlarmLow Property (Page 371)
CheckAlarmHigh Property (Page 371)

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


System Manual, 09/2023, A5E52671436-AB 179
VBS for Creating Procedures and Actions
1.15 VBS Reference

BorderWidth Property (Page 359)


BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor3 Property (Page 324)
BackColor2 Property (Page 324)
BackColor Property (Page 323)
AxisSection Property (Page 322)
Alignment Property (Page 309)
AlarmLow Property (Page 308)
AlarmHigh Property (Page 308)

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

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


180 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 587)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Zoom Property (Page 729)
WindowBorder Property (Page 719)
Width Property (Page 718)
Visible Property (Page 716)
UpdateCycle Property (Page 692)
Type Property (Page 686)
Top Property (Page 662)
TagPrefix Property (Page 613)
ScrollPositionY Property (Page 578)
ScrollPositionX Property (Page 577)
ScrollBars Property (Page 577)
ScreenName Property (Page 576)
Screens Property (Page 576)
Parent Property (Page 543)
OnTop Property (Page 531)
OffsetTop Property (Page 529)
OffsetLeft Property (Page 529)
ObjectName Property (Page 526)
Moveable Property (Page 522)
MaximizeButton Property (Page 502)
Left Property (Page 489)

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


System Manual, 09/2023, A5E52671436-AB 181
VBS for Creating Procedures and Actions
1.15 VBS Reference

Layer Object (Page 121)


Height Property (Page 456)
Enabled Property (Page 416)
CloseButton Property (Page 375)
CaptionText property (Page 368)
Caption Property (Page 366)
AdaptSize Property (Page 307)
AdaptPicture Property (Page 306)
MenuToolBarConfig Property (Page 508)

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

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


182 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
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.

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


System Manual, 09/2023, A5E52671436-AB 183
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

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 Slider Control
• WinCC UserArchiveControl
• HMI Symbol Library

See also
Object Property (Page 526)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
Parent Property (Page 543)

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


184 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ObjectName Property (Page 526)


Left Property (Page 489)
Layer Property (Page 474)
Height Property (Page 456)
Enabled Property (Page 416)

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 531)
EditAtOnce Property (Page 416)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 185
VBS for Creating Procedures and Actions
1.15 VBS Reference

Width Property (Page 718)


Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
OutputValue Property (Page 542)
OutputFormat Property (Page 542)
Orientation Property (Page 540)
OperationReport Property (Page 539)
ObjectName Property (Page 526)
LimitMin Property (Page 493)
LimitMax Property (Page 492)
Left Property (Page 489)
Layer Object (Page 121)
HiddenInput Property (Page 457)
Height Property (Page 456)
ForeFlashColorOn Property (Page 448)
ForeFlashColorOff Property (Page 447)
ForeColor Property (Page 446)
FontUnderline Property (Page 446)
FontSize Property (Page 445)
FontName Property (Page 444)
FontItalic Property (Page 444)
FontBold Property (Page 443)
FlashRateForeColor Property (Page 439)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashForeColor Property (Page 436)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillColor Property (Page 428)
Enabled Property (Page 416)

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


186 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

DataFormat Property (Page 405)


CursorControl Property (Page 402)
ClearOnNew Property (Page 374)
ClearOnError Property (Page 374)
BoxType Property (Page 361)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AssumeOnFull Property (Page 316)
AssumeOnExit Property (Page 316)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)
AdaptBorder Property (Page 306)

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, 09/2023, A5E52671436-AB 187
VBS for Creating Procedures and Actions
1.15 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 543)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)

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


188 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ScreenItem Object (Page 126)


Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
PicUseTransColor Property (Page 555)
PictureName Property (Page 552)
PicTransColor Property (Page 551)
PicReferenced Property (Page 550)
PasswordLevel Property (Page 545)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)

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


System Manual, 09/2023, A5E52671436-AB 189
VBS for Creating Procedures and Actions
1.15 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

See also
Text list property (Page 616)

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)


190 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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

See also
Text list property (Page 616)

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, 09/2023, A5E52671436-AB 191
VBS for Creating Procedures and Actions
1.15 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.

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


192 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Determine the version-dependent ProgID as follows:

'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, 09/2023, A5E52671436-AB 193
VBS for Creating Procedures and Actions
1.15 VBS Reference

In the case of identical names, the properties of the ScreenItem object are used.

See also
Height Property (Page 456)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Parent Property (Page 543)
Object Property (Page 526)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Property (Page 474)
Enabled Property (Page 416)

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)


194 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 731)
MCKQBackColorOn Property (Page 506)
FontBold Property (Page 443)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
UserValue4 Property (Page 698)
UserValue3 Property (Page 698)
UserValue2-Eigenschaft (Page 697)
UserValue1 Property (Page 697)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
SignificantMask Property (Page 594)
SameSize Property (Page 573)
Relevant Property (Page 565)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
MessageClass Property (Page 517)
MCText Property (Page 508)
MCKQTextFlash Property (Page 507)
MCKQTextColorOn Property (Page 507)
MCKQTextColorOff Property (Page 507)

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


System Manual, 09/2023, A5E52671436-AB 195
VBS for Creating Procedures and Actions
1.15 VBS Reference

MCKQBackFlash Property (Page 507)


MCKQBackColorOff Property (Page 506)
MCKOTextFlash Property (Page 506)
MCKOTextColorOn Property (Page 505)
MCKOTextColorOff Property (Page 505)
MCKOBackFlash Property (Page 505)
MCKOBackColorOn Property (Page 505)
MCKOBackColorOff Property (Page 504)
MCGUTextFlash Property (Page 504)
MCGUTextColorOn Property (Page 504)
MCGUTextColorOff Property (Page 503)
MCGUBackFlash Property (Page 503)
MCGUBackColorOn Property (Page 503)
MCGUBackColorOff-Eigenschaft (Page 503)
LockTextColor Property (Page 497)
LockText Property (Page 497)
LockStatus Property (Page 497)
LockBackColor Property (Page 497)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FontUnderline Property (Page 446)
FontSize Property (Page 445)
FontName Property (Page 444)
FontItalic Property (Page 444)
FlashRate Property (Page 437)
Enabled Property (Page 416)
CollectValue Property (Page 377)
Button4Width Property (Page 366)
Button3Width Property (Page 366)
Button2Width Property (Page 365)
Button1Width Property (Page 365)
BackColor Property (Page 323)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)

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


196 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

SVG object

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

Object type of ScreenItem object. Represents the graphic object "SVG object".

Type Identifier in VBS


HMISVGObject

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

'VBS383
Dim objSVGObject
Set objSVGObject = ScreenItems("SVGObject1")
objSVGObject.Left = objSVGObject.Left + 10

See also
ArrowsPosition property (Page 315)
BasicBorderColor property (Page 345)
BasicColor property (Page 345)
ColorState1Good property (Page 381)
ColorState2Maintenance property (Page 381)
ColorState3Error property (Page 381)
ColorStateXUncertain property (Page 381)
ContrastColor property (Page 388)
ConveyorBasicColor property (Page 390)
ConveyorContrastColor property (Page 390)
Cutaway property (Page 404)
DisplayFillLevel property (Page 413)

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


System Manual, 09/2023, A5E52671436-AB 197
VBS for Creating Procedures and Actions
1.15 VBS Reference

DisplayFillMode property (Page 413)


FillLevelColor property (Page 429)
FillLevelValue property (Page 430)
FlameBasicColor property (Page 434)
FlameBorderColor property (Page 434)
FlameContrastColor property (Page 434)
FlameSize property (Page 435)
FluidColorHigh property (Page 441)
FluidColorLow property (Page 441)
GreenLightOn property (Page 452)
HighlightToggle property (Page 458)
ImpulsePosition property (Page 465)
LightOff property (Page 491)
Maximum property (Page 502)
Minimum property (Page 521)
PipeColor property (Page 555)
Position property (SVG graphic) (Page 556)
RedLightOn property (Page 564)
RunningPosition property (Page 572)
Size property (Page 595)
State property (SVG graphic) (Page 603)
StripsBasicColor property (Page 610)
StripsContrastColor property (Page 610)
TemperatureValue property (Page 614)
YellowLightOn property (Page 728)

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


198 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 686)
FontUnderline Property (Page 446)
BackFlashColorOff Property (Page 325)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
UnselTextColor Property (Page 692)
UnselBGColor Property (Page 692)
Top Property (Page 662)

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


System Manual, 09/2023, A5E52671436-AB 199
VBS for Creating Procedures and Actions
1.15 VBS Reference

ToolTipText Property (Page 660)


SelTextColor Property (Page 584)
SelBGColor Property (Page 579)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
OutputValue Property (Page 542)
Orientation Property (Page 540)
OperationReport Property (Page 539)
OperationMessage Property (Page 531)
ObjectName Property (Page 526)
NumberLines Property (Page 525)
ListType Property (Page 495)
Left Property (Page 489)
Layer Object (Page 121)
LanguageSwitch Property (Page 472)
ItemBorderWidth Property (Page 469)
ItemBorderStyle Property (Page 469)
ItemBorderColor Property (Page 469)
ItemBorderBackColor Property (Page 468)
Height Property (Page 456)
ForeFlashColorOn Property (Page 448)
ForeFlashColorOff Property (Page 447)
ForeColor Property (Page 446)
FontSize Property (Page 445)
FontName Property (Page 444)
FontItalic Property (Page 444)
FontBold Property (Page 443)
FlashRateForeColor Property (Page 439)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashForeColor Property (Page 436)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillColor Property (Page 428)

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


200 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Enabled Property (Page 416)


EditAtOnce Property (Page 416)
CursorControl Property (Page 402)
BoxType Property (Page 361)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BitNumber Property (Page 349)
BackFlashColorOn Property (Page 325)
BackColor Property (Page 323)
AssumeOnExit Property (Page 316)
Assignments Property (Page 316)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)
AdaptBorder Property (Page 306)
Text list property (Page 616)
TextListSort property (Page 617)

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, 09/2023, A5E52671436-AB 201
VBS for Creating Procedures and Actions
1.15 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 121)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Index Property (Page 465)
Height Property (Page 456)
FlashRateFlashPic Property (Page 439)
FlashRateBorderColor Property (Page 438)
FlashPicUseTransColor Property (Page 437)
FlashPicture Property (Page 437)
FlashPicTransColor Property (Page 436)
FlashPicReferenced Property (Page 436)
FlashFlashPicture Property (Page 435)
FlashBorderColor Property (Page 435)
Enabled Property (Page 416)
BorderWidth Property (Page 359)

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


202 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BorderStyle Property (Page 359)


BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BasePicUseTransColor Property (Page 344)
BasePicture Property (Page 343)
BasePicTransColor Property (Page 343)
BasePicReferenced Property (Page 343)

1.15.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, 09/2023, A5E52671436-AB 203
VBS for Creating Procedures and Actions
1.15 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.

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


204 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

See also
Top Property (Page 662)
FlashBorderColor Property (Page 435)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
WindowsStyle Property (Page 720)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
ToolTipText Property (Page 660)
Text list (Page 199)
PictureUp Property (Page 554)
PictureDown Property (Page 552)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
Orientation Property (Page 540)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)

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


System Manual, 09/2023, A5E52671436-AB 205
VBS for Creating Procedures and Actions
1.15 VBS Reference

Hotkey Property (Page 463)


Height Property (Page 456)
ForeFlashColorOn Property (Page 448)
ForeFlashColorOff Property (Page 447)
ForeColor Property (Page 446)
FontUnderline Property (Page 446)
FontSize Property (Page 445)
FontName Property (Page 444)
FontItalic Property (Page 444)
FontBold Property (Page 443)
FlashRateForeColor Property (Page 439)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashForeColor Property (Page 436)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColorTop Property (Page 358)
BorderColor Property (Page 357)
BorderColorBottom Property (Page 358)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)
AdaptBorder Property (Page 306)

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


206 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 445)
BackColor Property (Page 323)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Text list (Page 199)

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


System Manual, 09/2023, A5E52671436-AB 207
VBS for Creating Procedures and Actions
1.15 VBS Reference

Process Property (Page 559)


PasswordLevel Property (Page 545)
Parent Property (Page 543)
Orientation Property (Page 540)
OperationMessage Property (Page 531)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Index Property (Page 465)
Height Property (Page 456)
ForeFlashColorOn Property (Page 448)
ForeFlashColorOff Property (Page 447)
ForeColor Property (Page 446)
FontUnderline Property (Page 446)
FontName Property (Page 444)
FontItalic Property (Page 444)
FontBold Property (Page 443)
FlashRateForeColor Property (Page 439)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashForeColor Property (Page 436)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BoxCount Property (Page 361)
BoxAlignment Property (Page 360)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)

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


208 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BorderBackColor Property (Page 357)


BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)
AdaptBorder Property (Page 306)
Text list property (Page 616)

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 446)
BackFlashColorOn Property (Page 325)
Activate Method (Page 731)
Properties (Page 301)

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


System Manual, 09/2023, A5E52671436-AB 209
VBS for Creating Procedures and Actions
1.15 VBS Reference

ScreenItems Object (List) (Page 129)


ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Text list (Page 199)
Process Property (Page 559)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
Orientation Property (Page 540)
OperationMessage Property (Page 531)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Index Property (Page 465)
Height Property (Page 456)
ForeFlashColorOn Property (Page 448)
ForeFlashColorOff Property (Page 447)
FontUnderline Property (Page 446)
FontSize Property (Page 445)
FontName Property (Page 444)
FontItalic Property (Page 444)
FontBold Property (Page 443)
FlashRateForeColor Property (Page 439)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashForeColor Property (Page 436)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)

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


210 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Enabled Property (Page 416)


BoxCount Property (Page 361)
BoxAlignment Property (Page 360)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOff Property (Page 325)
BackColor Property (Page 323)
AlignmentTop Property (Page 309)
AlignmentLeft Property (Page 309)
AdaptBorder Property (Page 306)
Text list property (Page 616)

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

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


System Manual, 09/2023, A5E52671436-AB 211
VBS for Creating Procedures and Actions
1.15 VBS Reference

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")
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 550)
BorderColorTop Property (Page 358)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)

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


212 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Top Property (Page 662)


ToolTipText Property (Page 660)
Toggle Property (Page 646)
Radius Property (Page 562)
Pressed Property (Page 558)
PicUpUseTransColor Property (Page 555)
PicUpTransparent Property (Page 554)
PicUpReferenced Property (Page 554)
PictureUp Property (Page 554)
PictureDown Property (Page 552)
PictureDeactivated Property (Page 551)
PicDownTransparent Property (Page 550)
PicDownReferenced Property (Page 549)
PicDeactUseTransColor Property (Page 549)
PicDeactTransparent Property (Page 549)
PicDeactReferenced-Eigenschaft (Page 548)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
Enabled Property (Page 416)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)

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


System Manual, 09/2023, A5E52671436-AB 213
VBS for Creating Procedures and Actions
1.15 VBS Reference

BorderColor Property (Page 357)


BorderColorBottom Property (Page 358)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
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

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


214 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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)


'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, 09/2023, A5E52671436-AB 215
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Height Property (Page 456)
BackColorBottom Property (Page 324)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
WindowsStyle Property (Page 720)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
SmallChange Property (Page 596)
Process Property (Page 559)
PasswordLevel Property (Page 545)
Parent Property (Page 543)
OperationReport Property (Page 539)
OperationMessage Property (Page 531)
ObjectName Property (Page 526)
Min Property (Page 520)
Max Property (Page 502)
Left Property (Page 489)
Layer Object (Page 121)
FlashRateBorderColor Property (Page 438)
FlashRateBackColor Property (Page 438)
FlashBorderColor Property (Page 435)
FlashBackColor Property (Page 435)
FillStyle Property (Page 430)
FillingIndex Property (Page 429)
Filling Property (Page 428)
FillColor Property (Page 428)
ExtendedOperation Property (Page 425)
Enabled Property (Page 416)
Direction Property (Page 413)

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


216 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColorTop Property (Page 382)


ColorBottom Property (Page 379)
ButtonColor Property (Page 361)
BorderWidth Property (Page 359)
BorderStyle Property (Page 359)
BorderFlashColorOn Property (Page 359)
BorderFlashColorOff Property (Page 358)
BorderColor Property (Page 357)
BorderBackColor Property (Page 357)
BackFlashColorOn Property (Page 325)
BackFlashColorOff Property (Page 325)
BackColorTop Property (Page 325)
BackColor Property (Page 323)

1.15.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, 09/2023, A5E52671436-AB 217
VBS for Creating Procedures and Actions
1.15 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

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


218 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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, 09/2023, A5E52671436-AB 219
VBS for Creating Procedures and Actions
1.15 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.15.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

Note
In order that example above works, a multimedia control should be inserted in the picture.

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


220 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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
' Make the VBS Array compatibile with the OLE Automation
vArrayCoercion = (arrayPoints)
objTrendControl.DataXY = vArrayCoercion ' this array will occur in the control

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


System Manual, 09/2023, A5E52671436-AB 221
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 Online Trend Control (before WinCC V7)
• WinCC Push Button Control (up to WinCC V7.3)
• WinCC RulerControl
• WinCC Slider Control
• WinCC UserArchiveControl

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


222 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
HMI Symbol Library (Page 240)
WinCC Slider Control (Page 274)
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Gauge Control (Page 255)
WinCC Function Trend Control (before WinCC V7) (Page 285)
WinCC Digital/Analog Clock (Page 247)
WinCC Alarm Control (before WinCC V7) (Page 283)
WinCC UserArchiveControl (Page 278)
WinCC RulerControl (Page 270)
WinCC OnlineTrendControl (Page 263)
WinCC OnlineTableControl (Page 258)
WinCC FunctionTrendControl (Page 249)
WinCC AlarmControl (Page 242)

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.

Use in the controls


• WinCC UserArchiveControl (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 "colobj.ColumnName", the listing name "Column" is dropped:
"colobj.Name".

ColumnAlias (Page 390) ColumnFlagUnique ColumnPosition (Page 395) ColumnSort (Page 398)
(Page 393)
ColumnAlign (Page 391) ColumnHideText (Page 393) ColumnPrecisions (Page 395) ColumnSortIndex (Page 399)

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


System Manual, 09/2023, A5E52671436-AB 223
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColumnAutoPrecisions ColumnHideTitleText ColumnReadAccess ColumnStartValue (Page 399)


(Page 391) (Page 393) (Page 396)
ColumnCaption (Page 391) ColumnIndex (Page 394) ColumnReadonly (Page 396) ColumnStringLength
(Page 399)
ColumnCount (Page 391) ColumnLeadingZeros ColumnRepos (Page 396) ColumnTimeFormat
(Page 394) (Page 399)
ColumnDateFormat ColumnLength (Page 394) ColumnShowDate (Page 397) ColumnType (Page 400)
(Page 392)
ColumnDMVarName ColumnMaxValue (Page 395) ColumnShowIcon (Page 397) ColumnVisible (Page 401)
(Page 392)
ColumnExponentialFormat ColumnMinValue (Page 395) ColumnShowTitleIcon ColumnWriteAccess
(Page 392) (Page 398) (Page 401)
ColumnFlagNotNull ColumnName (Page 395)
(Page 392)

See also
GetColumn method (Page 740)
GetColumnCollection method (Page 741)

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.

Use in the controls


• WinCC AlarmControl (Page 242)

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 458) HitlistColumnRepos (Page 460) HitListMaxSourceItems (Page 461)


HitlistColumnAutoAdjust (Page 458) HitlistColumnSort (Page 460) HitListMaxSourceItemsWarn (Page 461)
HitlistColumnCount (Page 459) HitlistColumnSortIndex (Page 460) HitListRelTime (Page 462)
HitlistColumnIndex (Page 459) HitlistColumnVisible (Page 460) HitListRelTimeFactor (Page 462)

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


224 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

HitlistColumnName (Page 459) HitListDefaultSort (Page 461) HitListRelTimeFactorType (Page 462)


HitlistColumnRemove (Page 459)

See also
GetHitlistColumn method (Page 742)
GetHistlistColumnCollection method (Page 743)

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.

Use in the controls


• WinCC AlarmControl (Page 242)

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 MessageBlockFlashOn MessageBlockLength MessageBlockShowIcon


(Page 509) (Page 512) (Page 514) (Page 515)
MessageBlockAutoPrecisions MessageBlockHideText MessageBlockName MessageBlockShowTitleIcon
(Page 509) (Page 512) (Page 514) (Page 515)
MessageBlockCaption MessageBlockHideTitleText MessageBlockPrecisions MessageBlockTextId
(Page 509) (Page 512) (Page 514) (Page 515)
MessageBlockCount MessageBlockID (Page 512) MessageBlockSelected MessageBlockTimeFormat
(Page 510) (Page 514) (Page 516)
MessageBlockDateFormat MessageBlockIndex MessageBlockShowDate MessageBlockType
(Page 513) (Page 515) (Page 516)
MessageBlockExponential‐ MessageBlockLeadingZeros
Format (Page 511) (Page 513)

See also
GetMessageBlock method (Page 744)
GetMessageBlockCollection method (Page 745)

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


System Manual, 09/2023, A5E52671436-AB 225
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 242)

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".
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 517) MessageColumnName (Page 518) MessageColumnSort (Page 519)


MessageColumnAutoAdjust (Page 517) MessageColumnRemove (Page 518) MessageColumnSortIndex (Page 519)
MessageColumnCount (Page 518) MessageColumnRepos (Page 519) MessageColumnVisible (Page 519)
MessageColumnIndex (Page 518)

See also
GetMessageColumn method (Page 746)
GetMessageColumnCollection method (Page 747)

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 242)

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


226 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 "opmessobj.OperatorMessageName", the listing name
"OperatorMessage" is dropped: "opmessobj.Name".

OperatorMessageID (Page 532) OperatorMessageSource5 (Page 534) OperatorMessageSourceType3


(Page 537)
OperatorMessageIndex (Page 532) OperatorMessageSource6 (Page 535) OperatorMessageSourceType4
(Page 537)
OperatorMessageName (Page 532) OperatorMessageSource7 (Page 535) OperatorMessageSourceType5
(Page 537)
OperatorMessageNumber (Page 533) OperatorMessageSource8 (Page 535) OperatorMessageSourceType6
(Page 538)
OperatorMessageSelected (Page 533) OperatorMessageSource9 (Page 536) OperatorMessageSourceType7
(Page 538)
OperatorMessageSource1 (Page 533) OperatorMessageSource10 (Page 536) OperatorMessageSourceType8
(Page 538)
OperatorMessageSource2 (Page 533) OperatorMessageSourceType1 OperatorMessageSourceType9
(Page 536) (Page 539)
OperatorMessageSource3 (Page 534) OperatorMessageSourceType2 OperatorMessageSourceType10
(Page 536) (Page 539)
OperatorMessageSource4 (Page 534)

See also
GetOperatorMessage method (Page 748)
GetOperatorMessageCollection method (Page 749)

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 242) WinCC OnlineTableControl (Page 258)


WinCC RulerControl (Page 270) WinCC UserArchiveControl (Page 278)

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


System Manual, 09/2023, A5E52671436-AB 227
VBS for Creating Procedures and Actions
1.15 VBS Reference

Available methods of the object

SelectAll (Page 817) SelectRow (Page 818)


UnselectAll (Page 834) UnselectRow (Page 835)

Available properties of the object


• Count (Page 389)

Example

'VBS371
Dim mycontrol
Set mycontrol = ScreenItems.Item("Control1")
Dim rowobj
Set rowobj = mycontrol.GetRowCollection

'Reading the property Count of the collection


HMIRuntime.Trace "RowCount: " & rowobj.Count & vbNewline

'Reading the properties CellText, CellCount an RowNumber for the items of the collection
For lIndex = 1 To rowobj.Count
'In this example the CellText of the third column is returned
HMIRuntime.Trace "RowCellText: " & lIndex & ": " & rowobj.item(lIndex).CellText(3) &
vbNewline
HMIRuntime.Trace "RowCellCount: " & lIndex & ": " & rowobj.item(lIndex).CellCount &
vbNewline
HMIRuntime.Trace "RowNumber: " & rowobj.item(lIndex).RowNumber & vbNewline
Next

See also
GetRow method (Page 750)
GetRowCollection method (Page 751)
GetSelectedRow method (Page 758)
GetSelectedRows method (Page 759)
CellCount property (Page 368)
CellText property (Page 370)
RowNumber property (Page 569)

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).

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


228 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Use the "Block" listing object to configure the blocks of WinCC RulerControl.

Use in the controls


• WinCC RulerControl (Page 270)

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 350) BlockHideText (Page 353) BlockPrecisions (Page 355)


BlockAutoPrecisions (Page 351) BlockHideTitleText (Page 353) BlockShowDate (Page 355)
BlockCaption (Page 351) BlockID (Page 353) BlockShowIcon (Page 355)
BlockCount (Page 351) BlockIndex (Page 354) BlockShowTitleIcon (Page 356)
BlockDateFormat (Page 351) BlockLength (Page 355) BlockTimeFormat (Page 356)
BlockExponentialFormat (Page 352) BlockName (Page 355) BlockUseSourceFormat (Page 356)

See also
GetRulerBlock method (Page 753)
GetRulerBlockCollection method (Page 754)

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.

Use in the controls


• WinCC RulerControl (Page 270)

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".

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


System Manual, 09/2023, A5E52671436-AB 229
VBS for Creating Procedures and Actions
1.15 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".

ColumnAdd (Page 390) ColumnName (Page 395) ColumnSort (Page 398)


ColumnCount (Page 391) ColumnRemove (Page 396) ColumnSortIndex (Page 399)
ColumnIndex (Page 394) ColumnRepos (Page 396) ColumnVisible (Page 401)

See also
GetRulerColumn method (Page 755)
GetRulerColumnCollection method (Page 756)

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 270)

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".

ColumnAdd (Page 390) ColumnName (Page 395) ColumnSort (Page 398)


ColumnCount (Page 391) ColumnRemove (Page 396) ColumnSortIndex (Page 399)
ColumnIndex (Page 394) ColumnRepos (Page 396) ColumnVisible (Page 401)

See also
GetStatisticAreaColumn method (Page 760)
GetStatisticAreaColumnCollection method (Page 761)

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


230 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 270)

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 390) ColumnName (Page 395) ColumnSort (Page 398)


ColumnCount (Page 391) ColumnRemove (Page 396) ColumnSortIndex (Page 399)
ColumnIndex (Page 394) ColumnRepos (Page 396) ColumnVisible (Page 401)

See also
GetStatisticResultColumn method (Page 762)
GetStatisticResultColumnCollection method (Page 763)

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 242) WinCC FunctionTrendControl (Page 249) WinCC OnlineTableControl (Page 258)
WinCC OnlineTrendControl (Page 263) WinCC RulerControl (Page 270) WinCC UserArchiveControl (Page 278)

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


System Manual, 09/2023, A5E52671436-AB 231
VBS for Creating Procedures and Actions
1.15 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 "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 605) StatusbarElementIndex (Page 606) StatusbarElementText (Page 607)


StatusbarElementAutoSize (Page 605) StatusbarElementName (Page 606) StatusbarElementTooltipText (Page 607)
StatusbarElementCount (Page 605) StatusbarElementRemove (Page 606) StatusbarElementUserDefined
(Page 608)
StatusbarElementIconId (Page 605) StatusbarElementRename (Page 606) StatusbarElementVisible (Page 607)
StatusbarElementId (Page 605) StatusbarElementRepos (Page 607) StatusbarElementWidth (Page 608)

See also
GetStatusbarElement method (Page 764)
GetStatusbarElementCollection method (Page 765)

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).
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 263)

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 624) TimeAxisRepos (Page 626)


TimeAxisAdd (Page 621) TimeAxisInTrendColor TimeAxisShowDate (Page 626)
TimeAxisAlign (Page 621) TimeAxisLabel (Page 625) TimeAxisTimeFormat (Page 626)

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


232 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

TimeAxisBeginTime (Page 622) TimeAxisMeasurePoints (Page 625) TimeAxisTimeRangeBase (Page 627)


TimeAxisColor (Page 622) TimeAxisName (Page 625) TimeAxisTimeRangeFactor (Page 627)
TimeAxisCount (Page 622) TimeAxisRangeType (Page 625) TimeAxisTrendWindow (Page 627)
TimeAxisDateFormat (Page 623) TimeAxisRemove (Page 625) TimeAxisVisible (Page 628)
TimeAxisEndTime (Page 623) TimeAxisRename (Page 626)

See also
GetTimeAxis method (Page 766)
GetTimeAxisCollection method (Page 767)

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.

Use in the controls


• WinCC OnlineTableControl (Page 258)

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 629) TimeColumnHideText (Page 633) TimeColumnShowDate (Page 635)


TimeColumnAdd (Page 629) TimeColumnHideTitleText (Page 633) TimeColumnShowIcon (Page 635)
TimeColumnAlign (Page 629) TimeColumnIndex (Page 633) TimeColumnShowTitleIcon (Page 635)
TimeColumnBackColor (Page 630) TimeColumnLength (Page 633) TimeColumnSort (Page 636)
TimeColumnBeginTime (Page 630) TimeColumnMeasurePoints (Page 634) TimeColumnSortIndex (Page 636)
TimeColumnCaption (Page 631) TimeColumnName (Page 634) TimeColumnTimeFormat (Page 636)
TimeColumnCount (Page 631) TimeColumnRangeType (Page 634) TimeColumnTimeRangeBase (Page 637)
TimeColumnDateFormat (Page 631) TimeColumnRemove (Page 634) TimeColumnTimeRangeFactor
(Page 637)
TimeColumnEndTime (Page 632) TimeColumnRename (Page 634) TimeColumnUseValueColumnColors
(Page 637)
TimeColumnForeColor (Page 632) TimeColumnRepos (Page 635) TimeColumnVisible (Page 638)

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


System Manual, 09/2023, A5E52671436-AB 233
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
GetTimeColumn method (Page 769)
GetTimeColumnCollection method (Page 770)

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 242) WinCC FunctionTrendControl (Page 249) WinCC OnlineTableControl (Page 258)
WinCC OnlineTrendControl (Page 263) WinCC RulerControl (Page 270) WinCC UserArchiveControl (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 "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 649) ToolbarButtonId (Page 655) ToolbarButtonRename (Page 656)


ToolbarButtonAdd (Page 649) ToolbarButtonIndex (Page 655) ToolbarButtonRepos (Page 656)
ToolbarButtonBeginGroup (Page 649) ToolbarButtonLocked (Page 655) ToolbarButtonTooltipText (Page 657)
ToolbarButtonCount (Page 654) ToolbarButtonName (Page 655) ToolbarButtonUserDefined (Page 657)
ToolbarButtonEnabled (Page 654) ToolbarButtonPasswordLevel (Page 655) ToolbarButtonVisible (Page 657)
ToolbarButtonHotKey (Page 654) ToolbarButtonRemove (Page 656)

See also
GetToolbarButton method (Page 771)
GetToolbarButtonCollection method (Page 772)

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


234 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 249) WinCC OnlineTrendControl (Page 263)

Available methods of the object

GetRulerData (Page 757) InsertData (Page 788) RemoveData (Page 814)

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 664) TrendLineWidth (Page 669) TrendRemove (Page 673)


TrendColor (Page 666) TrendLowerLimit (Page 669) TrendRename (Page 673)
TrendCount (Page 666) TrendLowerLimitColor (Page 669) TrendRepos (Page 673)
TrendExtendedColorSet TrendLowerLimitColoring (Page 670) TrendTrendWindow (Page 676)
TrendFill (Page 667) TrendName (Page 670) TrendUncertainColor (Page 676)
TrendFillColor (Page 667) TrendPointColor (Page 670) TrendUncertainColoring (Page 677)
TrendIndex (Page 668) TrendPointStyle TrendUpperLimit (Page 677)
TrendLabel (Page 668) TrendPointWidth (Page 671) TrendUpperLimitColor (Page 677)
TrendLineStyle (Page 668) TrendProvider (Page 671) TrendUpperLimitColoring (Page 677)
TrendLineType (Page 669) TrendProviderCLSID (Page 672) TrendVisible (Page 679)

Properties in WinCC OnlineTrendControl

TrendAutoRangeBeginTagName TrendAutoRangeSource (Page 665) TrendValueAlignment (Page 678)


(Page 664)
TrendAutoRangeBeginValue (Page 665) TrendSelectTagName (Page 673) TrendValueAxis (Page 678)

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


System Manual, 09/2023, A5E52671436-AB 235
VBS for Creating Procedures and Actions
1.15 VBS Reference

TrendAutoRangeEndTagName TrendTagName (Page 675) TrendValueUnit (Page 678)


(Page 665)
TrendAutoRangeEndValue (Page 665) TrendTimeAxis (Page 675)

Properties in the WinCC FunctionTrendControl

TrendActualize (Page 664) TrendSelectTagNameX (Page 674) TrendTimeRangeBase (Page 675)


TrendBeginTime (Page 666) TrendSelectTagNameY (Page 674) TrendTimeRangeFactor (Page 676)
TrendEndTime (Page 667) TrendTagNameX (Page 675) TrendXAxis (Page 685)
TrendMeasurePoints (Page 670) TrendTagNameY (Page 675) TrendYAxis (Page 685)
TrendRangeType

See also
GetTrend method (Page 773)
GetTrendCollection method (Page 774)

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 249) WinCC OnlineTrendControl (Page 263)

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 679) TrendWindowGridInTrendColor TrendWindowRulerColor (Page 683)


(Page 681)
TrendWindowCoarseGrid (Page 679) TrendWindowHorizontalGrid (Page 681) TrendWindowRulerLayer
TrendWindowCoarseGridColor TrendWindowIndex (Page 681) TrendWindowRulerStyle (Page 683)
(Page 680)
TrendWindowCount (Page 680) TrendWindowName (Page 682) TrendWindowRulerWidth (Page 683)

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


236 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

TrendWindowFineGrid (Page 680) TrendWindowRemove (Page 682) TrendWindowSpacePortion (Page 684)


TrendWindowFineGridColor (Page 680) TrendWindowRename (Page 682) TrendWindowVerticalGrid (Page 685)
TrendWindowForegroundTrendGrid TrendWindowRepos (Page 682) TrendWindowVisible (Page 685)
(Page 681)

Properties in WinCC OnlineTrendControl

TrendWindowStatisticRulerColor TrendWindowStatisticRulerStyle TrendWindowStatisticRulerWidth


(Page 684) (Page 684) (Page 684)

See also
GetTrendWindow method (Page 776)
GetTrendWindowCollection method (Page 777)

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 263)

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 701) ValueAxisEndValue (Page 703) ValueAxisRemove (Page 706)


ValueAxisAlign (Page 701) ValueAxisExponentialFormat (Page 704) ValueAxisRename (Page 706)
ValueAxisAutoPrecisions (Page 702) ValueAxisIndex (Page 704) ValueAxisRepos (Page 706)
ValueAxisAutoRange (Page 702) ValueAxisInTrendColor ValueAxisScalingType (Page 706)
ValueAxisBeginValue (Page 703) ValueAxisLabel (Page 705) ValueAxisTrendWindow (Page 707)
ValueAxisColor (Page 703) ValueAxisName (Page 705) ValueAxisVisible (Page 707)
ValueAxisCount (Page 703) ValueAxisPrecisions (Page 706)

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


System Manual, 09/2023, A5E52671436-AB 237
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
GetValueAxis method (Page 778)
GetValueAxisCollection method (Page 779)

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.

Use in the controls


• WinCC OnlineTableControl (Page 258)

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 707) ValueColumnHideTitleText (Page 710) ValueColumnRepos (Page 712)


ValueColumnAlign (Page 708) ValueColumnIndex (Page 710) ValueColumnSelectTagName
(Page 713)
ValueColumnAutoPrecisions (Page 708) ValueColumnLength (Page 711) ValueColumnShowIcon (Page 713)
ValueColumnBackColor (Page 709) ValueColumnName (Page 711) ValueColumnShowTitleIcon (Page 713)
ValueColumnCaption (Page 709) ValueColumnPrecisions (Page 711) ValueColumnSort (Page 713)
ValueColumnCount (Page 709) ValueColumnProvider (Page 711) ValueColumnSortIndex (Page 714)
ValueColumnExponentialFormat ValueColumnProviderCLSID (Page 712) ValueColumnTagName (Page 714)
(Page 709)
ValueColumnForeColor (Page 710) ValueColumnRemove (Page 712) ValueColumnTimeColumn (Page 714)
ValueColumnHideText (Page 710) ValueColumnRename (Page 712) ValueColumnVisible (Page 715)

See also
GetValueColumn method (Page 780)
GetValueColumnCollection method (Page 781)

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


238 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

Use in the controls


• WinCC FunctionTrendControl (Page 249)

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 721) XAxisEndValue (Page 724) XAxisRemove (Page 725)


XAxisAlign XAxisExponentialFormat (Page 724) XAxisRename (Page 727)
XAxisAutoPrecisions (Page 722) XAxisIndex (Page 727) XAxisRepos (Page 726)
XAxisAutoRange (Page 723) XAxisInTrendColor XAxisScalingType (Page 726)
XAxisBeginValue (Page 723) XAxisLabel (Page 725) XAxisTrendWindow (Page 726)
XAxisColor (Page 723) XAxisName (Page 725) XAxisVisible (Page 727)
XAxisCount (Page 727) XAxisPrecisions (Page 725)

See also
GetXAxis method (Page 783)
GetXAxisCollection method (Page 784)

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.

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


System Manual, 09/2023, A5E52671436-AB 239
VBS for Creating Procedures and Actions
1.15 VBS Reference

Use in the controls


• WinCC FunctionTrendControl (Page 249)

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".
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 721) YAxisEndValue (Page 724) YAxisRemove (Page 725)


YAxisAlign (Page 722) YAxisExponentialFormat (Page 724) YAxisRename (Page 728)
YAxisAutoPrecisions (Page 722) YAxisIndex (Page 728) YAxisRepos (Page 726)
YAxisAutoRange (Page 723) YAxisInTrendColor (Page 724) YAxisScalingType (Page 726)
YAxisBeginValue (Page 723) YAxisLabel (Page 725) YAxisTrendWindow (Page 726)
YAxisColor (Page 723) YAxisName (Page 725) YAxisVisible (Page 727)
YAxisCount (Page 728) YAxisPrecisions (Page 725)

See also
GetYAxis method (Page 785)
GetYAxisCollection method (Page 786)

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

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


240 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

Properties
This object type has the following properties:

See also
Left Property (Page 489)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
Stretch Property (Page 610)
Picture Property (Page 551)
Parent Property (Page 543)
ObjectName Property (Page 526)
Object Property (Page 526)
Layer Object (Page 121)
Height Property (Page 456)
ForeColor Property (Page 446)
Flip Property (Page 440)
Enabled Property (Page 416)
Cursor Property (Page 402)
BlinkColor Property (Page 349)
BackStyle Property (Page 327)
BackColor Property (Page 323)

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


System Manual, 09/2023, A5E52671436-AB 241
VBS for Creating Procedures and Actions
1.15 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 224) Row (Page 227)


MessageBlock (Page 225) StatusbarElement (Page 231)
MessageColumn (Page 226) ToolbarButton (Page 234)
OperatorColumn (Page 226)

Methods Available in VBS

Activate ActivateDynamic AttachDB

CopyRows

DeactivateDynamic DetachDB

Export

GetHitlistColumn GetOperatorMessage GetStatusbarElement


GetHitlistColumnCollection GetOperatorMessageCollection GetStatusbarElementCollection
GetMessageBlock GetRow (Page 750) GetToolbarButton

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


242 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

GetMessageBlockCollection GetRowCollection (Page 751) GetToolbarButtonCollection


GetMessageColumn GetSelectedRow (Page 758)
GetMessageColumnCollection GetSelectedRows (Page 759)

HideAlarm LockAlarm

LoopInAlarm

MoveToFirstLine MoveToLastPage MoveToPreviousLine


MoveToFirstPage MoveToNextLine MoveToPreviousPage
MoveToLastLine MoveToNextPage

Print

QuitHorn QuitSelected QuitVisible

ShowComment ShowInfoText ShowSelectionDialog


ShowDisplayOptionsDialog ShowLockDialog ShowShortTermArchiveList
ShowEmergencyQuitDialog ShowLockList ShowSortDialog
ShowHelp ShowLongTermArchiveList ShowTimebaseDialog
ShowHideList ShowMessageList
ShowHitList ShowPropertyDialog

UnhideAlarm UnlockAlarm

Properties Available 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 AutoCompleteColumns AutoSelectionColors


AllServer AutoCompleteRows AutoSelectionRectColor
ApplyProjectSettings AutoScroll

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


System Manual, 09/2023, A5E52671436-AB 243
VBS for Creating Procedures and Actions
1.15 VBS Reference

BackColor BorderColor BorderWidth

Caption CellSpaceRight ColumnTitleAlign


CellCut CellSpaceTop ColumnTitles
CellSpaceBottom Closeable
CellSpaceLeft ColumnResize

DefaultMsgFilterSQL DefaultSort2 DisplayOptions


DefaultSort DefaultSort2Column DoubleClickAction

ExportDirectoryChangeable ExportFilenameChangeable ExportSelection


ExportDirectoryname ExportFormatGuid ExportShowDialog
ExportFileExtension ExportFormatName ExportXML
ExportFilename ExportParameters

Font

GridLineColor GridLineWidth

HitlistColumnAdd HitlistColumnRepos HitListMaxSourceItemsWarn


HitlistColumnAutoAdjust (Page 458) HitlistColumnSort HitListRelTime
HitlistColumnCount HitlistColumnSortIndex HitListRelTimeFactor
HitlistColumnIndex HitlistColumnVisible HitListRelTimeFactorType
HitlistColumnName HitListDefaultSort HorizontalGridLines
HitlistColumnRemove HitListMaxSourceItems

IconSpace

LineColor (Page 493) LineWidth (Page 494) LongTermArchiveConsistency

MessageBlockAlign MessageBlockLength MessageColumnIndex


MessageBlockAutoPrecisions MessageBlockPrecisions MessageColumnName
MessageBlockCaption MessageBlockSelected MessageColumnRemove

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


244 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

MessageBlockCount MessageBlockShowDate MessageColumnRepos


MessageBlockDateFormat MessageBlockShowIcon MessageColumnSort
MessageBlockExponentialFormat MessageBlockShowTitleIcon MessageColumnSortIndex
MessageBlockFlashOn MessageBlockTextId MessageColumnVisible
MessageBlockHideText MessageBlockType MessageListType
MessageBlockHideTitleText MessageColumnAdd Moveable
MessageBlockIndex MessageColumnAutoAdjust (Page 517) MsgFilterSQL
MessageBlockLeadingZeros MessageColumnCount

OperatorMessageID OperatorMessageSource5 OperatorMessageSourceType4


OperatorMessageIndex OperatorMessageSource6 OperatorMessageSourceType5
OperatorMessageName OperatorMessageSource7 OperatorMessageSourceType6
OperatorMessageNumber OperatorMessageSource8 OperatorMessageSourceType7
OperatorMessageSelected OperatorMessageSource9 OperatorMessageSourceType8
OperatorMessageSource1 OperatorMessageSource10 OperatorMessageSourceType9
OperatorMessageSource2 OperatorMessageSourceType1 OperatorMessageSourceType10
OperatorMessageSource3 OperatorMessageSourceType2
OperatorMessageSource4 OperatorMessageSourceType3

PageMode PageModeMessageNumber PrintJobName

RowCellCount (Page 368) RowScrollbar RTPersistencePasswordLevel


RowCellText (Page 370) RowTitleAlign RTPersistenceType
RowCount (Page 389) RowTitles
RowNumber (Page 569) RTPersistence

SelectedCellColor SelectionRect ShowSortIndex


SelectedCellForeColor SelectionRectColor ShowTitle
SelectedRowColor SelectionRectWidth Sizeable
SelectedRowForeColor SelectionType SkinName
SelectedTitleColor ServerNames SortSequence
SelectedTitleForeColor ShowSortButton
SelectionColoring ShowSortIcon

StatusbarBackColor StatusbarElementName StatusbarElementVisible


StatusbarElementAdd StatusbarElementRemove StatusbarElementWidth
StatusbarElementAutoSize StatusbarElementRename StatusbarFontColor

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


System Manual, 09/2023, A5E52671436-AB 245
VBS for Creating Procedures and Actions
1.15 VBS Reference

StatusbarElementCount StatusbarElementRepos StatusbarShowTooltips


StatusbarElementIconId StatusbarElementText StatusbarText
StatusbarElementId StatusbarElementTooltipText StatusbarUseBackColor
StatusbarElementIndex StatusbarElementUserDefined StatusbarVisible

TableColor TitleColor TitleLightShadowColor


TableColor2 TitleCut TitleSort
TableForeColor TitleDarkShadowColor TitleStyle
TableForeColor2 TitleForeColor
TimeBase TitleGridLineColor

ToolbarAlignment ToolbarButtonHotKey ToolbarButtonRepos


ToolbarBackColor ToolbarButtonId ToolbarButtonTooltipText
ToolbarButtonActive ToolbarButtonIndex ToolbarButtonUserDefined
ToolbarButtonAdd ToolbarButtonLocked ToolbarButtonVisible
ToolbarButtonBeginGroup ToolbarButtonName ToolbarShowTooltips
ToolbarButtonClick ToolbarButtonPasswordLevel ToolbarUseBackColor
ToolbarButtonCount ToolbarButtonRemove ToolbarUseHotKeys
ToolbarButtonEnabled ToolbarButtonRename ToolbarVisible

UseMessageColor UseSelectedTitleColor UseTableColor2

VerticalGridLines

Example
A selection of messages is defined in an existing WinCC AlarmControl. The column properties are
configured in the script.

Requirement
• 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.
• 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.

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


246 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

'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 220)

WinCC Digital/Analog Clock

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

Object Type of ScreenItem Object. Represents the graphic object "WinCC Digital/Analog Clock"

Type Identifier in VBS


HMIClock

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


System Manual, 09/2023, A5E52671436-AB 247
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 543)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
Ticks Property (Page 620)
TicksColor Property (Page 620)
SquareExtent Property (Page 602)
SecondNeedleWidth Property (Page 578)
SecondNeedleHeight Property (Page 578)
Picture Property (Page 551)
ObjectName Property (Page 526)
Object Property (Page 526)
MinuteNeedleWidth Property (Page 521)
MinuteNeedleHeight Property (Page 521)
LocaleID Property (Page 496)
Left Property (Page 489)
Layer Object (Page 121)
HourNeedleWidth Property (Page 464)
HourNeedleHeight Property (Page 463)
Height Property (Page 456)
Handtype Property (Page 456)

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


248 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

HandFillColor Property (Page 455)


ForeColor Property (Page 446)
Font property (before WinCC V7) (Page 442)
FocusRect Property (Page 442)
Enabled Property (Page 416)
BackStyle Property (Page 327)
BackColor Property (Page 323)
Analog Property (Page 312)

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 231) Trend (Page 235) XAxis (Page 239)


ToolbarButton (Page 234) TrendWindow (Page 236) YAxis (Page 239)

Methods Available in VBS

Activate ActivateDynamic AttachDB

DeactivateDynamic DetachDB

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


System Manual, 09/2023, A5E52671436-AB 249
VBS for Creating Procedures and Actions
1.15 VBS Reference

Export

GetStatusbarElement GetTrend GetXAxis


GetStatusbarElementCollection GetTrendCollection GetXAxisCollection
GetToolbarButton GetTrendWindow GetYAxis
GetToolbarButtonCollection GetTrendWindowCollection GetYAxisCollection

MoveAxis

NextTrend

OneToOneView

PreviousTrend Print

ShowHelp ShowTagSelection ShowTrendSelection


ShowPropertyDialog ShowTimeSelection StartStopUpdate

ZoomArea ZoomInOutX ZoomMove


ZoomInOut ZoomInOutY

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 BorderColor BorderWidth

Caption Closeable ConnectTrendWindows

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


250 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ExportDirectoryChangeable ExportFilenameChangeable ExportShowDialog


ExportDirectoryname ExportFormatGuid ExportParameters
ExportFileExtension ExportFormatName ExportXML
ExportFilename ExportSelection

Font

GraphDirection

LineColor LineWidth LoadDataImmediately

Moveable

Online

PrintJobName

RTPersistence RTPersistencePasswordLevel RTPersistenceType

ShowRuler ShowTitle SkinName


ShowRulerInAxis Sizeable
ShowScrollbars ShowTrendIcon

StatusbarBackColor StatusbarElementName StatusbarElementVisible


StatusbarElementAdd StatusbarElementRemove StatusbarElementWidth
StatusbarElementAutoSize StatusbarElementRename StatusbarFontColor
StatusbarElementCount StatusbarElementRepos StatusbarShowTooltips
StatusbarElementIconId StatusbarElementText StatusbarText
StatusbarElementId StatusbarElementTooltipText StatusbarUseBackColor
StatusbarElementIndex StatusbarElementUserDefined StatusbarVisible

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


System Manual, 09/2023, A5E52671436-AB 251
VBS for Creating Procedures and Actions
1.15 VBS Reference

TimeBase ToolbarButtonHotKey ToolbarButtonTooltipText


ToolbarAlignment ToolbarButtonId ToolbarButtonUserDefined
ToolbarBackColor ToolbarButtonIndex ToolbarButtonVisible
ToolbarButtonActive ToolbarButtonLocked ToolbarShowTooltips
ToolbarButtonAdd ToolbarButtonName ToolbarUseBackColor
ToolbarButtonBeginGroup ToolbarButtonPasswordLevel ToolbarUseHotKeys
ToolbarButtonClick ToolbarButtonRemove ToolbarVisible
ToolbarButtonCount ToolbarButtonRename
ToolbarButtonEnabled ToolbarButtonRepos

TrendActualize TrendLowerLimit TrendSelectTagNameX


TrendAdd TrendLowerLimitColor TrendSelectTagNameY
TrendBeginTime TrendLowerLimitColoring TrendTagNameX
TrendColor TrendMeasurePoints TrendTagNameY
TrendCount TrendName TrendTimeRangeBase
TrendEndTime TrendPointColor (Page 670) TrendTimeRangeFactor
TrendExtendedColorSet TrendPointStyle TrendTrendWindow
TrendFill TrendPointWidth TrendUncertainColor
TrendFillColor TrendProvider TrendUncertainColoring
TrendIndex TrendProviderCLSID TrendUpperLimit
TrendLabel TrendRangeType TrendUpperLimitColor
TrendLineStyle TrendRemove TrendUpperLimitColoring
TrendLineType TrendRename TrendVisible
TrendLineWidth TrendRepos

TrendWindowAdd TrendWindowHorizontalGrid TrendWindowRulerStyle


TrendWindowCoarseGrid TrendWindowIndex TrendWindowRulerWidth
TrendWindowCount TrendWindowName TrendWindowSpacePortion
TrendWindowCoarseGridColor TrendWindowRemove TrendWindowVerticalGrid
TrendWindowFineGrid TrendWindowRename TrendWindowVisible
TrendWindowFineGridColor TrendWindowRepos TrendXAxis
TrendWindowForegroundTrendGrid TrendWindowRulerColor TrendYAxis
TrendWindowGridInTrendColor TrendWindowRulerLayer

UseTrendNameAsLabel

XAxisAdd XAxisEndValue XAxisRemove


XAxisAlign XAxisExponentialFormat XAxisRename / YAxisRename

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


252 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

XAxisAutoPrecisions XAxisIndex / YAxisIndex XAxisRepos


XAxisAutoRange XAxisInTrendColor XAxisScalingType
XAxisBeginValue XAxisLabel XAxisTrendWindow
XAxisColor XAxisName XAxisVisible
XAxisCount / YAxisCount XAxisPrecisions

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.

Requirement
• 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.

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


System Manual, 09/2023, A5E52671436-AB 253
VBS for Creating Procedures and Actions
1.15 VBS Reference

'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

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 220)
ServerDataX (Page 584)
ServerDataY (Page 585)

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


254 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

See also
WarningColor Property (Page 717)
Object Property (Page 526)
BackColor Property (Page 323)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Object types of the ScreenItem object (Page 144)
Width Property (Page 718)
Warning Property (Page 717)
Visible Property (Page 716)
ValueMin Property (Page 715)

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


System Manual, 09/2023, A5E52671436-AB 255
VBS for Creating Procedures and Actions
1.15 VBS Reference

ValueMax Property (Page 715)


ValueColumnAlignment Property (Page 708)
UnitText Property (Page 691)
UnitOffset Property (Page 691)
UnitFont Property (Page 691)
UnitColor Property (Page 690)
Type Property (Page 686)
Top Property (Page 662)
TicWidth Property (Page 619)
TicTextOffset Property (Page 619)
TicTextColor Property (Page 618)
TicOffset Property (Page 618)
TicFont Property (Page 618)
TicColor Property (Page 617)
ShowWarning Property (Page 594)
ShowPeak Property (Page 589)
ShowNormal Property (Page 589)
ShowDecimalPoint Property (Page 588)
ShowDanger Property (Page 588)
Rectangular Property (Page 563)
Parent Property (Page 543)
ObjectName Property (Page 526)
NormalColor Property (Page 524)
NeedleColor Property (Page 524)
LocaleID Property (Page 496)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FrameScale Property (Page 449)
FramePicture Property (Page 449)
FrameColor Property (Page 448)
Enabled Property (Page 416)
Delta Property (Page 409)
DangerColor Property (Page 404)
CenterScale Property (Page 370)

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


256 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

CenterColor Property (Page 370)


CaptionOffset Property (Page 368)
CaptionFont Property (Page 367)
Caption Property (Page 366)
CaptionColor Property (Page 367)
BorderWidth Property (Page 359)
BevelWidth Property (Page 349)
BevelOuter Property (Page 348)
BevelInner Property (Page 348)
BackStyle Property (Page 327)
BackgroundPicture Property (Page 326)
AngleMin Property (Page 313)
AngleMax Property (Page 313)

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

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


System Manual, 09/2023, A5E52671436-AB 257
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

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 227) ToolbarButton (Page 234)


StatusbarElement (Page 231) ValueColumn (Page 238)
TimeColumn (Page 233)

Methods Available in VBS

Activate ActivateDynamic AttachDB

CalculateStatistic CopyRows

DeactivateDynamic DetachDB

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


258 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Edit Export

GetRow (Page 750) GetStatusbarElement GetToolbarButton


GetRowCollection (Page 751) GetStatusbarElementCollection GetToolbarButtonCollection
GetSelectedRow (Page 758) GetTimeColumn GetValueColumn
GetSelectedRows (Page 759) GetTimeColumnCollection GetValueColumnCollection

MoveToFirst MoveToNext MoveToPrevious


MoveToLast

NextColumn

PreviousColumn Print

SelectedStatisticArea ShowPropertyDialog ShowTimeSelection


ShowColumnSelection ShowTagSelection StartStopUpdate
ShowHelp

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 "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 AutoSelectionColors AutoSelectionRectColor


AutoCompleteRows

BackColor BorderColor BorderWidth

Caption CellSpaceRight ColumnScrollbar


CellCut CellSpaceTop ColumnTitleAlign
CellSpaceBottom Closeable ColumnTitles
CellSpaceLeft ColumnResize

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


System Manual, 09/2023, A5E52671436-AB 259
VBS for Creating Procedures and Actions
1.15 VBS Reference

EnableEdit ExportFilename ExportParameters


ExportDirectoryChangeable ExportFilenameChangeable ExportSelection
ExportDirectoryname ExportFormatGuid ExportShowDialog
ExportFileExtension ExportFormatName ExportXML

Font

GridLineColor GridLineWidth

HorizontalGridLines

IconSpace

LineColor LineWidth LoadDataImmediately

Moveable

Online

PrintJobName

RowCellCount (Page 368) RowScrollbar RTPersistence


RowCellText (Page 370) RowTitleAlign RTPersistencePasswordLevel
RowCount (Page 389) RowTitles RTPersistenceType
RowNumber (Page 569)

SelectedCellColor SelectionColoring ShowSortIcon


SelectedCellForeColor SelectionRect ShowSortIndex
SelectedRowColor SelectionRectColor ShowTitle
SelectedRowForeColor SelectionRectWidth Sizeable
SelectedTitleColor SelectionType SkinName
SelectedTitleForeColor ShowSortButton SortSequence

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


260 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

StatusbarBackColor StatusbarElementName StatusbarElementVisible


StatusbarElementAdd StatusbarElementRemove StatusbarElementWidth
StatusbarElementAutoSize StatusbarElementRename StatusbarFontColor
StatusbarElementCount StatusbarElementRepos StatusbarShowTooltips
StatusbarElementIconId StatusbarElementText StatusbarText
StatusbarElementId StatusbarElementTooltipText StatusbarUseBackColor
StatusbarElementIndex StatusbarElementUserDefined StatusbarVisible

TableColor TableForeColor TimeBase


TableColor2 TableForeColor2

TimeColumnActualize TimeColumnHideText TimeColumnShowDate


TimeColumnAdd TimeColumnHideTitleText TimeColumnShowIcon
TimeColumnAlign TimeColumnIndex TimeColumnShowTitleIcon
TimeColumnBackColor TimeColumnLength TimeColumnSort
TimeColumnBeginTime TimeColumnMeasurePoints TimeColumnSortIndex
TimeColumnCaption TimeColumnName TimeColumnTimeFormat
TimeColumnCount TimeColumnRangeType TimeColumnTimeRangeBase
TimeColumnDateFormat TimeColumnRemove TimeColumnTimeRangeFactor
TimeColumnEndTime TimeColumnRename TimeColumnUseValueColumnColors
TimeColumnForeColor TimeColumnRepos TimeColumnVisible

TimeStepBase TitleDarkShadowColor TitleLightShadowColor


TimeStepFactor TitleForeColor TitleSort
TitleColor TitleGridLineColor TitleStyle
TitleCut

ToolbarAlignment ToolbarButtonHotKey ToolbarButtonRepos


ToolbarBackColor ToolbarButtonId ToolbarButtonTooltipText
ToolbarButtonActive ToolbarButtonIndex ToolbarButtonUserDefined
ToolbarButtonAdd ToolbarButtonLocked ToolbarButtonVisible
ToolbarButtonBeginGroup ToolbarButtonName ToolbarShowTooltips
ToolbarButtonClick ToolbarButtonPasswordLevel ToolbarUseBackColor
ToolbarButtonCount ToolbarButtonRemove ToolbarUseHotKeys
ToolbarButtonEnabled ToolbarButtonRename ToolbarVisible

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


System Manual, 09/2023, A5E52671436-AB 261
VBS for Creating Procedures and Actions
1.15 VBS Reference

UseColumnBackColor UseSelectedTitleColor UseTableColor2


UseColumnForeColor

ValueColumnAdd ValueColumnIndex ValueColumnShowIcon


ValueColumnAlign ValueColumnLength ValueColumnShowTitleIcon
ValueColumnAutoPrecisions ValueColumnName ValueColumnSort
ValueColumnBackColor ValueColumnPrecisions ValueColumnSortIndex
ValueColumnCaption ValueColumnProvider ValueColumnState
ValueColumnCount ValueColumnProviderCLSID ValueColumnTagName
ValueColumnExponentialFormat ValueColumnRemove ValueColumnTimeColumn
ValueColumnForeColor ValueColumnRename ValueColumnVisible
ValueColumnHideText ValueColumnRepos VerticalGridLines
ValueColumnHideTitleText ValueColumnSelectTagName

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.

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


262 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

‘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".

See also
Controls (Page 220)

WinCC OnlineTrendControl

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

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


System Manual, 09/2023, A5E52671436-AB 263
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 231) ToolbarButton (Page 234) TrendWindow (Page 236)


TimeAxis (Page 232) Trend (Page 235) ValueAxis (Page 237)

Methods Available in VBS

Activate ActivateDynamic-Methode AttachDB-Methode

CalculateStatistic

DeactivateDynamic DetachDB

Export

GetStatusbarElement GetToolbarButton (Page 771) GetTrendWindow


GetStatusbarElementCollection GetToolbarButtonCollection (Page 772) GetTrendWindowCollection
GetTimeAxis GetTrend GetValueAxis
GetTimeAxisCollection GetTrendCollection GetValueAxisCollection

MoveAxis MoveToLast MoveToPrevious


MoveToFirst MoveToNext

NextTrend

OneToOneView

PreviousTrend Print

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


264 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ShowHelp ShowTagSelection StartStopUpdate


ShowPercentageAxis ShowTimeSelection
ShowPropertyDialog ShowTrendSelection

ZoomArea ZoomInOutTime ZoomMove


ZoomInOut ZoomInOutValues

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 "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 BorderColor BorderWidth

Caption Closeable ConnectTrendWindows

ExportDirectoryChangeable ExportFilenameChangeable ExportSelection


ExportDirectoryname ExportFormatGuid ExportShowDialog
ExportFileExtension ExportFormatName ExportXML
ExportFilename ExportParameters

Font

GraphDirection

LineColor LineWidth LoadDataImmediately

Moveable

Online

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


System Manual, 09/2023, A5E52671436-AB 265
VBS for Creating Procedures and Actions
1.15 VBS Reference

PercentageAxis PercentageAxisColor PrintJobName


PercentageAxisAlign

RTPersistence RTPersistencePasswordLevel RTPersistenceType

ShowRuler ShowStatisticRuler Sizeable


ShowRulerInAxis ShowTitle SkinName
ShowScrollbars ShowTrendIcon

StatusbarBackColor StatusbarElementName StatusbarElementVisible


StatusbarElementAdd StatusbarElementRemove StatusbarElementWidth
StatusbarElementAutoSize StatusbarElementRename StatusbarFontColor
StatusbarElementCount StatusbarElementRepos StatusbarShowTooltips
StatusbarElementIconId StatusbarElementText StatusbarText
StatusbarElementId StatusbarElementTooltipText StatusbarUseBackColor
StatusbarElementIndex StatusbarElementUserDefined StatusbarVisible

TimeAxisActualize TimeAxisIndex TimeAxisRepos


TimeAxisAdd TimeAxisInTrendColor TimeAxisShowDate
TimeAxisAlign TimeAxisLabel TimeAxisTimeFormat
TimeAxisBeginTime TimeAxisMeasurePoints TimeAxisTimeRangeBase
TimeAxisColor TimeAxisName TimeAxisTimeRangeFactor
TimeAxisCount TimeAxisRangeType TimeAxisTrendWindow
TimeAxisDateFormat TimeAxisRemove TimeAxisVisible
TimeAxisEndTime TimeAxisRename TimeBase

ToolbarAlignment ToolbarButtonHotKey ToolbarButtonRepos


ToolbarBackColor ToolbarButtonId ToolbarButtonTooltipText
ToolbarButtonActive ToolbarButtonIndex ToolbarButtonUserDefined
ToolbarButtonAdd ToolbarButtonLocked ToolbarButtonVisible
ToolbarButtonBeginGroup ToolbarButtonName ToolbarShowTooltips
ToolbarButtonClick ToolbarButtonPasswordLevel ToolbarUseBackColor
ToolbarButtonCount ToolbarButtonRemove ToolbarUseHotKeys
ToolbarButtonEnabled ToolbarButtonRename ToolbarVisible

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


266 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

TrendAdd TrendLineType TrendSelectTagName


TrendAutoRangeBeginTagName TrendLineWidth TrendTagName
TrendAutoRangeBeginValue TrendLowerLimit TrendTimeAxis
TrendAutoRangeEndTagName TrendLowerLimitColor TrendTrendWindow
TrendAutoRangeEndValue TrendLowerLimitColoring TrendUncertainColor
TrendAutoRangeSource TrendName TrendUncertainColoring
TrendColor TrendPointColor (Page 670) TrendUpperLimit
TrendCount TrendPointStyle TrendUpperLimitColor
TrendExtendedColorSet TrendPointWidth TrendUpperLimitColoring
TrendFill TrendProvider TrendValueAlignment (Page 678)
TrendFillColor TrendProviderCLSID TrendValueAxis
TrendIndex TrendRemove TrendValueUnit (Page 678)
TrendLabel TrendRename TrendVisible
TrendLineStyle TrendRepos

TrendWindowAdd TrendWindowHorizontalGrid TrendWindowRulerStyle


TrendWindowCoarseGrid TrendWindowIndex TrendWindowRulerWidth
TrendWindowCoarseGridColor TrendWindowName TrendWindowSpacePortion
TrendWindowCount TrendWindowRemove TrendWindowStatisticRulerColor
TrendWindowFineGrid TrendWindowRename TrendWindowStatisticRulerStyle
TrendWindowFineGridColor TrendWindowRepos TrendWindowStatisticRulerWidth
TrendWindowForegroundTrendGrid TrendWindowRulerColor TrendWindowVerticalGrid
TrendWindowGridInTrendColor TrendWindowRulerLayer TrendWindowVisible

UseTrendNameAsLabel

ValueAxisAdd ValueAxisEndValue ValueAxisRemove


ValueAxisAlign ValueAxisExponentialFormat ValueAxisRename
ValueAxisAutoPrecisions ValueAxisIndex ValueAxisRepos
ValueAxisAutoRange ValueAxisInTrendColor ValueAxisScalingType
ValueAxisBeginValue ValueAxisLabel ValueAxisTrendWindow
ValueAxisColor ValueAxisName ValueAxisVisible
ValueAxisCount ValueAxisPrecisions

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.

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


System Manual, 09/2023, A5E52671436-AB 267
VBS for Creating Procedures and Actions
1.15 VBS Reference

Requirement
• 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.

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


268 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

'VBS361
Sub OnClick(ByVal Item)
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, 09/2023, A5E52671436-AB 269
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Controls (Page 220)

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 227) StatisticResultColumn (Page 231)


RulerBlock (Page 228) StatusbarElement (Page 231)
RulerColumn (Page 229) ToolbarButton (Page 234)
StatisticAreaColumn (Page 230)

Methods Available in VBS

Activate ActivateDynamic

DeactivateDynamic

Export

GetRow (Page 750) GetSelectedRow (Page 758) GetStatusbarElement


GetRowCollection (Page 751) GetSelectedRows (Page 759) GetStatusbarElementCollection
GetRulerBlock GetStatisticAreaColumn GetToolbarButton

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


270 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

GetRulerBlockCollection GetStatisticAreaColumnCollection GetToolbarButtonCollection


GetRulerColumn GetStatisticResultColumn
GetRulerColumnCollection GetStatisticResultColumnCollection

ShowHelp ShowPropertyDialog

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 "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 AutoPositon AutoSelectionRectColor


AutoCompleteRows AutoSelectionColors AutoShow

BackColor BlockHideText BlockShowDate


BlockAlign BlockHideTitleText BlockShowIcon
BlockAutoPrecisions BlockID (Page 353) BlockShowTitleIcon
BlockCaption BlockIndex BlockTimeFormat
BlockCount BlockLength BlockUseSourceFormat
BlockDateFormat BlockName BorderColor
BlockExponentialFormat BlockPrecisions BorderWidth

Caption ColumnAdd ColumnScrollbar


CellCut ColumnCount ColumnSort
CellSpaceBottom ColumnIndex ColumnSortIndex
CellSpaceLeft ColumnName ColumnTitleAlign
CellSpaceRight ColumnRemove ColumnTitles
CellSpaceTop ColumnRepos ColumnVisible
Closeable ColumnResize

ExportDirectoryChangeable ExportFilenameChangeable ExportSelection


ExportDirectoryname ExportFormatGuid ExportShowDialog
ExportFileExtension ExportFormatName ExportXML
ExportFilename ExportParameters

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


System Manual, 09/2023, A5E52671436-AB 271
VBS for Creating Procedures and Actions
1.15 VBS Reference

Font

GridLineColor GridLineWidth

HorizontalGridLines

IconSpace

LineColor LineWidth

Moveable

PrintJobName

RowCellCount (Page 368) RowScrollbar RTPersistencePasswordLevel


RowCellText (Page 370) RowTitleAlign RTPersistenceType
RowCount (Page 389) RowTitles RulerType
RowNumber (Page 569) RTPersistence

SelectedCellColor SelectionRect ShowSortIndex


SelectedCellForeColor SelectionRectColor ShowTitle
SelectedRowColor SelectionRectWidth Sizeable
SelectedRowForeColor SelectionType SkinName
SelectedTitleColor ShareSpaceWithSourceControl SortSequence
SelectedTitleForeColor ShowSortButton SourceControl
SelectionColoring ShowSortIcon SourceControlType

StatusbarBackColor StatusbarElementName StatusbarElementVisible


StatusbarElementAdd StatusbarElementRemove StatusbarElementWidth
StatusbarElementAutoSize StatusbarElementRename StatusbarFontColor
StatusbarElementCount StatusbarElementRepos StatusbarShowTooltips
StatusbarElementIconId StatusbarElementText StatusbarText

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


272 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

StatusbarElementId StatusbarElementTooltipText StatusbarUseBackColor


StatusbarElementIndex StatusbarElementUserDefined StatusbarVisible

TableColor TitleColor TitleGridLineColor


TableColor2 TitleCut TitleLightShadowColor
TableForeColor TitleDarkShadowColor TitleSort
TableForeColor2 TitleForeColor TitleStyle

ToolbarAlignment ToolbarButtonHotKey ToolbarButtonRepos


ToolbarBackColor ToolbarButtonId ToolbarButtonTooltipText
ToolbarButtonActive ToolbarButtonIndex ToolbarButtonUserDefined
ToolbarButtonAdd ToolbarButtonLocked ToolbarButtonVisible
ToolbarButtonBeginGroup ToolbarButtonName ToolbarShowTooltips
ToolbarButtonClick ToolbarButtonPasswordLevel ToolbarUseBackColor
ToolbarButtonCount ToolbarButtonRemove ToolbarUseHotKeys
ToolbarButtonEnabled ToolbarButtonRename ToolbarVisible

UseSelectedTitleColor UseSourceForeColors UseTableColor2


UseSourceBackColors

VerticalGridLines

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.

Requirement
• 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.

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


System Manual, 09/2023, A5E52671436-AB 273
VBS for Creating Procedures and Actions
1.15 VBS Reference

'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)
' 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 220)

WinCC Slider Control

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

Object Type of ScreenItem Object. Represents the graphic object "WinCC Slider Control"

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


274 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

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.

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


System Manual, 09/2023, A5E52671436-AB 275
VBS for Creating Procedures and Actions
1.15 VBS Reference

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
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 553)
BarFillColor Property (Page 330)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
WithLabels Property (Page 721)
WithAxes Property (Page 721)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
TickStyle Property (Page 620)
ThumbBackColor Property (Page 617)
ShowThumb Property (Page 592)

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


276 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ShowPosition Property (Page 589)


ShowBar Property (Page 587)
RangeMin Property (Page 563)
RangeMax Property (Page 563)
Position Property (Page 556)
PictureBack Property (Page 551)
Parent Property (Page 543)
OuterBevelWidth Property (Page 541)
OuterBevelStyle Property (Page 541)
ObjectName Property (Page 526)
Object Property (Page 526)
LocaleID Property (Page 496)
Left Property (Page 489)
Layer Object (Page 121)
LabelColor Property (Page 471)
InnerBevelWidth Property (Page 467)
InnerBevelStyle Property (Page 467)
InnerBevelOffset Property (Page 466)
Height Property (Page 456)
ForeColor Property (Page 446)
FontPosition Property (Page 445)
Font property (before WinCC V7) (Page 442)
FocusWidth Property (Page 442)
FocusColor Property (Page 441)
Enabled Property (Page 416)
ContinuousChange property (Page 388)
Caption Property (Page 366)
BevelColorUp Property (Page 348)
BevelColorDown Property (Page 347)
BarBackColor Property (Page 328)
BackStyle Property (Page 327)
BackColor Property (Page 323)

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


System Manual, 09/2023, A5E52671436-AB 277
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

Type Identifier in VBS


HMIUserArchiveControl

Available list objects

Column (Page 223) StatusbarElement (Page 231)


Row (Page 227) ToolbarButton (Page 234)

Methods Available in VBS

Activate ActivateDynamic

CopyRows CutRows

DeactivateDynamic

Export

GetColumn GetSelectedRow (Page 758) GetToolbarButton


GetColumnCollection GetSelectedRows (Page 759) GetToolbarButtonCollection
GetRow (Page 750) GetStatusbarElement
GetRowCollection (Page 751) GetStatusbarElementCollection

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


278 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

MoveToFirst MoveToNext MoveToPrevious


MoveToLast

PasteRows Print

ReadTags

ServerExport ShowPropertyDialog ShowSelectTimeBase


ServerImport ShowSelectArchive ShowSort
ShowHelp ShowSelection

WriteTags

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 "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 AutoCompleteColumns AutoSelectionColors


ArchiveType AutoCompleteRows AutoSelectionRectColor

BackColor BorderColor BorderWidth

Caption CellSpaceLeft CellSpaceTop


CellCut CellSpaceRight Closeable
CellSpaceBottom

ColumnAlias ColumnLeadingZeros ColumnShowIcon


ColumnAlign ColumnLength ColumnShowTitleIcon
ColumnAutoPrecisions ColumnMaxValue ColumnSort
ColumnCaption ColumnMinValue ColumnSortIndex
ColumnCount ColumnName ColumnStartValue

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


System Manual, 09/2023, A5E52671436-AB 279
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColumnDateFormat ColumnPosition (Page 395) ColumnStringLength


ColumnDMVarName ColumnPrecisions ColumnTimeFormat
ColumnExponentialFormat ColumnReadAccess ColumnTitleAlign
ColumnFlagNotNull ColumnReadonly ColumnTitles
ColumnFlagUnique ColumnRepos ColumnType
ColumnHideText ColumnResize ColumnVisible
ColumnHideTitleText ColumnScrollbar ColumnWriteAccess
ColumnIndex ColumnShowDate

EnableDelete ExportFileExtension ExportParameters


EnableEdit ExportFilename ExportSelection
EnableInsert ExportFilenameChangeable ExportShowDialog
ExportDirectoryChangeable ExportFormatGuid ExportXML
ExportDirectoryname ExportFormatName

FilterSQL Font

GridLineColor GridLineWidth

HorizontalGridLines

IconSpace

LineColor LineWidth

Moveable

PrintJobName

RowCellCount (Page 368) RowScrollbar RTPersistence


RowCellText (Page 370) RowTitleAlign RTPersistencePasswordLevel
RowCount (Page 389) RowTitles RTPersistenceType
RowNumber (Page 569)

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


280 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

SelectArchiveName SelectionColoring ShowSortIcon


SelectedCellColor SelectionRect ShowSortIndex
SelectedCellForeColor SelectionRectColor ShowTitle
SelectedRowColor SelectionRectWidth Sizeable
SelectedRowForeColor SelectionType SkinName
SelectedTitleColor ShowSortButton SortSequence
SelectedTitleForeColor

StatusbarBackColor StatusbarElementName StatusbarElementVisible


StatusbarElementAdd StatusbarElementRemove StatusbarElementWidth
StatusbarElementAutoSize StatusbarElementRename StatusbarFontColor
StatusbarElementCount StatusbarElementRepos StatusbarShowTooltips
StatusbarElementIconId StatusbarElementText StatusbarText
StatusbarElementId StatusbarElementTooltipText StatusbarUseBackColor
StatusbarElementIndex StatusbarElementUserDefined StatusbarVisible

TableColor TitleColor TitleGridLineColor


TableColor2 TitleCut TitleLightShadowColor
TableForeColor TitleDarkShadowColor TitleSort
TableForeColor2 TitleForeColor TitleStyle
TimeBase

ToolbarAlignment ToolbarButtonHotKey ToolbarButtonRepos


ToolbarBackColor ToolbarButtonId ToolbarButtonTooltipText
ToolbarButtonActive ToolbarButtonIndex ToolbarButtonUserDefined
ToolbarButtonAdd ToolbarButtonLocked ToolbarButtonVisible
ToolbarButtonBeginGroup ToolbarButtonName ToolbarShowTooltips
ToolbarButtonClick ToolbarButtonPasswordLevel ToolbarUseBackColor
ToolbarButtonCount ToolbarButtonRemove ToolbarUseHotKeys
ToolbarButtonEnabled ToolbarButtonRename ToolbarVisible

UseSelectedTitleColor UseTableColor2

VerticalGridLines

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


System Manual, 09/2023, A5E52671436-AB 281
VBS for Creating Procedures and Actions
1.15 VBS Reference

Example
A user archive is displayed in a WinCC UserArchiveControl.
The following actions are initiated via script:
• Selecting data
• Exporting data
• Printing a table

Requirement
• 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".

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


282 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Controls (Page 220)

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 560)
BackColor Property (Page 323)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)

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


System Manual, 09/2023, A5E52671436-AB 283
VBS for Creating Procedures and Actions
1.15 VBS Reference

WindowType Property (Page 720)


Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolbarButtons Property (Page 658)
Titleline Property (Page 645)
TitleCut property (before WinCC V7) (Page 644)
StatusbarPanes Property (Page 608)
ServerNames property (before WinCC V7) (Page 586)
SelectionType property (before WinCC V7) (Page 583)
SelectionRectWidth property (before WinCC V7) (Page 582)
SelectionRectColor property (before WinCC V7) (Page 582)
SelectionMode Property (Page 581)
PersistentRTPermission property (before WinCC V7) (Page 548)
PersistentRTCSPermission property (before WinCC V7) (Page 547)
Parent Property (Page 543)
ObjectName Property (Page 526)
Object Property (Page 526)
MsgFilterSQL property (before WinCC V7) (Page 523)
MsgCtrlFlags property (before WinCC V7) (Page 522)
LineTitle Property (Page 494)
LineHeight Property (Page 493)
LineFont Property (Page 493)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
HeaderSort Property (Page 456)
GridLineVert Property (Page 454)
GridLineHorz Property (Page 452)
Font property (before WinCC V7) (Page 442)
Enabled Property (Page 416)
ColWidth Property (Page 384)
ColTitle Property (Page 383)
ColMove Property (Page 378)

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


284 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

CellCut property (before WinCC V7) (Page 369)


Caption Property (Page 366)
ButtonCommand Property (Page 362)
AutoScroll property (before WinCC V7) (Page 319)
AllServer property (before WinCC V7) (Page 311)
Activate property (before WinCC V7) (Page 302)
LocaleSpecificSettings Property (Page 496)
SortOrder Property (Page 596)
TableFocusOnButtonCommand Property (Page 612)
CursorMode Property (Page 403)
CursorModePrefetch Property (Page 403)
LongTimeArchiveConsistency property (before WinCC V7) (Page 499)

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, 09/2023, A5E52671436-AB 285
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Top Property (Page 662)
ScalingTypeY Property (Page 575)
Layer Object (Page 121)
DesiredCurveSourceUAArchive Property (Page 411)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
Width Property (Page 718)
Visible Property (Page 716)
UpperLimitValue Property (Page 694)
UpperLimit Property (Page 693)
UpperLimitColor Property (Page 693)
Type Property (Page 686)
ToolbarHotKeys Property (Page 659)
ToolbarButtons Property (Page 658)
ToolbarAlignment property (before WinCC V7) (Page 648)
Titleline Property (Page 645)
TimeZone Property (Page 643)
TimeAxisX Property (Page 628)
TagProviderClsid Property (Page 614)
SourceUAColumnY Property (Page 602)
SourceUAColumnX Property (Page 601)
SourceUAArchiveStartID Property (Page 601)
SourceUAArchive Property (Page 601)
SourceTimeRange Property (Page 600)
SourceTagProviderDataY Property (Page 600)
SourceTagProviderDataX Property (Page 599)
SourceTagNameY Property (Page 599)
SourceTagNameX Property (Page 599)
SourceNumberOfValues Property (Page 598)
SourceNumberOfUAValues Property (Page 598)
SourceEndTime Property (Page 598)

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


286 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

SourceBeginTime Property (Page 597)


ShowValuesExponentialY Property (Page 594)
ShowValuesExponentialX Property (Page 593)
ShowRulerImmediately Property (Page 590)
ScalingTypeX Property (Page 575)
RulerPrecisionY Property (Page 572)
RulerPrecisionX Property (Page 571)
Replacement Property (Page 565)
ReplacementColor Property (Page 566)
RelayCurves Property (Page 565)
ProviderType Property (Page 560)
PrecisionY Property (Page 557)
PrecisionX Property (Page 557)
PersistentRTPermission property (before WinCC V7) (Page 548)
PersistentRT property (before WinCC V7) (Page 547)
PersistentRTCSPermission property (before WinCC V7) (Page 547)
PersistentRTCS property (before WinCC V7) (Page 547)
Parent Property (Page 543)
Online property (before WinCC V7) (Page 530)
ObjectName Property (Page 526)
Object Property (Page 526)
NumItems Property (Page 525)
Name Property (Page 523)
LowerLimitValue Property (Page 501)
LowerLimit Property (Page 500)
LowerLimitColor Property (Page 500)
LoadDataImmediately property (before WinCC V7) (Page 496)
Left Property (Page 489)
LabelY Property (Page 471)
LabelX Property (Page 471)
ItemVisible Property (Page 470)
InsertData Property (Page 468)
Index Property (Page 465)
Height Property (Page 456)
GridlinesY Property (Page 454)

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


System Manual, 09/2023, A5E52671436-AB 287
VBS for Creating Procedures and Actions
1.15 VBS Reference

GridlinesX Property (Page 453)


GridlinesValueY Property (Page 453)
GridlinesValueX Property (Page 453)
GraphDirection property (before WinCC V7) (Page 451)
FreezeProviderConnections Property (Page 450)
Font property (before WinCC V7) (Page 442)
FineGridY Property (Page 433)
FineGridX Property (Page 433)
FineGridValueY Property (Page 433)
FineGridValueX Property (Page 433)
EndY Property (Page 421)
EndX Property (Page 420)
Enabled Property (Page 416)
DesiredCurveVisible Property (Page 412)
DesiredCurveSourceUAColumnY Property (Page 412)
DesiredCurveSourceUAColumnX Property (Page 411)
DesiredCurveSourceUAArchiveStartID Property (Page 411)
DesiredCurveSourceNumberOfUAValues Property (Page 410)
DesiredCurveCurveForm Property (Page 410)
DesiredCurveColor Property (Page 410)
DeleteData Property (Page 409)
DataY Property (Page 407)
DataXY Property (Page 406)
DataX Property (Page 406)
DataIndex Property (Page 405)
CurveForm Property (Page 403)
CommonY Property (Page 386)
CommonX Property (Page 385)
Color Property (Page 378)
CoarseGridY Property (Page 376)
CoarseGridX Property (Page 376)
CoarseGridValueY Property (Page 377)
CoarseGridValueX Property (Page 377)
Closeable property (before WinCC V7) (Page 374)
Caption Property (Page 366)

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


288 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BeginY Property (Page 347)


BeginX Property (Page 347)
BackColor Property (Page 323)
AutorangeY Property (Page 319)
AutorangeX Property (Page 318)
AllowPersistence property (before WinCC V7) (Page 310)
LocaleSpecificSettings Property (Page 496)
PrintBackgroundColor Property (Page 558)
PrintJob Property (Page 559)
RulerFont Property (Page 571)

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, 09/2023, A5E52671436-AB 289
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
TimeOverlap Property (Page 639)
ItemVisible Property (Page 470)
PrintBackgroundColor Property (Page 558)
Activate Method (Page 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
Width Property (Page 718)
Visible Property (Page 716)
Variable Property (Page 715)
ValueColumnAlignment Property (Page 708)
UpperLimitValue Property (Page 694)
UpperLimit Property (Page 693)
UpperLimitColor Property (Page 693)
Type Property (Page 686)
Top Property (Page 662)
ToolbarHotKeys Property (Page 659)
Toolbar Property (Page 647)
ToolbarButtons Property (Page 658)
ToolbarAlignment property (before WinCC V7) (Page 648)
Titleline Property (Page 645)
TimeZone Property (Page 643)
TimeRangeFactor Property (Page 641)
TimeRange Property (Page 640)
TimeRangeBase Property (Page 640)
TimeOverlapColor Property (Page 640)
TimeJump Property (Page 638)
TimeJumpColor Property (Page 639)
TimeFormat Property (Page 638)
TimeColumnAlignment Property (Page 630)
Statusbar Property (Page 604)
PrintJob Property (Page 559)
Precisions Property (Page 557)

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


290 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

PersistentRTPermission property (before WinCC V7) (Page 548)


PersistentRT property (before WinCC V7) (Page 547)
PersistentRTCSPermission property (before WinCC V7) (Page 547)
PersistentRTCS property (before WinCC V7) (Page 547)
Parent Property (Page 543)
Online property (before WinCC V7) (Page 530)
ObjectName Property (Page 526)
Object Property (Page 526)
NumItems Property (Page 525)
LowerLimitValue Property (Page 501)
LowerLimit Property (Page 500)
LowerLimitColor Property (Page 500)
LoadDataImmediately property (before WinCC V7) (Page 496)
Left Property (Page 489)
Layer Object (Page 121)
Index Property (Page 465)
Height Property (Page 456)
Font property (before WinCC V7) (Page 442)
EndTime Property (Page 420)
Enabled Property (Page 416)
Edit Property (Page 415)
Editable Property (Page 415)
CommonTime Property (Page 385)
Command Property (Page 384)
Color Property (Page 378)
Closeable property (before WinCC V7) (Page 374)
Caption Property (Page 366)
BeginTime Property (Page 346)
BackColor Property (Page 323)
Archive Property (Page 314)
AllowPersistence property (before WinCC V7) (Page 310)
Actualize Property (Page 305)
Activate property (before WinCC V7) (Page 302)
LocaleSpecificSettings Property (Page 496)

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


System Manual, 09/2023, A5E52671436-AB 291
VBS for Creating Procedures and Actions
1.15 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 301)
TimeAxis Property (Page 621)
LowerLimitColor Property (Page 500)
Caption Property (Page 366)
Activate Method (Page 731)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
Width Property (Page 718)
Visible Property (Page 716)
UpperLimitValue Property (Page 694)
UpperLimit Property (Page 693)

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


292 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

UpperLimitColor Property (Page 693)


Type Property (Page 686)
Top Property (Page 662)
ToolbarHotKeys Property (Page 659)
Toolbar Property (Page 647)
ToolbarButtons Property (Page 658)
ToolbarAlignment property (before WinCC V7) (Page 648)
Titleline Property (Page 645)
TimeZone Property (Page 643)
TimeRangeFactor Property (Page 641)
TimeRange Property (Page 640)
TimeRangeBase Property (Page 640)
TimeOverlap Property (Page 639)
TimeOverlapColor Property (Page 640)
TimeJump Property (Page 638)
TimeJumpColor Property (Page 639)
TimeAxisFormat Property (Page 623)
TagName Property (Page 613)
Statusbar Property (Page 604)
ShowRulerImmediately Property (Page 590)
ServerData Property (Page 584)
RulerPrecisions Property (Page 571)
Replacement Property (Page 565)
ReplacementColor Property (Page 566)
RelayCurves Property (Page 565)
ProviderClsid Property (Page 560)
PrintJob Property (Page 559)
Precisions Property (Page 557)
PersistentRTPermission property (before WinCC V7) (Page 548)
PersistentRT property (before WinCC V7) (Page 547)
PersistentRTCSPermission property (before WinCC V7) (Page 547)
PersistentRTCS property (before WinCC V7) (Page 547)
Parent Property (Page 543)
Online property (before WinCC V7) (Page 530)
ObjectName Property (Page 526)

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


System Manual, 09/2023, A5E52671436-AB 293
VBS for Creating Procedures and Actions
1.15 VBS Reference

Object Property (Page 526)


NumItems Property (Page 525)
MeasurePoints Property (Page 508)
LowerLimitValue Property (Page 501)
LowerLimit Property (Page 500)
LoadDataImmediately property (before WinCC V7) (Page 496)
Left Property (Page 489)
Layer Object (Page 121)
Label Property (Page 470)
ItemVisible Property (Page 470)
Index Property (Page 465)
Height Property (Page 456)
GridLineValue Property (Page 454)
GridLines Property (Page 452)
GraphDirection property (before WinCC V7) (Page 451)
Font property (before WinCC V7) (Page 442)
FineGridValue Property (Page 432)
FineGrid Property (Page 432)
EndValue Property (Page 420)
EndTime Property (Page 420)
Enabled Property (Page 416)
CurveForm Property (Page 403)
CommonY Property (Page 386)
CommonX Property (Page 385)
Command Property (Page 384)
Color Property (Page 378)
CoarseGridValue Property (Page 376)
CoarseGrid Property (Page 375)
Closeable property (before WinCC V7) (Page 374)
BeginValue Property (Page 346)
BeginTime Property (Page 346)
BackColor Property (Page 323)
Autorange Property (Page 318)
AllowPersistence property (before WinCC V7) (Page 310)
Actualize Property (Page 305)

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


294 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Activate property (before WinCC V7) (Page 302)


AdjustRuler Property (Page 307)
LineWidth property (before WinCC V7) (Page 494)
ScalingType Property (Page 574)
UseRangeSubstitutes Property (Page 696)
XAxisColor property (before WinCC V7) (Page 721)
HideTagNames Property (Page 458)
LocaleSpecificSettings Property (Page 496)
PrintBackgroundColor Property (Page 558)
ItemProviderClsid Property (Page 470)
OneY Property (Page 530)
AllowXAxisColor - Property (Page 311)
AnchorRuler Property (Page 312)
SavedTrend Property (Page 573)
SelectedTrend Property (Page 581)
ShowSpanNames Property (Page 592)
DefaultPrecision Property (Page 408)
DefaultRulerPrecision Property (Page 408)
LowerLimitTagName Property (Page 501)
UpperLimitTagName Property (Page 693)
UseOnlineTags Property (Page 695)

WinCC Push Button Control (up to WinCC V7.3)

Description

6FUHHQV

6FUHHQ

6FUHHQ,WHPV

6FUHHQ,WHP

Object Type of ScreenItem Object. Represents the graphic object "WinCC Push Button Control"
As of WinCC V7, the control was replaced by the Windows object "Button" and "Round
Button". Up to WinCC V7.3, the "WinCC Push Button Control" is still available in the "Controls"
selection window. You can still use the control in migrated projects.

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


System Manual, 09/2023, A5E52671436-AB 295
VBS for Creating Procedures and Actions
1.15 VBS Reference

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
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.

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


296 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 error handling
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
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling

See also
Properties (Page 301)
FontName Property (Page 444)
Activate Method (Page 731)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Controls (Page 220)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Transparent Property (Page 663)
Top Property (Page 662)
PictureUnselected Property (Page 553)

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


System Manual, 09/2023, A5E52671436-AB 297
VBS for Creating Procedures and Actions
1.15 VBS Reference

PictureSelected Property (Page 553)


Parent Property (Page 543)
Outline Property (Page 541)
ObjectName Property (Page 526)
Object Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
FrameWidth Property (Page 449)
FrameColorUp Property (Page 449)
FrameColorDown Property (Page 448)
ForeColor Property (Page 446)
FontUnderline Property (Page 446)
FontStrikeThru Property (Page 445)
FontSize Property (Page 445)
FontItalic Property (Page 444)
Font property (before WinCC V7) (Page 442)
FontBold Property (Page 443)
FocusRect Property (Page 442)
Enabled Property (Page 416)
Caption Property (Page 366)
BackColor Property (Page 323)
AutoSize Property (Page 321)

1.15.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)


298 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 731)
Properties (Page 301)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Object types of the ScreenItem object (Page 144)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Parent Property (Page 543)
ObjectName Property (Page 526)
Left Property (Page 489)
Layer Object (Page 121)
Height Property (Page 456)
Enabled Property (Page 416)

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


System Manual, 09/2023, A5E52671436-AB 299
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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 301)
Activate Method (Page 731)
ScreenItems Object (List) (Page 129)
ScreenItem Object (Page 126)
Object types of the ScreenItem object (Page 144)
Width Property (Page 718)
Visible Property (Page 716)
Type Property (Page 686)
Top Property (Page 662)
ToolTipText Property (Page 660)
Parent Property (Page 543)
ObjectName Property (Page 526)

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


300 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Left Property (Page 489)


Layer Object (Page 121)
Height Property (Page 456)
Enabled Property (Page 416)

1.15.4 Properties

1.15.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.15.4.2 A

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, 09/2023, A5E52671436-AB 301
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 126)
Screens Object (List) (Page 135)

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 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

Activate property
Activate

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


302 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
To differentiate the "Activate" property from the "Activate" method, the property is addressed
via "Object".
Example
Dim ctrlSet
ctrl = ScreenItems("Control")
ctrl.Object.activate = true
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 545)
Name Property (Page 523)
Ellipse segment (Page 148)
HMIRuntime Object (Page 119)

ActiveScreen Property

Description
Supplies a reference to the picture which contains the object with the current focus.

Use
"ActiveScreen" is used in runtime to address the properties of the picture which contains the
currently focussed object.

Picture window
If the current focus is on a picture window, the process picture in the picture window is
addressed.
To address the process picture in which the picture window is called, use the following call:
• HMIRuntime.ActiveScreen.Parent.ObjectName

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


System Manual, 09/2023, A5E52671436-AB 303
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

See also
Screen Object (Page 132)
HMIRuntime Object (Page 119)

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 126)
HMIRuntime Object (Page 119)

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


304 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

See also
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Online Trend Control (before WinCC V7) (Page 292)
ScreenItem Object (Page 126)

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 159)
Polygon (Page 157)
ScreenItem Object (Page 126)

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).

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


System Manual, 09/2023, A5E52671436-AB 305
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Polyline (Page 159)
Polygon (Page 157)
ScreenItem Object (Page 126)

AdaptBorder Property

Description
TRUE, when the border should be dynamically adjusted to the size of the text. BOOLEAN write-
read access.
For text list and I/O field: Read only access.

See also
Button (Page 203)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
I/O Field (Page 185)
ScreenItem Object (Page 126)

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 180)
ScreenItem Object (Page 126)

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


306 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

See also
Picture Window (Page 180)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

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 111)

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


System Manual, 09/2023, A5E52671436-AB 307
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

AlarmLogs Property

Description
Returns an object of type "AlarmLogs".
AlarmLogs (read-only)

See also
HMIRuntime Object (Page 119)

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 175)
ScreenItem Object (Page 126)

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


308 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 175)
ScreenItem Object (Page 126)

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 194)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
ScreenItem Object (Page 126)

AlignmentTop Property

Description
Defines or returns the vertical alignment of the text. Value range from 0 to 2.
0 = top
1 = centered
2 = bottom

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


System Manual, 09/2023, A5E52671436-AB 309
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Group Display (Page 194)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
ScreenItem Object (Page 126)

AllowDrag property
Allow Drag in Runtime
If the object property is activated, you can drag the tag in Runtime with which the I/O field is
dynamized via Drag&Drop:
• Into a WinCC OnlineTrendControl.
Requirement: The object property "Allow Drop in Runtime" is activated at WinCC control.
The tag of the I/O field is displayed as a new trend.
• Into the WinCC TAG Simulator.
Requirement: The tag type is supported by the tag simulator.
The attribute can be dynamized with the name "AllowDrag".

AllowDrag property
Allow Drop in Runtime
If the object property is activated, you can have the tags from the I/O field displayed as a new
trend in WinCC OnlineTrendControl by using the Drag&Drop of the I/O field in Runtime.
Requirements:
• The object property "Allow Drag in Runtime" is enabled at the I/O field.
• The I/O field is dynamized with a tag.
The attribute can be dynamized with the name "AllowDrop".

AllowPersistence property (before WinCC V7)

Description
TRUE, when settings regarding persistence are possible. BOOLEAN write-read access.

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


310 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 283)
ScreenItem Object (Page 126)

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".

The attribute can be assigned dynamic properties by means of the name AllServer. The data
type is BOOLEAN.

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


System Manual, 09/2023, A5E52671436-AB 311
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 247)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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


312 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 255)
ScreenItem Object (Page 126)

AngleMin Property

Description
Defines or returns the angle on the scale at which the scale graduation begins. LONG write-read
access.

See also
WinCC Gauge Control (Page 255)
ScreenItem Object (Page 126)

Appearance property

Appearance
Specifies the appearance of the table in WinCC UserAdminControl.

Value Explanation
0 The table is displayed normally.
1 The table is displayed in button style.

The attribute can be assigned dynamic properties using the name Appearance. The data
type is SHORT.

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


System Manual, 09/2023, A5E52671436-AB 313
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 174)
ScreenItem Object (Page 126)

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 289)
ScreenItem Object (Page 126)

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


314 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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.

ArrowsPosition property

Description
Specifies the position of the rotating arrows.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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.

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


System Manual, 09/2023, A5E52671436-AB 315
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 199)
ScreenItem Object (Page 126)

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 185)
Text list (Page 199)
ScreenItem Object (Page 126)

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 185)
ScreenItem Object (Page 126)

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


316 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

AuthorizedGroups property

Required electronic signatures (AuthorizedGroups)


The attribute specifies which user can sign an operation.
In Runtime, the configured user authenticates him or herself with the password during
operation.
The user has the option to enter a comment which is saved with the triggered system
message. If the "Mandatory" option is activated for the "Operator Activities Report" attribute,
the user must enter a comment.
In the "Selection" dialog, select the users in the "User group" column. To activate the drop-
down list, select the empty row in the "Group" column.
The attribute can be made dynamic with the name "AuthorizedGroups".

WinCC/Audit: Additional options


With WinCC/Audit, you can select multiple users and group them via operands and
parentheses.
The option "Later" allows signing after the operation.

See also
ElectronicSignature property (Page 416)

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.

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


System Manual, 09/2023, A5E52671436-AB 317
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
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 292)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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


318 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

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 283)
ScreenItem Object (Page 126)

AutoScroll Property

Auto scrolling - AutoScroll


Defines the behavior of the message window after a new message events.

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


System Manual, 09/2023, A5E52671436-AB 319
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 mes‐
sage window is not changed.

The attribute can be assigned dynamic properties by means of the name AutoScroll. The
data type is BOOLEAN.

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

Automatic hide/show - 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.

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


320 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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 (up to WinCC V7.3) (Page 295)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 321
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Bar (Page 175)
ScreenItem Object (Page 126)

Axe Property

Description
Defines or returns the position of the 3D bar in the coordinate system. Value range from 0 to 2.
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 170)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

1.15.4.3 B

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.

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


322 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
ScreenItem Object (Page 126)
Button (Page 203)
Round Button (Page 211)
Slider (Page 214)
Group Display (Page 194)

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)

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


System Manual, 09/2023, A5E52671436-AB 323
VBS for Creating Procedures and Actions
1.15 VBS Reference

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)

See also
FillStyle Property (Page 430)
FillColor Property (Page 428)
ScreenItem Object (Page 126)

BackColor2 Property

Description
Defines or returns the bar color for the display of the current value. LONG write-read access.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

BackColor3 Property

Description
Defines or returns the color of the bar background. LONG write-read access.

See also
ScreenItem Object (Page 126)
Bar (Page 175)

BackColorBottom Property

Description
Defines or returns the color for the bottom/right part of the slider. LONG write-read access.

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


324 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Slider (Page 214)
ScreenItem Object (Page 126)

BackColorTop Property

Description
Defines or returns the color for the top/left part of the slider. LONG write-read access.

See also
Slider (Page 214)
ScreenItem Object (Page 126)

BackFlashColorOff Property

Description
Defines or returns the color of the object background for the flash status "Off". LONG write-read
access.

See also
ScreenItem Object (Page 126)

BackFlashColorOn Property

Description
Defines or returns the color of the object background for the flash status "On". LONG write-read
access.

See also
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 325
VBS for Creating Procedures and Actions
1.15 VBS Reference

Background Property

Description
TRUE, when the background of the 3D-bar graph object should be visible. BOOLEAN write-read
access.

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

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 255)
ScreenItem Object (Page 126)

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.

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


326 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
• 2: Numbered face and rectangular background are transparent.

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 240)
WinCC Slider Control (Page 274)
WinCC Gauge Control (Page 255)
WinCC Digital/Analog Clock (Page 247)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 327
VBS for Creating Procedures and Actions
1.15 VBS Reference

Bar

BarAdd property

New - BarAdd
Creates a new diagram.
The attribute can be assigned dynamic properties using the name BarAdd. The data type is
STRING.

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 274)
ScreenItem Object (Page 126)

BarBarGradientColor property

Fill pattern color – BarFillPatternColor


The "Fill Pattern Color" attribute defines the color of the pattern that is displayed on a filled area.
The attribute can be assigned dynamic properties by means of the name BarFillPatternColor.
The data type is LONG.

BarBarGradientPattern property

Fill pattern - BarBarGradientPattern


The "Fill Pattern" attribute specifies the pattern for the display of bars.
So that the fill pattern becomes visible, the color of the fill pattern must differ from the
background color.
49 fill patterns are available for selection:
• Fill pattern 1 "Solid" fills the object with the set background color.
• Fill pattern 2 "Transparent" means neither a background nor a fill pattern is displayed.
The attribute can be assigned dynamic properties using the name BarBarGradientPattern.
The data type is LONG.

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


328 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarBarWindow property

Diagram window - BarBarWindow


Specifies the diagram window in which the selected diagram will be displayed. You specify the
available diagram windows on the "Diagram window" tab.
The attribute can be assigned dynamic properties using the name BarWindow. The data type
is STRING.

BarChartType property

Diagram type - BarChartType


Specifies how the diagram will be displayed.
The following settings are available:

Value Description Explanation


0 Bar diagram A diagram with bars will be displayed.
1 Bars with value In addition to the bars, the values will be displayed in the diagram. The display of values
conforms to the configuration of the "Alignment" property and the write direction of the bars.

The attribute can be assigned dynamic properties using the name BarChartType. The data
type is LONG.

BarColor property

Border color - BarColor


Indicates the border color of the bar. Use the button to open the "Color selection" dialog to select
the color.
The attribute can be assigned dynamic properties using the name BarColor. The data type is
LONG.

BarCount property

BarCount
Specifies the number of configured diagrams.
The attribute can be assigned dynamic properties using the name BarCount. The data type is
LONG.

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


System Manual, 09/2023, A5E52671436-AB 329
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarDepth Property

Description
Defines or returns the depth of the bar in pixels.

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

BarFillColor property

Bar color - BarFillColor


Indicates the fill color of the bars. For the "Bars with value" diagram type, the text background
color is specified.
Use the button to open the "Color selection" dialog to select the color.
The attribute can be assigned dynamic properties using the name BarFillColor. The data type
is LONG.

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 274)
ScreenItem Object (Page 126)

BarHeight Property

Description
Defines or returns the height of the bar in pixels.

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

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


330 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarIndex property

BarIndex
References a configured diagram. Using this attribute, you can assign the values of other
attributes to a specific diagram. The index must always be set before you change the properties
of a diagram in Runtime.
Valid values for "BarIndex" are between 0 and "BarCount" minus 1. The "BarCount" attribute
specifies the number of configured diagrams.
The "BarIndex" attribute can be assigned dynamic properties using the attribute BarRepos.
The data type is LONG.

BarLabel property

Label - BarLabel
Specifies the label of the selected diagram. The label is displayed in Runtime when the
"UseBarNameAsLabel" attribute has the value "FALSE".
The attribute can be assigned dynamic properties using the name BarLabel. The data type is
STRING.

BarLineStyle property

Border style - BarLineStyle


Specifies which border type is used to represent the border of the bar.
The following settings are available:

Value Description Explanation


0 Solid The border is displayed as a solid border.
1 Dashed The border is displayed as a dashed border.
2 Dotted The border is displayed as a dotted line.
3 Dash dot The border is displayed as a dash-dot line.
4 Dash-dot-dot The border is displayed as a dash-dot-dot line.

The attribute can be assigned dynamic properties using the name BarLineStyle. The data
type is LONG.

BarLineWidth property

Border width - BarLineWidth


Specifies the border width of the bar.

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


System Manual, 09/2023, A5E52671436-AB 331
VBS for Creating Procedures and Actions
1.15 VBS Reference

The attribute can be assigned dynamic properties using the name BarLineWidth. The data
type is LONG.

BarLowerLimit property

BarLowerLimit
Specifies the low limit of a tag. If the tag value is less than "BarLowerLimit", the values are
designated with the color set in "BarLowerLimitColor". This setting is enabled when the
"BarLowerLimitColoring" attribute has the value "TRUE".
The attribute can be assigned dynamic properties using the name BarLowerLimit. The data
type is DOUBLE.

BarLowerLimitColor property

BarLowerLimitColor
Specifies the color for designating tag values below the value at "BarLowerLimit". The setting is
enabled when the "BarLowerLimitColoring" attribute has the value "TRUE".
The attribute can be assigned dynamic properties using the name BarLowerLimitColor. The
data type is LONG.

BarLowerLimitColoring property

BarLowerLimitColoring
Specifies whether the "BarLowerLimitColor" attribute is used for designating tag values that are
lower than the value at "BarLowerLimit".

Value Explanation
TRUE The "BarLowerLimitColor" attribute is enabled.
FALSE The "BarLowerLimitColor" attribute is disabled.

The attribute can be assigned dynamic properties using the name BarLowerLimitColoring.
The data type is BOOLEAN.

BarName property

Object name - BarName


Displays the name of the selected bar.
To change the name, use the attribute BarRename or the configuration dialog.
The "BarName" attribute can be assigned dynamic properties using the attribute BarRename.

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


332 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarProvider property

Data source - BarProvider


Specifies the data source of the selected diagram.
The following settings are available:

Value Description Explanation


0 None No data source configured to create a connection in Runtime by means of a script.
1 Archive tags Data source with archive tags of a process value archive.

The attribute can be assigned dynamic properties using the name BarProvider.

BarProviderCLSID property

BarProviderCLSID
Displays the data source of the selected diagram.

Value Explanation
No data source configured to create a connection in Runtime by means of a script.
{416A09D2-8B5A-11D2- Data source with archive tags of a process value archive.
8B81-006097A45D48}

The attribute can be assigned dynamic properties using the name BarProviderCLSID. The
data type is STRING.

BarRemove property

Remove - BarRemove
Removes the selected diagram from the list.
The attribute can be assigned dynamic properties using the name BarRemove. The data type
is STRING.

BarRename property

BarRename
Renames the diagram that is referenced using the "BarIndex" attribute.
The attribute can be assigned dynamic properties using the name BarRename. You can use
"BarRename" to also assign dynamic properties to the "BarName" attribute. The data type is
STRING.

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


System Manual, 09/2023, A5E52671436-AB 333
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarRepos property

Up/down - BarRepos
Changes the order of the selected diagrams in the diagram window. "Up" and "Down" move the
selected diagrams up and down in the list. As a result, the diagram is displayed further in the
foreground or background in runtime.
The attribute can be assigned dynamic properties using the name BarRepos. The data type is
LONG.

BarSelectTagName property

BarSelectTagName
Opens a dialog for selecting the tag name for the data source of the diagram. Programmers can
set this attribute to allow users to select a tag name using a button, for example.
The attribute can be assigned dynamic properties using the name BarSelectTagName. The
data type is BOOLEAN.

BarTagName property

Tag name - BarTagName


Displays the tag name of the connected tag. With the button you open a dialog for selecting an
archive tag.
The attribute can be assigned dynamic properties using the name BarTagName. The data
type is STRING.

BarTimeAxis property

Time axis - BarTimeAxis


Specifies which time axis will be used for the selected diagram. You specify the available time
axes on the "Time axes" tab.
The attribute can be assigned dynamic properties using the name BarTimeAxis. The data
type is STRING.

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


334 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarUncertainColor property

BarUncertainColor
Values have an uncertain status if the initial value is unknown when Runtime starts or if a
substitute value is used. You can use the "BarUncertainColor" attribute to specify the color used
for identifying these values. The "BarUncertainColoring" attribute determines whether or not
this setting is evaluated.
The attribute can be assigned dynamic properties using the name BarUncertainColor. The
data type is LONG.

BarUncertainColoring property

BarUncertainColoring
Values have an uncertain status if the initial value is unknown when Runtime starts or if a
substitute value is used. You can use the "BarUncertainColoring" attribute to enable
identification of such values based on the color set in "BarUncertainColor".

Value Explanation
TRUE The setting for the "BarUncertainColor" attribute is enabled.
FALSE The setting for the " BarUncertainColor " attribute is disabled.

The attribute can be assigned dynamic properties using the name BarUncertainColoring.
The data type is BOOLEAN.

BarUpperLimitColoring property

BarUpperLimitColoring
Specifies whether the "BarUpperLimitColor" attribute is used for designating tag values that are
higher than the value at "BarUpperLimit".

Value Explanation
TRUE The setting for the "BarUpperLimitColor" attribute is enabled.
FALSE The setting for the "BarUpperLimitColor" attribute is disabled.

The attribute can be assigned dynamic properties using the name BarUpperLimitColoring.
The data type is BOOLEAN.

BarUpperLimitColor property

BarUpperLimitColor
Specifies the color for designating tag values above the value at "BarUpperLimit". The setting is
enabled when the "BarUpperLimitColoring" attribute has the value "TRUE" hat.

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


System Manual, 09/2023, A5E52671436-AB 335
VBS for Creating Procedures and Actions
1.15 VBS Reference

The attribute can be assigned dynamic properties using the name BarUpperLimitColor. The
data type is LONG.

BarUpperLimit property

BarUpperLimit
Specifies the high limit of a tag. If the tag value is higher than "BarUpperLimit", the values are
designated with the color set in "BarUpperLimitColor". This setting is enabled when the
"BarUpperLimitColoring" attribute has the value "TRUE".
The attribute can be assigned dynamic properties using the name BarUpperLimit. The data
type is DOUBLE.

BarValueAlignment property

Alignment - BarValueAlignment
Specifies the alignment of the displayed values for the "Bars with value" diagram type.
The following settings are available depending on the write direction of the bars:
• The write direction of bars is "From the right" or "From the left"

Value Description Explanation


0 Bottom The values are displayed at the bottom of the diagram window.
1 Centered The values are displayed at the center of the diagram window.
2 Top The values are displayed at the top of the diagram window.

• The write direction of bars is "From the top" or "From the bottom"

Value Description Explanation


0 Left The values are displayed at the left of the diagram window.
1 Centered The values are displayed at the center of the diagram window.
2 Right The values are displayed at the right of the diagram window.

The attribute can be assigned dynamic properties using the name BarValueAlignment. The
data type is LONG.

BarValueAxis property

Value axis - BarValueAxis


Specifies which value axis will be used for the selected diagram. You specify the available value
axes on the "Value axes" tab.
The attribute can be assigned dynamic properties using the name BarValueAxis. The data
type is STRING.

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


336 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarValueUnit property

Unit - BarValueUnit
Specifies a unit of the values that will be appended to the value to be displayed for the "Bars with
value" diagram type. e.g. "%" or "°C"
The attribute can be assigned dynamic properties using the name BarValueUnit. The data
type is STRING.

BarVisible property

Diagram - BarVisible
The list shows the diagrams you have created.
Select the diagrams in the list that you want to display in the diagram windows.
Click on a diagram in the list to adapt the properties and to assign axes and diagram windows
to the diagram.
The attribute can be assigned dynamic properties using the name BarVisible. The data type
is BOOLEAN.

BarWindowAdd property

New - BarWindowAdd
Creates a new diagram window.
The attribute can be assigned dynamic properties using the name BarWindowAdd. The data
type is STRING.

BarWindowCoarseGrid property

Main scaling - BarWindowCoarseGrid


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 using the name BarWindowCoarseGrid.
The data type is BOOLEAN.

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


System Manual, 09/2023, A5E52671436-AB 337
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarWindowCoarseGridColor property

Color main scale - BarWindowCoarseGridColor


Specifies the color of the grid lines for the main scale. Use the button to open the "Color
selection" dialog to select the color.
The attribute can be assigned dynamic properties using the name
BarWindowCoarseGridColor. The data type is LONG.

BarWindowCount property

BarWindowCount
Specifies the number of configured diagrams.
The attribute can be assigned dynamic properties using the name BarWindowCount. The
data type is LONG.

BarWindowFineGrid property

Secondary scaling - BarWindowFineGrid


Specifies whether the grid lines are displayed 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 using the name BarWindowFineGrid. The
data type is BOOLEAN.

BarWindowFineGridColor property

Color secondary scale - BarWindowFineGridColor


Specifies the color of the grid lines for the secondary scale. Use the button to open the "Color
selection" dialog to select the color.
The attribute can be assigned dynamic properties using the name
BarWindowFineGridColor. The data type is LONG.

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


338 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarWindowForegroundBarGrid property

For foreground diagram only - BarWindowForegroundBarGrid


Specifies whether the grid lines for the foreground diagram only will be displayed in the selected
diagram window.

Value Explanation
TRUE The grid lines for the foreground diagram are displayed in the diagram window.
FALSE The grid lines for all diagrams are displayed in the diagram window.

The attribute can be assigned dynamic properties using the name


BarWindowForegroundBarGrid. The data type is BOOLEAN.

BarWindowGapWidth property

Gap width - BarWindowGapWidth


Specifies the gap between two bars of a bar diagram in % of the bar width.
The attribute can be assigned dynamic properties using the name BarWindowGapWidth.
The data type is LONG.

BarWindowGridInBarColor property

In diagram color - BarWindowGridInBarColor


Specifies whether the grid lines for the main scaling will be displayed in the color of the bars.

Value Explanation
TRUE The grid lines are displayed in the color of the bars.
FALSE The grid lines are displayed with the color set in the "Color" field.

The attribute can be assigned dynamic properties using the name


BarWindowGridInBarColor. The data type is BOOLEAN.

BarWindowHorizontalGrid property

For value axes - BarWindowHorizontalGrid


Enables the display of horizontal grid lines for value axes.

Value Explanation
TRUE Display of horizontal grids for value axes is enabled.
FALSE Display of horizontal grid lines for value axes is disabled.

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


System Manual, 09/2023, A5E52671436-AB 339
VBS for Creating Procedures and Actions
1.15 VBS Reference

The attribute can be assigned dynamic properties using the name


BarWindowHorizontalGrid.

BarWindowIndex property

BarWindowIndex
References a configured diagram. Using this attribute, you can assign the values of other
attributes to a specific diagram.
Valid values for "BarWindowIndex" are between 0 and "BarWindowCount" minus 1. The
"BarWindowCount" attribute specifies the number of configured diagrams.
The "BarWindowIndex" attribute can be assigned dynamic properties using the attribute
BarWindowRepos. The data type is LONG.

BarWindowName property

Object name - BarWindowName


Displays the name of the selected bar window.
To change the name, use the attribute BarWindowRename or the configuration dialog.
The "BarWindowName" attribute can be assigned dynamic properties using the attribute
BarWindowRename. The data type is STRING.

BarWindowRemove property

Remove - BarWindowRemove
Removes the selected diagram window from the list.
The attribute can be assigned dynamic properties using the name BarWindowRemove. The
data type is STRING.

BarWindowRename property

BarWindowRename
Renames the diagram window, which is referenced using the "BarWindowIndex" attribute.
The attribute can be assigned dynamic properties using the name BarWindowRename. You
can use "BarWindowRename" to also assign dynamic properties to the "BarWindowName"
attribute. The data type is STRING.

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


340 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarWindowRepos property

Up/down - BarWindowRepos
Changes the order of the diagram windows. "Up" and "Down" move the selected diagram
windows up and down in the list.
The order in the list determines the position in the Control. The first diagram window is
displayed at the bottommost position, the last diagram window is displayed at the topmost
position.
The attribute can be assigned dynamic properties using the name BarWindowRepos. The
data type is LONG.

BarWindowSeriesOverlap property

Overlap - BarWindowBarOverlap
Specifies the overlap of various bars of a time instant in % of the bar width.
The attribute can be assigned dynamic properties using the name BarWindowBarOverlap.
The data type is LONG.

BarWindowSpacePortion property

Proportional area - BarWindowSpacePortion


Specifies the portion of the selected diagram window for the display in the control.
The attribute can be assigned dynamic properties using the name BarWindowSpacePortion.
The data type is LONG.

BarWindowVerticalGrid property

For time axes- BarWindowVerticalGrid


Enables the display of vertical grid lines for time axes.

Value Explanation
TRUE Display of vertical grid lines for time axes is enabled.
FALSE Display of vertical grid lines for time axes is disabled.

The attribute can be assigned dynamic properties using the name BarWindowVerticalGrid.

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


System Manual, 09/2023, A5E52671436-AB 341
VBS for Creating Procedures and Actions
1.15 VBS Reference

BarWindowVisible property

Diagram window - BarWindowVisible


The list shows the diagram windows you have created.
Select the diagram windows in the list that you want to display in the control.
Click on an entry in the list to adapt the properties of the bar display and the grid lines.
The attribute can be assigned dynamic properties using the name BarWindowVisible. The
data type is BOOLEAN.

BarWidth Property

Description
Defines or returns the width of the bar in pixels.

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

BarChartAlignment property

Alignment - BarChartAlignment
Specifies the alignment of the bar in the diagram.
The following settings are available depending on the write direction of the bars:
• The write direction of bars is "From the right" or "From the left"

Value Description Explanation


0 Left The bars are shown left justified on the graph.
1 Centered The bars are centered in the graph.
2 Right The bars are shown right justified on the graph.

• The write direction of bars is "From the top" or "From the bottom"

Value Description Explanation


0 Top The bars are shown at the top of the graph.
1 Centered The bars are centered in the graph.
2 Bottom The bars are shown at the bottom of the graph.

The attribute can be dynamized with the BarChartAlignment name. The data type is LONG.

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


342 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 201)
ScreenItem Object (Page 126)

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 201)
ScreenItem Object (Page 126)

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 201)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 343
VBS for Creating Procedures and Actions
1.15 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 201)
ScreenItem Object (Page 126)

BaseScreenName Property

Function
Defines or returns the current basic picture.
STRING (write-read access)
A picture change is executed using the

HMIRuntime.BaseScreenName = (<Serverpräfix>::)<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 126)
HMIRuntime Object (Page 119)

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


344 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

BasicBorderColor property

Description
Specifies the border color.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

BasicColor property

Description
Specifies the color of the object.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

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


System Manual, 09/2023, A5E52671436-AB 345
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
SVG object (Page 197)

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.

See also
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Online Trend Control (before WinCC V7) (Page 292)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

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


346 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

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 126)
WinCC Function Trend Control (before WinCC V7) (Page 285)

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 274)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 347
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 274)
ScreenItem Object (Page 126)

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

See also
WinCC Gauge Control (Page 255)
ScreenItem Object (Page 126)

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

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


348 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Gauge Control (Page 255)
ScreenItem Object (Page 126)

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 255)
ScreenItem Object (Page 126)

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.

See also
Text list (Page 199)
ScreenItem Object (Page 126)

BlinkColor Property

Description
Defines the color of the icon in the flash picture. LONG write-read access.

See also
HMI Symbol Library (Page 240)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 349
VBS for Creating Procedures and Actions
1.15 VBS Reference

BlinkMode property

Flash mode (BlinkMode)


Specifies the flash mode of the icon in runtime.
The following settings are available:

Value Description Comments


0 No flashing The icon does not flash.
1 Hidden The icon flashes in the background color.
2 Shadow The icon flashes with shading in the foreground color.
3 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.

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


0 left The block caption is left justified.
1 centered The block caption is aligned to center.
2 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.

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


350 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

BlockDateFormat property

Date format (BlockDateFormat)


Defines the date format for visualization.

Parameter (example: 31 December 2015)


Automatic The date format is set automatically. The setting is only available in the
configuration dialog.
dd Day, as two-digit number, e.g. "31"
MM Month, as two-digit number, e.g. "12"
MMM Month, as short form of the name of the month, e.g. "Dec"
yy Year, as two-digit number, e.g. "15"

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


System Manual, 09/2023, A5E52671436-AB 351
VBS for Creating Procedures and Actions
1.15 VBS Reference

yyyy Year, as four-digit number, e.g. "2015"


Separator: . / You can replace the period with a slash as a separator.
Example "yyyy/MM/dd": 2015/12/31
The attribute can be assigned dynamic properties by means of the name BlockDateFormat.
The data type is STRING.

BlockDurationTimeFormat property
BlockDurationTimeFormat
Defines which duration format will be used for the display in the block.
To change the setting, the option “Take from source" must be deactivated or
"BlockUseSourceFormat" must be set to "FALSE".
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
Example: 1 2:03:55
H:mm:ss. Hours:Minutes:Seconds
Example: 26:03:55
m:ss Minutes:Seconds
Example: 1563:55
s Seconds
Example: 93835
d H:mm:ss. Day Hours:Minutes:Seconds.Milliseconds
ms Example: 1 2:03:55.150
H:mm:ss.m Hours:Minutes:Seconds.Milliseconds
s Example: 26:03:55.150
m:ss.ms Minutes:Seconds.Milliseconds
Example: 1563:55.150
s.ms Seconds.Milliseconds
Example: 2.150

The attribute can be assigned dynamic properties by means of the name


BlockDurationTimeFormat. 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.

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


352 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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:

Value Description
0 No block
1 Name
2 Index
3 Label
4 Show
5 Tag name Y
6 Tag name X
7 Y value
8 X value/time stamp
9 Y value (LL)

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


System Manual, 09/2023, A5E52671436-AB 353
VBS for Creating Procedures and Actions
1.15 VBS Reference

Value Description
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 average value
21 Duration
22 Number of values
23 Area name
24 Area name (LL)
25 Area name (HL)
26 Label X
27 Label Y
28 Last Y value
The tag values are also updated while the update via "Autoscroll" or "Stop" is disabled in the connected WinCC
Control.
The update cycle from the interconnected control is used.
29 Last X value / time stamp
The tag values are also updated while the update via "Autoscroll" or "Stop" is disabled in the connected WinCC
Control.
The update cycle from the interconnected control is used.

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.

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


354 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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

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


System Manual, 09/2023, A5E52671436-AB 355
VBS for Creating Procedures and Actions
1.15 VBS Reference

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:

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

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


356 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 126)

BorderColor Property

Description
Defines or returns the line color for the object. LONG write-read access.

See also
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 357
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 126)
Button (Page 203)
Round Button (Page 211)

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 203)
Round Button (Page 211)
ScreenItem Object (Page 126)

BorderEndStyle Property

Description
Defines or returns the line end style of the object. LONG write-read access.

See also
Polyline (Page 159)
Line (Page 155)
ScreenItem Object (Page 126)

BorderFlashColorOff Property

Description
Defines or returns the color of the object lines for the flashing status "Off". LONG write-read
access.

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


358 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
ScreenItem Object (Page 126)

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 126)

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 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 359
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
ScreenItem Object (Page 126)

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 168)
ScreenItem Object (Page 126)

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.

See also
Connector (Page 168)
ScreenItem Object (Page 126)

BoxAlignment Property

Description
TRUE, when the fields are arranged aligned to the right. BOOLEAN write-read access.

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


360 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Radio box (Page 209)
Check box (Page 207)
ScreenItem Object (Page 126)

BoxCount Property

Description
Defines or returns the number of fields. Value range from 0 to 63.

See also
Radio box (Page 209)
Check box (Page 207)
ScreenItem Object (Page 126)

BoxType Property

Description
Defines or returns the field type. Value range from 0 to 2:
• 0: Edition
• 1: Input
• 2: I/O field

See also
Text list (Page 199)
I/O Field (Page 185)
ScreenItem Object (Page 126)

ButtonColor Property

Description
Defines or returns the color of the slider. LONG write-read access.

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


System Manual, 09/2023, A5E52671436-AB 361
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Slider (Page 214)
ScreenItem Object (Page 126)

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
• 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

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


362 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

• 0x08000000; 134217728; Show/hide message


• 0x10000000; 268435456; Display option dialog

See also
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

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.
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.

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


System Manual, 09/2023, A5E52671436-AB 363
VBS for Creating Procedures and Actions
1.15 VBS Reference

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".

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".

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


364 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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".

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 194)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 365
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Group Display (Page 194)
ScreenItem Object (Page 126)

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 126)
Group Display (Page 194)

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.

See also
Group Display (Page 194)
ScreenItem Object (Page 126)

1.15.4.4 C

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.

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


366 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 220)
Picture Window (Page 180)
Application Window (Page 174)
ScreenItem Object (Page 126)

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.

CaptionColor Property

Description
Defines or returns the color of the element labeling. LONG write-read access.

See also
ScreenItem Object (Page 126)
WinCC Gauge Control (Page 255)

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 255)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 367
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 255)
ScreenItem Object (Page 126)

CaptionText property

Description
Defines the window title that is displayed in Runtime or returns it. The window title is displayed
as "Header" object property.
The Caption property must be set to TRUE.

See also
Picture Window (Page 180)
ScreenItem Object (Page 126)

CellCount property

CellCount
Specifies the number of cells of the Row object of a Table Control. The number of cells
corresponds to the number of columns.

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


368 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 283)
ScreenItem Object (Page 126)

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.

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.

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


System Manual, 09/2023, A5E52671436-AB 369
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

CellText property

CellText
Returns the contents of a cell as a string. The cell is determined from the column number of the
row object, e.g. CellText(3) for the third column. Numbering runs from "1" to "CellCount".

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 255)
ScreenItem Object (Page 126)

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:
1: The diameter corresponds to the smaller value of the "Width" or "Height" geometric values.

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


370 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Gauge Control (Page 255)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 371
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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


372 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 373
VBS for Creating Procedures and Actions
1.15 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 175)
ScreenItem Object (Page 126)

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 185)
ScreenItem Object (Page 126)

ClearOnNew Property

Description
TRUE, when the field entry is deleted as soon as the I/O field has the focus. BOOLEAN write-read
access.

See also
I/O Field (Page 185)
ScreenItem Object (Page 126)

Closeable property (before WinCC V7)

Description
TRUE, when the window can be closed in Runtime. BOOLEAN write-read access.

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


374 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
ScreenItem Object (Page 126)

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 180)
Application Window (Page 174)
ScreenItem Object (Page 126)

Co

CoarseGrid Property

Description
TRUE if the value axis is scaled with long distances between the marks. The spacing between two
long tick marks can be changed using the "CoarseGridValue" property.
BOOLEAN write-read access.

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


System Manual, 09/2023, A5E52671436-AB 375
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 292)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

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


376 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

CoarseGridValueX Property

Description
Defines or returns the distance between two long tick marks on the graduation scale of the X-
axis. Whether the information is evaluated is dependent on the value of the "CoarseGridX"
property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

CoarseGridValueY Property

Description
Defines or returns the distance between two long tick marks on the graduation scale of the Y-
axis. Whether the information is evaluated is dependent on the value of the "CoarseGridY"
property.

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 194)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 377
VBS for Creating Procedures and Actions
1.15 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 283)
ScreenItem Object (Page 126)

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 289)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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


378 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 175)
ScreenItem Object (Page 126)

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 214)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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, 09/2023, A5E52671436-AB 379
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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


380 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColorState1Good property

Description
Specifies the color of the status "Good" of diagnostic objects.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

ColorState2Maintenance property

Description
Specifies the color of the status "Maintenance" of diagnostic objects.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

ColorState3Error property

Description
Specifies the color of the status "Error" of diagnostic objects.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

ColorStateXUncertain property

Description
Specifies the color of the status "Uncertain" of diagnostic objects.
The property can be dynamized for some SVG graphics of the SVG library.

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


System Manual, 09/2023, A5E52671436-AB 381
VBS for Creating Procedures and Actions
1.15 VBS Reference

Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

ColorTop Property

Description
Defines or returns the color for the top/left stop of the slider object. LONG write-read access.

See also
Slider (Page 214)
ScreenItem Object (Page 126)

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


382 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

ColTitle Property

Description
TRUE, when the columns in the message window should have a title bar. BOOLEAN write-read
access.

See also
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 383
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 283)
ScreenItem Object (Page 126)

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 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
ScreenItem Object (Page 126)

Comment property (Alarm Logging)

Description
Reads or sets the Alarm object comment.

See also
Alarms object (list) (Page 111)

Comment property (Tag Logging)

Description
Reads the tag comment.
The comment text is language neutral.
STRING (read only)

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


384 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Example
The example shows how the comment for the "Tag1" tag is output.

'VBS376
Dim objTag
Set objTag = HMIRuntime.Tags("Tag1")
MsgBox objTag.Comment

The following example adds two tags to the TagSet list and outputs the comment of each tag
as trace.

'VBS377
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add "Motor1"
group.Add "Motor2"
HMIRuntime.Trace "Comment of Motor1: " & group(“Motor1”).Comment & vbNewLine
HMIRuntime.Trace "Comment of Motor2: " & group(“Motor2”).Comment & vbNewLine

See also
Tag Object (Page 138)

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 289)
ScreenItem Object (Page 126)

CommonX Property

Description
TRUE, when the trends in the trend window should be displayed with a common X-axis.
BOOLEAN write-read access.

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


System Manual, 09/2023, A5E52671436-AB 385
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 126)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Function Trend Control (before WinCC V7) (Page 285)

ComputerName property

Description
Returns the name of the computer on which the alarm object was triggered.
ComputerName (readonly)

See also
Alarms object (list) (Page 111)

ConnectBarWindows property

Connected diagram window - ConnectBarWindows


Specifies whether the configured diagram windows are connected. You must have configured
several diagram windows for this.
The connected diagram windows have the following properties:
• They can have a common X axis.
• They have a scroll bar.
• The zoom functions for a diagram window affect the connected diagram windows.

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


386 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Value Description
TRUE All configured diagram windows are connected.
FALSE The diagram windows are displayed separately.

The attribute can be assigned dynamic properties using the name ConnectBarWindows. The
data type is BOOLEAN.

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.

Context property

Description
Reads or sets the alarm object server prefix.

See also
Alarms object (list) (Page 111)

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


System Manual, 09/2023, A5E52671436-AB 387
VBS for Creating Procedures and Actions
1.15 VBS Reference

ContinuousChange property

Description
The attribute determines how the value set with the slider is transferred in runtime:

FALSE The value is transferred as soon as the mouse button is released.


TRUE The value is transferred as soon as the slider position is changed.

The "Update continuously" object property is used with the following objects and values:
• Slider object: Value of "Process driver connection" property
• WinCC Slider Control: Value of "Position" property

See also
WinCC Slider Control (Page 274)
ScreenItem Object (Page 126)

ContrastColor property

Description
ContrastColor and ContrastColor2 specify the contrasting colors of the object.
The properties can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

CornerRadiusMode property

Description
Defines or returns the corner radius mode of the RoundRectangle object.

FALSE Relative radius


TRUE Fixed radius

See also
RoundCornerHeight Property (Page 568)
RoundCornerWidth Property (Page 568)
Rounded rectangle (Page 163)

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


388 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Count property (listing)

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

See also
CreateTagSet Method (Page 737)
TagSet Object (List) (Page 142)
ScreenItems Object (List) (Page 129)
Screens Object (List) (Page 135)
Layers Object (Listing) (Page 122)
DataSet Object (List) (Page 116)
ProcessValues Object (List) (Page 125)

Count property

Count
Specifies the number of rows of the row listing object of a table control.

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


System Manual, 09/2023, A5E52671436-AB 389
VBS for Creating Procedures and Actions
1.15 VBS Reference

ConveyorBasicColor property

Description
Specifies the color of the conveyor belt.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

ConveyorContrastColor property

Description
Specifies the contrast color of the conveyor belt.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

Column

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.

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


390 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColumnAlign property

Alignment - ColumnAlign
Specifies the mode of alignment of a selected column.
The following settings are available:

Value Description Explanation


0 left The selected column is aligned left.
1 centered The selected column is aligned to center.
2 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.

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.

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


System Manual, 09/2023, A5E52671436-AB 391
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColumnDateFormat property

Date format (ColumnDateFormat)


Defines the date format for visualization.

Parameter (Example:31 December 2015)


Automatic The date format is set automatically. The setting is only available in the
configuration dialog.
dd Day, as two-digit number, e.g. "31"
MM Month, as two-digit number, e.g. "12"
MMM Month, as short form of the name of the month, e.g. "Dec"
yy Year, as two-digit number, e.g. "15"
yyyy Year, as four-digit number, e.g. "2015"
Separator: . / You can replace the period with a slash as a separator.
Example "yyyy/MM/dd": 2015/12/31
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.

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

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


392 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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.

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


System Manual, 09/2023, A5E52671436-AB 393
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColumnId property

ColumnId
Default assignment of the ID number and column in the WinCC control:
The attribute can be assigned dynamic properties by means of the name ColumnId . The
data type is LONG.

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.

ColumnInInspectorView property

ColumnInInspectorView
Specifies whether the diagnostic data in the detail view are displayed in columns instead of rows.
The attribute can be assigned dynamic properties using the name ColumnInInspectorView.
The data type is BOOLEAN.

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.

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


394 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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, 09/2023, A5E52671436-AB 395
VBS for Creating Procedures and Actions
1.15 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.

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


396 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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


0 no Column scroll bars are not displayed.
1 as required Column scroll bars are displayed if vertical space requirements of the control
are greater than the actually available display area.
2 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, 09/2023, A5E52671436-AB 397
VBS for Creating Procedures and Actions
1.15 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.

ColumnsMoveable property

ColumnsMoveable
Specifies whether the user can move the columns of the control in runtime.
The attribute can be assigned dynamic properties using the name ColumnsMoveable. 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


0 No No sorting
1 Ascending Ascending order, starting at the lowest value.
2 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.

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


398 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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..
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.

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


System Manual, 09/2023, A5E52671436-AB 399
VBS for Creating Procedures and Actions
1.15 VBS Reference

ColumnTitleAlign property

Column title alignment - ColumnTitleAlign


Specifies the type of column title alignment.
The following settings are available:

Value Description Explanation


0 left The column titles are left justified.
1 centered The column titles are centered.
2 right The column titles are right justified.
3 Same as table con‐ The column titles are justified to fit the corresponding column content.
tent

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.

ColumnType property

ColumnType
Indicates the associated view of the selected column in the SysDiagControl.
The attribute can be assigned dynamic properties using the name ColumnType. The data
type is LONG.

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


400 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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.

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 119)

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


System Manual, 09/2023, A5E52671436-AB 401
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

See also
ScreenItem Object (Page 126)
HMI Symbol Library (Page 240)

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 199)
I/O Field (Page 185)
ScreenItem Object (Page 126)

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


402 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
• 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 292)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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, 09/2023, A5E52671436-AB 403
VBS for Creating Procedures and Actions
1.15 VBS Reference

Cutaway property

Description
Specifies whether the object is displayed as open or closed, such as boiler with flame that can be
dynamized.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

1.15.4.5 D

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 255)
ScreenItem Object (Page 126)

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 255)
ScreenItem Object (Page 126)

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


404 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

DataFormat Property

Description
Returns the data type of the I/O field object. Read only access.
Range of values from 0 to 5.
0: Binary
1: Decimal
2: String
3: Hexadecimal
4: Date/time
5: Date/Time (local)

See also
I/O Field (Page 185)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

DataLogs Property

Description
Returns an object of type "DataLogs".
DataLogs (read-only)

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


System Manual, 09/2023, A5E52671436-AB 405
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
DataLogs Object (Page 115)
HMIRuntime Object (Page 119)

DataSet Property

Description
Returns an object of type "DataSet".
DataSet (read-only)

See also
DataSet Object (List) (Page 116)
HMIRuntime Object (Page 119)

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 285)
ScreenItem Object (Page 126)

DataXY Property

Description
Inserts several data records as an array with pairs of values and must be set before calling
"InsertData".

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


406 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 861)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 407
VBS for Creating Procedures and Actions
1.15 VBS Reference

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


0 Ascending The list is updated starting with the bottom line.
1 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


0 Ascending The list is updated starting with the bottom line.
1 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.

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


408 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

Delta Property

Description
Defines or returns the value difference between two main scale graduation marks. Write/Read
access.

See also
WinCC Gauge Control (Page 255)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 409
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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.

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


410 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 411
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

DiagnosticsContext Property

Description
Specifies the diagnostics context.
Access in runtime: Read and write

Syntax
Object.DiagnosticsContext[=STRING]

Object
Required. A "ScreenItem" object with the following characteristics:
• AlarmControl

STRING
Optional. A value or a constant that specifies the diagnostics context.

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


412 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 214)
Bar (Page 175)
3D Bar (Page 170)
ScreenItem Object (Page 126)

DisplayFillLevel property

Description
Specifies whether the fill level is displayed.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

DisplayFillMode property

Description
Specifies the display of the fill level (object-dependent):
• 0 = Window with level bar
• 1 = Fill level in the object
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

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


System Manual, 09/2023, A5E52671436-AB 413
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
SVG object (Page 197)

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 logon name is displayed in the following cases:

WinCC Explorer "Details" view in the data window "Display name" column
"Large Icons" view in the data window Process picture preview
WinCC Runtime "Favorites" system dialog Process picture preview
Picture Tree Container name

The "Display name" attribute cannot be made dynamic.

DisplayOptions property

Show messages - DisplayOptions


Select the messages to be displayed.
The following selection options are available:

Value Designation
0 All messages
1 Only displayed messages
2 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 Picture or text: If a picture exists, the button is assigned with the picture, otherwise it is
assigned with text.
1 Graphic and text
2 Text only
3 Graphic only

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


414 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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


0 none No action.
1 Loop-in-alarm Calls the "Loop-in-alarm" function.
2 Open comments dialog Calls the "Comments dialog" button function.
3 Open Infotext dialog Calls the "Infotext dialog" button function.
4 Column-dependent The action is determined by the column in which you dou‐
ble-clicked.

The attribute can be assigned dynamic properties by means of the name DoubleClickAction.
The data type is LONG.

1.15.4.6 E

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 289)
ScreenItem Object (Page 126)

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 289)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 415
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 199)
I/O Field (Page 185)
ScreenItem Object (Page 126)

ElectronicSignature property

Activate electronic signature (ElectronicSignature)


The attribute determines whether a signature is required during operation in Runtime. The
"Required electronic signatures" property is used to define which user can sign the operation.

Yes An electronic signature is required when the object or control is operated.


No Operation is possible without an electronic signature.

The attribute can be made dynamic with the name "ElectronicSignature".

See also
AuthorizedGroups property (Page 317)

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.

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


416 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 'Read names of objects
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Enabled=False 'Lock object
Next

See also
Screen Object (Page 132)
ScreenItem Object (Page 126)

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, 09/2023, A5E52671436-AB 417
VBS for Creating Procedures and Actions
1.15 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.

EnableUserAutoLogout property

Automatic user logout - EnableUserAutoLogout


Specifies for the WinCC UserAdminControl whether the settings in the User Administrator for
user logout are inherited from the group or are user-specific.

Value Name Explanation


FALSE Inherit from group Automatic user logout is inherited from the group.
TRUE User-specific The user has his/her own logout.

If you are using the "SIMATIC Logon" option, you will only be able to use automatic logout
for the group. The setting will automatically be applied to each user in this group. Automatic
logout is deactivated if a user logs on with a chip card.
The attribute can be assigned dynamic properties using the name EnableUserAutoLogout.
The data type is BOOL.

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


418 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

EnableUserPermissions property

Operator authorizations of the user - EnableUserPermissions


Defines whether user-specific operator authorizations can be configured for WinCC
UserAdminControl.

Value Explanation
FALSE "Inherit from group"
The operating authorizations are always inherited by the group. The "Authorization levels" button is disabled.
TRUE "User-specific"
When the user is created, the user authorizations of the group are transferred.
You can change the user's authorizations in the "Authorization levels" window.

The attribute can be assigned dynamic properties using the name EnableUserPermissions.
The data type is BOOL.

EnableUserWebOptions property

Web options of the user - EnableUserWebOptions


Specifies for the WinCC UserAdminControl whether the settings in the User Administrator for the
Web options of the user are inherited from the group or are user-specific.
The settings for the Web options refer to the WinCC options WinCC/WebNavigator, WinCC/
DataMonitor and WinCC/WebUX.

Value Name Explanation


FALSE Inherit from group The settings for the Web options are inherited from the group.
TRUE User-specific The user has his/her own settings for the Web options.

The attribute can be assigned dynamic properties using the name EnableUserWebOptions.
The data type is BOOL.

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 153)
Circular arc (Page 152)
Ellipse segment (Page 148)

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


System Manual, 09/2023, A5E52671436-AB 419
VBS for Creating Procedures and Actions
1.15 VBS Reference

Ellipse arc (Page 147)


ScreenItem Object (Page 126)

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 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

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)


420 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 421
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 472)
QualityCode Property (Page 561)
TagSet Object (List) (Page 142)
Tag Object (Page 138)

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 175)
ScreenItem Object (Page 126)

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


422 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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.

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


System Manual, 09/2023, A5E52671436-AB 423
VBS for Creating Procedures and Actions
1.15 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.

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.

ExportSelection property

Scope of data export - ExportSelection


Specifies the control's Runtime data to be exported.

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


424 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

The following settings are available:

Value Description Explanation


0 all All Runtime data of the control is exported.
1 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.

See also
Slider (Page 214)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 425
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 132)

1.15.4.7 F

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.

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


426 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

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.

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


System Manual, 09/2023, A5E52671436-AB 427
VBS for Creating Procedures and Actions
1.15 VBS Reference

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)

See also
FillStyle Property (Page 430)
BackColor Property (Page 323)
ScreenItem Object (Page 126)

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.

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


428 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
ScreenItem Object (Page 126)

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 126)

FillLevelColor property

Description
Specifies the color of the fill level.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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


System Manual, 09/2023, A5E52671436-AB 429
VBS for Creating Procedures and Actions
1.15 VBS Reference

FillLevelValue property

Description
Specifies the fill level.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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

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

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


430 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 428)
BackColor Property (Page 323)
Screen Object (Page 132)

FillStyle2 Property

Description
Defines or returns the fill style of the bar.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 431
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 if the value axis is scaled with short distances between the 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 292)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

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


432 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 433
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

FlameBasicColor property

Description
Specifies the color of the flame.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

FlameBorderColor property

Description
Specifies the border color of a flame.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

FlameContrastColor property

Description
Specifies the contrast color of the flame.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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


434 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

FlameSize property

Description
Specifies the size of the flame.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

FlashBackColor Property

Description
TRUE, when flashing of the background is activated. BOOLEAN write-read access

See also
ScreenItem Object (Page 126)

FlashBorderColor Property

Description
TRUE, when flashing of the object lines is activated. BOOLEAN write-read access.

See also
ScreenItem Object (Page 126)

FlashFlashPicture Property

Description
TRUE, when flashing of the flash picture is activated. BOOLEAN write-read access.

See also
Status display (Page 201)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 435
VBS for Creating Procedures and Actions
1.15 VBS Reference

FlashForeColor Property

Description
TRUE, when flashing of the text is activated. BOOLEAN write-read access.

See also
I/O Field (Page 185)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
ScreenItem Object (Page 126)

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 201)
ScreenItem Object (Page 126)

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 126)
Status display (Page 201)

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


436 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 201)
ScreenItem Object (Page 126)

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 201)
ScreenItem Object (Page 126)

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) 0
Medium (approx. 0.5 Hz) 1
Fast (approx. 1 Hz) 2

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, 09/2023, A5E52671436-AB 437
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Group Display (Page 194)
ScreenItem Object (Page 126)

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) 0
Medium (approx. 0.5 Hz) 1
Fast (approx. 1 Hz) 2

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 126)

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) 0
Medium (approx. 0.5 Hz) 1
Fast (approx. 1 Hz) 2

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)


438 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
ScreenItem Object (Page 126)

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) 0
Medium (approx. 0.5 Hz) 1
Fast (approx. 1 Hz) 2

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 201)
ScreenItem Object (Page 126)

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) 0
Medium (approx. 2 Hz) 1
Fast (approx. 8 Hz) 2

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, 09/2023, A5E52671436-AB 439
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
ScreenItem Object (Page 126)

Flip property

Flip (Flip)
Specifies flipping of the icon at runtime.
The following settings are available:

Value Description Comments


0 None The icon is not flipped.
1 Horizontal The object is flipped along the horizontal center axis.
2 Vertical The object is flipped along the vertical center axis.
3 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 240)
ScreenItem Object (Page 126)

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


440 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

FluidColorHigh property

Description
Specifies the color of the liquid with the highest value.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

FluidColorLow property

Description
Specifies the color of the liquid with the lowest value.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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 274)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 441
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 (up to WinCC V7.3) (Page 295)
WinCC Digital/Analog Clock (Page 247)
ScreenItem Object (Page 126)

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 274)
ScreenItem Object (Page 126)

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)

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


442 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

• 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 274)
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Function Trend Control (before WinCC V7) (Page 285)
WinCC Digital/Analog Clock (Page 247)
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

FontBold Property

Description
TRUE, when the text in the object should be assigned the "bold" attribute. BOOLEAN write-read
access.

See also
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
Group Display (Page 194)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)

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


System Manual, 09/2023, A5E52671436-AB 443
VBS for Creating Procedures and Actions
1.15 VBS Reference

I/O Field (Page 185)


Bar (Page 175)
ScreenItem Object (Page 126)

FontItalic Property

Description
TRUE, when the text in the object should be assigned the "italic" attribute. BOOLEAN write-read
access.

See also
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
Group Display (Page 194)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
ScreenItem Object (Page 126)

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 (up to WinCC V7.3) (Page 295)
Group Display (Page 194)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)

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


444 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Bar (Page 175)


ScreenItem Object (Page 126)

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 274)
ScreenItem Object (Page 126)

FontSize Property

Description
Defines or returns the font size of the text in the object in points.

See also
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
Group Display (Page 194)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
Bar (Page 175)
ScreenItem Object (Page 126)

FontStrikeThru Property

Description
TRUE, when the text in the object should be assigned the "strikethrough" attribute. BOOLEAN
write-read access.

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


System Manual, 09/2023, A5E52671436-AB 445
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
ScreenItem Object (Page 126)

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 (up to WinCC V7.3) (Page 295)
Group Display (Page 194)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
ScreenItem Object (Page 126)

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 274)
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
WinCC Digital/Analog Clock (Page 247)
HMI Symbol Library (Page 240)
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)

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


446 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

Button (Page 203)


I/O Field (Page 185)
ScreenItem Object (Page 126)

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.

ForeColorDisabled property

Text color for disabled text (ForeColorDisabled)


If the object is not active, the font is displayed in this color.
The attribute can be made dynamic with the name "ForeColorDisabled".

ForeColorDisabledShadow property

Text color for disabled text shadow (ForeColorDisabledShadow)


If the object is not active, the text shadow is displayed in this color.
If the value "100%" is selected for the object property "Object Transparency", the text shadow
is also displayed transparently.
The attribute can be made dynamic with the name "ForeColorDisabledShadow".

ForeFlashColorOff Property

Description
Defines or returns the color of the text for flash status "Off". LONG write-read access.

See also
Text list (Page 199)
Static text (Page 166)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)

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


System Manual, 09/2023, A5E52671436-AB 447
VBS for Creating Procedures and Actions
1.15 VBS Reference

I/O Field (Page 185)


ScreenItem Object (Page 126)

ForeFlashColorOn Property

Description
Defines or returns the color of the text for flash status "On". LONG write-read access.

See also
Static text (Page 166)
Text list (Page 199)
Radio box (Page 209)
Check box (Page 207)
Button (Page 203)
I/O Field (Page 185)
ScreenItem Object (Page 126)

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 255)
ScreenItem Object (Page 126)

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.

See also
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
ScreenItem Object (Page 126)

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


448 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 (up to WinCC V7.3) (Page 295)
ScreenItem Object (Page 126)

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 255)
ScreenItem Object (Page 126)

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 255)
ScreenItem Object (Page 126)

FrameWidth Property

Description
Defines or returns the border width of the button in pixels. Write/Read access.

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


System Manual, 09/2023, A5E52671436-AB 449
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Push Button Control (up to WinCC V7.3) (Page 295)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

1.15.4.8 G

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.

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.

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


450 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 292)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

GraphDirection Property

Write direction - GraphDirection


Defines the direction of the update of axis values.

Value Description Explanation


0 From the right The updated values are displayed starting at the right in the control.
1 From the left The updated values are displayed starting at the left in the control.
2 From the top The updated values are displayed starting at the top in the control.
3 From the bottom The updated values are displayed starting at the bottom in the control.

If you select the "From the top" or "From the bottom" setting for the write direction, you must
use True-Type fonts within the window. 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.

Graphiclist property

Graphic list (Graphiclist)


The graphics list is used for the picture selection when configuring the "status display" smart
object. A graphic lists facilitates the configuration of graphics and its flashing characteristics for
the various states.
Select a graphic list that you created in the WinCC Configuration Studio in the "Text and
graphics lists" editor.
The "Graphics list" attribute can be made dynamic with the name "Graphiclist".

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


System Manual, 09/2023, A5E52671436-AB 451
VBS for Creating Procedures and Actions
1.15 VBS Reference

GreenLightOn property

Description
Specifies whether the green signal lamp lights up.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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 283)
ScreenItem Object (Page 126)

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 write-read
access.

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


452 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 292)
ScreenItem Object (Page 126)

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.

See also
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 453
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

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 283)
ScreenItem Object (Page 126)

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)


454 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

GridVisible property

GridVisible
Specifies whether or not the grid is visible in the table of the WinCC UserAdminControl.
The attribute can be assigned dynamic properties using the name GridVisible. The data type
is BOOLEAN.

GroupEditMode property

Edit mode groups - GroupEditMode


Specifies which editing options the user has in WinCC UserAdminControl regarding group
properties of the User Administrator.

Value Name Explanation


0 Read The user can only read the group properties.
1 Change The user can change the group properties.
2 Full access The user can access the group properties without restrictions.

The attribute can be assigned dynamic properties using the name GroupEditMode. The data
type is LONG.

1.15.4.9 H

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 247)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 455
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 247)
ScreenItem Object (Page 126)

HeaderSort Property

Description
Specifies if sorting of messages by message block column header is possible.

See also
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

Height Property

Description
Defines or returns the height of the object in pixels.
LONG (write-read access)

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


456 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 718)
Object types of the ScreenItem object (Page 144)
ScreenItem Object (Page 126)

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 185)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 457
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.

HighlightToggle property

Description
Specifies whether the alternating highlighting is displayed, for example, by two consecutive
arrows.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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.

HitlistColumnAutoAdjust property

HitlistColumnAutoAdjust
Automatically optimizes the width of the columns in the hit list in Runtime. If the configured
column is not sufficient for the displayed text, the column width is increased.
If the user changes the width of columns in Runtime, the width is only optimized again when
the picture is opened again.
The attribute can be assigned dynamic properties using the name HitlistColumnAutoAdjust.
The data type is BOOLEAN.

See also
WinCC AlarmControl (Page 242)
HitlistColumn object (list) (Page 224)

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


458 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
The attribute can be assigned dynamic properties by means of the name
HitlistColumnRemove. The data type is STRING.

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


System Manual, 09/2023, A5E52671436-AB 459
VBS for Creating Procedures and Actions
1.15 VBS Reference

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


0 none No sorting
1 Ascending Ascending order, starting at the lowest value.
2 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.

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.

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


460 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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


0 Ascending The list is sorted in ascending order based on frequency.
1 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.

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.

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


System Manual, 09/2023, A5E52671436-AB 461
VBS for Creating Procedures and Actions
1.15 VBS Reference

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
0 Minute
1 Hour
2 Day
3 Week
4 Month

The attribute can be assigned dynamic properties by means of the name


HitListMaxRelTimeFactorType. The data type is LONG.

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


462 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 203)
ScreenItem Object (Page 126)

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 247)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 463
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 247)
ScreenItem Object (Page 126)

Hysteresis Property

Description
TRUE, when the display should appear with hysteresis. BOOLEAN write-read access.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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


464 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

1.15.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.

ImpulsePosition property

Description
Specifies the position of the wandering pulse.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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, option group


Defines or returns the number (0 to 63) of the field whose text is to be defined.

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


System Manual, 09/2023, A5E52671436-AB 465
VBS for Creating Procedures and Actions
1.15 VBS Reference

Combo box, list box


Defines or returns the number (0 to 63) 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 201)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Function Trend Control (before WinCC V7) (Page 285)
Polyline (Page 159)
Polygon (Page 157)
Radio box (Page 209)
Check box (Page 207)
ScreenItem Object (Page 126)

InnerBevelOffset Property

Description
Defines the distance between the inner and outer bevels.

See also
WinCC Slider Control (Page 274)
ScreenItem Object (Page 126)

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


466 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 274)
ScreenItem Object (Page 126)

InnerBevelWidth Property

Description
Defines the width of the inner bevel in pixels.

See also
WinCC Slider Control (Page 274)
ScreenItem Object (Page 126)

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 861)

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


System Manual, 09/2023, A5E52671436-AB 467
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 285)
ScreenItem Object (Page 126)

Instance property

Description
Returns an instance of the alarm object.

See also
Alarms object (list) (Page 111)

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 199)
ScreenItem Object (Page 126)

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


468 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 199)
ScreenItem Object (Page 126)

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 199)
ScreenItem Object (Page 126)

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 199)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 469
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 trend-
specific 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}".

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 292)
WinCC Online Table Control (before WinCC V7) (Page 289)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

1.15.4.11 L

Lab - Las

Label Property

Description
The "Index" property references a trend.
Depending on the value of the "TimeAxis" property, the name of the time axis or the value
axis is defined via label.

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


470 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Online Trend Control (before WinCC V7) (Page 292)
ScreenItem Object (Page 126)

LabelColor Property

Description
Defines the color of the scale label.

See also
WinCC Slider Control (Page 274)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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 285)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 471
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 199)
ScreenItem Object (Page 126)

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 119)

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.

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


472 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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

See also
TagSet Object (List) (Page 142)
QualityCode Property (Page 561)

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


System Manual, 09/2023, A5E52671436-AB 473
VBS for Creating Procedures and Actions
1.15 VBS Reference

ErrorDescription Property (Page 421)


Tag Object (Page 138)

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

See also
ScreenItem Object (Page 126)

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


474 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 475
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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


476 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 477
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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


478 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 479
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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


480 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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

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


System Manual, 09/2023, A5E52671436-AB 481
VBS for Creating Procedures and Actions
1.15 VBS Reference

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".

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

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


482 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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.
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.

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


System Manual, 09/2023, A5E52671436-AB 483
VBS for Creating Procedures and Actions
1.15 VBS Reference

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".
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".

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


484 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 "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".

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 170)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 485
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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.

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


486 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 126)
3D Bar (Page 170)

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


System Manual, 09/2023, A5E52671436-AB 487
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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 170)
ScreenItem Object (Page 126)

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.

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


488 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 132)

Layers Property

Description
Returns an object of type "Layers".
Layers (read-only)

See also
Layers Object (Listing) (Page 122)
HMIRuntime Object (Page 119)

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)

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


System Manual, 09/2023, A5E52671436-AB 489
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 662)
ScreenItem Object (Page 126)

LeftComma Property

Description
Defines or returns the number of digits to the left of the decimal point (0 to 20).

See also
Bar (Page 175)
ScreenItem Object (Page 126)

LightEffect Property

Description
TRUE, when the light effect should be activated. BOOLEAN write-read access.

See also
3D Bar (Page 170)
ScreenItem Object (Page 126)

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


490 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

LightOff property

Description
Specifies whether the signal lamp lights up.
The property can be dynamized for some SVG graphics of the SVG library.
Whether the attribute is displayed depends on the referenced SVG graphic.

See also
SVG object (Page 197)

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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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


System Manual, 09/2023, A5E52671436-AB 491
VBS for Creating Procedures and Actions
1.15 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 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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 185)
ScreenItem Object (Page 126)

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


492 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 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 185)
ScreenItem Object (Page 126)

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 write-
read access.

See also
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

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".

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


System Manual, 09/2023, A5E52671436-AB 493
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
WinCC Alarm Control (before WinCC V7) (Page 283)
ScreenItem Object (Page 126)

LineJoinStyle property

Description
Defines the way that corners are displayed in a tube polygon.

Angle The tubes are joined at corner points without rounding


Round 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 283)
ScreenItem Object (Page 126)

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 292)
ScreenItem Object (Page 126)

LineWidth property

Line weight of window dividers - LineWidth


Defines the line weight of the window dividers in pixels.

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


494 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

The attribute can be assigned dynamic properties by means of the name LineWidth. The
data type is LONG.

ListType property

List - ListType
Specifies which of the following lists is displayed in WinCC UserAdminControl.

Value Name Explanation


0 Users The user list is displayed.
1 Groups The group list is displayed.

The attribute can be assigned dynamic properties using the name ListType. 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 199)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 495
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 289)
WinCC Online Trend Control (before WinCC V7) (Page 292)
WinCC Function Trend Control (before WinCC V7) (Page 285)
ScreenItem Object (Page 126)

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 274)
WinCC Gauge Control (Page 255)
WinCC Digital/Analog Clock (Page 247)
ScreenItem Object (Page 126)

LocaleSpecificSettings Property

Description
TRUE if a font can be assigned and formatted for each Runtime language. BOOLEAN write-read
access.

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


496 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

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 194)
ScreenItem Object (Page 126)

LockStatus Property

Description
TRUE, when a locked measuring point should be displayed. BOOLEAN write-read access.

See also
Group Display (Page 194)
ScreenItem Object (Page 126)

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 194)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 497
VBS for Creating Procedures and Actions
1.15 VBS Reference

See also
Group Display (Page 194)
ScreenItem Object (Page 126)

Logging Property

Description
Returns an object of type "Logging".
Logging (read-only)

See also
HMIRuntime Object (Page 119)
Logging Object (Page 123)

LongStrokesBold Property

Description
TRUE, when the long sections of a scale should be displayed in bold face. BOOLEAN write-read
access.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

LongStrokesOnly Property

Description
TRUE, when only the long sections of a scale should be displayed . BOOLEAN write-read access.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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


498 System Manual, 09/2023, A5E52671436-AB
VBS for Creating Procedures and Actions
1.15 VBS Reference

LongStrokesSize Property

Description
Defines or returns the length of the axis section in pixels.

See also
Bar (Page 175)
ScreenItem Object (Page 126)

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 175)
ScreenItem Object (Page 126)

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.

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


System Manual, 09/2023, A5E52671436-AB 499
VBS for Creating Procedures and Actions
1.15 VBS Reference

Write/Read access.

LowerLimit Property

Description

WinCC Online Trend Control/WinCC Function Trend Control


TRUE, when the "