Message 1 of 13
Help with setting style & font with VBA
Not applicable
03-13-2003
08:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've attached this code to be run from 2 different buttons, one for the
RomanD and the other for the RomanS. The co. I work for basically uses these
2 fonts in their drawings and I was trying to automate the switching back
and forth. The code works some of the time but not all the time and I can't
figure out what's wrong. Can anyone help?
The following code is in a module and the buttons work OK
'===============================
Option Explicit
Public SDimScale As Single
'-------------------------------------------------------------------
' ROMAN-D code
Public Sub SetFontRomanD()
Dim objTextStyle As AcadTextStyle
Set objTextStyle = ThisDrawing.TextStyles("standard")
objTextStyle.fontFile = "romand.shx"
SDimScale = ThisDrawing.GetVariable("dimscale")
objTextStyle.Height = SDimScale * 0.1875 'set the font to a
height of 3/16"
End Sub
' ROMAN-S code
Public Sub SetFontRomanS()
Dim objTextStyle As AcadTextStyle
Set objTextStyle = ThisDrawing.TextStyles("standard")
objTextStyle.fontFile = "romans.shx"
SDimScale = ThisDrawing.GetVariable("dimscale")
objTextStyle.Height = SDimScale * 0.09375 'set the font to a
height of 3/32"
End Sub
'===============================
TIA
DonB
RomanD and the other for the RomanS. The co. I work for basically uses these
2 fonts in their drawings and I was trying to automate the switching back
and forth. The code works some of the time but not all the time and I can't
figure out what's wrong. Can anyone help?
The following code is in a module and the buttons work OK
'===============================
Option Explicit
Public SDimScale As Single
'-------------------------------------------------------------------
' ROMAN-D code
Public Sub SetFontRomanD()
Dim objTextStyle As AcadTextStyle
Set objTextStyle = ThisDrawing.TextStyles("standard")
objTextStyle.fontFile = "romand.shx"
SDimScale = ThisDrawing.GetVariable("dimscale")
objTextStyle.Height = SDimScale * 0.1875 'set the font to a
height of 3/16"
End Sub
' ROMAN-S code
Public Sub SetFontRomanS()
Dim objTextStyle As AcadTextStyle
Set objTextStyle = ThisDrawing.TextStyles("standard")
objTextStyle.fontFile = "romans.shx"
SDimScale = ThisDrawing.GetVariable("dimscale")
objTextStyle.Height = SDimScale * 0.09375 'set the font to a
height of 3/32"
End Sub
'===============================
TIA
DonB