Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating fields with VBA?

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
US
below is some code. I think I have the problem areas found but do not know how to fix it. I cant seem to find the filter codes for fields. I want to update the fields only in paperspace without having to switch to each of the tabs. Is this possible? ALso i need to delete the selection set if there is an error in the program(or if you hit the escape key etc.)

Code:
Sub fixfield()
   Dim ssfield As AcadSelectionSet
   Dim entObj As AcadEntity
   Dim filtertype(1) As Integer
   Dim FilterData(1) As Variant
   Dim mode As Integer
   mode = acSelectionSetAll
   Set ssfield = ThisDrawing.SelectionSets.Add("SS2")
   filtertype(0) = [COLOR=red]??????????[/color]
   filtertype(1) = 67
   FilterData(0) = [COLOR=red]??????????[/color]
   FilterData(1) = "1"
   ssfield.Select mode, , , filtertype, FilterData
   ssfield.Erase
   ssfield.Delete
End Sub
 
Hi vbcad,

You might want to take a look at this: faq687-5792 . You have a few things wrong with your filtertype/filterdata setup, that should explain it.

But, I however haven't had any luck selecting objects limted to paper space only using the 67 filter, but that was a while ago - maybe that's changed in newer releases.

HTH
Todd
 
i have this working with the following code. it selects all objects on a certain layer. Can i change the data in red to update fields?(along with some other changes i plan to do)
Code:
Sub fixfield()
   Dim ssfield As AcadSelectionSet
   Dim entObj As AcadEntity
   Dim filtertype(1) As Integer
   Dim FilterData(1) As Variant
   Dim mode As Integer
   mode = acSelectionSetAll
   Set ssfield = ThisDrawing.SelectionSets.Add("SS2")
   filtertype(0) = [COLOR=red]8[/color]
   filtertype(1) = 67
   FilterData(0) = [COLOR=red]"G-TTLB-PLBK"[/color]
   FilterData(1) = "0"
   ssfield.Select mode, , , filtertype, FilterData
   ssfield.Erase
   ssfield.Delete
End Sub
 
Hi vbcad,

I'm not sure what you mean to update fields; if you mean you want to use a variable instead of a hard coded string, the answer is yes.

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top