0

I have a issue in deletion of publication in catia.

below is the code which i use.

Sub removepub(remove_p)

Dim PubName As String

For i = 1 To remove_p.Product.Publications.Count
    PubName = remove_p.Product.Publications.Item(i).Name
    remove_p.Product.Publications.Remove (PubName)
Next

End Sub

there are 3 published elements, the above code removes the 2 publications successfully but gives an error when its time to remove the 3rd.

can anyone please help me with this

below is the image of error generated

enter image description here

a point to be noted though

enter image description here

one of the publication has that yellow Dot.

Thanks.

tls
  • 11
  • 2
  • You are modifying the collection, so the counter changes during the iteration and teh third element doesn't exist any more. Try to iterate from the last to the first element (_for i = remove_p.Product.Publications.Count To 1 Step -1_) – Shrotter Feb 08 '23 at 14:44

0 Answers0