Jay
Mon Oct 13 21:05:37 CDT 2003
Hi, Annette,
Use this macro. (For instructions on putting a macro into a template, see
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm.)
Sub CountChars()
Dim Letters(25) As Long
Dim startCt As Long, endCt As Long
Dim oRg As Range
Dim ch As Integer
Dim msg As String
For ch = 1 To 26
Set oRg = ActiveDocument.Range
startCt = oRg.Characters.Count
With oRg.Find
.ClearFormatting
.Format = False
.Forward = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.Text = Chr(64 + ch) ' "A" = Chr(65)
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
endCt = oRg.Characters.Count
Letters(ch - 1) = startCt - endCt
ActiveDocument.Undo
Next ch
For ch = 1 To 26
msg = msg & Chr(64 + ch) & vbTab & _
Letters(ch - 1) & vbCr
Next ch
MsgBox msg, , "Results"
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://www.mvps.org/word
Annette wrote:
> is there a way to count individual characters in word or
> is there an attachment available?
> I am creating a name directory and need to buy the
> individual letters to create each name. I don't want to go
> through the 30 odd names: counting all the A's, B's etc.
> Could you help me?
> Thank you.
>
> CAR