Re: Macro to Remove Direct Font Name without Removing other font properties
From: Julie (abc_at_abc.com)
Date: 04/09/04
- Next message: Dave Neve: "Array"
- Previous message: Mark Settle: "Re: Does anybody know how I report a bug in Word/VBA to Microsoft?"
- In reply to: Peter Hewett: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Next in thread: Peter Hewett: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Reply: Peter Hewett: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Reply: Klaus Linke: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 9 Apr 2004 10:56:10 -0700
Hi Peter.
Thanks for the reply. The method you suggested has been tried and it causes
one of the problems mentioned in my first post, e.g. this code
Sub testit()
Dim opara As Paragraph
Dim oSty As Style
For Each opara In ActiveDocument.Paragraphs
Set oSty = ActiveDocument.Styles(opara.Style)
opara.Range.Font.Name = oSty.Font.Name
Next opara
Set opara = Nothing
Set oSty = Nothing
End Sub
If I run this in Word2000 fully patched running under Windows XP, it does
the job, but .... if LATER I edit the font property of the underlying style,
I am afflicted with the very problem I am trying to resolve. If I try the
code out on some paragraphs styled with Normal, with Normal style currently
set to Arial (but paragraphs manually formtted with TNR), the macro does
what it should - that is apply Arial to all. Later, If I edit Normal style
to change the font to TNR, all of the directly-applied Arial remains - thus,
now my whole document has a direct font applied rather than just part of it.
Am I missing something here????
Thanks,
Julie
"Peter Hewett" <nospam@xtra.co.nz> wrote in message
news:qbcd705740fr8nnia9mt2jmb0lg5nkedh2@4ax.com...
> Hi Julie
>
> Iterate the documents Paragraph collection (use a For Each loop). Look up
the
> paragraphs style, look up the styles font name and then apply the font
name ass
> direct formatting.
>
> HTH + Cheers - Peter
>
>
> "Julie" <abc@abc.com>, said:
>
> >Hello,
> >
> >I am writing macros to clean up converted WordPerfect documents and am
> >stumped trying to figure out how to find and remove directly applied font
> >names without,
> >
> >- removing any other directly applied font formatting (size, bold,
italic,
> >etc.), and
> >- without breaking the ability to later change the font of the underlying
> >style and have that change take effect for all paragraphs styled with
that
> >style
> >
> >(I don't know the name of the font to search for up front - could be any
> >font - always know the name of the font to apply in replacement - that is
> >the default paragraph font name).
> >
> >Every method I try has its pitfalls (Word2000), including find each style
> >and replace each style with "no formatting", apply the underling
paragraph
> >font to the paragraph, etc.
> >
> >Final result must be that after macro finishes, if user changes the font
of
> >the underlying style, the change takes effect for all paragraphs with
that
> >style. All of the methods that I have tried are successful in applying
the
> >correct font, but they break the ability to make subsequent font changes
to
> >the underlying paragraph style and have those changes take effect for all
> >relevant paragraphs.
> >
> >Formerly, in WordPerfect, I was able to achieve this end with a very
simple
> >macro to find [Font] codes and replace with nothing.
> >
> >Any help with this would be very much appreciated.
> >
> >Thanks in advance,
> >Julie
> >
> >
>
- Next message: Dave Neve: "Array"
- Previous message: Mark Settle: "Re: Does anybody know how I report a bug in Word/VBA to Microsoft?"
- In reply to: Peter Hewett: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Next in thread: Peter Hewett: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Reply: Peter Hewett: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Reply: Klaus Linke: "Re: Macro to Remove Direct Font Name without Removing other font properties"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|