Welcome toWord.Tips.Net
Ask a Word Question
Make a Comment
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Setting Fraction Bar Overhang Spacing in the Equation Editor
Printing On Both Sides of the Paper
Turning Off AutoComplete for Dates
Understanding Auto Line Spacing
Adding Comments to Your Document
Conditional Calculations in Word
When you are developing macros, it is often helpful to know how many characters are in a text selection. The following WordBasic macro, CharCount, will display the number of characters in a selection.
Sub MAIN
Title$ = "CharCount"
On Error Goto HugeString
InSelection = SelType()
If InSelection = 2 Or InSelection = 6 Then
CharCount = Len(Selection$())
CharCount$ = Mid$(Str$(CharCount), 2) + " character"
If CharCount <> 1 Then CharCount$ = CharCount$ + "s"
MsgBox CharCount$, Title$
Else
Beep
MsgBox "No text selected", Title$, 16
End If
Goto Done
HugeString:
MsgBox "Selection too large", Title$, 48
Done:
End Sub
Tip #745 applies to Microsoft Word versions: 6 95
Create and Merge! Using Word's mail merge tool you can quickly and easily combine data from a variety of data sources to create great individualized documents that incorporate your data in ways that you control. WordTips: Mail Merge Magic is an invaluable source for learning how to harness the full power of Word's mail merging capabilities.