newfoundfreedom
2007-05-10, 03:15 PM
I need help with my first VBA routine. What I am trying to accomplish is as follows:
1. Change the "Standard" TextStyle to have Height = 250, Width = 0.8, & Font = romans.shx
2. Set "Standard" TextStyle as Current
3. Change all existing Text and MText entities to the "Standard" Text Style
Looking at some of the other code examples on this forum - I have been able to complete steps one and two - but I don't know how to accomplish the third. My coding knowledge is fledgling at best - but I imagine that I have to create a dynamic array and then put all the existing Text and MText objects into that array - then cycle through each of them setting their text style to "Standard". Could someone please post a code example. Thanks you.
This is what I currently have.
Sub ChangeTextStyle()
Dim objTextStyle As AcadTextStyle
Set objTextStyle = ThisDrawing.TextStyles("Standard")
objTextStyle.fontFile = "romans.shx"
objTextStyle.Height = 250
objTextStyle.Width = 0.8
ThisDrawing.ActiveTextStyle = objTextStyle
End Sub
1. Change the "Standard" TextStyle to have Height = 250, Width = 0.8, & Font = romans.shx
2. Set "Standard" TextStyle as Current
3. Change all existing Text and MText entities to the "Standard" Text Style
Looking at some of the other code examples on this forum - I have been able to complete steps one and two - but I don't know how to accomplish the third. My coding knowledge is fledgling at best - but I imagine that I have to create a dynamic array and then put all the existing Text and MText objects into that array - then cycle through each of them setting their text style to "Standard". Could someone please post a code example. Thanks you.
This is what I currently have.
Sub ChangeTextStyle()
Dim objTextStyle As AcadTextStyle
Set objTextStyle = ThisDrawing.TextStyles("Standard")
objTextStyle.fontFile = "romans.shx"
objTextStyle.Height = 250
objTextStyle.Width = 0.8
ThisDrawing.ActiveTextStyle = objTextStyle
End Sub