Code:
Sub Wingding()
Dim oTextStyle As AcadTextStyle
Dim currTextStyle As AcadTextStyle
Set currTextStyle = ThisDrawing.ActiveTextStyle
For Each oTextStyle In ThisDrawing.TextStyles
If LCase(oTextStyle.Name) Like "*wetland" Then
oTextStyle.fontFile = "c:\windows\fonts\wingding.ttf"
End If
Next oTextStyle
ThisDrawing.ActiveTextStyle = currTextStyle
ThisDrawing.Regen acAllViewports
MsgBox "The MUNBD linetype has been repaired ", vbInformation, "ActiveTextStyle Example"
End Sub
on that last line, what is this for? , vbInformation, "ActiveTextStyle Example"
I took it out and ran the program & the only diffrence i'm noticing is the sound when the msgbox pops up.
Here is the final program. Seeing how i'm very green when it comes to VBA, any suggestions are always welcome. thanks in advance.
Code:
Option Explicit
Sub Wingding()
Dim oTextStyle As AcadTextStyle
Dim currTextStyle As AcadTextStyle
'remembers the current Text Style.
Set currTextStyle = ThisDrawing.ActiveTextStyle
'Finds the wetland text style and changes the font back to wingdings
For Each oTextStyle In ThisDrawing.TextStyles
If LCase(oTextStyle.Name) Like "*wetland" Then
oTextStyle.fontFile = "c:\windows\fonts\wingding.ttf"
'pops up a personalized message box confiriming the repair.
MsgBox "The MUNBD linetype has been repaired for " & Environ("UserName"), vbInformation, "ActiveTextStyle Example"
End If
Next oTextStyle
'restores the previous text style to current.
ThisDrawing.ActiveTextStyle = currTextStyle
'regens the drawing so changes can be seen.
ThisDrawing.Regen acAllViewports
End Sub