K
klam
I use Format > Change Case > Title Case quite frequently. However, it is a
pain to have to change all the short words (e.g., the, a, of) back to lower
case.
There is a macro that takes care of that (shown below). I was wondering if I
should replace Word's Change Case function with this macro. Any downsides to
doing that? I've never written my own macro before and all previous macro
work was "step by step" instructions I followed.
If I replace Word's Change Case function with this macro, can someone pls
let me know how I would go about doing it? If I didn't replace the Word
function, how would I set up using this macro?
Using Word 2003 on standalone PC (XP).
Any insights much appreciated.
Here's the macro:
Intelligent Title Case, taken from Allen Wyatt's Word Tips (on-line):
Sub TitleCase()
Dim lclist As String
Dim wrd As Integer
Dim sTest As String
' list of lowercase words, surrounded by spaces
lclist = " of the by to this is from a "
Selection.Range.Case = wdTitleWord
For wrd = 2 To Selection.Range.Words.Count
sTest = Trim(Selection.Range.Words(wrd))
sTest = " " & LCase(sTest) & " "
If InStr(lclist, sTest) Then
Selection.Range.Words(wrd).Case = wdLowerCase
End If
Next wrd
End Sub
pain to have to change all the short words (e.g., the, a, of) back to lower
case.
There is a macro that takes care of that (shown below). I was wondering if I
should replace Word's Change Case function with this macro. Any downsides to
doing that? I've never written my own macro before and all previous macro
work was "step by step" instructions I followed.
If I replace Word's Change Case function with this macro, can someone pls
let me know how I would go about doing it? If I didn't replace the Word
function, how would I set up using this macro?
Using Word 2003 on standalone PC (XP).
Any insights much appreciated.
Here's the macro:
Intelligent Title Case, taken from Allen Wyatt's Word Tips (on-line):
Sub TitleCase()
Dim lclist As String
Dim wrd As Integer
Dim sTest As String
' list of lowercase words, surrounded by spaces
lclist = " of the by to this is from a "
Selection.Range.Case = wdTitleWord
For wrd = 2 To Selection.Range.Words.Count
sTest = Trim(Selection.Range.Words(wrd))
sTest = " " & LCase(sTest) & " "
If InStr(lclist, sTest) Then
Selection.Range.Words(wrd).Case = wdLowerCase
End If
Next wrd
End Sub