Introduction
This is a simple macro but can be quite useful at times.
How to use it
- Select some text
- Press assigned macro key , change selection case to upper case
- Press assigned macro key one more , change upper case to lower case
- Press assigned macro key one more, change lower case to capitalized case
- Press assigned macro key one more, change capitalized case to upper case
Below this line is the entire flow of the macro
Code Listing
Sub MakeCaseUpperLower()
Dim doc
set doc = ActiveDocument
if doc Is Nothing Then
Exit Sub
elseif doc.Type <> "Text" Then
Exit Sub
End If
strSelected = doc.Selection
strNewUCase = ""
strNewLCase = ""
strNewUCase = UCase(strSelected)
strNewLCase = LCase(strSelected)
if( strNewUCase = strSelected ) then
doc.Selection = LCase(strSelected)
elseif strNewLCase = strSelected Then
doc.Selection = Left(strNewUCase,1) + Right(strNewLCase, Len(strNewLCase)-1)
else
doc.Selection = strNewUCase
End if
End Sub
Conclusion
It's some very simple code. Please write your comments. Thank you.