PC Review


Reply
Thread Tools Rate Thread

replace format (subscript)

 
 
Lamb Chop
Guest
Posts: n/a
 
      5th Sep 2006
Is it possible to do the following:

I would like to change "O2" to

O<subscript> 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 With Quote
 
 
 
 
Graham Mayor
Guest
Posts: n/a
 
      5th Sep 2006
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
>
> O<subscript> 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 With Quote
 
Lamb Chop
Guest
Posts: n/a
 
      6th Sep 2006
Thanks, Graham

A very good trick.




"Graham Mayor" <(E-Mail Removed)> wrote in message
news:O$(E-Mail Removed)...
> 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
> >
> > O<subscript> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find+Replace Dialog Box, Replace with Format problem Kathy Microsoft Word Document Management 3 1st Feb 2008 05:26 AM
Word 2007: Search and replace with superscript/subscript characters Holst Microsoft Word Document Management 2 28th Sep 2007 08:42 AM
Apple version of microsoft excel where is the subscript format? =?Utf-8?B?QUxFWA==?= Microsoft Excel Misc 1 12th Jul 2006 07:35 AM
Replace million-billion number format to lakhs-crores format Sumit Microsoft Excel Misc 1 9th Dec 2005 05:58 PM
Button to format selected text as subscript John Microsoft Excel Programming 2 4th Apr 2004 02:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:59 PM.