Extract Text string from Field

Discussion in 'AutoCAD' started by Dan, Sep 27, 2004.

  1. Dan

    Dan Guest

    I have learned how to create a field in VB using the Object Id, but I am
    struggling with how to extract the string itself from a field, place it into
    the clipboard, to be copied into another application (Excel).


    Thank you,
    Dan
     
    Dan, Sep 27, 2004
    #1
  2. Dan

    Ed Jobe Guest

    Use the TextString property to get what was evaluated. If there is other
    text besides the field, use the standard string manipulation functions (e.g.
    InStr) to extract the field info from the TexString.
     
    Ed Jobe, Sep 27, 2004
    #2
  3. Dan

    Dan Guest

    I understand how to truncate text to get what I want from the text string,
    but I have not figured out how to get the string from the field yet. I know
    how to get the field expression.

    I must be overlooking something:

    Sub CaptureFieldText()

    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Dim point(0 To 2) As Double
    Dim fText As AcadText ' Not
    sure if this is the right object for the field
    Dim sysVarName As String
    Dim sysVarData As String
    sysVarName = "CTAB"
    sysVarData = "Model"
    ThisDrawing.SetVariable sysVarName, sysVarData
    Set ssetObj = ThisDrawing.SelectionSets.Add("capField")
    point(0) = -100: point(1) = 525.221859: point(2) = 0
    ssetObj.SelectAtPoint point
    For Each fText In ssetObj

    'Here is where I wanted to place code to extract string from field

    Next fText
    ThisDrawing.SelectionSets.Item("capField").Delete
    Set Layout = Nothing
    Set fText = Nothing
    End Sub

    Any help is appreciated. I am sure there are better habits, and coding could
    be optimized, flame awway.
    I am still very new at this,

    Thanks,
    Dan
     
    Dan, Sep 28, 2004
    #3
  4. Dan

    Dan Guest

    Figured it out, Thanks.

    AcadEntity works with FIELD. Thats what I was looking for. Got my code
    working now.



    Have a great week,

    Dan
     
    Dan, Sep 28, 2004
    #4
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.