I am trying to write what I thought was a simple program to add elements to a named group if they meet the criteria I designated. However when I go to add an element that is in an attachment to a named group I get an error (Error Number -2147219301, Error Description: Far reference). This is something that works without issue when done manually using the dialog box and also works using similar code within the activemodelreference. I hope someone has an idea of why this does not work or knows how to get around this error. Thanks in advance.
Dim oAttachment As Attachment
Dim oAttachments As Attachments
Dim oATTACHMENT_EE As ElementEnumerator
Set oAttachments = ActiveModelReference.Attachments
For Each oAttachment In oAttachments
Set oATTACHMENT_EE = oAttachment.GraphicalElementCache.Scan
Do While oATTACHMENT_EE.MoveNext
Selection_NG.AddMember oATTACHMENT_EE.Current
Loop
Next