Change font in Word

Any way to change the font of selected text in Word?
Pretty simple operation I would have though but can't find anything approaching a solution in KM.
'Apply Style to Clipboard' is the closest I've found, but it's clumsy and not what I need.

Changing a font is a very manual process, isn't it? You have to open the Font drop-down in the bar, then select the font. You could automate this by clicking at the location of the font panel (as it's fixed in each window), then typing the font name, perhaps with a delay between each character, to select the font by name.

I can't think of a better way to do this—maybe Visual Basic could do it, which would let it be truly programmatic?

-rob.

Hi @timbo
I agree to @griffman , a very manual process.
I case you just want to change (always) to let's say Arial you could use this very basic KM macro. It opens the font dialog by keystroke, waits for a while, then writes «arial» and ends that with «OK».
We Change Font in Word.kmmacros (3.0 KB)

Kind regards –
Walter

To a particular font? Word already has a way to do this -- Styles. Set up a character style as you want, apply with a single click -- you could certainly automate that in KM, maybe with AppleScript to avoid the GUI, and it would even be available in Word's Search & Replace so you could make every occurence of "fishfingers" be blue bold Comic Sans with triple underlining at the press of a button.

If Styles won't do it for you, perhaps you could explain what you are trying to achieve?

I don't have Word. Is Word's method for changing fonts accessible via the KM Press Button action? In both Pages and TextEdit you can access the font change pop-up using the KM Press Button action. If that's not the case in Word, you could cut the text out of word, paste it into TextEdit, change the font there, and copy it back to Word. I did a quick test and it worked. But I agree with you that there may need to be a delay between each character in the font name. I didn't test that. But it certainly can be done.

I use AppleScript:

image

tell application "Microsoft Word"
	set {selection start:startIndex, selection end:endIndex} to selection
	set theRange to create range active document start startIndex end endIndex
	set name of font object of theRange to "Times New Roman"
end tell
1 Like

Thanks for all your replies. I have tried the 'Styles' option in Word but I find it a bit inconsistent in that it alters depending on the type of text that surrounds it, if that makes sense. I shall try the Applescript as well, thank you Martin. Cheers all.

Perfectly -- but it's because of how Styles, particularly Character Styles -- work. And I should have been clearer about that in my post -- my bad. In brief:

Styles are a hierarchy -- anything you don't explicitly set in inherited from whatever the style is based on. You can't base a Character Style on nothing so, unless you set every single characteristic, you can get "surprises".

The surprises happen most often when your Character Style is based on the menu item "(underlying properties)". That's because those "underlying properties" are the character formatting of the paragraph the selection is in, not the formatting of any neighbouring characters.

So if you have a paragraph whose character style is 12pt Arial in black, someone has manually changed that to 24pt Times in red, and you apply a Character Style that only sets the font to Comic Sans while the rest are "underlying properties" -- your selection will be now be 12pt Comic Sans in black, not the 24pt Comic Sans in red you were probably expecting.

Styles work well if you are all in on them, but can get flakey if you (or, more likely, someone else!) have applied manual overrides. In those cases, when you only want to change the font while keeping everything else as-is, @martin's AppleScript is the way to go.