Rtext -runtime error

Discussion in 'AutoCAD' started by Mark Gardiner, Apr 22, 2004.

  1. Hi All,

    When I run a loop

    ''''
    Sub RtextTest()
    Dim obj As Variant
    On Error Resume Next
    For Each obj In ThisDrawing.ModelSpace
    'Error on Rtext object
    'Even though I have on error resume next the error exits the loop
    Next

    End Sub
    ''''

    When obj is an Rtext object I get
    Run-Time error '-2147024770 (8007007E)'
    Automation error
    The specified module could be found.

    Anyone esle come accross this, or know of a workaround. I suspect it is because Rtext does not have a COM interface

    Mark
     
    Mark Gardiner, Apr 22, 2004
    #1
  2. Dim obj As Variant

    Try:

    Dim Obj As AcadObject

    or

    Dim Obj As AcadEntity




    Hi All,

    When I run a loop

    ''''
    Sub RtextTest()
    Dim obj As Variant
    On Error Resume Next
    For Each obj In ThisDrawing.ModelSpace
    'Error on Rtext object
    'Even though I have on error resume next the error exits the loop
    Next

    End Sub
    ''''

    When obj is an Rtext object I get
    Run-Time error '-2147024770 (8007007E)'
    Automation error
    The specified module could be found.

    Anyone esle come accross this, or know of a workaround. I suspect it is because Rtext does not have a COM interface

    Mark
     
    Tony Tanzillo, Apr 22, 2004
    #2
  3. Thanks Tony

    I have tried Dim obj as AcadObject & Dim obj as AcadEntity.
    But I still get the same error

    I have tried this in 2002 & 2004 & I only get the error in 2004
    Mark

    because Rtext does not have a COM interface
     
    Mark Gardiner, Apr 22, 2004
    #3
  4. Mark Gardiner

    Ken Hutson Guest

    Mark,
    All these work for me. AutoCAD 2000.

    Public Sub junk()

    Dim i As AcadEntity
    For Each i In ThisDrawing.ModelSpace
    MsgBox TypeName(i)
    Next i

    Dim j As AcadObject
    For Each j In ThisDrawing.ModelSpace
    MsgBox TypeName(j)
    Next j

    Dim k As Variant
    For Each k In ThisDrawing.ModelSpace
    MsgBox TypeName(k)
    Next k

    End Sub

    Ken Hutson
    San Antonio, TX
    Hi All,

    When I run a loop

    ''''
    Sub RtextTest()
    Dim obj As Variant
    On Error Resume Next
    For Each obj In ThisDrawing.ModelSpace
    'Error on Rtext object
    'Even though I have on error resume next the error exits the loop
    Next

    End Sub
    ''''

    When obj is an Rtext object I get
    Run-Time error '-2147024770 (8007007E)'
    Automation error
    The specified module could be found.

    Anyone esle come accross this, or know of a workaround. I suspect it is because Rtext does not have a COM interface

    Mark
     
    Ken Hutson, Apr 22, 2004
    #4
  5. Mark Gardiner

    Dave.B Guest

    Ken,
    Those all work until they find an Rtext object, at which point they give the error that Mark posted above.
    Strange thing is, the typename of the Rtext object appears to be "IAcadText", from what I can gather from the VB editor.
    Anyone know?
     
    Dave.B, Sep 1, 2004
    #5
  6. Mark Gardiner

    Kevin Terry Guest

    Just looking back through a routine I wrote some time ago, though I don't
    remember anything about developing it apparently there is a workaround:

    Dim asPSpace As AcadPaperSpace
    Dim i As Long
    Dim acText As AcadText
    Dim acMText As AcadMText
    Dim sText As String

    Set asPSpace = ThisDrawing.PaperSpace

    For i = 0 To asPSpace.Count - 1
    'screen out all but text entities
    If TypeOf asPSpace.item(i) Is AcadText Then
    'this is text
    Set acText = asPSpace.item(i)
    sText = acText.TextString
    '''
    ElseIf TypeOf asPSpace.item(i) Is AcadMText Then
    'this is mtext
    Set acMText = asPSpace.item(i)
    sText = acMText.TextString
    '''
    ElseIf InStr(1, UCase(asPSpace.item(i).ObjectName), "RTEXT", 1) > 0
    Then
    'this is reactive text
    sText = asPSpace.item(i).Contents
    '''


    hth,
    Kevin

    the error that Mark posted above.
    "IAcadText", from what I can gather from the VB editor.
     
    Kevin Terry, Sep 2, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.