Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi! What I hope is a simple ques 2

Status
Not open for further replies.

RayMunro

Technical User
Dec 4, 2001
72
GB
Hi!

What I hope is a simple question. Can you swap formatting in Word 2000. I have a whole raft of documents where I want to swap Bold. so all the bold is unbold and all the plain text becomes bold.

Is there a short cut for this?

Thanks

Ray
 
Hi Ray,

I don't know of an easy way to swap formatting in Word, but this might work for you:

1) Do a global search and replace - look for Formatting:Bold, and replace with, say, Font Color:Green;

2) Select your entire document and make it bold;

3) Do another global search and replace - look for Formatting:Font Color:Green, replace with font color:automatic and not bold.

You see the idea - you're just marking the bold text with some other formatting, making the entire document bold, and "unbolding" the marked text. Not elegant, but it'll get the job done!

Cheers,
--Michael
 
tsurikov That's the sort of lateral thinking that makes this Forum so useful



Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Thanks for the idea but it did not work. Just got the response not found.

Ray
 
Ray,

You could try using VBA to do the swapping for you. I have 2 examples that you could try. One changes between bold/notbold by each character in the document. The other by each word. The latter example is much quicker but will not change the bold status if the entire word is not bold or notbold.



Code:
Application.ScreenUpdating = False

For Each char In ActiveDocument.Characters
Select Case char.Font.Bold
Case True
char.Font.Bold = False
Case False
char.Font.Bold = True
End Select
Next
Application.ScreenUpdating = True

End Sub


Sub Swap_bold_by_words()

For Each char In ActiveDocument.Words
Select Case char.Font.Bold
Case True
char.Font.Bold = False
Case False
char.Font.Bold = True
End Select
Next

End Sub


HTH

Matt
[rockband]
 
Matt,

Thanks for this. I couldn't get the first to run but the second is brilliant.

Many Thanks,

Ray
 
Ray,

Sorry but I forgot to add the line

Sub swap_bold_by_characters()

at the beginning of the first macro.

If you try this you should see it run a lot slower than the by word macro but it is also more accurate.

Glad I could help.



Matt
[rockband]
 
For those opposed to VBA Scripting, you can also do it with find and replace although I would use chandlm's method.


Replace all bold characters with red unbolded characters
Edit > Replace > Special > Any Character > Format > Font > Bold > OK

with: Format > Font > Color Red > style Regular > replace all

Now repeat the process with replacing all black characters with bold characters

And finally replace all red characters with black characters
 
Sorry I didn't see tsurikov's thread, he has the same approach.

I did try mine and it did turn
[There are bolded words here]
to
[There are bolded words here]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top