Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Lamb Chop Lamb Chop is offline
external usenet poster
 
Posts: 23
Default replace format (subscript)

Is it possible to do the following:

I would like to change "O2" to

Osubscript 2/subscript

I can only change the whole word "O2" to

subscript O2 /subscript

If I just replace "2", I will run into trouble because the whole document
has a lot of numbers.

I use office 2k

Thanks


  #2   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default replace format (subscript)

You can do it in stages.
Replace O2 with
O &&2
(Note the space)
Replace &&2
with ^& format superscript
Replace space&&
with nothing

or by macro

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "O2"
.Replacement.Text = "O &&2"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "&&2"
.Replacement.Text = "^&"
.Replacement.Font.Superscript = True
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " &&"
.Replacement.Text = ""
End With
Selection.Find.Execute replace:=wdReplaceAll

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Lamb Chop wrote:
Is it possible to do the following:

I would like to change "O2" to

Osubscript 2/subscript

I can only change the whole word "O2" to

subscript O2 /subscript

If I just replace "2", I will run into trouble because the whole
document has a lot of numbers.

I use office 2k

Thanks



  #3   Report Post  
Posted to microsoft.public.word.newusers
Lamb Chop Lamb Chop is offline
external usenet poster
 
Posts: 23
Default replace format (subscript)

Thanks, Graham

A very good trick.




"Graham Mayor" wrote in message
...
You can do it in stages.
Replace O2 with
O &&2
(Note the space)
Replace &&2
with ^& format superscript
Replace space&&
with nothing

or by macro

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "O2"
.Replacement.Text = "O &&2"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "&&2"
.Replacement.Text = "^&"
.Replacement.Font.Superscript = True
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " &&"
.Replacement.Text = ""
End With
Selection.Find.Execute replace:=wdReplaceAll

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Lamb Chop wrote:
Is it possible to do the following:

I would like to change "O2" to

Osubscript 2/subscript

I can only change the whole word "O2" to

subscript O2 /subscript

If I just replace "2", I will run into trouble because the whole
document has a lot of numbers.

I use office 2k

Thanks





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Format painter doesn't work with F5??!! Epinn Microsoft Word Help 1 August 22nd 06 06:44 PM
Number format field wordspinster Page Layout 1 August 5th 06 12:21 AM
Search and replace of format deleted text John Voda Microsoft Word Help 1 January 30th 06 10:05 PM
Bizarre wildcard replace cfulmer Microsoft Word Help 2 January 29th 06 07:15 AM
wildcard replacing dk Page Layout 11 December 6th 04 02:04 AM


All times are GMT +1. The time now is 03:14 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"