Hi all,
I'm having problems editing Leader Notes with VBA. I've written code which replaces all our LeaderNotes and Balloons with the same object which has slightly different properties (namely, the leader colour and lineweight). Now my problem is that when I adjust the verticle justification of a LeaderNote, then the colour property is disturbed. By default, our LeaderNotes have colour = ByLayer. However once I change the Verticle Justification, then the colour is changed to Black by Override.
I'm using this code to change the justification
newLeader.VerticalJustification = oldLeader.VerticalJustification
And I tried using this code to manually fix the colour
Set clrColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0) clrColor.ColorSourceType = kLayerColorSource newLeader.Color = clrColor
but nothing is working... It's driving me mad, does anyone have any suggestions???
Thanks
How about use below line instead of creating a totoally new color:
Set clrColor = oldLeader.Color
Hi Rocky,
Thanks for the suggestion.
I had tried to change the colorsourcetype using that same method, but that didn't work. I've just tried your suggestion now, and it still doesn't work.
Here's a code example you could try on any drawing with any leader note.
Sub LeaderJustificationTest() Dim oDoc As DrawingDocument Dim oLeader As LeaderNote Set clrColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0) clrColor.ColorSourceType = kLayerColorSource Set oDoc = ThisApplication.ActiveDocument For Each oLeader In oDoc.ActiveSheet.DrawingNotes.LeaderNotes oLeader.VerticalJustification = kAlignTextLower oLeader.Color = clrColor Next oLeader End Sub
Try running that, and once it's done check the color to see if it's "ByLayer"... Mine isn't...
Cheers
Yes, the code reproduces the issue, I logged this issue, please provide the number 1413808 to us to check the status. If you need a hotfix for this issue please provide your business case to Autodesk ADN.