Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
briggs1055 briggs1055 is offline
external usenet poster
 
Posts: 6
Default Find & Replace All - Subscripts

Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Find & Replace All - Subscripts

Format one AAl2O3 to be exactly as you need it, select it and then copy to
the clipboard. Open Replace, in the Find What, paste the usual AAl2O3, in the
Replace With type ^c, this represents the Clipboard contents, now Replace.

Hope this helps
DeanH


"briggs1055" wrote:

Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Find & Replace All - Subscripts

Format one AAl2O3 to be exactly as you need it, select it and then copy to
the clipboard. Open Replace, in the Find What, paste the usual AAl2O3, in the
Replace With type ^c, this represents the Clipboard contents, now Replace.

Hope this helps
DeanH


"briggs1055" wrote:

Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Find & Replace All - Subscripts

Hi briggs1055,

The following macro will search the active document for all numbers preceded by a letter or a right bracket, and subscript just the
numbers. Unless you're working with isotopes, the results should be correct - you'll need to apply the isotope superscripting
yourself (if the numbers are already superscripted, theyll be left alone).

If your document has other alphanumeric strings in which a non-superscripted number follows a letter (eg Table cell references),
youll need to select only the range(s) containing the text to be converted and answer €˜No to the prompt.

Sub ChemicalFormatter()
Dim oRng As Range, fRng As Range, bState As Boolean
Application.ScreenUpdating = False
Select Case MsgBox("Do you want to process the whole document?", _
vbYesNoCancel + vbQuestion, "Chemical Formatter")
Case vbYes
bState = True
Case vbNo
bState = False
Case vbCancel
End
End Select
With Selection
Set oRng = .Range
With .Find
.ClearFormatting
.Text = "[A-Za-z)][0-9]{1,}"
.MatchWildcards = True
.Wrap = wdFindContinue
.Forward = True
Do While .Execute = True
Set fRng = ActiveDocument.Range(Start:=Selection.Start + 1, End:=Selection.End)
If bState = False Then
If fRng.Start = oRng.End Then Exit Do
If fRng.End = oRng.End Then fRng.End = oRng.End
End If
If fRng.Font.Superscript = False Then fRng.Font.Subscript = True
fRng.Collapse Direction:=wdCollapseEnd
Loop
End With
End With
oRng.Select
Set fRng = Nothing
Set oRng = Nothing
Application.ScreenUpdating = True
End Sub


--
Cheers
macropod
[Microsoft MVP - Word]


"briggs1055" wrote in message ...
Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Find & Replace All - Subscripts

Hi briggs1055,

The following macro will search the active document for all numbers preceded by a letter or a right bracket, and subscript just the
numbers. Unless you're working with isotopes, the results should be correct - you'll need to apply the isotope superscripting
yourself (if the numbers are already superscripted, theyll be left alone).

If your document has other alphanumeric strings in which a non-superscripted number follows a letter (eg Table cell references),
youll need to select only the range(s) containing the text to be converted and answer €˜No to the prompt.

Sub ChemicalFormatter()
Dim oRng As Range, fRng As Range, bState As Boolean
Application.ScreenUpdating = False
Select Case MsgBox("Do you want to process the whole document?", _
vbYesNoCancel + vbQuestion, "Chemical Formatter")
Case vbYes
bState = True
Case vbNo
bState = False
Case vbCancel
End
End Select
With Selection
Set oRng = .Range
With .Find
.ClearFormatting
.Text = "[A-Za-z)][0-9]{1,}"
.MatchWildcards = True
.Wrap = wdFindContinue
.Forward = True
Do While .Execute = True
Set fRng = ActiveDocument.Range(Start:=Selection.Start + 1, End:=Selection.End)
If bState = False Then
If fRng.Start = oRng.End Then Exit Do
If fRng.End = oRng.End Then fRng.End = oRng.End
End If
If fRng.Font.Superscript = False Then fRng.Font.Subscript = True
fRng.Collapse Direction:=wdCollapseEnd
Loop
End With
End With
oRng.Select
Set fRng = Nothing
Set oRng = Nothing
Application.ScreenUpdating = True
End Sub


--
Cheers
macropod
[Microsoft MVP - Word]


"briggs1055" wrote in message ...
Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks




  #6   Report Post  
Posted to microsoft.public.word.docmanagement
briggs1055 briggs1055 is offline
external usenet poster
 
Posts: 6
Default Find & Replace All - Subscripts

Thanks - Brilliant

"DeanH" wrote:

Format one AAl2O3 to be exactly as you need it, select it and then copy to
the clipboard. Open Replace, in the Find What, paste the usual AAl2O3, in the
Replace With type ^c, this represents the Clipboard contents, now Replace.

Hope this helps
DeanH


"briggs1055" wrote:

Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks

  #7   Report Post  
Posted to microsoft.public.word.docmanagement
briggs1055 briggs1055 is offline
external usenet poster
 
Posts: 6
Default Find & Replace All - Subscripts

Thanks - Brilliant!

"macropod" wrote:

Hi briggs1055,

The following macro will search the active document for all numbers preceded by a letter or a right bracket, and subscript just the
numbers. Unless you're working with isotopes, the results should be correct - you'll need to apply the isotope superscripting
yourself (if the numbers are already superscripted, theyll be left alone).

If your document has other alphanumeric strings in which a non-superscripted number follows a letter (eg Table cell references),
youll need to select only the range(s) containing the text to be converted and answer €˜No to the prompt.

Sub ChemicalFormatter()
Dim oRng As Range, fRng As Range, bState As Boolean
Application.ScreenUpdating = False
Select Case MsgBox("Do you want to process the whole document?", _
vbYesNoCancel + vbQuestion, "Chemical Formatter")
Case vbYes
bState = True
Case vbNo
bState = False
Case vbCancel
End
End Select
With Selection
Set oRng = .Range
With .Find
.ClearFormatting
.Text = "[A-Za-z)][0-9]{1,}"
.MatchWildcards = True
.Wrap = wdFindContinue
.Forward = True
Do While .Execute = True
Set fRng = ActiveDocument.Range(Start:=Selection.Start + 1, End:=Selection.End)
If bState = False Then
If fRng.Start = oRng.End Then Exit Do
If fRng.End = oRng.End Then fRng.End = oRng.End
End If
If fRng.Font.Superscript = False Then fRng.Font.Subscript = True
fRng.Collapse Direction:=wdCollapseEnd
Loop
End With
End With
oRng.Select
Set fRng = Nothing
Set oRng = Nothing
Application.ScreenUpdating = True
End Sub


--
Cheers
macropod
[Microsoft MVP - Word]


"briggs1055" wrote in message ...
Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks


.

  #8   Report Post  
Posted to microsoft.public.word.docmanagement
briggs1055 briggs1055 is offline
external usenet poster
 
Posts: 6
Default Find & Replace All - Subscripts

Thanks - Brilliant

"DeanH" wrote:

Format one AAl2O3 to be exactly as you need it, select it and then copy to
the clipboard. Open Replace, in the Find What, paste the usual AAl2O3, in the
Replace With type ^c, this represents the Clipboard contents, now Replace.

Hope this helps
DeanH


"briggs1055" wrote:

Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

Thanks

  #9   Report Post  
Posted to microsoft.public.word.docmanagement
briggs1055 briggs1055 is offline
external usenet poster
 
Posts: 6
Default Find & Replace All - Subscripts

Thanks - Brilliant!

"macropod" wrote:

Hi briggs1055,

The following macro will search the active document for all numbers preceded by a letter or a right bracket, and subscript just the
numbers. Unless you're working with isotopes, the results should be correct - you'll need to apply the isotope superscripting
yourself (if the numbers are already superscripted, theyll be left alone).

If your document has other alphanumeric strings in which a non-superscripted number follows a letter (eg Table cell references),
youll need to select only the range(s) containing the text to be converted and answer €˜No to the prompt.

Sub ChemicalFormatter()
Dim oRng As Range, fRng As Range, bState As Boolean
Application.ScreenUpdating = False
Select Case MsgBox("Do you want to process the whole document?", _
vbYesNoCancel + vbQuestion, "Chemical Formatter")
Case vbYes
bState = True
Case vbNo
bState = False
Case vbCancel
End
End Select
With Selection
Set oRng = .Range
With .Find
.ClearFormatting
.Text = "[A-Za-z)][0-9]{1,}"
.MatchWildcards = True
.Wrap = wdFindContinue
.Forward = True
Do While .Execute = True
Set fRng = ActiveDocument.Range(Start:=Selection.Start + 1, End:=Selection.End)
If bState = False Then
If fRng.Start = oRng.End Then Exit Do
If fRng.End = oRng.End Then fRng.End = oRng.End
End If
If fRng.Font.Superscript = False Then fRng.Font.Subscript = True
fRng.Collapse Direction:=wdCollapseEnd
Loop
End With
End With
oRng.Select
Set fRng = Nothing
Set oRng = Nothing
Application.ScreenUpdating = True
End Sub


--
Cheers
macropod
[Microsoft MVP - Word]


"briggs1055" wrote in message ...
Hi

Query regarding Word 2003:

I have a number of documents to format, required to change all AAl2O3 to
have the 2 & 3 as subscript to show as chemical formula for the mineral.

I've set up autocorrect within my templates, so it does it when I type....
however working for a large corporation I'm unable to change the normal.dot
template, therefore get the document back to re-format!

I've tried to find & replace the word however within the advance options you
can only select the whole word to be subscript not individual characters....

Any help would be brilliant as I have a fair few large docs to do!

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
Find+Replace Dialog Box, Replace with Format problem Kathy Microsoft Word Help 3 February 1st 08 04:26 AM
Find multiple characters in one find using MSword find/replace Cliff Microsoft Word Help 2 October 29th 06 07:48 PM
Trying to replace words with fields using Find/Replace mbleyle Microsoft Word Help 2 March 29th 06 11:35 PM
Using find and replace or macros to replace page ranges JeremyC Microsoft Word Help 7 February 13th 06 09:20 PM
Find/ Replace is auto-capping the words I want to replace with Graham Mayor Microsoft Word Help 8 January 27th 06 01:39 AM


All times are GMT +1. The time now is 02:33 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"