Message 1 of 5
Adding New TextStyle

Not applicable
01-06-2006
08:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI,
I am having a problem adding a textstyle in vba. What I am doing is looping through several different textstyles to add them dynamically. When I do this the routine fails with the error "Run-time erro '-2145320949 (8021000b)': Calling method SetObjectId of interface IAcadBaseObject failed". What I have found out is that when I add the textstyle using a variable for my name it fails, if i actually type the name in it works. Here is a code snippet of each.
DOES NOT WORK
For intI = 0 To 1
Dim StyleHt As Double, StyleWF As Double, StyleOA As Double
tempAry = Split(strStyleAry(intI), ",")
Dim strStyleName As String
strStyleName = tempAry(0)
Dim objTextStyle As AcadTextStyle
Set objTextStyle = .TextStyles.Add(strStyleName)
Set TextStyleObject = Nothing
Next
WORKS
Dim objTextStyle As AcadTextStyle
Set objTextStyle = .TextStyles.Add("TESTSTYLE")
Set TextStyleObject = Nothing
Please help, I cannot figure out why this is happening....
Thanks,
Mike
I am having a problem adding a textstyle in vba. What I am doing is looping through several different textstyles to add them dynamically. When I do this the routine fails with the error "Run-time erro '-2145320949 (8021000b)': Calling method SetObjectId of interface IAcadBaseObject failed". What I have found out is that when I add the textstyle using a variable for my name it fails, if i actually type the name in it works. Here is a code snippet of each.
DOES NOT WORK
For intI = 0 To 1
Dim StyleHt As Double, StyleWF As Double, StyleOA As Double
tempAry = Split(strStyleAry(intI), ",")
Dim strStyleName As String
strStyleName = tempAry(0)
Dim objTextStyle As AcadTextStyle
Set objTextStyle = .TextStyles.Add(strStyleName)
Set TextStyleObject = Nothing
Next
WORKS
Dim objTextStyle As AcadTextStyle
Set objTextStyle = .TextStyles.Add("TESTSTYLE")
Set TextStyleObject = Nothing
Please help, I cannot figure out why this is happening....
Thanks,
Mike