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
Collapsing and Expanding Subdocuments
The following articles are available for the 'Creating Macros' topic. Click the article's title (shown in bold) to see the associated article.
Can't Save a Macro
If you can't save your macros for some reason, here's a few things to check out.
Comparing Strings
Macros often need to compare text strings in order to make some type of decision. If you don't do the comparison properly, you may not get the desired result. This tip explains how you can confidently compare strings to reduce the chance for error.
Continuing Macro Lines
Program a macro, and you can easily find that some lines get very long. If you want to shorten the lines so they are more understandable, here's the key to breaking them up.
Controlling the Hidden Text Attribute
Want your macro to change the Hidden attribute for some text in your document? It's easier to change than you might think.
Counting Open Document Windows
When creating macros, it is sometimes necessary to know how many documents are open in Word. This is relatively easy to do using the Windows.Count property, but it can be more troublesome to figure out what is in each of those windows.
Debugging a VBA Macro
Create a macro and you are faced with the (sometimes) challenge of debugging it. Here's how to make that task as simple as possible.
Debugging a WordBasic Macro
How to get the bugs out of your macro.
Determining an ANSI Value
You may need to determine the numeric value of a character in a macro. You can do that using the Asc function, described in this tip.
Determining If a Number is Odd or Even
Odd and even numbers are used for lots of different purposes, and sometimes you need to know the status of a given number. This tip discusses a simple technique you can use in your macros to determine whether a particular number is odd or even.
Determining the Upper Bounds of an Array
When working with variables in a macro, you may need to know the upper boundary dimension for an array. This can be discovered by using the UBound function, described in this tip.
Disk Full Errors When Saving Macros
If you are in the process of upgrading your old WordBasic macros to VBA in Word 97, this tip can save you a lot of grief.
Dissecting a String
When writing macros, you often need to slice and dice strings so you can determine their different parts. VBA provides three primary functions you use for this purpose, as described in this tip.
Locating the My Documents Folder
Need to do some macro processing of documents in the user's My Documents folder? First step is to figure out where the folder is located. Here's the easiest way to figure out the path.
Moving the Insertion Point to the End of a Line
When writing a macro to process the text in a document, you may need to move the insertion point to the end of a line. This is done with the EndKey method, described in this tip.
Repeating In a Macro
Macros are often used to process information stored in documents. Usually the processing involves some sort of iterative action within the document, such as doing a search and every time the searched-for item is found, perform a task. Understanding how to perform this type of repeating can be very powerful.
Repeating in a WordBasic Macro
How to loop through a complete document in your WordBasic macro.
Running Macros from Macros
Need to run one macro from within another macro? You can easily do it by using the Run method of the Application object, as described in this tip.
Saving Changes when Closing
If you write a macro that makes changes to a document, you may want that macro to save those changes. There are several ways you can implement the proper code to do this, as described in this tip.
Saving in a Macro Using a Desired File Name
Need to save a new document, from within a macro, to a specific file name? If you use the Record Macro capabilities of Word, you won't get the results you want. The information in this tip provides the answers, as well as a whole lot of different ways you can approach the problem.
Saving in Document Format from a Macro
Saving a document in a different format is easy if you are manually using the Save As command. Saving a document in an existing macro, in the format you want, is a bit trickier unless you know how to use the SaveAs method, described in this tip.
Turning on Large Icons in a Macro
Word includes the ability to display toolbar icons in two sizes: regular and large. You can turn on the large icons by using the Customize dialog box, as described in this tip.
Understanding Precedence
Formulas created in a macro have a specific order in which operations are performed. This is known as precedence, as explained in this tip.
Understanding the If ... End If Structure
One of the powerful programming structures provided in VBA allows you to conditionally execute commands. The If … End If structure is easy to implement once you grasp what it does.
Using Message Boxes
Macros often use message boxes to communicate information and get simple feedback from users. This tip explains how you can add message boxes to your macro, including the use of specific icons in the message box and specific buttons for feedback.
Writing a Macro from Scratch
Creating macros can help extend what you can do in Word. If you work with macros, you know that creating macros from scratch results in the most flexibility. Here's how to create your own macros from scratch.
Writing a WordBasic Macro from Scratch
Ever wonder how to create a WordBasic macro from scratch? It is easier than you think.
The following are additional topics related to the subject of 'Creating Macros'. A bracketed number after the topic indicates how many articles are related to that subject.