Calling method SetObjectId of interface IAcadBaseObject failed

Calling method SetObjectId of interface IAcadBaseObject failed

OceanaPolynom
Advocate Advocate
2,713 Views
3 Replies
Message 1 of 4

Calling method SetObjectId of interface IAcadBaseObject failed

OceanaPolynom
Advocate
Advocate

Hello

I want to pick a point on a drawing, and draw some text at that point.  The text is in a textbox on the form.  I get the error message

"Calling method SetObjectId of interface IAcadBaseObject failed"

 

 

 

 

 

 

Private Sub CommandButton1_Click()

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
    Dim returnPnt As Variant
    UserForm6.Hide
    textString = Trim(TextBox1)
    ' Return a point using a prompt
    returnPnt = ThisDrawing.Utility.GetPoint(, "Pick a point: ")
insertionPoint(0) = returnPnt(0): insertionPoint(1) = returnPnt(1): insertionPoint(2) = returnPnt(2) UserForm6.Show height = 0.3
'CODE FAILS HERE Set textObj = ThisDrawing.ModelSpace.AddText(textString,insertionPoint,height)
End Sub

 

0 Likes
Accepted solutions (1)
2,714 Views
3 Replies
Replies (3)
Message 2 of 4

Ed__Jobe
Mentor
Mentor
Accepted solution

the var textstring is probably not set because you can't Trim a TextBox object. You need to supply the value of the TextBox.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 3 of 4

OceanaPolynom
Advocate
Advocate

Thank you very much. This solution solved the problem
I changed

 

TextString=Trim(TextBox1)

 

to

 

TextString=TextBox1
TextString=Trim(textString)

 

and it worked perfectly

Thanks again
John

0 Likes
Message 4 of 4

Ed__Jobe
Mentor
Mentor

Glad it worked, but what I meant was

 

textString = Trim(TextBox1.Value)

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes