Message 1 of 3
Selecting object, changing color, using form
Not applicable
01-03-2008
11:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write a VBA macro that, when I select a polyline, and then click a shortcut key (or cmd button on a form) will simply change the color of the polyline.
When I say selected, I mean highlighted with the blue boxes. (gripped?)
The following code does that, but it only works when I have the VBA editor open. When I close the editor and bind the macro to a keyboard shortcut, it doesnt work.
I would really like some code that does this:
Show form->click button to start process-> hide form->user selects a polyline->color is changed->Form reappears...or something along those lines.
Code so far:
Sub change_color_sel()
Dim pfSS As AcadSelectionSet
Dim ssobject As AutoCAD.AcadObject
'Dim ssobject As AcadEntity
Set pfSS = ThisDrawing.PickfirstSelectionSet
For Each ssobject In pfSS
ssobject.color = 2
ssobject.Update
Next
End Sub
-----
Thanks in advance
When I say selected, I mean highlighted with the blue boxes. (gripped?)
The following code does that, but it only works when I have the VBA editor open. When I close the editor and bind the macro to a keyboard shortcut, it doesnt work.
I would really like some code that does this:
Show form->click button to start process-> hide form->user selects a polyline->color is changed->Form reappears...or something along those lines.
Code so far:
Sub change_color_sel()
Dim pfSS As AcadSelectionSet
Dim ssobject As AutoCAD.AcadObject
'Dim ssobject As AcadEntity
Set pfSS = ThisDrawing.PickfirstSelectionSet
For Each ssobject In pfSS
ssobject.color = 2
ssobject.Update
Next
End Sub
-----
Thanks in advance