Hey Guys,
I really appreciate your help thus far.
The above code works great but either I am not utilizing it exactly how I need to or may be one of you will have another suggestion.
Below is an example of the module I am developing
I am inserting a block, it is a legend for Intercomm symbols.
My menu macro allows you to choose what scale (out of 7 or so) you would like to insert the block into your drawing at.
The menu macro pauses for insertion, after the user inserts the block, the Vba Module is fired off.
The Below Code (For Each Loop)
is repeated for each scale that the user can select from, it was just too much to paste in
On the first block inserted, all works well.
So, if you look at the For Each Loop below, I am saying if The Block Intercomm has an xscale factor of 48, then rename the layer Co-I-SYMB toCo-I-SYMB-48
Now, if I insert a second Intercomm at a different scale (for instance 96)
It seems to be going through all of the possible scale factors in the module, seeing 48 again, then I get the duplicate record error and the layer remains at Co-I-SYMB
I need to somehow have it see that there is a 48, overlook it then proceed to 96 and create Co-I-SYMB-96 layer and so on.
So, I was trying to filter by layer name.
If that layer exists, then move on, but I am still having no luck
I hope this makes sense?
Any help will be APPRECIATED
Thanks
Mark
Dim Co_Layers As AcadLayers
Dim Intercomm As AcadBlockReference
Dim BlockXScaleFactor As Double
Set Co_Layers = ThisDrawing.Layers
Set Intercomm = ThisDrawing.ModelSpace.Item(Intercomm1)
BlockXScaleFactor = Intercomm.XScaleFactor
If Intercomm.XScaleFactor = 48 Then
For Each Layer In Co_Layers
If Layer.Name = ("Co-I-SYMB") Then
Layer.Name = ("Co-I-SYMB-48")
End If
Next
End If
Exit Sub