1156x
004638
2020-08-19

Question

I have the following problem when programming in VBA with RFEM lines: "No assignment to data field possible". What can I do?


Answer:

In this case, there is an error in EXCEL VBA that cannot be fixed from our side. For this reason, a new object, RFEM.RfLine (instead of RFEM.Line) has been created, which you can use to continue your work. Here is a brief example:

Sub test_RfLine()
    
    Dim iModel As RFEM5.IModel2
    Set iModel = GetObject(, "RFEM5.Model")
    iModel.GetApplication.LockLicense
    

On Error GoTo e
    
    Dim iModelData As RFEM5.IModelData2
    Set iModelData = iModel.GetModelData
    
    Dim lines() As RFEM5.RfLine
    lines = iModelData.GetLines
    
    
e:  If Err.Number <> 0 Then MsgBox Err.Description, , Err.Source
    
    Set iModelData = Nothing
    iModel.GetApplication.UnlockLicense
    Set iModel = Nothing
    
End Sub