Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
April April is offline
external usenet poster
 
Posts: 50
Default Replacing underlining and symbols problem

I am attempting to convert "greater than" and "less than" underlined symbols
to "greater than or equal to" and "less than or equal to" symbols in Word
2003. When I record a macro, the process works fine. It converts the
underlined greater/less than symbols to the correct one and leaves the not
underlined greater/less than symbols alone and gets rid of the underlining.
However, when I test the macro, it changes both the underlined symbol and the
not underlined symbol and converts it to the greater/less than or equal to
symbol, AND leaves the underlining. What can I do to ensure it only converts
the symbol that is underlined and leaves the not underlined symbol alone, and
gets rid of the underlining?

Here is the code the recorder came up with:

Sub Test11()
'
' Test11 Macro
' Macro recorded 3/27/2008 by nc6404
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ChrW(8805)
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub


I've tried inserting some font.underline code to the mix, but that doesn't
work either:

Sub Test8()
'
' Test7 Macro Edit
' Macro recorded 3/27/2008 by nc6404
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Font.Underline = wdUnderlineSingle
.Replacement.Text = ChrW(8805)
.Font.Underline = wdUnderlineNone
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub



Any ideas will be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
grammatim[_2_] grammatim[_2_] is offline
external usenet poster
 
Posts: 2,751
Default Replacing underlining and symbols problem

Wouldn't Find/Replace be a lot simpler? In the Find box type the or
the , and under More, go to Format Font and choose Underline. Or
simply press Ctrl-U. This will then find all and only the underlined
greater/less thans.

In the Replace box, type the symbol you need and press Ctrl-U once or
twice until Not Underline appears. (Or go through the More pane.)

Do "Find Next" and "Replace" once just to be sure, and then Replace
All.

Repeat for the other one -- you don't even have to retype the
formatting options.

On Mar 27, 12:36*pm, April wrote:
I am attempting to convert "greater than" and "less than" underlined symbols
to "greater than or equal to" and "less than or equal to" symbols in Word
2003. When I record a macro, the process works fine. It converts the
underlined greater/less than symbols to the correct one and leaves the not
underlined greater/less than symbols alone and gets rid of the underlining..
However, when I test the macro, it changes both the underlined symbol and the
not underlined symbol and converts it to the greater/less than or equal to
symbol, AND leaves the underlining. What can I do to ensure it only converts
the symbol that is underlined and leaves the not underlined symbol alone, and
gets rid of the underlining?

Here is the code the recorder came up with:

Sub Test11()
'
' Test11 Macro
' Macro recorded 3/27/2008 by nc6404
'
* * Selection.Find.ClearFormatting
* * Selection.Find.Replacement.ClearFormatting
* * With Selection.Find
* * * * .Text = ""
* * * * .Replacement.Text = ChrW(8805)
* * * * .Forward = True
* * * * .Wrap = wdFindContinue
* * * * .Format = True
* * * * .MatchCase = False
* * * * .MatchWholeWord = False
* * * * .MatchWildcards = False
* * * * .MatchSoundsLike = False
* * * * .MatchAllWordForms = False
* * End With
* * Selection.Find.Execute Replace:=wdReplaceAll
End Sub

I've tried inserting some font.underline code to the mix, but that doesn't
work either:

Sub Test8()
'
' Test7 Macro Edit
' Macro recorded 3/27/2008 by nc6404
'
* * Selection.Find.ClearFormatting
* * Selection.Find.Replacement.ClearFormatting
* * With Selection.Find
* * * * .Text = ""
* * * * .Font.Underline = wdUnderlineSingle
* * * * .Replacement.Text = ChrW(8805)
* * * * .Font.Underline = wdUnderlineNone
* * * * .Forward = True
* * * * .Wrap = wdFindContinue
* * * * .Format = True
* * * * .MatchCase = False
* * * * .MatchWholeWord = False
* * * * .MatchWildcards = False
* * * * .MatchSoundsLike = False
* * * * .MatchAllWordForms = False
* * End With
* * Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Any ideas will be greatly appreciated.


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Replacing underlining and symbols problem

In your Test8 macro, change the line

.Font.Underline = wdUnderlineNone

to

.Replacement.Font.Underline = wdUnderlineNone

The line you have now changes the formatting used for the .Text search term
(which is implied by the absence of any qualification of the .Font keyword),
where what you want is to change the formatting of the .Replacement.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

April wrote:
I am attempting to convert "greater than" and "less than" underlined
symbols to "greater than or equal to" and "less than or equal to"
symbols in Word 2003. When I record a macro, the process works fine.
It converts the underlined greater/less than symbols to the correct
one and leaves the not underlined greater/less than symbols alone and
gets rid of the underlining. However, when I test the macro, it
changes both the underlined symbol and the not underlined symbol and
converts it to the greater/less than or equal to symbol, AND leaves
the underlining. What can I do to ensure it only converts the symbol
that is underlined and leaves the not underlined symbol alone, and
gets rid of the underlining?

Here is the code the recorder came up with:

Sub Test11()
'
' Test11 Macro
' Macro recorded 3/27/2008 by nc6404
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ChrW(8805)
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub


I've tried inserting some font.underline code to the mix, but that
doesn't work either:

Sub Test8()
'
' Test7 Macro Edit
' Macro recorded 3/27/2008 by nc6404
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Font.Underline = wdUnderlineSingle
.Replacement.Text = ChrW(8805)
.Font.Underline = wdUnderlineNone
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub



Any ideas will be greatly appreciated.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
April April is offline
external usenet poster
 
Posts: 50
Default Replacing underlining and symbols problem

That worked great! Thanks!

And we need to do this in a macro primarily because we've got a few hundred
documents to edit.

Thanks!

"Jay Freedman" wrote:

In your Test8 macro, change the line

.Font.Underline = wdUnderlineNone

to

.Replacement.Font.Underline = wdUnderlineNone

The line you have now changes the formatting used for the .Text search term
(which is implied by the absence of any qualification of the .Font keyword),
where what you want is to change the formatting of the .Replacement.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

April wrote:
I am attempting to convert "greater than" and "less than" underlined
symbols to "greater than or equal to" and "less than or equal to"
symbols in Word 2003. When I record a macro, the process works fine.
It converts the underlined greater/less than symbols to the correct
one and leaves the not underlined greater/less than symbols alone and
gets rid of the underlining. However, when I test the macro, it
changes both the underlined symbol and the not underlined symbol and
converts it to the greater/less than or equal to symbol, AND leaves
the underlining. What can I do to ensure it only converts the symbol
that is underlined and leaves the not underlined symbol alone, and
gets rid of the underlining?

Here is the code the recorder came up with:

Sub Test11()
'
' Test11 Macro
' Macro recorded 3/27/2008 by nc6404
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ChrW(8805)
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub


I've tried inserting some font.underline code to the mix, but that
doesn't work either:

Sub Test8()
'
' Test7 Macro Edit
' Macro recorded 3/27/2008 by nc6404
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Font.Underline = wdUnderlineSingle
.Replacement.Text = ChrW(8805)
.Font.Underline = wdUnderlineNone
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub



Any ideas will be greatly appreciated.




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
Problem: Autocorrect replacing words before I hit the space bar Nemo42117 Microsoft Word Help 7 July 19th 07 03:26 AM
Underlining problem BigJB3 Microsoft Word Help 1 May 4th 07 03:46 PM
Symbols (Insert Problem)_2003 Mark Forman / DRC, TRCT Microsoft Word Help 1 March 19th 07 02:37 PM
Replacing highlighted text by typing - a problem Henley writer Microsoft Word Help 4 April 7th 06 09:42 AM
Finding and replacing symbols Hans L Microsoft Word Help 0 November 6th 05 01:00 AM


All times are GMT +1. The time now is 10:19 AM.

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"