Welcome toWord.Tips.Net
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Standardizing Note Reference Placement
Selecting Printing of Color Pictures
Moving Rows and Columns With the Mouse
The following articles are available for the 'VBA Examples' topic. Click the article's title (shown in bold) to see the associated article.
A Real AutoSave
When you enable AutoSave in Word, it doesn't really save your document; it just saves a temporary file that allows your document to be recovered if the program should end unexpectedly. If you want to really save your document periodically, you need to develop your own macro-based system, as described in this tip.
Accessing Paragraphs in a Macro
Need to process a document, paragraph by paragraph, in a macro? It's easy to do once you understand that Word's object model allows you to access each paragraph individually.
Adding Parentheses
Need to add parentheses around some word or phrase? Here's a quick macro that makes this simple edit in one step.
Adding Quotes
This tip presents a handy little macro that adds quote marks around any selected text. The macro can be assigned to a shortcut key to make adding matching quote marks even faster.
Adjusting Small Caps Text
If you use small caps text in a document, you know that there are several steps involved in properly formatting the text. These steps can be combined into a single macro that makes adjusting the text easier than ever before.
Aligning Paragraphs in a Macro
Using a macro to format your document (or portions of your document) is not all that uncommon. If you want your macro to change paragraph alignment within the document, there are just a couple of properties you need to focus upon.
An Automatic Two Spaces After a Period
Should you put two spaces after a sentence or just one? Ask different people and you will get different answers. To Word the answer isn't really important; it can help you enforce either type of spacing you want. This tip explains how.
Applying Bold Italics
Applying bold and italics formatting to text is easy in Word. If you want to apply bold and italics simultaneously, you can create a tool to handle this formatting easily.
Automatic Blank Pages at the End of a Section
If you want to have a blank page at the end of a document section, you can insert one manually or you can use the technique described in this tip. The technique makes the added pages dynamic and easy to use.
Automatic Non-breaking Spaces in Dates
It drives some people crazy to have a date break across two lines. If you find yourself in this mindset, then you'll appreciate the ideas presented in this tip for easily making sure that a date stays all on the same line.
Automatically Adding Tabs in Footnotes
Word, by default, places a space between a footnote reference character and the actual footnote text. If you want to use a tab instead, you'll find the information in this tip invaluable.
Automatically Determining a Due Date
When you are doing a mail merge in Word, you may need to calculate a date sometime in the future. Word doesn't include an option to do this, but there are a couple of workarounds you can try.
Automatically Formatting an ASCII File
Import a file from a source external to Word, and you can end up with a formatting nightmare. One big step is to remove any extra hard returns in the document. The macro in this tip is very helpful in this regard.
Automatically Inserting Brackets
Want a fast way to add brackets around a selected word? You can use this simple macro to add both brackets in a single step.
Automatically Opening a Document at a Specific Zoom Setting
Do you prefer to have your documents open at a specific zoom magnification? You can get whatever magnification you desire by adding one simple macro to your Normal.dot template file.
Automatically Saving Document Copies on Floppy
WordPerfect included a command that allowed users to save a copy of their current document to the A: drive. Word has no similar command, but you can create your own that allows you to save document copies to any drive you want.
Automatically Setting Right Leader Tabs
If you have a constant need to define tabs at the edge of the right margin, you'll love the macro-based technique provided in this tip. You can, just by running the macro, set the requisite tab and include either dot or underscore leaders for the tab.
Batch Template Changes
Changing the Template on a couple of documents is easy, but what if a whole directory needs to be changed? This VBA macro will do it very quickly.
Bumping Numbers in a Document
If your documents include words that contain numbers (such as a list of parts numbers) you may need a way to increment those numbers. Here's a way you can do it quickly using a macro.
Calculated Dates
Word makes it easy to insert today's date in a document, but not as easy to insert a date X number of days in the future. This tip discusses some ways that you can get around this apparent limitation.
Capitals After Colons
Do you want Word to always capitalize the first letter appearing after a colon? The program won't do it by default, but there are a couple of things you can try to get the capitalization you want.
Centering a Text Box
Different ways you can move a text box to the center of the page.
Changing Character Color
Need to easily change the color of some selected text? A quick way to do it is with a custom macro that sets just the hue that you want. This tip describes such a macro and explains how to modify it for any color desired.
Changing How Go To Works
You can force Word's Go To command to start with a cleen slate.
Changing Print Dialog Box Defaults
Word doesn't really remember the settings in the Print dialog box very long. Here's how to get around that limitation and make the dialog box default to the settings you want.
Changing Text Case
If you need to easily change the upper- and lower-case configuration of your text, Word has you covered. All you need to do is use the Change Case feature, as described in this tip.
Changing the Default Drive
A single line of code is all it takes to change the default drive in your VBA macro.
Changing Toolbar Buttons with VBA
Toolbar buttons can have a different appearance depending on their state—whether they have been clicked or not. This tip explains how you can create the two necessary versions of a toolbar button for your customizations.
Character Frequency Count
Word collects a wide range of statistics about your documents, but one of the things it doesn't collect is how many times individual characters appear in the document. (This would be considered a "frequency count" of each character.) You can create a macro to count the characters, but the approach you use to the macro will determine how efficiently the requisite counts are collected.
Checking for a Security Certificate
You can digitally sign your VBA projects to help ensure authenticity of your code and increase security. If you use such signatures, it is a good idea if your macros check to ensure that the signature is present. This tip explains how to do the check in VBA.
Checking for a Text Selection Length
Need to know if the user selected some text before running your macro? Here's how to make that check.
Clearing the Undo Stack in a Macro
When writing a macro, you may need a way to clear the undo stack. This can be done with a single command, as described in this tip.
Combining Documents
If you have a quite a few text documents you need to combine into a single Word document, using the menus to do the concatenation can be tedious. This tip explains a couple of ways how you can put the text files together into a larger, single file.
Consistent Spacing
Do you need to check your document to make sure that each sentence has one and only one trailing space? This tip presents a macro that will make short work of getting rid of any extraneous spaces after sentences.
Continually Saving Normal.dot
If your Normal.dot file is continually saved when you exit Word, even when you haven't made any changes to it, the culprit could be other programs you have operating on your system. This tip explains what you can do to help track down the problem.
Controlling the Italic Text Attribute
If you are formatting your document by using a macro, you may need to make some of your text italics. You do that by changing the Italic property for the selection.
Converting Inches to Points
Typographical measurements are often expressed in points. There are several formatting settings that, when accessed through a macro, require measurements to be made in points. Fortunately, VBA provides a function that can handle the conversion from inches into points for you.
Converting Lists to Text
If you have a numbered list in a document, you might want to convert it to regular, non-dynamic text and not lose the numbers that are in the list. This tip explains a couple of techniques you can use to accomplish the task.
Converting Numbers to Text
Converting numbers (123) to text (one hundred twenty-three) is a common requirement in some businesses. This tip provides a macro you can use to handle the conversions for you, with numbers as large as 999,999,999.
Converting Text to Uppercase in a Macro
The VBA macro language includes the ability to modify the capitalization of a text selection. There are two ways to perform this conversion, as you discover in this tip.
Copying a File in VBA
Need to have your macro copy a file from one place to another? It's easy to do using the FileCopy command, described in this tip.
Correct Line Numbers When Printing Selections
Line numbers are, for some types of documents, a necessity. Line numbers are usually sequential for a page or for the entire document. If you choose to print just a portion of the page or document, Word actually renumbers the lines on the printed page as if that portion were, in reality, the entire document. If you want the printed page to reflect the line numbers as they would appear if the entire document were printed, the macros in this tip will come in handy.
Counting Characters in a Selection with VBA
Need to figure out the number of characters in a range of selected text? Here's how to do it in VBA.
Counting Characters in Text Boxes
When you do a word count, the value that is returned does not include any text contained in text boxes. This may not be a significant problem, unless you have a large amount of text in those boxes. This tip discusses ways you can deal with this issue.
Creating a Document Font List
If you need a list of fonts used in a document (as opposed to the fonts installed on a system), then the macro in this tip will be of great use. It quickly allows you to pinpoint if you are missing fonts necessary to properly display the document.
Creating a New Document in VBA
When working with documents in a macro, it makes sense that you may need to create a document from time to time. Here's how easy it is.
Default Envelope Margins
When you create envelopes in Word, you may want to adjust where the return address and main address are printed. Doing so is not as easy as you might desire, but it can be done.
Deleting a Page
Here's a quick little macro that you can use to dispose of entire pages. Assign it to a button or shortcut, and you have a powerful way to get rid of document pages you no longer need.
Deleting All Comments
Got comments in your document? Want to get rid of them all? The easiest way to do so is going to depend on the version of Word you are using and the complexity of the document you are editing.
Deleting All Footnotes
Tired of all those footnotes hanging on the bottom of each page in your document? You can get rid of them in one step, as described in this tip.
Deriving an Absolute Value
Want to know the absolute value of a number? It's easy to derive in VBA by using the Abs function.
Determining a Paragraph's Style in VBA
When processing a document via a macro, it is often helpful to understand what style has been applied to a paragraph. You can figure this out by using the Style property, described in this tip.
Determining a Random Value
If you need to determine a random value in a macro, you can do so using the Rnd function. This tip presents the syntax and usage of the function.
Determining Differences Between Dates
Do you need to do some simple math using dates in a your macro? One of the easy functions you can use is the DateDiff function.
Determining How Many Styles are Available
Got a macro that processes or uses styles? You definitely need to know how many styles Word has available in the document. Use the Count property of the Styles collection to determine the figure.
Determining How Many Windows are Open
You can open multiple documents at the same time in Word, and each document occupies its own document window. Here's a way you can determine, in a macro, how many of those windows are open at the current time.
Determining if a File Exists
Your macro may need to know if a particular file exists. This is easy to figure out using the Dir command, and even easier if you use it in the function provided in this tip.
Determining if a Text Selection Exists
When creating a macro that processes your document text in some way, it is often helpful to determine if there was a text selection made when the macro was run. This is easy enough to do, requiring only a single line of code.
Determining if Caps Lock is On
If your macro needs to determine the status of the Caps Lock key, you need the code in this tip. Just use the Information property to query the key's state.
Determining if Num Lock is On with VBA
The NumLock key is used to control the numeric keypad on a PC. If your macro requires that the numeric keypad be enabled or disabled, you need a way to determine the state of the NumLock key. This tip shows how you can implement a simple strategy to determine the condition of the key.
Determining if Overtype Mode is Active
Your macro may need to determine if the user has overtype mode turned on. You can find out the overtype status easily by using the Overtype property.
Determining If the End of a Text File Has Been Reached
When writing a macro that processes a text file, you may need to know when the end of the file has been reached. This is easy to do with the EOF function, described in this tip.
Determining Picture Size in VBA
A VBA macro that will determine the size of all the graphic objects within your document.
Determining the Current Directory
When creating macros, it is often necessary to know which directory is the default. Here's how you can find out by using the CurDir command.
Determining the Current Page Number
While your macro is processing the text in your document, you may need a way to determine the current page number where the insertion pointer is located. This is done by using the Information method, as described in this tip.
Determining the Day of the Year
Need to find out the day of the year for a particular date? It's easy to do if you are using a macro. All you need to do is use the DatePart function.
Determining the Hour of the Day
Need to figure out the hour represented by a particular time value? It's easy to do in a macro; just use the Hour function, described in this tip.
Determining the Number of Fonts Available
When creating a macro, you may need to figure out how many fonts are available to Word. You can do this using the FontNames collection.
Determining the Number of Pages in Your Document
If your macro needs to know how many pages are in your document, you can use the Information method to get the desired info. It just takes a single line added to your macro.
Determining the Number of Paragraphs in a Document
Need to know how many paragraphs are in your document? This is very easy to figure out with this VBA code.
Determining the Size of a File
Need to know how many bytes are used by a file? This VBA code will figure it out for you.
Determining Word Frequency
How to construct a word frequency list.
Displaying a Message in the Status Bar
A great place for your macro to display status information is, well, in the status bar. Displaying the information is easy, as this tip points out.
Filling Table Cells with a Macro
Creating tabular data consists of two parts—creating the table and adding the data to the table. If you want to fill a table with data, there are a few macro approaches you can use to do the trick.
Finding a Cell Reference
Want to know what the reference address is for a particular cell in a table? Word won't tell you, but you can use a macro to figure it out.
Finding a Lost Menu Bar
A few ways to find a missing Menu bar in Word.
Finding a Missing Toolbar
A few methods for finding an errant toolbar in Word.
Finding an Unknown Character
Most of the text in a Word document is readily identifiable because you create it using well-known keystrokes: A, B, C, etc. Some characters are much harder to figure out, however, as they have no keyboard equivalent. If you need to search for or replace these characters, your first task is to figure out what they are. This tip provides an easy way to make that determination so that you can do the desired search or replace operation.
Finding Formatted Bulleted Paragraphs
You can use the Bullets tool on the Formatting toolbar to turn paragraphs into a bulleted list. If you want to later search for those bulleted lists, you may be out of luck—Word doesn't provide an inherent way to perform such a search. The macro in this tip can help you find the lists, however.
Finding Long Lines
Word is very dynamic in how it "flows" text from one line to another and one page to another. In most cases we are willing to allow Word to do its job in this area. In some situations, however, you may need to know if a paragraph has flowed to a new line so that you can "force" it to fit all on one line. Making this determination is not as easy as you might like.
Finding Unused Styles
Use this VBA macro to determine which styles are being used in the current Word document.
Formatting an ASCII Table with Spaces
When you get a text file from a program other than Word, tabular information may be formatted with nothing but spaces in between columns. You can easily convert such information to Word's native table structure by using the macro in this tip.
Formatting Fractions
Need to have a great looking fraction in a document? It's relatively easy to do if you apply the formatting techniques discussed in this tip.
Formatting Text Files with VBA
Got a bunch of text that you've imported from a text file? Need to make it look better? You can take a stab at it with this macro.
Full Path Names in Word
An easy way to display the document's full path name in the title bar.
Getting Bookmark Information in VBA
Bookmarks are a handy way to "mark" locations within a document. If you are creating a macro that processes the document in some manner, it may be helpful for your macro to determine if the insertion point is within a macro and, if so, grab information about that bookmark. Here's the techniques you need in order to do this.
Getting Input from a Text File
VBA includes some commands that you can use to read information from text files (non-Word documents). These commands can come in handy when you need to access a wide variety of information. This tip presents a very simple technique to use these commands and read information from a text file.
Grabbing the MRU List
The MRU (most recently used) list informs you which documents were the last to be opened and edited in Word. You can access the list in a macro by using the RecentFiles collection, as illustrated in this tip.
Hiding Macros
Macros are normally visible in the Macros dialog box, except under very specific circumstances. If you don't want a macro to be visible, then it is important that you understand those circumstances and how to use them in your own macros.
Ignoring Smart Quotes when Comparing Text
When comparing two pieces of text, you may find that Word's smart quotes can mess up the comparison. Here's a quick way to get that obstacle out of the way so that the comparison can be done properly.
Importing AutoCorrect Entries
The AutoCorrect feature in Word is quite handy, but getting a lot of entries into the feature can be tedious. This tip provides a macro that will allow you to enter entries quite a bit faster.
Including Headers and Footers when Selecting All
If you are creating a macro that, in the course of processing your document, needs to update all the fields in the document, you may be surprised to find out the process is more complex than anticipated. This tip explains why this is the case, and provides some code you can use to do the updating you need.
Inserting a Break with a Macro
Inserting a break in your document is easy. You may think that inserting one using a macro is more complex, but it isn't. Just use the InsertBreak method, described in this tip.
Inserting Text with a Macro
Need to have your macro insert a bit of text into your document? It's easy to do using the TypeText method.
Intelligible Names for Macros
The names you use for macros can affect what you see when you add those macros to a toolbar. This tip explains how you can change macro names on toolbars, as well as change the ToolTip that appears for a macro.
Jumping to the Start or End of a Document
When creating macros, it is often necessary to move the insertion point around the document so that text can be processed in the manner desired. One of the most common movements is to move the insertion point to the beginning or ending of the document. Here's how to do it.
Jumping to the Top of a Page
Do you want to easily jump to the top of a page in your document? You can use the Go To command to make the shift, or you can use the short macro described in this tip.
Marking Multiple Documents
After using Word for a while, it is easy to accumulate quite a few documents. At some point you may want to make a change to each of the documents in a folder. This tip explains the basics of how to easily make such a change, without the need to manually open and edit each document.
Merging to Individual Files
Mail Merge is great for creating standardized letters that need to go out to a group of people. Each letter ends up as a new section within a much larger document. This tip discusses a way you can store each of those customized letters in their own document, rather than as part of the huge merged document.
Misbehaving Rulers
When upgrading from Word 2000 to 2002, many people have a problem with the Ruler function. This tip explains how to fix the issue.
Moving Found Text Down On a Page
When you use the Search feature to find information, if the information is not on the visible page, then Word displays the page with the information and the occurrence of what you are searching for is highlighted on the top row of the window. It is often helpful for it to be on the second or third row, so you can see the context of what was located. This tip explains how you can "move" the page a bit so you can see what was found within its context.
Moving the Insertion Point in a Macro
One of the common things done in macros is to somehow "process" documents, which often means moving the insertion point in some manner. This tip explains how this is most easily done.
Moving the Insertion Point to the Beginning of a Line
If you need to move the insertion point within your macro, then you'll want to note the HomeKey method, described in this tip. It can be used to move the insertion point to the beginning of a line of text.
Moving Through a Table in a Macro
Do you need to step through a table, cell by cell, in a macro? It's easy to do using the Move method, as described in this tip.
Moving to the Start or End of the Real Document
The main body of your text is only one part of what makes up the entire document. Documents can consist of other elements, as well, such as headers, footers, text boxes, footnotes, etc. How can you create a macro that will move the insertion point to the beginning or end of the main body of your text, regardless of where the insertion point is currently located? It's easier than you think.
Numbers to Text, Take Three (Over a Million)
So, you need to convert a number to text that is over one million? Here is a VBA macro that will convert up to 999,999,999.
Numbers to Words
Want to spell out your numbers--automatically? This VBA macro presents one way to accomplish the task.
Odd Sorting
Sorting information is a common task in Word. Sometimes, however, it is difficult to determine exactly how to sort certain types of information. This tip shows how to use a macro to sort a series of names that may have suffixes associated with them.
Only Showing Readability Statistics
Perform a grammar check, and Word displays some statistics that represent an analysis of your words. By writing a macro you can access these statistics and display whatever part of them you want.
Opening the Document Map by Default
The Document Map can be a handy tool to use when navigating and working with a large document. If you want the Document Map to always be visible with certain documents, the only way you can ensure this is by using a macro, as detailed in this tip.
Picking Up in the Last Document Edited
If you work on the same document over and over again, you'll like the very quick macro in this tip. It loads the last used file and jumps to the location in the document where you last made an edit. Also includes a version of the macro that jumps to the end of the last-used document.
Printer Name on the Status Bar
Got multiple printers available to your system? The only way to tell which printer a document will go to is to display the Print dialog box (which means the Print tool is almost worthless). This tip discusses ways you can make printing to different printers easier.
Printing a Bookmark List
You can define and use bookmarks to reference all sorts of text and text positions within a document. If, at some point, you want to print a list of the bookmarks you've created, you'll be interested in the macro in this tip. It provides a very simple way to create a list and then print it.
Printing a File List
Do you need a quick list of all the files in a particular folder? Here's a couple of different ways you can get the information you need.
Printing a Font List
Do you need to get a list of all the fonts available on your system? It's easy with the macro included in this tip.
Printing All Open Documents
Have a bunch of documents you need to print? If all the documents are open, you can use a handy little macro to print them all at once.
Printing Color Separations with VBA
When printing in color (at a commercial printer) it is necessary to print different colors of your document in different passes. For this purpose, commercial printers often deal with color separations, or separating a document into its component colors. Word can't perform such a complex task, but there is a way you can simulate color separations in simple documents.
Printing Copy Numbers
Copy 1, Copy 2, Copy 3... Do you want to mark your printouts so that they are numbered? Here's how you can do it.
Printing Graphic Thumbnails
If you use a lot of graphics in your Word documents, then you may want to help manage those graphics by printing small "thumbnails" of all the graphics in a folder. This tip includes a macro that will print thumbnail sheets that are great for just that purpose.
Printing On Both Sides of the Paper
A VBA macro to allow duplex printing.
Printing Personalized Copies of a Document
Do you need to print individualized copies of documents for a series of individuals? This tip describes how to do just that, without using mail merge. Individual names are pulled from a text file and placed in the header of each document as it is printed.
Printing the Active Document from a Macro
Using VBA macros you can process documents in all sorts of ways. One common task you may need to do is to have your macro print the active document. You can accomplish this task by using the PrintOut method, as shown in this tip.
Problems Using Words as Bullets
If you know the secret, you can use actual words as "bullets" in a bulleted list. The built-in bulleted lists in Word aren't the way to achieve what you want to do, and this tip explains why. It also provides a macro that you can use to apply the formatting you want to the list.
Protecting Hidden Text
Formatting some of your text as hidden can be a great help when you need to keep some things from being viewed or printed. The hidden text can be easily unhidden by anyone, however. Here's how to get rid of it so that it can't be uncovered.
Pulling Headers and Footers from Other Files
You may have some standard headers and footers you want to make available in your document templates. This tip describes some ways you can approach managing these headers and footers.
Quickly Changing Document Windows
Word provides a keyboard shortcut that you can use to cycle through document windows, but no way to do it using the mouse. You can get around this shortcoming by using the macro provided in this tip.
Quickly Dumping Array Contents
A VBA macro that will erase all of the information in your array.
Quickly Formatting Footers in Documents with Many Sections
If you have a document that includes many, many sections, you may want to change each section so that its headers and footers are the same as the section before it. This tip explains how to do the conversion manually, as well as with a very quick little macro.
Quickly Formatting Multiple Documents
What is the best way to apply consistent formatting across a range of documents? Templates, of course, are very helpful in this regard. There are other formatting considerations which are not controlled by templates, and this tip presents ways you can account for all the formatting you need to apply.
Removing Extra Paragraph Marks
Part of working with other people's documents is cleaning them up so that they are easier to maintain and format. One common task is removing extra paragraph marks in the document. The macro in this tip makes short work of removing all the extra paragraph marks.
Removing Tabs Used to Indent a Paragraph
Someone sends you a document, and it has a lot of tabs in it that are used to indent paragraphs. This tip explains how you can get rid of those tabs as a first step in cleaning up the text.
Removing Unused Styles
Got an older document that has a bunch of unused styles defined in it? You can get rid of those styles easily by using the short macro in this tip.
Repeating Actions
Pressing F4 or Ctrl+Y allows you to repeat the last action you took in Word. If you want to repeat an action more than a single time, you'll need a macro to do the task. This tip presents a simple one that you can use to repeat an action any number of times.
Replacing Quoted Text with Italics
In many documents it is preferable to have special terms formatted as italics when they are first used. Some people, however, often place quote marks around such text. This tip provides a handy macro that can step through a document and make sure that any text surrounded by quote marks is converted to italics text.
Replacing Text in a Macro
When using a macro to process text in a document, it is not unusual to replace one portion of a text string with another piece of text. Some versions of VBA include commands to perform this task, but not all do. This tip presents a handy function you can use to make sure a replacement is done correctly.
Resetting Character Formatting in a Macro
Want your macro to get rid of the formatting applied to a selection of text? It's easy enough to do using the Reset method, described in this tip.
Reverse Numbered Lists
Numbered lists are easy to generate in Word; it is part of the built-in formatting capabilities of the program. If you want reverse numbered lists (lists that count down toward 1), then you need to create your own lists that are a bit more tricky in nature. This tip explains how to get just what you want.
Reversing Type
Most text appears black on white, not white on black. If you want to change this so that your type is reversed, here's a quick way to do it.
Saving a Document in a Macro
If you develop a macro to process your document, you may want the macro to save the document to disk. This is easily done using the Save or SaveAs commands in your macro code.
Saving Everything
Do you want Word to save all documents that users create, regardless of whether they choose to save them or not? This configuration involves the use of a couple of macros and an intrinsic change to the way that Word does its work.
Saving Information in a Non-Document Text File
When using macros, you aren't limited to storing information in a document. A full set of commands are available that allow you to open text files and store information in them, as well.
Screen Flip Flop with VBA
A handy VBA macro that switches which of two document windows is displayed on top.
Searching for Adjectives and Adverbs
Searching for different types of words in your documents is a nice thing to contemplate, but it is much harder to do in reality. The English language has enough vagaries that it can be challenging.
Searching for Borders
The Find and Replace feature in Word allows you to easily search for lots of different items or characteristics in your document. One of the things you cannot natively do, however, is to search for borders on paragraphs. This tip introduces two macros that make short work of finding any bordered paragraphs in your documents.
Searching for Floating Graphics
Graphics can be added to a document so that they are either inline with the text or floating over the text. You can use Word's find and replace tool to locate the inline graphics, but not the floating ones. This tip provides ways you can find the latter.
Select All Changes By a Particular Reviewer
If you are using Word 2002 or Word 2003, and you've been tracking changes in a document, you can display all the changes made by individual editors. This tip shows how easy such a task can be.
Selecting a Bookmark in a Macro
Bookmarks can be very handy in a document. Word provides a VBA command you can use to easily select any of those bookmarks.
Selective Formatting in Replacements
Do you need to replace text with a term or phrase that uses multiple formats? You can perform this seemingly complex task using the powerful find and replace tools in Word, or you can create a macro that will do the trick for you.
Setting a Default Table Border Width
When you insert a table into your document, it uses a standard-weight line around each cell in the table. If you want to change that default line weight, you may be out of luck. Here's a couple of macros you can use to make it easier to change the line weight.
Setting Change Bars Manually
A couple of ways you can add change bars to your document.
Setting Decimal Tabs in a Table Using the Keyboard
Most people use the mouse to set tab stops in the paragraphs in a table. If you prefer to not use the mouse, then you'll be interested in the techniques for keyboard tab setting, as described in this tip.
Setting Maximum Line Lengths in Word E-mail Messages
When you use Word as your e-mail editor, it allows you to format the text of your e-mail messages using tools you are familiar with. One thing that is harder to do, however, is to limit the line length of e-mail messages created with Word. This tip explains why the difficulty arises and what you can do to work through the difficulty.
Setting the Right Indent of a Paragraph in a Macro
Need to format your document using a macro? You can easily set the right margin for an individual paragraph by using the RightIndent property, described in this tip.
Sharing Headings with Others
The headings in your document are very important. The constitute the outline of what your document conveys. If you want to share those headings with others (without sharing the document itself), you'll love the information in this tip.
Single Instance of Word
Here's a nifty macro that allows you to limit how many instances of Word 97 are open at the same time.
Single-Character Fractions
When typing in Word, some fractions are converted into a professional-looking character, while others are not. This tip explains why that occurs and provides some ideas on how all your fractions can look their best.
Spacing After Sentences
Word can check to see if you have a consistent number of spaces at the end of your sentences.
Specific Capitalization
How to get around Word's AutoCorrect feature for having uncapitalized words at the start of a sentence.
Specifying a Paper Tray in a Macro
If your printer uses multiple paper trays, you may want a way to access those trays from a macro. Why? Because you may want the macro to print a part of your document on a particular paper that you have in that tray. This tip describes how you can accomplish the task and explains all the caveats related to the process.
Strip Trailing Spaces
A common nuisance in documents is unnecessary trailing spaces at the end of paragraphs. This tip provides a macro that makes quick work of those spaces, removing them from the document completely.
Suppressing the Control Toolbox Toolbar
If the Control Toolbox keeps appearing when you open a document, it can be bothersome. This tip explains why this may happen and what you can do to get rid of the toolbox, once and for all.
Swapping Two Strings
Part of developing macros is learning how to use and manipulate variables. This tip examines a technique you can use to exchange the contents of two string variables.
Talking to Yourself Using Hidden Text
Got a few notes you want to add to a document? You can do it with comments, but another way may be better: Add notes that won't print out, right in the regular text. This tip explains how that is done and even provides a macro that makes it easier.
Templates and Page Setup
Templates are a great way to share styles, macros, and other settings among various documents. One thing that isn't shared through templates, however, is page setup. If you want to have this shared, you'll love the macro presented in this tip.
The Case of the Vanished Menu Bar
Has your Word menu bar disappeared? This tip explains how you can restore the menu bar to its rightful place at the top of your screen.
Tiling Documents
A quick method of placing your open documents side by side on the screen.
Toggling AutoCorrect Settings
If you need to turn AutoCorrect on or off, there is no built-in way to easily do it in Word. You can create your own toggle command, however, as described in this tip.
Transposing Two Paragraphs
There is no command in Word to transpose (switch the position of) two paragraphs. Such a command would be a real boon for some editing tasks, and it can be easily implemented by using the macro in this tip.
Trimming Spaces from Strings
When processing text with a macro, you often need to remove extraneous spaces from the text. VBA provides three handy functions to remove those leading or trailing spaces easily.
Turning Off Default First Page Numbering
How to set up Word so the First Page Numbering default is not selected.
Turning Off Screen Updating
When working with macros, you can often speed up processing by turning off the updating of the screen. Best news is that it takes only a line or two added to your macro.
Underlining Quoted Text
Do you have a document in which you need to convert all the quoted text (text surrounded by quotes) to underlined text? If so, then the macro presented in this tip will be a huge timesaver for you.
Understanding Document Variables
When working with macros, you may want to create a variable that will remain constant from one instance of the macro to another. This is a great use for document variables, as described in this tip.
Understanding the For ... Next Structure
Spend any time creating Word macros, and sooner or later you will need to repeat some of your programming code a certain number of times. That's where the For ... Next structure comes into play.
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.
Understanding the Select Case Structure
Programming structures are an important tool used by any programmer. The VBA language used by Word's macros includes several powerful programming structures, including the Select Case structure, described in this tip.
Updating Calculated Fields in a Form
Using a macro to determine if the Calculated Fields in your document calculate correctly.
Updating Fields in Locked Forms
If you create a form in Word and then lock it, you may notice that regular fields don't get updated in the locked document as you might expect. If you want to update the fields, you must first unlock the document. This tip provides a quick macro you can use that will unlock, update, and relock the form—quite a timesaver!
Using a Macro to Change the Formatting of All Instances of a Word
If you use the formatting of a specific word as a design element in your document, you may be interested in the macro in this tip. It allows you to format all occurrences of a word in a desired manner.
Viewing Side-by-Side Pages
How to display pages side-by-side, through a VBA macro.
Working With Multiple Printers Using VBA
Some Word users are fortunate enough to have access to multiple printers. This tip provides a quick way you can access those printers through a custom macro that bypasses the need to use the Print dialog box.
Zooming With the Keyboard
With computer screens getting larger, video resolutions getting higher, and eyeballs getting older, the zoom feature is a great tool to learn to use. Unfortunately, Word doesn't provide a quick way to access the zoom feature strictly using the keyboard. You can remedy that shortcoming with the macros discussed in this tip.