Delete structured tag

Delete structured tag

me again :rolleyes:
VBA Code:
VarTypeIndex = 0
For Index = zPRJ.VarTypes.Count - 1 To 0 Step -1
Name = zPRJ.VarTypes.Item(Index).Name
If Right(Name, 13) = ".InternalData" Or _
Right(Name, 9) = ".MathData" Or _
Right(Name, 9) = ".NodeData" Or _
Right(Name, 13) = ".WriteTrigger" Then
VarTypeID(VarTypeIndex) = CInt(zPRJ.VarTypes.Item(Index).ID)
VarTypeIndex = VarTypeIndex + 1
End If
Next Index

For Index = zPRJ.Variables.Count - 1 To 0 Step -1
Set zVAR = zPRJ.Variables.Item(Index)
Name = zVAR.Name
ID = zVAR.DynProperties("ID_DataTyp")
For Index2 = 0 To VarTypeIndex - 1
If ID = VarTypeID(Index2) Then
If Name <> "ICON2K" And _
Name <> "ICON2Ki" And _
Name <> "ICON2Km" And _
Name <> "ICON2K.WriteTrigger" And _
Name <> "NET" And _
Name <> "NETi" And _
Name <> "ROUTERA" And _
Name <> "ROUTERAi" And _
Name <> "ROUTERB" And _
Name <> "ROUTERBi" And _
Name <> "LOOPi" And _
Name <> "LOOPm" Then
If zPRJ.Variables.DeleteVar(Name) = False Then
AddLogInfo "Variable: " & Index & " " & Name & " error while deleting"
End If
AddLogInfo "Variable: " & Index & " " & Name & " deleted"
End If
Exit For
End If
Next Index2
Next Index

with this code, I want to delete all the structured tag (all of them has more then one item), build on 4 specified datatype.
Everything look run good, but on delete action code return me an error.
I tried a lot of solution:
descrease "Index" based on subitem number
deactivate all subitem before delete the tag
and many other
probably there is something that I don't know
could you help me?
hoping to be clear enought .....
thank you

This is a migrated post! Originally posted on 22.07.2008 by user fabios. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com