I have some code that creates MLeaders, and it works great. My problem is opening the drawing after I have added the MLeaders, it throws a message box saying the drawing found errors. I continue the open and do an Audit, and my previously added MLeaderStyle gets deleted
I am unsure why it is doing this as when I run the code, it stores it in the dictionary.
Am I missing a step out somewhere?
StrMLeaderStyle = "500m"
Dim BlnMLSExists As Boolean
BlnMLSExists = False
Dim oDict As AcadDictionary
Set oDict = ThisDrawing.Dictionaries.Item("ACAD_MLEADERSTYLE")
Dim i As Long
For i = 0 To oDict.Count - 1
Dim oObj As AcadObject
Set oObj = oDict.Item(i)
If oObj.ObjectName = "AcDbMLeaderStyle" Then
Dim oMLS As AcadMLeaderStyle
Set oMLS = oObj
If oMLS.Name = StrMLeaderStyle Then
BlnMLSExists = True
If BlnMLSExists = False Then
Dim oNewMLS As AcadMLeaderStyle
Set oNewMLS = oDict.AddObject(StrMLeaderStyle, "AcDbMLeaderStyle")