Thanks, I know I am being very persistent. Basically I decided that if even
if i could select the text with a macro, then I could use the Format >>
Change Case command to change the text as I needed.
I used you code which worked when i inserted:
Sub Test2()
Dim pChar As Variant
For Each pChar In ActiveDocument.Characters
If pChar Like "[A-Z]" Then
pChar.Select
End If
Next
End Sub
But it would only select the last letter in the document that was caps. Any
ideas?
Thbaks
Josha
> Presumably this relates to your previous post about correcting upper-case
> names. The problem here is not so much the VBA code as specifying what the
[quoted text clipped - 31 lines]
> >
> > Josha
Jezebel - 07 Sep 2006 05:34 GMT
What your code does is select each character in turn, until it reaches the
end of the document, leaving the last one selected. Run it by pressing F8
repeatedly to see what's going on.
> Thanks, I know I am being very persistent. Basically I decided that if
> even
[quoted text clipped - 61 lines]
>> >
>> > Josha
Josha - 07 Sep 2006 06:05 GMT
ok... so would i need to use a wend command or something to loop the select
and add the selections togeather. As i said... i have no idea.
> What your code does is select each character in turn, until it reaches the
> end of the document, leaving the last one selected. Run it by pressing F8
[quoted text clipped - 65 lines]
> >> >
> >> > Josha
Jezebel - 07 Sep 2006 06:37 GMT
'Or something' is what you'll need, yes.
> ok... so would i need to use a wend command or something to loop the
> select
[quoted text clipped - 76 lines]
>> >> >
>> >> > Josha
Josha - 07 Sep 2006 07:07 GMT
:P is this one of those "i wont tell you so you learn things" or is it a "not
possible" or "i dont know" things
> 'Or something' is what you'll need, yes.
>
[quoted text clipped - 78 lines]
> >> >> >
> >> >> > Josha
Jezebel - 07 Sep 2006 07:32 GMT
This is a "you're starting in absolutely the wrong place to solve this
problem" kind of thing. I could write you whole essays on ways you could
approach this task, but you've resolutely ignored all the previous
suggestions I and others have offered.
Go buy a book.
> :P is this one of those "i wont tell you so you learn things" or is it a
> "not
[quoted text clipped - 92 lines]
>> >> >> >
>> >> >> > Josha
Jean-Guy Marcil - 07 Sep 2006 13:20 GMT
Josha was telling us:
Josha nous racontait que :
> ok... so would i need to use a wend command or something to loop the
> select and add the selections togeather. As i said... i have no idea.
AS others have said, this is easier said than done. Since you seem you
really want to do this, here is some code that will get you started. Be
warned that there are many problems ahead: Just to state one: How to deal
with compound words that needs to be capitalized (Dominican Republic)?
Also, dealing with characters in a document makes for code that is really
slow... you may want to change the approach for words, but it will still be
slow...
It would be better to find a way to do this with Find/Replace.
'_______________________________________
Dim pChar As Range
Dim rgeTemp As Range
Dim lngRgeStart As Long
Dim lngRgeEnd As Long
Dim boolFoundCaps As Boolean
lngCharCount = ActiveDocument.Characters.Count
boolFoundCaps = False
For Each pChar In ActiveDocument.Characters
If pChar Like "[A-Z]" Then
If Not boolFoundCaps Then
lngRgeStart = pChar.Start
boolFoundCaps = True
End If
Else
If boolFoundCaps Then
lngRgeEnd = pChar.Start
boolFoundCaps = False
Set rgeTemp = ActiveDocument.Range(lngRgeStart, lngRgeEnd)
If rgeTemp.Characters.Count <> 1 Then
If Not rgeTemp.Text Like "BP" And _
Not rgeTemp.Text Like "MT" And _
Not rgeTemp.Text Like "RS" Then
rgeTemp.Case = wdLowerCase
End If
End If
End If
End If
Next
'_______________________________________

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Doug Robbins - Word MVP - 08 Sep 2006 21:39 GMT
Use the following:
Dim drange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="[A-Z]{2,}", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True
Set drange = Selection.Range
drange.Case = wdTitleWord
Loop
End With

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Thanks, I know I am being very persistent. Basically I decided that if
> even
[quoted text clipped - 61 lines]
>> >
>> > Josha