Written by Allen Wyatt (last updated November 25, 2017)
This tip applies to Word 97, 2000, 2002, and 2003
If you have done any programming in VBA, you know the value of using variable arrays to store information. It is not uncommon to start working with large arrays in your macros. For instance, you might declare a 100-element string array, as follows:
Dim MyText(99) As String
As your macro executes, information can be stored and restored in the elements of the array. At some time, you may want to erase all the information in the array. One classic way of doing this is using a For ... Next loop to step through each array element, as follows:
For J = 0 To 99 MyText(J) = "" Next J
When the looping is complete, everything has been erased from the array. A quicker way of accomplishing the same task is to use the ERASE function, as follows:
Erase MyText
Once executed, this single line sets each element of the MyText array back to an empty string. If the array is numeric, then each element of the array is set to zero.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1444) applies to Microsoft Word 97, 2000, 2002, and 2003.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
In some documents Roman numerals might be used quite a bit. If you ever want to change the Roman numerals to their Arabic ...
Discover MoreIf you know how to create macros, you can easily create entire replacements for Word's internal commands. Here's all you ...
Discover MoreOne of the common things done in macros is to somehow "process" documents, which often means moving the insertion point ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments