Kkula
Browse Questions » SIMATIC WinCC: Condition Display crash + Vba reference

About User

Questions Asked: 37.9K

Answers Given: 32

0
  • Open

SIMATIC WinCC: Condition Display crash + Vba reference

If I change the picture path for multiple states of a Status Display, Graphic Designer crashes:
I have many .PDL pictures with many Status Display objects, that have around 5 configured states each with Basic Picture and/or Flash Picture. 
I have to rename all the pictures' path, but i cannot, intead, i have to search the picture in the Selection of Picture area, then drag & drop the name on the picture's path.
If I do this for all the configured paths, usually 6 paths, and click OK, the Grapich Designer crashes.
So, I have to do this with a few pictures at a time.
But sometimes it crashes anyway.
I am on WinCC 7.5 SP2 upd17.
Anyway, I am looking for a way to edit the pictures' path with VBA.
I need to get all the Status Display objects, and I found in
this topic
how to do it. Then, I need to access all the Basic Picture and Flash Picture property for all the configured states.
Is it possible? How could I do it?

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

WinCC Graphic Designer Crash & VBA Path Editing for Status Displays

You're encountering a known issue in WinCC 7.5 SP2 upd17 where changing picture paths for multiple states within Status Display objects can cause Graphic Designer to crash. Your workaround of updating paths in small batches is a valid mitigation.

Regarding VBA, yes, it's possible to address this programmatically. Building on the information from the linked topic, here's how you can access and modify the picture paths:

  1. Access Status Display Objects: Utilize the VBA code from the referenced topic to iterate through all Status Display objects in your screen.
  2. Access States: Each Status Display object has a 'States' collection. Loop through each state within the object.
  3. Access Picture Properties: Within each state, access the 'BasicPicture' and 'FlashPicture' properties. These properties hold the picture paths.
  4. Modify Paths: Update the 'BasicPicture' and 'FlashPicture' properties with the new picture paths.

Example Snippet (Illustrative):

Dim objSD As Object
Dim objState As Object

' Assuming you have a loop iterating through Status Display objects
For Each objSD In Screen.Objects
    If TypeName(objSD) = "StatusDisplay" Then
        For Each objState In objSD.States
            objState.BasicPicture = "NewPicturePath"
            objState.FlashPicture = "AnotherNewPath"
        Next objState
    End If
Next objSD

Important Considerations:

  • Backup: Always back up your project before running any VBA code.
  • Error Handling: Implement robust error handling to catch potential issues during the process.
  • Testing: Thoroughly test your VBA script on a non-production environment before deploying it to your live system.

For detailed VBA documentation and examples, refer to the Siemens WinCC Information System (accessible through SiePortal). Searching for "WinCC VBA Status Display" will yield relevant results.

0