cancel
Showing results for 
Search instead for 
Did you mean: 

VB Script to Remove an Object Error

Occasional Contributor

VB Script to Remove an Object Error

Hi,

 

I am trying to write a simple script to disconnect one object from another object but I receive the following error;

 

Script Editor Default : Object Deletion Error line 16, offset 10 :
Error(0x800aa200) : Object  ~odAkCZBsq400{MetaClass}[External reference] : Error, updating not possible

 

My code is below - am I doing something wrong or is this a permissions error?  Any help would be greatly appreciated.

 

 

Set oRoot = object.GetRoot


  Set oExtRefs = oRoot.GetSelection("Select [External Reference] Where [Operation]'")

  For Each oExtRef in oExtRefs

  oExtRefName = oExtRef.GetProp("Short Name")

      Set oOperations = oRoot.GetSelection("Select [Operation] Where [External Reference].[Short Name] Like '" & oExtRefName & "'").Item(1)


              For each oOperation in oOperations

                  oExtRef.Remove oOperation

             Next

 

    Next

 

1 REPLY
MEGA Partner

Re: VB Script to Remove an Object Error

Set oRoot = object.GetRoot


  Set oExtRefs = oRoot.GetSelection("Select [External Reference] Where [Operation]'")

for each oExtRef in oExtRefs
  oExtRefName = oExtRef.GetProp("Name")
print oExtRef.GetProp("Name")

      Set oOperations = oExtRef.GetCollection("operation")

              For each oOperation in oOperations
         print oOperation.GetProp("Name")
                  oOperation.Remove oExtRef

             Next

next