1. Computing
Your First 'Job Worthy' Program
2 - Put Your Assistant To Work Again
 Lesson 3
Your First 'Job Worthy' Program

1 - Analysis - Plan Your Work

2 - Put Your Assistant To Work Again

3 - The Form Letter Macro

4 - Help!

5 - Take It One Step At A Time!


Start Word and the Macro Recorder, save the macro in the document again, but this time name it AboutFormLetter. Name the document AboutVB3.doc. If you need any help remembering exactly how to do all this, review the second segment of Lesson 1 again HERE. More detailed instructions can also be found a little later in this segment.

If you're new to programming, you might be struggling with how to organize your files on your computer as well. It's a good idea to create a new folder for a project like this to avoid mixing files together and forgetting which is which. Create a new folder somewhere on your computer (you could call it FormLetter or About Visual Basic Project).

Here's some suggested text for your new form letter:

Dear (1),

I'm planning on writing (2) and (Lucky YOU!), 
I'm going to give your publishing company the 
chance to publish it first! Simply send the 
cost of mailing twenty pounds of paper 
to the return address on this letter, and 
I'll get started writing it right away.

The text (1) and (2) are called placeholders. The VBA macro we will write will replace the placeholders with other text. There are alternative, more sophisticated ways to do this, but this will do as an initial program.

  1. Open a new document.
  2. Save it using the file name AboutVB3.doc.
  3. Type the suggested text above into the letter, or type a letter of your choice! Be sure to include some placeholders - (1) and (2) - in the document.
  4. Save and close the document. We go through this extra step so we can include the "Open" operation into the macro when we turn on the recorder in the next step.
  5. Turn on the macro recorder. Use the name AboutFormLetter for the macro. Because we closed the document, we can't store it in this document right now. We have to select the Normal template as a place to store the it and plan on moving it later.
  6. Open the AboutVB3.doc document again.
  7. Find the text (1) in the document and replace it with Mr. Publisher Dude.
  8. Find the text (2) in the document and replace it with the text the Great Novel of Our Time.
  9. Close the Find dialog and save the document using the file name AboutVB3_01.doc.
  10. Turn off the macro recorder.

Now that we have created another program, let's see what we have in the next segment:

3 - The Form Letter Macro

©2013 About.com. All rights reserved.