PDA

View Full Version : [SOLVED:] changing specific character font



Kilroy
09-15-2016, 11:38 AM
Hey guys me again. Thanks for your help so far. I've come across another problem. I've tried to record a macro to resolve but can't seem to get it right. I'm getting document with mixed fonts. I wrote a macro to change all text to Calibri but now all my bullets are squares with a question mark inside. I need to either change all font except "symbol" the first time or figure out how to change the Calibri bullet to symbol. Any help appreciated. Here's what I have so far:


Sub bulletstosymbol()
'
' bulletstosymbol Macro
' bulletstosymbol
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Size = 9
.Bold = False
.Italic = False

End With
With Selection.Find
.Text = ChrW(61623)
.Replacement.Text = "" & ChrW(61623)
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

gmaxey
09-15-2016, 12:32 PM
Why not:

ActiveDocument.Range.Font.Name = "Calibri"

Kilroy
09-15-2016, 12:44 PM
Hey Greg how's it going? What I have for changing the font to Calibri is


Selection.Tables(1).Select
Selection.Font.Name = "Calibri"


But I don't want it to change the symbol font.

The code I posted was my lame attempt to change the bullets back to symbol font. Like you said to me before the macro recorder is like half a yard stick.

gmaxey
09-15-2016, 01:09 PM
Going well considering recent PC disasters. What is the bullet symbol before you run the your code?

Kilroy
09-15-2016, 01:15 PM
Sorry to hear about the computer issues. I feel lost in those situations. I press the bullet button. it's set for a round bullet but could be a dash as well. I also wrote a macro for entering page numbers. it seemed to work but then now it's not. very strange.


Sub pagenumbers()
'
' pagenumbers Macro
' pagenumbers
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
End Sub

gmaxey
09-15-2016, 01:52 PM
Killroy,

If I type a document in one font (say Times New Roman) insert bullets as you have done and then want to change the font to "Calibri" I can run:


Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
ActiveDocument.Range.Font.Name = "Calibri"
lbl_Exit:
Exit Sub
End Sub

and the font changes with the bullets remaining the same (appearance).

You would have to attached a small sample document with the issue.

I don't see how you macro last posted has anything to do with entering page numbers.

Kilroy
09-16-2016, 04:14 AM
Greg I figured out the problem. I'm running the macro you wrote for me that changes numbers to text. no matter what order I run them in it keeps happening. I left my memory stick at home so I can't post the examples.

Kilroy
09-16-2016, 06:28 AM
So I figured it out. I put it at the top of my list of macros and it's working now.

gmaxey
09-16-2016, 07:01 AM
So what did you figure out? It doesn't benefit other readers/users if you don't explain what the problem was and what you did to make it work.

Kilroy
10-25-2016, 04:55 AM
I was running a macro that changed all numbers to text first (ActiveDocument.ConvertNumbersToText) this did not change the font of the bullet but it did effect the bullet properties. Normally when you highlight a bullet or number they all appear selected and that stopped happening when convert numbers to text macro was run. So when I ran a second macro to change the font to Calibri it was able to change symbol to Calibri.
For some reason that I do not understand if I run the ActiveDocument.Range.Font.Name = "Calibri" first it did not have the same effect. it works just fine.


Sub calibrifont()
'
'calibrifont
ActiveDocument.Range.Font.Name = "Calibri"
lbl_Exit:
Exit Sub
End Sub
Sub Auto_Format_convert_list_numbers()
'
' convert_list_numbers Macro
'
ActiveDocument.ConvertNumbersToText
End Sub