modify reference elements one by one

Hi there,

Is it possible to move reference elements to their new location one by one? If not, what should i do?

I'm trying following code but i couldn't success.

(I'm using V8i 08.11.05.17)

Option ExplicitDim EE As ElementEnumerator
Dim SC As New ElementScanCriteria
Dim elem As Element
Dim i As Long
Dim a0 As Integer, a1 As Integer, a2 As Integer
Dim b0 As Integer, b1 As Integer, b2 As Integer

a0 = 30
a1 = 1
a2 = 0
b0 = 180
b1 = 0
b2 = 1
Dim oAttachment As AttachmentSC.ExcludeNonGraphical

Set EE = oAttachment.Scan(SC)
Do While EE.MoveNext
Set elem = EE.Current

Select Case elem.Type
  Case msdElementTypeCellHeader
  Dim offset As Point3d
  Dim onc As Point3d
  Dim td As Point3d

  onc = elem.AsCellElement.Origin

  td.Y = a0 + a1 * onc.Y + b1 * onc.X
  td.X = b0 + b2 * onc.Y + a2 * onc.X

  offset.X = td.X - onc.X
  offset.Y = td.Y - onc.Y
  offset.Z = onc.Z

  elem.Move offset
  elem.Redraw
  elem.Rewrite
Case msdElementTypeLine
  Dim startof As Point3d
  Dim transtart As Point3d
  Dim oline As LineElement

  f = elem.AsLineElement.VerticesCount
  Set oline = elem.AsLineElement

  For i = 1 To f
    startof = oline.Vertex(i)

    transtart.Y = a0 + a1 * startof.Y + b1 * startof.X
    transtart.X = b0 + b2 * startof.Y + a2 * startof.X
    transtart.Z = startof.Z

    oline.ModifyVertex i - 1, transtart
  Next

  oline.Redraw
  oline.Rewrite
Case Else
 MsgBox "Not defined object: " & elem.Type
End Select
Loop
oAttachment.Rewrite
oAttachment.Redraw