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!
Using the command line to pass parameters to a program is a common occurrence. Using the command line to pass parameters ...Discover More
If you are working with dates in a macro, you may need to determine which week of the year a date falls within. This can ...Discover More
The main body of your text is only one part of what makes up the entire document. Documents can consist of other ...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.