Update node text

Hi! I'm updating some text from excel to Microstation. Until now I'd been able to update Text and Tags, but I have problems with Text nodes, here is my code:

If myWS.Cells(FileRow, 2) = "NODE" Then
Set myNode = myDGN.GetElementByID(myID)     'Store ID High and Low
myNode.TextLine(1) = myWS.Cells(FileRow, 4)    'Store new Textnode Value
myNode.Rewrite                                                            'Write TextNode
End If

The error is "Run time error -69652(ffeefec) at the line three. I have been looking for information regarding the text nodes, but I can't find something similar, even in the help files.

Thanks!

Parents
  • Hi Romaca,

    I use the below snippet to test TextNodeElement.TextLine(1), all work fine.

    Sub Macro1()
    Dim myNode As TextNodeElement
    Set myNode = ActiveModelReference.GetElementByID(DLongFromLong(2341))
    myNode.TextLine(1) = "New Textnode Value"
    myNode.Rewrite
    End Sub

    So I guess maybe your myWS.Cells(FileRow, 4) 's type is not a string. Trying

    myNode.TextLine(1) = CStr(myWS.Cells(FileRow, 4))

    HTH,

    Yongan



Reply
  • Hi Romaca,

    I use the below snippet to test TextNodeElement.TextLine(1), all work fine.

    Sub Macro1()
    Dim myNode As TextNodeElement
    Set myNode = ActiveModelReference.GetElementByID(DLongFromLong(2341))
    myNode.TextLine(1) = "New Textnode Value"
    myNode.Rewrite
    End Sub

    So I guess maybe your myWS.Cells(FileRow, 4) 's type is not a string. Trying

    myNode.TextLine(1) = CStr(myWS.Cells(FileRow, 4))

    HTH,

    Yongan



Children