Word.Tips.Net Welcome toWord.Tips.Net

Helpful Links

Tips.Net Home
WordTips Home

Ask a Word Question
Make a Comment

Tips.Net Store

WordTips FAQ
WordTips Premium

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

Advertise on the
WordTips Site

Newest Tips

Setting Fraction Bar Overhang Spacing in the Equation Editor

Printing On Both Sides of the Paper

Turning Off AutoComplete for Dates

Ordering Search and Replace

Understanding Auto Line Spacing

Adding Comments to Your Document

Conditional Calculations in Word

 

Determining if a Text Selection Has Been Made in WordBasic

Summary: Sometimes your macro needs to know if the user made a selection before starting the macro. Here's how to figure it out. (This tip works with Microsoft Word 6, and Word 95.)

There are numerous times when you are writing macros when you will need to determine if the user has made a selection. The following WordBasic code will let you know if a selection has been made. It sets the value of a flag, InSelection, to -1 (True) if there is currently a selection. Otherwise InSelection is set to 0 (False).

InSelection = 0
If SelType() = 2 or SelType() = 6 Then InSelection = -1

Tip #126 applies to Microsoft Word versions: 6 | 95

More Power! For some people, the prospect of creating Word macros can be scary. WordTips: The Macros can help you conquer your fears and you'll discover you're much more confident and productive as you make Word do exactly what you want. This is an invaluable source for learning macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of WordTips. Learn at your own pace, exactly the way you want.
 
Check out WordTips: The Macros today!