Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Office 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Determining an ANSI Value.
by Allen Wyatt
(last updated October 13, 2018)
When writing macros, you can use the Asc function to determine the ANSI value of the first letter of a string. In early versions of BASIC, Asc returned the ASCII value, but Word uses only ANSI values. The function uses the following format:
x = Asc(sMyString)
where x is the variable that the ANSI value should be assigned to, and sMyString is the string to be analyzed.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (12314) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Office 365. You can find a version of this tip for the older menu interface of Word here: Determining an ANSI Value.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Writing macros often involves selecting different parts of your document so that some sort of processing can be ...Discover More
Part of the information that Word maintains about each of your documents is a summary statement, which you can define in ...Discover More
Do you need to highlight certain words in a document, and aren't quite sure how to go about it? Using the techniques ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.