Is there any way to convert a document in one word upper and one lower case sequentially? For example, I write a line "HOW ARE YOU I AM FINE" and this will convert into "HoW aRe YoU i Am FiNe".
-
Are you asking to convert text in MS Word to capitalize every other letter of a sentence automatically? – Matt King Feb 26 '16 at 18:16
-
1Check out the VBA suggestion from G-Man. What you want to do is rather odd. Why would the writer of a Word Processor application bother offering this feature? Just write some code yourself in (for example) VBA, C#, C++, Delphi, etc. You can download Visual Studio 2008 or 2012 (Express) for free. The coding itself takes a bit of time to get into but once you get going you can achieve all many of fun and whacky things! :o) – AlainD Feb 29 '16 at 23:21
2 Answers
Here's a VBA routine that will do what you describe:
Sub Alternate_case()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^$"
.Forward = True
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While True
.Execute Wrap:=wdFindStop
If Not .Found Then Exit Do
Selection.Range.Case = wdUpperCase
.Execute Wrap:=wdFindStop
If Not .Found Then Exit Do
Selection.Range.Case = wdLowerCase
Loop
End With
End Sub
The Selection.HomeKey statement is equivalent
to Ctrl+Home;
it jumps to the beginning of the document.
Delete it if you just want to start wherever you are
when you invoke the routine.
The next dozen lines set up a case-insensitive, non-wildcarded,
forward search for a letter (Text = "^$").
(You may be able to get away with deleting the ….ClearFormatting lines
and the … = False lines,
as these just explicitly establish the default parameters.)
The Do While True block is an "infinite loop"
that stops after it finds the last letter in the document.
It executes the configured search (for a letter)
without wraparound to the beginning of the document (Wrap:=wdFindStop);
if it fails (Not .Found), it terminates the loop (Exit Do),
otherwise it proceeds to capitalize the selected letter and search again.
On the next search, if successful, it sets the letter to lower case,
and so on.
See How do I add VBA in MS Office? for general information on how to use VBA in Microsoft Word (and Excel, etc.)
- 7,678
- 22
- 41
- 87
This is indeed nearly possible. Just select the option you want using the capitlization font button.
Here is a full description of what you must do.
On the Home tab, in the Font group, click Change Case
, and then click the capitalization option that you want.
You can also select text then perform the keyboard shortcut
To change case by using a keyboard shortcut, press SHIFT+F3 until the style you want — title case, all caps, or lowercase — is selected.
Which is exactly what you should do to your question. You can even copy and paste the quoted text to do exactly that.
Hey guys i have a question that is there any way to convert a document in one word upper and one lower case sequentially for example i write a line "how are you i am fine" and this will convert into "HoW aRe YoU i Am FiNe"
- 41,734
- 35
- 103
- 130
-
1I just realized the output would not exactly be what you want. It is the best you can do within Word though without writing a VBA macro. – Ramhound Feb 26 '16 at 18:37

