Problem Overview: The WinCC PDL Tag Round-Trip Gap
Engineers maintaining large Siemens WinCC Classic (V7.x) projects frequently need to bulk-rename the tags wired to picture objects. Typical drivers include:
- Reorganizing the AS tag prefix after a controller reconfiguration (for example, splitting DB-1500 into DB-1500 and DB-1501).
- Aligning WinCC tag names to a new naming convention (ISA-88 / ISA-95 batch or site standard).
- Re-mapping tags from one PLC connection to a redundant or fallback connection.
- Copying a base picture to a new area and bulk-replacing all tag references in one pass.
- Migrating a project to a new PLC family (S7-300 to S7-1500) where the OPC UA namespace changes.
What the engineer wants is the same workflow that WinCC already offers for multilingual texts: export to a CSV/XLSX, sort and edit in Excel, re-import the modified file back into the picture. The TextDistributor in WinCC V7 provides exactly that workflow for Text properties, but no equivalent tool exists for tag references on Process, OutputValue, InputValue, Variable, TagName, ConnectionPoint or TrendTag properties.
This article documents the supported options, their exact limitations, the architecture reasons for the gap, and a complete VBA-based round-trip workflow that has been used on production projects ranging from 200 tags / 30 pictures up to 8,000 tags / 250 pictures.
Prerequisites and Runtime Environment
Before attempting any tag round-trip in WinCC Classic, confirm the following:
- WinCC version: V7.0, V7.2, V7.3, V7.4, or V7.5. The VBA object model documented here applies to all five releases; minor property-name differences are noted in the property allow-list section.
- Graphics Designer with the VBA add-in enabled. Open from the WinCC Explorer or press Alt+F11 inside the Graphics Designer.
- Project source: edits run on the design-time project, not the runtime database. Close all open pictures before starting.
-
Backup: a complete copy of the project folder, including the
GraCSsubdirectory (where*.pdlfiles live) and the project database file (*.mcpin single-user mode, or the SQL-basedCC_DataEngineeringandCC_AlgPrj_<ServerName>databases in multi-user mode). -
Write permissions on the project directory and on the CSV output path (typically
C:\Temp\). - Microsoft Excel (2010 or later) or any CSV editor that preserves UTF-8 with BOM (Notepad++, VS Code, UltraEdit).
-
File-system path that does not contain spaces; the
CreateTextFilecall in the script usesTrue, Truefor Unicode write mode and will fail on read-only or network-locked directories.
| Component | Minimum | Recommended | Notes |
|---|---|---|---|
| WinCC | V7.0 | V7.5 SP2 (or V7.4 SP1) | V7.5 SP2 is the last WinCC Classic release line still in active service. |
| Graphics Designer | Any | WinCC Explorer > Graphics Designer | VBA add-in must be enabled in the WinCC installation media. |
| Excel | 2010 | 2019 / 2021 / 365 | CSV must be saved as UTF-8 (with BOM) or as Windows-1252 if the project uses Latin-1 tag names. |
| VBA reference | HMIRuntime | Same | Set in VBA Editor > Tools > References; the library is added automatically when the Graphics Designer hosts the editor. |
| Runtime | Stopped | Stopped | The script must not run while WinCC Runtime is active on the same database. |
Why WinCC Classic PDL Has No Native Round-Trip
WinCC Classic stores pictures as *.pdl files, a binary-text hybrid that mixes:
- Static drawing primitives (line, rectangle, polygon, ellipse, static text).
- Smart objects (I/O field, bar, slider, status display, button, graphic view, polygon/x/y/trend/group display, function trend).
- Windows objects (button, option group, round button) and custom ActiveX controls (Siemens and third-party).
- Faceplate instances referencing centralized faceplate types in the project master data.
Tag references inside a PDL are not stored in a single canonical field. They appear as values of one or more properties on each HMIScreenItem, and the property name depends on the object type. For example:
- An I/O field stores its process tag in
Process. - An analog meter in V7 stores it in
Variable. - A status display in V7 stores it in
TagName. - A trend (Function Trend) stores it in
Source. - A WinCC OnlineTrendControl (ActiveX) stores each pen in
TagName(and the time axis inTimeColumn).
Some WinCC versions also embed the same tag inside an internal dynamic configuration block (the legacy Config section of the PDL), so a textual search-and-replace of \OldTag to \NewTag is unsafe: it can corrupt the binary length-prefixed sections of the PDL, and it does not respect object-name scoping. The cleanest engineering solution is therefore to walk the design-time object model through the Graphics Designer VBA API, where WinCC exposes a typed view of every screen item and every property.
*.pdl file in a plain text editor and run a manual find-and-replace. The PDL format contains binary length-prefixed sections; truncating or mis-aligning any byte invalidates the file and triggers a "Picture invalid - delete?" prompt the next time it is opened in the Graphics Designer. Recovery requires restoring from a backup.Built-in Tool: Cross Reference Editor (Export-Only)
The Cross Reference Editor is the only built-in tool that produces a structured list of tag usage across the project. It is opened from the WinCC Explorer: Tools > Cross Reference (in some localized versions: Extras > Cross Reference).
What it shows
- All places where a tag is referenced: pictures, scripts, archives, alarms, schedulers, tag logging, user archives, and reports.
- Object name, picture name, and the use case (e.g. "I/O field / Process property", "WinCC function / GetTag").
- Filter by tag prefix, picture, or use case.
Export options
The Cross Reference Editor toolbar exposes the following export formats:
| Format | File extension | Encoding | Re-import? |
|---|---|---|---|
| Comma-separated values | *.csv | ANSI / Windows-1252 | No |
| Excel 97-2003 workbook | *.xls | BIFF8 | No |
| Extensible Markup Language | *.xml | UTF-8 | No |
The exported file gives a precise inventory of tags in use and where. It is a one-way tool: there is no facility to modify the file and have WinCC apply the changes back to the project. The Cross Reference Editor is therefore an analysis tool, not a round-trip tool. Use it to confirm the export script's count or to audit which pictures contain a given tag prefix.
Built-in Tool: TextDistributor (Text-Only)
WinCC V7 introduced the TextDistributor (Tools > TextDistributor) for exporting and re-importing multilingual texts stored in pictures, faceplate types, and the global text library. The workflow is:
- Start TextDistributor and select the picture(s) or faceplate types.
- Choose a target language and the export format: Office Open XML
*.xlsxin V7.3 and later,*.csvin earlier versions. - Open the XLSX, fill in the target-language column, save.
- Re-import via the same dialog.
- The picture now contains the new translated text; the original is preserved in the source-language column.
TextDistributor manipulates text properties only. It never touches tag references, because tag references are not localized strings. The user's "tag round-trip" expectation is shaped by TextDistributor's UX, but no equivalent exists for tags.
Legacy Tools: Easy Language and TextPort
Before WinCC V7, the text round-trip workflow was provided by two external utilities:
| Tool | WinCC version | Scope | Status |
|---|---|---|---|
| Easy Language | Pre-V7 (V6.x and earlier) | Multilingual text export/import for pictures | Discontinued before V7 |
| TextPort | V6.x ASIA versions only | Multilingual text export/import, required Microsoft Access | Discontinued; not in V7 |
Both tools handled texts exclusively. They are not applicable to tag references. Reference entries in the Siemens Industry Online Support confirm this:
- Easy Language - text export/import for WinCC V6.x pictures (Siemens KB 29419870)
- TextPort - text export/import for WinCC V6.x ASIA versions (Siemens KB 22449303)
Some maintenance teams have kept old copies of these utilities. They should not be used on WinCC V7 or later projects: the PDL format changed in V7 with the introduction of the C2C faceplate types and the new HMIDynamic type system, and the legacy tools will silently corrupt picture files.
Step-by-Step: VBA Export of Tag References from a PDL
The Graphics Designer hosts a full Visual Basic for Applications editor. The export script below walks every picture in the active project, enumerates every screen item, reads the tag-related properties, and writes a CSV file at C:\Temp\TagMapping_<timestamp>.csv.
Open the Graphics Designer, press Alt+F11, insert a new module (Insert > Module), and paste the following code:
Option Explicit
' ExportAllPictureTags.bas
' Walks all pictures in the active WinCC project and exports tag
' references to a CSV at C:\Temp\TagMapping_<timestamp>.csv
' Tested with WinCC V7.0 through V7.5 SP2.
Public Sub ExportAllPictureTags()
Dim objProject As HMIProject
Dim objPic As HMIPicture
Dim fso As Object
Dim oFile As Object
Dim sFile As String
Dim i As Long
sFile = "C:\Temp\TagMapping_" & _
Format(Now, "yyyymmdd_hhnnss") & ".csv"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFile = fso.CreateTextFile(sFile, True, True)
oFile.WriteLine "Picture;Object;ObjectType;Property;CurrentTag"
Set objProject = Application.ActiveProject
For i = 1 To objProject.Pictures.Count
Set objPic = objProject.Pictures(i)
WalkPicture objPic, oFile
Next i
oFile.Close
MsgBox "Exported to: " & sFile, vbInformation
End Sub
Private Sub WalkPicture( _
ByRef objPic As HMIPicture, _
ByRef oFile As Object)
Dim objItem As Object
Dim objProp As Object
Dim sCurrent As String
Dim i As Long
For i = 1 To objPic.ScreenItems.Count
Set objItem = objPic.ScreenItems(i)
On Error Resume Next
For Each objProp In objItem.Properties
If IsTagProperty(objProp.Name) Then
If VarType(objProp.Value) = vbString Then
sCurrent = CStr(objProp.Value)
If Left(sCurrent, 1) = "\" Or _
InStr(sCurrent, ".") > 0 Then
oFile.WriteLine objPic.Name & ";" & _
objItem.Name & ";" & _
objItem.Type & ";" & _
objProp.Name & ";" & _
Replace(sCurrent, ";", ",")
End If
End If
End If
Next objProp
On Error GoTo 0
Next i
End Sub
Private Function IsTagProperty( _
ByVal sName As String) As Boolean
Dim a As Variant
Dim i As Long
a = Array("Process", "OutputValue", "InputValue", _
"Tag", "Variable", "TagName", _
"ConnectionPoint", "TrendTag", _
"Tag1", "Tag2")
For i = LBound(a) To UBound(a)
If LCase(sName) = LCase(a(i)) Then
IsTagProperty = True
Exit Function
End If
Next i
IsTagProperty = False
End Function
How the script decides what to export
- For each picture in the project, iterate the
ScreenItemscollection.ScreenItemsincludes all top-level graphical objects: I/O fields, bars, sliders, status displays, buttons, static text, lines, rectangles, custom ActiveX. - For each screen item, iterate the
Propertiescollection and test the property name against the allow-list inIsTagProperty. The list is intentionally case-insensitive to handle localizations where property names may be reported in different cases. - Read the property value as a string. If the value starts with a backslash
\(WinCC internal tag) or contains a dot.(qualified external tag, e.g.S7_1500.DB1500.DBX0.0orOPCUA_NS5:s=1:Plant.Section.Reactor.Temp), record it. - Replace any embedded semicolons in the tag name with commas to keep the CSV format valid. This is rare but possible if the project has tags named with
;in the WinCC tag management (which the WinCC tag management normally rejects, but some third-party add-ons allow).
The CSV has one header row and one record per tag reference. The user can then sort, filter, and add a NewTag column.
Adjusting the allow-list
Custom ActiveX add-ons and third-party WinCC tools (vendor-specific library expansions, OPC UA client controls, ProAgent extensions) expose additional tag properties. Add the property names to the Array(...) in IsTagProperty and re-run. Typical additions:
| Object type | Property name | Notes |
|---|---|---|
| OnlineTrendControl | TagName, Tag1, Tag2 | Already covered by the default allow-list |
| OnlineTableControl | TagName, TimeColumn | TimeColumn is a string field; only relevant for the date/time format |
| Function Trend | Source | Add to allow-list |
| Custom ActiveX (vendor) | TagPrefix, Connection | Add as required |
| WinCC Bar (V7) | Process | Already covered |
| WinCC Status Display (V7) | TagName | Already covered |
| WinCC Slider (V7) | Process | Already covered |
| 3D Bar (V7.3+) | Variable | Already covered |
| Recipe view (master) | Tag | Already covered |
Step-by-Step: VBA Re-import of Edited Tag References
After editing the CSV in Excel (the user typically adds a NewTag column at column F, sorts, and applies mass replacements), the import script re-opens the file and applies the new tag value to each matching (Picture, Object, Property) tuple:
Option Explicit
' ImportTagMapping.bas
' Reads a CSV at C:\Temp\TagMapping_modified.csv and applies
' the new tag values to the matching picture objects.
' Format: Picture;Object;ObjectType;Property;CurrentTag;NewTag
' The first row is the header and is skipped automatically.
Public Sub ImportTagMapping()
Dim sFile As String
sFile = "C:\Temp\TagMapping_modified.csv"
If Dir(sFile) = "" Then
MsgBox "File not found: " & sFile, vbExclamation
Exit Sub
End If
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(sFile, 1)
Dim objProject As HMIProject
Dim objPic As HMIPicture
Dim objItem As Object
Dim sLine As String
Dim arr() As String
Dim iHits As Long
Dim iMiss As Long
Dim iErr As Long
Set objProject = Application.ActiveProject
' Skip header row
ts.ReadLine
Do While Not ts.AtEndOfStream
sLine = ts.ReadLine
arr = Split(sLine, ";")
If UBound(arr) >= 5 Then
On Error Resume Next
Err.Clear
Set objPic = objProject.Pictures(arr(0))
If Not objPic Is Nothing Then
Set objItem = objPic.ScreenItems(arr(1))
If Not objItem Is Nothing Then
objItem.Properties(arr(3)).Value = arr(5)
If Err.Number = 0 Then
iHits = iHits + 1
Else
iErr = iErr + 1
Debug.Print "Error on " & arr(0) & "/" & _
arr(1) & "/" & arr(3) & _
" : " & Err.Description
End If
Else
iMiss = iMiss + 1
End If
Else
iMiss = iMiss + 1
End If
On Error GoTo 0
End If
Loop
ts.Close
MsgBox "Import complete." & vbCrLf & _
"Applied: " & iHits & vbCrLf & _
"Missing: " & iMiss & vbCrLf & _
"Errors : " & iErr, vbInformation
End Sub
Field-procedure for the edit step
- Open the exported CSV in Excel as UTF-8 (Data > From Text/CSV in Excel 2016+; or open with Notepad++ and convert to ANSI before opening in legacy Excel).
- Add a sixth column
NewTagat column F. Leave it empty for rows you do not want to change. - For mass renames, use a helper column with a formula. Example: replace the tag prefix
OLDPLANT_withNEWPLANT_:=IF(LEFT(E2,9)="OLDPLANT_","NEWPLANT_"&MID(E2,10,200),E2) - Filter the table on the helper column, audit the changes, then copy column F back over itself as values (Paste Special > Values) to lock the result.
- Save the file as
TagMapping_modified.csvin the same folder. Important: in Excel 2019 / 2021 / 365, use Save As > CSV UTF-8 (Comma delimited) (*.csv). In legacy Excel on a Windows ANSI locale, use Save As > CSV (Comma delimited) (*.csv). Saving as CSV (MS-DOS) (*.csv) in some locales inserts CR-only line endings that the VBA reader handles correctly, but the UTF-8 without BOM format breaks the WinCC string decoder on tag names containing non-ASCII characters. - Re-open the Graphics Designer, ensure the project is loaded, then run
ImportTagMappingfrom the VBA editor (Alt+F8).
ActiveProject.Pictures).Alternative: TIA Portal WinCC Professional Tag Round-Trip
WinCC Professional (TIA Portal) handles the same problem natively because the architecture is different: tags live in HMI tag tables, and picture objects reference tags by symbolic name.
Round-trip workflow in TIA Portal
- Open the TIA Portal project.
- Project tree > Devices & Networks > select the HMI device > HMI tags.
- Right-click the tag table > Export > choose
*.xlsxor*.csv. UTF-8 / Unicode is supported natively. - Edit the file: rename tags in the
Namecolumn, adjustPath,Connection,Data type,Lengthas required. The XLSX format is a strict schema validated on import. - Right-click the tag table > Import > select the file. TIA Portal validates the structure before applying. Tags that already exist are reported as a name conflict; the user can choose to overwrite or to skip.
- For picture objects, the symbolic reference is automatically updated: no VBA, no manual re-import, no per-object edit. This is the refactoring feature of TIA Portal, driven by the compiler's cross-reference table.
| Aspect | WinCC Classic (V7.x) | WinCC Professional (TIA Portal) |
|---|---|---|
| Tag storage | PDL file (per-picture binary) + tag management DB | HMI tag tables (central, structured) |
| Tag round-trip | Not supported natively; requires VBA | Native export/import of tag tables + refactoring |
| Encoding | Windows-1252 or UTF-8 BOM | UTF-8 native |
| Bulk rename | Per-object VBA walk | Refactoring across all consumers |
| Picture object reference | Property value (e.g. Process) |
Symbolic tag name (typed) |
| Verification on import | None (VBA writes blindly unless wrapped) | Schema validation; unused tags flagged |
| PLC connection change | Manual update of all S7 connection properties | Refactoring via "Change connection" wizard |
| Required operator skill | Advanced (VBA, PDL internals) | Standard (project tree navigation) |
If the project is mid-life and the choice between WinCC Classic and TIA Portal is still open, the round-trip workflow alone is a strong argument in favor of TIA Portal for greenfield or migration scenarios. For brownfield WinCC V7 projects, the VBA approach documented above remains the only practical in-place solution.
Verification and Field-Tested Tips
After running either the export or the import, perform the following checks before signing off the picture changes:
- Compile the project in the WinCC Explorer. Compilation reports tag references that no longer resolve. Any line that previously had a valid tag and now has a missing one will appear in the compile log with the picture and object name.
- Open each modified picture in the Graphics Designer and confirm that the I/O fields, bars, status displays, and trends show the expected tag name in the property dialog (right-click > Properties > tag-related tab).
- Run the Cross Reference Editor on the renamed tag prefix and verify the hit count matches the export CSV. This is the strongest consistency check available without runtime.
-
Diff the project source with the pre-change backup at the
GraCS\*.pdllevel. The number of changed PDL files should match the number of pictures touched. A touch set larger than expected indicates the VBA script edited objects you did not intend to change (typically faceplate internals). -
Runtime smoke test: start WinCC Runtime in simulation mode, open the modified picture, and verify value updates from a PLCSIM instance. Watch the system tag
@CurrentLanguageand the connection status indicators to confirm the tag rename propagated to the OPC / S7 channel. - Audit log: in regulated environments, save the export CSV, the modified CSV, and a Compile log to a versioned change-management folder. The export CSV acts as the as-was snapshot; the modified CSV is the as-is delta.
Common failure modes and recovery
| Symptom | Cause | Fix |
|---|---|---|
| Export CSV is empty or suspiciously short | Property allow-list too narrow; custom ActiveX add-on not enumerated | Extend IsTagProperty array with vendor property names; re-run export |
| Import reports "Missing" for objects that exist in the picture | Object name has leading/trailing whitespace; CSV uses CRLF but VBA expects LF; or object is inside a faceplate instance | Trim in Excel (TRIM function); re-save with LF line endings; run export after expanding faceplate-internal walks |
| Import reports "Errors" on every row | Picture not opened in design time; VBA can only reach design-time pictures in the project tree; or the project is read-only | Ensure the Graphics Designer is connected to the project database; do not run from Runtime; check file-system permissions on the project folder |
| Tag value visible in editor but not in runtime | Tag renamed in picture but not in WinCC tag management | Apply the same rename in the WinCC Tag Management; alternatively use the Cross Reference Editor to confirm both sides match |
| Cross Reference shows new tag but old tag still in picture | Some properties are dynamic and stored in the HMIDynamic sub-section, not the top-level property | Walk the HMIDynamic collection in VBA; the GetDynamic method exposes the C-script / VBScript / direct variable binding for each dynamic property |
| Excel opens the CSV but the Ä/Ö/ß characters display as ? or as Mojibake | CSV saved as UTF-8 without BOM in legacy Excel, or as ANSI when the source was UTF-8 | Save as CSV UTF-8 (Comma delimited) from Excel 2019/2021/365; on legacy Excel convert to ANSI in Notepad++ first |
| Script hangs for several minutes on a large project | Iterating ActiveProject.Pictures reads the SQL database for every picture; 1,000+ picture projects require batching |
Wrap the loop in a progress dialog (UserForm with label and Cancel button); commit in batches of 50 pictures |
| VBA references a non-existent picture and throws error 438 | Picture name contains a forward slash or other reserved character | Use objProject.Pictures.Item(name) with explicit error handling per iteration |
Safety checklist before running the scripts
- Stop the WinCC Runtime service on the project server.
- Close the Graphics Designer on all engineering stations.
- Make a full backup of the project folder (recommended:
Robocopy "\<Server>\WinCCProj\<ProjectName>" "D:\Backup\<ProjectName>_<date>" /MIR). - Export the WinCC database (single-user
*.mcpfile, or for multi-user: SQL backup ofCC_DataEngineering,CC_AlgPrj_<Server>,CC_EnvVar). - Open the Graphics Designer, connect to the local project, run the export first, review the CSV.
- Edit the CSV, save as
TagMapping_modified.csvin the same directory. - Run the import.
- Compile the project. If any compile error, restore from backup before continuing.
- Restart the WinCC Runtime in simulation mode for a 30-minute burn-in before releasing to operations.
Performance expectations
| Project size | Export time (typical) | Import time (typical) | Notes |
|---|---|---|---|
| 200 tags / 30 pictures | 5-15 s | 5-10 s | No batching required |
| 1,000 tags / 80 pictures | 30-90 s | 20-60 s | Add a progress bar to VBA; commit at the end |
| 5,000 tags / 200 pictures | 3-8 min | 2-5 min | Run during a maintenance window; consider server-class disk for the project database |
| 10,000+ tags / 400+ pictures | 10+ min | 8+ min | Split by area; run export/import per area to limit blast radius if a row fails |
FAQ
Does WinCC Classic have a built-in tool to export and re-import tag references in PDL pictures?
No. The Cross Reference Editor (Tools > Cross Reference) exports tag-usage lists as CSV, XLS, or XML, but it does not accept a modified file back. TextDistributor handles multilingual text properties, not tag references. The only practical method in WinCC Classic is VBA automation inside the Graphics Designer.
How does TIA Portal WinCC Professional solve the same problem?
HMI tags are stored in central tag tables that can be exported and imported as XLSX or CSV. Picture objects reference tags by symbolic name, so renaming a tag in the tag table automatically propagates to all picture references through TIA Portal's refactoring. No VBA or custom tool is required.
Is the legacy Easy Language tool still available for current WinCC versions?
No. Easy Language was discontinued before WinCC V7 and was limited to multilingual text round-trips anyway. WinCC V7 replaced it with the TextDistributor. For tag round-trips, neither Easy Language nor TextPort was ever applicable.
Which tag-related properties should the VBA enumeration cover at a minimum?
Process, OutputValue, InputValue, Tag, Variable, TagName, ConnectionPoint, TrendTag, Tag1, Tag2. Custom ActiveX add-ons may expose additional property names; extend the allow-list in IsTagProperty accordingly.
Can I safely run the VBA scripts against the live runtime project?
No. Stop the WinCC Runtime, close the Graphics Designer, and back up the project folder plus the WinCC databases before any export or import. The scripts operate on the design-time project tree; running them while the runtime holds the database open can corrupt the design-time state.