Find & Replace a Font with Word

Hello,

I don’t know how to make this work…

I must replace a paragraph in “N Helvetica Narrow” with the font “Helvetica LT Pro Bold Narrow” but it doesn’t work.

The font is a family I guess. There is:

  • Helvetica LT Pro

With Microsoft Word It breaks down in a sub-menu in:

  • Bold Narrow
  • Narrow

Here is a small portion of the script. Ih I say “Helvetica LT Pro Narrow” it works… but if I say “Helvetica LT Pro Bold Narrow”, it doesn’t work…


set myFind to find object of text object of active document
clear formatting myFind
set name of font object of myFind to "N Helvetica Narrow"
set bold of font object of myFind to true
set content of myFind to ""
clear formatting replacement of myFind
set name of font object of replacement of myFind to "Helvetica LT Pro Bold Narrow"
set content of replacement of myFind to ""
execute find myFind replace replace all

My question is: Is there a way to assign a font to a paragraph other by it’s font Name? Can I use the internnal font ID or something else?

Or what is the solution? Because I am stuck…

Thanks for any help.

Andrew Hobson

Hello again,

As I didn’t get any replies, I guess I need to ask differently my question:

With AppleScript and Word, I can’t set some text to the 2nd font in a font family.

I have the font family:

Helvetica LT Pro

with:

Bold Narrow
Narrow

I’m able to set some text to “Helvetica LT Pro Narrow” but not to “Helvetica LT Pro Bold Narrow”.

Why?

Is this a bug in AppleScript or Word or MacOS and font families?

Any help would be appreciated.

Andrew

Hello.

See if you can find anything about changing fonts and font families when you have downloaded Word2004AppleScriptRef.Pdf

Best Regards

McUsr

Hello to all,

I finally found my problem!

I needed to add this line:

set bold of font object of replacement of myFind to false

And everything works just fine. Iguess It is simply because the font “Helvetica LT Pro Bold Narrow” is already in bold and therefore doesn’t have a Bold style.

But in my conception, the line:

clear formatting replacement of myFind

Would clear any font attribute asked for in the find stage…

But anyway, thanks to StefanK & McUsr for the help.

Andrew