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
Some WordTips readers have extended their use of Word by using macros to automatically add special codes to their documents. For instance, to covert regular text to SGML format. (SGML is a predecessor to HTML and is used for many on-line and publishing needs.) Parsing regular text using macros is no problem, but if you insert a symbol in your document (using the Symbol option from the Insert menu) then parsing can be a bit more complex. This is because Word internally represents the symbol using multiple characters. Thus, the regular ASC function will not work to retrieve a symbol.
Word 6 and Word 95 include a special macro which you can install to allow you to extract the symbol character information. The macro, FindSymbol, is included in the Macros60.dot or Macros70.dot files which can be optionally installed on your system. Simply rerun the Word Setup program and choose to install these macros.
If you are the type that likes to write your own macros, you can parse the symbols by first searching for each occurrence of a left parentheses (ASCII value 40) in your document. Then, you can use GetCurValues and the InsertSymbol object to get the details on the character. As you might imagine, search for a left parentheses also returns many "false" hits, namely those where you simply use the left parentheses in your document. The following WordBasic macro provides an example of how you can get information about the symbols in your document while still bypassing traditional use of the left parentheses.
Sub MAIN
EditFind .Find = "(", .Direction = 0, .MatchCase = 0, .WholeWord = 0, \
.PatternMatch = 0, .SoundsLike = 0, .Format = 0, .Wrap = 0
While EditFindFound()
Dim InsSym As InsertSymbol
GetCurValues InsSym
vFont$ = InsSym.Font
vCharNum$ = InsSym.CharNum
If vCharNum$ <> "40" Then
MsgBox "Font: " + vFont$ + Chr$(10) + "CharNum: " + vCharNum$
EndIf
RepeatFind
Wend
End Sub
When you run this macro on an open document, it stops every time it locates a symbol and displays both the font and ASCII value of the symbol. When you click on the OK button, the macro continues looking through the document for the next symbol.
Tip #123 applies to Microsoft Word versions: 6 95
Step Up and Take Control! Subscribers to WordTips know just how valuable a resource it is. WordTips Premium provides twice the number of exceptional, easy-to-understand tips every week in an ad-free newsletter, as well as substantial discounts on WordTips archives and e-books.