Click here to Skip to main content
Click here to Skip to main content

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

, 1 Dec 2003
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

Comments and Discussions

 
GeneralAnother way Pinmembermelwyn11-Dec-03 1:17 
QuestionCamelCase? PinmemberJonathan de Halleux3-Dec-03 2:13 
AnswerRe: CamelCase? Pinmember=[ Abin ]=4-Dec-03 14:05 
GeneralOutrageous abuse of the article rating system PinstaffNishant S2-Dec-03 20:57 
QuestionWhere's the MACRO??? PinmemberWREY2-Dec-03 9:13 
AnswerRe: Where's the MACRO??? PinsitebuilderErik Thompson2-Dec-03 13:01 
GeneralRe: Where's the MACRO??? PinsitebuilderErik Thompson3-Dec-03 8:24 
GeneralThis is not an article PinmemberJonathan de Halleux2-Dec-03 1:46 
GeneralRe: No, this is a joke PinmemberJonny Newman2-Dec-03 12:58 
GeneralRe: No, this is a joke PinsitebuilderErik Thompson2-Dec-03 13:03 
GeneralRe: No, this is a joke PinstaffNishant S2-Dec-03 20:59 
GeneralRe: No, this is a joke PinmemberJonny Newman3-Dec-03 3:47 
GeneralRe: No, this is a joke PinstaffNishant S4-Dec-03 17:04 
GeneralRe: No, this is a joke PinmemberJonny Newman3-Dec-03 3:45 
GeneralRe: No, this is a joke PinsitebuilderErik Thompson3-Dec-03 8: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.141220.1 | Last Updated 2 Dec 2003
Article Copyright 2003 by Hae Moon, Kwon
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid