Case switching
Posted
by David Little
on November 29th, 1998
Sub SwapCase() ' DESCRIPTION: Macro to swap the case of selected words. ' ' David Little ' COADE, Inc. ' Houston, TX ' dlittle@coade.com ' 5OCT98 ' str = ActiveDocument.Selection.Text str1 = "" i = 1 Do While (i < Len(str)+1) If (Mid(str, i, 1) = LCase(Mid(str, i, 1))) Then str1 = str1 + UCase(Mid(str, i, 1)) Else str1 = str1 + LCase(Mid(str, i, 1)) End If i = i + 1 Loop ActiveDocument.Selection.Text = str1 End Sub

Comments
SwapCase macro updated for VS.NET
Posted by Legacy on 07/08/2002 12:00amOriginally posted by: David Little
Replyreplacing instead of adding to
Posted by Legacy on 12/26/2001 12:00amOriginally posted by: Max MacLean
When I ran the above macro, it appended the converted
string to the end of the origanal string. I added
ActiveDocument.Selection.Delete
just before the
ActiveDocument.Selection.Text = strNew
Peace and Happiness
ReplyEnhancement required...
Posted by Legacy on 10/23/2001 12:00amOriginally posted by: dmaly
Is it possible to SELECT back the converted area ?
ReplyAlternate Macro
Posted by Legacy on 05/31/2001 12:00amOriginally posted by: George
ReplyCase Switching with ease 1.0
Posted by Legacy on 01/20/1999 12:00amOriginally posted by: Farhan Noor Qureshi
This macro is a very handy tool for me. Thanks David!
The main problem is not about caps lock's wrong position on the key board, rather it is the programmer's attention on his work.
Very good solution to a very annoying problem.
ReplyFarhan Noor Qureshi
Case swap macro comment
Posted by Legacy on 11/30/1998 12:00amOriginally posted by: Filip Dossche
I have the same typing problem so this is really a neat bit of code, quite small and not really very difficult but "why did'nt I think of that myself !!"
Reply