Visual Basic Customization

Reply
*Dan
Message 1 of 6 (124 Views)

Extract Text string from Field

124 Views, 5 Replies
09-27-2004 12:29 PM
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
*Ed Jobe
Message 2 of 6 (124 Views)

Re: Extract Text string from Field

09-27-2004 01:32 PM in reply to: *Dan
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 ---- "Dan" wrote in message news:41586a3f_3@newsprd01... > 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
Message 3 of 6 (124 Views)

Re: Extract Text string from Field

09-28-2004 08:26 AM in reply to: *Dan
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 "Ed Jobe" wrote in message news:415878f2$1_1@newsprd01... > 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 > ---- > "Dan" wrote in message > news:41586a3f_3@newsprd01... > > 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
Message 4 of 6 (124 Views)

Re: Extract Text string from Field

09-28-2004 02:36 PM in reply to: *Dan
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" wrote in message news:415982b6$1_2@newsprd01... > 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 > > "Ed Jobe" wrote in message > news:415878f2$1_1@newsprd01... > > 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 > > ---- > > "Dan" wrote in message > > news:41586a3f_3@newsprd01... > > > 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 > > > > > > > > > > > >
Member
leeraybone7272
Posts: 3
Registered: ‎01-02-2008
Message 5 of 6 (124 Views)

Re: Extract Text string from Field

04-21-2010 02:45 AM in reply to: *Dan
I am too struggling to extract the string form the field could you please advise on how you accomplished this.

Thanks in Advance

Lee
Member
danranderson327
Posts: 4
Registered: ‎04-21-2010
Message 6 of 6 (124 Views)

Re: Extract Text string from Field

04-21-2010 08:34 AM in reply to: *Dan
Well Lee,
Thinking back, it should be something as simple as the following:

{code}
Sub FindFieldTextString()
Dim entText As AcadEntity
Dim Pt As Variant

ThisDrawing.Utility.GetEntity entText, Pt, vbCr & "Select text entity:"
If TypeOf entText Is AcadText Or TypeOf entText Is AcadMText Then
MsgBox entText.TextString
End If

End Sub
{code}

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community