Add textelement by excel vba

I would like to add text element in V8xm by Excel VBA. The following code usually alerted error  '438'. Do you have any sample for adding element to microstation when used by excel vba ? Thank You!

Sub imporoMS()
Dim myUstation As MicroStationDGN.Application
Dim myDGN As DesignFile

Dim PnoCoord As Point3d
Dim placetext As TextElement

Set myUstation = New MicroStationDGN.Application

myUstation.Visible = false

Set myDGN = myUstation.OpenDesignFile("c:\temp\test1.dgn", False)

PnoCoord.x = 80000#
PnoCoord.Y = 80000#
PnoCoord.Z = 0#

Set placetext = myUstation.CreateTextElement1(Nothing, "ImportfromExcel", PnoCoord, Matrix3dIdentity)
myUstation.ActiveModelReference.AddElement (placetext)

myUstation.Quit
End Sub

 

kwhung

Microstation Version 08.09.04.51

    • Where (in which line of code) does the error occur? Step through your code in DEBUG (function key F8) to find the problem
    • What does error code 438 mean? You can search VBA help or perhaps this Microsoft page will help
    • Is this a compile-time or run-time error?
      • If you use VBA menu Debug|Compile VBA Project it's a compile-time error
      • If the error occurs when you run or step through your code it's a run-time error
    • Is this a syntax error?
    myUstation.ActiveModelReference.AddElement (placetext)

    The above line has the wrong syntax. Look at this web page for information about VBA procedure calling conventions.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions