Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

reset font format to default but keep the bold formatting..>>

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
michiel - 07 Mar 2006 12:34 GMT
hello, I'm looking for a way to remove all font formatting from a Word
document except the bold. Appreciate any suggestions. Thanks, Michiel
Jezebel - 07 Mar 2006 13:48 GMT
1. Define a character style called maybe "BoldText". The actual style
features are irrelevant -- it's only the name you need. Not that it must be
a *character* style, not a paragraph style.

2. Use Find and Replace. Leave the Find box blank and set the format to Font
> Bold. Leave the Replace box blank and set the format to Style =
"BoldText". Click Replace All.

3. Select the entire document and reset the styles: Ctrl-A Ctrl-Q
Ctrl-Space.

4. Use the above Find and Replace in reverse: Find format > Style =
"BoldText", Replace with format > Font > bold.

5. Delete the "BoldText" style.

> hello, I'm looking for a way to remove all font formatting from a Word
> document except the bold. Appreciate any suggestions. Thanks, Michiel
michiel - 07 Mar 2006 14:30 GMT
thanks, but that doesn't really work. Problem is that by clearing the format
thru ctrl+q and ctrl+space, you also delete the boldtext style so that the
second find and replace doesn't work anymore.  But thanks for taking the time
to respond to my question!

> 1. Define a character style called maybe "BoldText". The actual style
> features are irrelevant -- it's only the name you need. Not that it must be
[quoted text clipped - 14 lines]
> > hello, I'm looking for a way to remove all font formatting from a Word
> > document except the bold. Appreciate any suggestions. Thanks, Michiel
Klaus Linke - 25 Mar 2006 13:02 GMT
Hi Michiel,

Two snags:
-- Bold may be applied by styles.
-- If you have a bold style and something in that has been unbolded, you
likely don't want to loose that either?

You could
-- tag bold text first (Find/Replace "Font = bold" with <b>^&</b>),
(both bold from styles and manual bolding will be tagged)
-- reset the font,
-- remove all bold formatting (say by replacing "bold" with "not bold"),
-- then replace (using "Match wildcards"):
   Find what: \<b\>(*)\</b\>
   Replace with: \1  ((+ Format > Font = bold))

-- Finally save the doc before you work further on it. You'll have applied
manual bold formatting to all bold styles (headings?...).
A Save will enable Word to clean that unnecessary formatting up.

Greetings,
Klaus

> thanks, but that doesn't really work. Problem is that by clearing the
> format
[quoted text clipped - 23 lines]
>> > hello, I'm looking for a way to remove all font formatting from a Word
>> > document except the bold. Appreciate any suggestions. Thanks, Michiel
Helmut Weber - 25 Mar 2006 15:42 GMT
Hi Klaus,

how about this one,
coded with respect to speed
and with respect to avoiding repagination by inserting tags,
at least to some extend.

I think in principle it could be used in quite a variety of cases:

Sub test000()
Dim oPrg As Paragraph
Dim rWrd As Range
Dim rChr As Range
For Each oPrg In ActiveDocument.Paragraphs
  If oPrg.Range.Font.Bold = False Then
     oPrg.Range.Font.Reset
  ElseIf oPrg.Range.Font.Bold = True Then
     oPrg.Range.Font.Reset
     oPrg.Range.Font.Bold = True
  ElseIf oPrg.Range.Font.Bold = 9999999 Then
     For Each rWrd In oPrg.Range.Words
        If rWrd.Font.Bold = False Then
           rWrd.Font.Reset
        ElseIf rWrd.Font.Bold = True Then
           rWrd.Font.Reset
           rWrd.Font.Bold = True
        ElseIf rWrd.Font.Bold = 9999999 Then
           For Each rChr In rWrd.Characters
              If rChr.Font.Bold = True Then
                 rChr.Font.Reset
                 rChr.Font.Bold = True
              ElseIf rChr.Font.Bold = False Then
                 rChr.Font.Reset
              End If
           Next
        End If
        Next
  End If
Next
End Sub

I am not sure, whether formatting something as bold,
which is bold anyway, may cause problems sometime.

Signature

Gruß aus Landsberg am Lech

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Klaus Linke - 25 Mar 2006 21:06 GMT
Hi Helmut,

Interesting approach, looks well optimized! Though 3 replacements and
"FontReset" on the whole doc is likely pretty fast, too...
Not sure what program would "win".

It might depend on the specifics of the document (how large? how much bold
text? ...).

Regards,
Klaus

> Hi Klaus,
>
[quoted text clipped - 39 lines]
> I am not sure, whether formatting something as bold,
> which is bold anyway, may cause problems sometime.
michiel - 26 Mar 2006 23:51 GMT
> Hi Klaus,
>
[quoted text clipped - 39 lines]
> I am not sure, whether formatting something as bold,
> which is bold anyway, may cause problems sometime.
michiel - 26 Mar 2006 23:50 GMT
> Hi Michiel,
>
[quoted text clipped - 46 lines]
> >> > hello, I'm looking for a way to remove all font formatting from a Word
> >> > document except the bold. Appreciate any suggestions. Thanks, Michiel
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.