Looping through FEMs in an Assembly FEM-How to?

To all,

Looking at expanding a macro so that it works in a assembly FEM (.afm) as the macro deals with mesh collectors (which can exist in an .afm) and also needs to access/check something in all the elements making the .afm. In other word Check if an element ID exist in any o fthe FEMs making up the .afm. I am looking for the syntax but struggling with the type of variable to be returned/expected. I have the following;

Dim theSession As Session = Session.GetSession()
Dim theLW As ListingWindow = theSession.ListingWindow

theLW.Open()

Dim theBasePart As BasePart = theSession.Parts.BaseWork
Dim workAssyFemPart As CAE.AssyFemPart

Try
workAssyFemPart = CType(theBasePart, CAE.AssyFemPart)
Catch ex As Exception
Dim Msg as String = "Macro only works on a Assy FEM part"
'Style = vbOKOnly + vbCritical
Dim Title as String = strMacroName
MsgBox(Msg, vbOKOnly + vbCritical, Title)
theLW.WriteLine ("End of macro...")
theLW.WriteLine (vbNewLine + "-----------------------------------")
Exit Sub
End Try

If TypeOf theBasePart Is CAE.AssyFemPart Then
theLw.WriteLine("it's a Assy FEM part")
Dim theFEModelsCollection As CAE.FEModel = CType(workAssyFemPart.BaseFEModel(), CAE.FEModel)
For each FEModelInAFEM As CAE.FEModel In theFEModelsCollection
theLW.WriteLine(" name if: " & FEModelInAFEM.Name)
next FEModelinAssyFEM
Else
theLw.WriteLine("it's NOT a Assy FEM part")
End If

Looks like NX doe snot like the line : Dim theFEModelsCollection As CAE.FEModel

Any help/pointer is welcome

Thanks

Regards

JXB