Click here to Skip to main content
11,584,208 members (57,800 online)
Click here to Skip to main content

Macros : Upper case -> Lower case -> Capitalized case

, 1 Dec 2003 69.6K 5
Rate this:
Please Sign up or sign in to vote.
This macro provides some useful functions for editing : change selection case to Upper case, Lower case, Capitalized case with rotation

Introduction

This is a simple macro but can be quite useful at times.

How to use it

  1. Select some text
  2. Press assigned macro key , change selection case to upper case
  3. Press assigned macro key one more , change upper case to lower case
  4. Press assigned macro key one more, change lower case to capitalized case
  5. Press assigned macro key one more, change capitalized case to upper case

Below this line is the entire flow of the macro

  • Selected case ->
    • Upper case ->
      • Lower case ->
        • Capitalized Case ->
          • Upper Case

Code Listing

Sub MakeCaseUpperLower()
Dim doc
set doc = ActiveDocument 

' Be sure active document is a text document
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)
' Upper case -> Lower case
if( strNewUCase = strSelected ) then
doc.Selection = LCase(strSelected)
' Lower case -> Capitalized Case
elseif strNewLCase = strSelected Then
doc.Selection = Left(strNewUCase,1) + Right(strNewLCase, Len(strNewLCase)-1)
' Capitalized Case
else
doc.Selection = strNewUCase
End if
End Sub 

Conclusion

It's some very simple code. Please write your comments. Thank you.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Hae Moon, Kwon
Web Developer
Korea (Republic Of) Korea (Republic Of)
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralAnother way Pin
melwyn11-Dec-03 0:17
membermelwyn11-Dec-03 0:17 
QuestionCamelCase? Pin
Jonathan de Halleux3-Dec-03 1:13
memberJonathan de Halleux3-Dec-03 1:13 
AnswerRe: CamelCase? Pin
=[ Abin ]=4-Dec-03 13:05
member=[ Abin ]=4-Dec-03 13:05 
GeneralOutrageous abuse of the article rating system Pin
Nishant S2-Dec-03 19:57
staffNishant S2-Dec-03 19:57 
QuestionWhere's the MACRO??? Pin
WREY2-Dec-03 8:13
memberWREY2-Dec-03 8:13 
AnswerRe: Where's the MACRO??? Pin
Erik Thompson2-Dec-03 12:01
sitebuilderErik Thompson2-Dec-03 12:01 
GeneralRe: Where's the MACRO??? Pin
Erik Thompson3-Dec-03 7:24
sitebuilderErik Thompson3-Dec-03 7:24 
GeneralThis is not an article Pin
Jonathan de Halleux2-Dec-03 0:46
memberJonathan de Halleux2-Dec-03 0:46 
GeneralRe: No, this is a joke Pin
Jonny Newman2-Dec-03 11:58
memberJonny Newman2-Dec-03 11:58 
GeneralRe: No, this is a joke Pin
Erik Thompson2-Dec-03 12:03
sitebuilderErik Thompson2-Dec-03 12:03 
GeneralRe: No, this is a joke Pin
Nishant S2-Dec-03 19:59
staffNishant S2-Dec-03 19:59 
GeneralRe: No, this is a joke Pin
Jonny Newman3-Dec-03 2:47
memberJonny Newman3-Dec-03 2:47 
GeneralRe: No, this is a joke Pin
Nishant S4-Dec-03 16:04
staffNishant S4-Dec-03 16:04 
GeneralRe: No, this is a joke Pin
Jonny Newman3-Dec-03 2:45
memberJonny Newman3-Dec-03 2:45 
GeneralRe: No, this is a joke Pin
Erik Thompson3-Dec-03 7:23
sitebuilderErik Thompson3-Dec-03 7:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150603.1 | Last Updated 2 Dec 2003
Article Copyright 2003 by Hae Moon, Kwon
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid