PLC Tutorials

How to Export Data from WinCC Runtime Advanced into Excel using VB Script

Data reporting is a very crucial process in Industrial Automation. These data can be of any type such as Batch Data, Alarms log, Process Data, Utility Data, etc.

This article will focus on the usage of VB Script to log data into an excel file.

What is VB Script?

  • VB Script is programming language developed by Microsoft.
  • It is very commonly found scripting language in various SCADA System such as Siemens, Schneider, Indusoft, AVEVA etc.

Why do we need to use any scripting language in SCADA?

  • Many a Times when you want to develop sophisticated and perfect SCADA with many features then to enable that features you have to use scripting language.
  • For Scalability of project.
  • Unlimited possibilities.

Export Data from WinCC Runtime Advanced into Excel

First, make these tags in the tag table.

Here we have added three tags as an example Flow, Pressure, Temperature.

Tag named excel row is for use of VB Script counting.

WinCC RT Advanced

Add a new VB Script and copy the code from this article.

This is the complete code.

Download VB Script: Download Now

Path of the Excel file.

Excel file Starting cell number of every tag. Change this if you change the Excel file format.

Change these tags if you want to add new tags and do not change any other part of the code if you don’t have any clear idea.

Configure the SCADA Screen with the following items as shown in the image.

For sample reporting, I have configured this button to trigger the excel data. Whenever I press the button new data is inserted into the excel report.

Configure the Alarm window with the following setting, it will be helpful to find any error in the script and troubleshoot it, if the code does not work as expected.

This Excel file formatting. You can change any format you like. But keep in mind the cell number.

Now close the Excel file and Start WinCC Runtime in Simulation mode.

Enter any values in the IO- Field and after that press the “Insert New Data” Button.

Now you can check the new data is inserted into the excel file.

Keep in mind to close the excel window whenever new data is added, otherwise, the script won’t work and result in an error.

EndNote

VBScript has unlimited possibilities to make your SCADA work like charm. So, use this script for your practice and log any data in excel.

If you liked this article, then please subscribe to our YouTube Channel for Electrical, Electronics, Instrumentation, PLC, and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

You've successfully subscribed !

View Comments

  • Good morning everyone. Will anyone know where the database error problem lies, when executing scripts to access SQL server, from a Wincc RT Professional client in the TIA portal.

    The Client/Server interaction is carried out perfectly, all screens, menus, etc. are displayed. The problem occurs when an event is executed that needs to read from the SQL database through a script.

    I clarify this, this also happens for the configuration with the web navigator. The scripts works ok on server. Greetings

Share

Recent Articles

  • PLC Tutorials

Conveyor Sorting Machine PLC Program with Calculation Function

The conveyor sorting machine is widely used in the packing industries using the PLC program…

4 days ago
  • PLC Tutorials

Example of Flip-Flop PLC Program for Lamps Application

Learn the example of flip-flop PLC program for lamps application using the ladder logic to…

5 days ago
  • PLC Tutorials

STAR DELTA Programming using PLC Controller

In this article, you will learn the STAR DELTA programming using PLC controller to start…

5 days ago
  • Instrumentation Design

Single and Three Phase Immersion Electrical Heaters Wiring Circuits

Lube oil consoles of rotary equipment packages in industrial process plants are usually equipped with…

2 days ago
  • Instrumentation Design

Immersion Heaters in Lube Oil Consoles

Rotating equipment packages such as pumps, compressors, turbines need the lube oil consoles for their…

4 days ago
  • PLC Tutorials

How to Blink Lights in Ladder Logic?

This article explains how to blink lights in ladder logic with a detailed explanation video…

4 weeks ago