RE: Repeatedly Change First Letter After [period][blank] to Uppercase



The problem is that you use the range object to find the text (which is
fine), but you apply the changes to the selection and not the range you
found. Therefore, what your macro does is that it changes the characters
found after the selection you had when starting the macro - the number of
characters changed equals the number of ". " found. If you use F8 to step
through the macro, you can see what happens.

You could change the Do-Loop in you macro to the following (note that the
code below also applies uppercase to ". " - but since uppercase and
lowercase of ". " are identical, this is OK).

Do While .Execute = True
With .Parent
Include the next character
.End = .End + 1
'Change to uppercase
.Case = wdUpperCase
'Make sure to move on to next ". "
.Start = .End
End With
Loop

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Don Macnaughton" wrote:

I'm developing a macro in Word 2003 to convert text from point form to
finished test. One step is supposed to find the string [period][blank] i.e.,
the end of each sentence. Then it's supposed to convert the character
immediately following this string to uppercase because this character will be
the first letter in the next sentence, which therefore should be in
uppercase. Here's what I've been trying to use, which converts a large
number of consecutive characters to uppercase:

With ActiveDocument.Content.Find
.Text = ". "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

Do While .Execute = True
With .Parent
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Range.Case = wdUpperCase
.Move Unit:=wdSentence, Count:=1
End With
Loop
End With

Thanks for your help.
.



Relevant Pages

  • Re: More on Format part of a found text string
    ... the close parentheses character ")" should be added to the list of characters ... This way, the macro ... while a Range object represents a portion of the doc ... > the selection and moving the cursor to the position after the number. ...
    (microsoft.public.word.vba.general)
  • Re: Stump on .range.characters
    ... for this sort of coding you shouldn't be using the Selection object ... other than to determine what the user wants the macro to work on. ... you don't need to select the character and extend the ...
    (microsoft.public.word.vba.beginners)
  • Re: Insert/Remove a "!" in front of every line of a selected text
    ... Furthermore, the end-of-line character seems ... Set oRg = Selection.Range ... ' If the selection is exactly one ... Another macro should be able to remove that "!" ...
    (microsoft.public.word.vba.general)
  • Re: Swap two selections
    ... > If you do not include the space after the third word in the selection, ... to make the macro work. ... I'm starting to understand a bit about string concatenation, ... to remove the last character in a string but don't know what it is? ...
    (microsoft.public.word.vba.beginners)
  • Re: How to remove automatically some pages?
    ... Word MVP web site http://word.mvps.org ... pages using tha macro from you. ... without the extra character. ...
    (microsoft.public.word.newusers)