April 23, 2008

How do I… Integrate mail merge in Microsoft Word with Excel

Takeaway: For a few simple form letters, Microsoft Word's internal address book may be all you need when using the built-in mail merge features. However, the true power of Word's mail merge is only revealed after you integrate it with the more advanced database features of Microsoft Excel. In this How do I… article Scott Lowe shows you how to integrate Excel data when using Word's mail merge feature.

Earlier in this series, you saw an article explaining how to harness the pure power of Word's mail merge feature and bend it you your will. In that article, you used Word's internal address book—really a very limited database—to keep track of the addresses to which information would be sent.

But, how many of you actually keep all of your contact information in Word? If you keep it in any Office program, you probably keep it in Excel, or in Access. Or, if you keep it in some other system, it's generally an easy process to get, for example, customer address information into Excel. In this article, I will show you how to make use of Excel data when using Word's mail merge feature.

I'm assuming that you know how to enter data into Excel and understand the purpose of Word's mail merge feature. If you need a refresher on either of these topics, take a look at previous articles in this series. I will be repeating some of the mail merge information from my previous article in this article in the interest of completeness. However, if you're interested in Word mail merge, you should read that article before you read this one.

Inventory sheets

For this article, rather than the typical form letter, we'll use an existing Excel used vehicle inventory to create inventory sheets that can be posted on each vehicle on the lot. Here's a snapshot of the Excel inventory table.

Figure A

We'll use this inventory table for the examples in this article.

Note the column headings in Figure A. Every column has some kind of heading. While this isn't absolutely required, I do highly recommend that you assign a column heading to every column in your spreadsheet. Word will use these column headings as field names. If you fail to provide a column heading, you'll get things like "Column A", "Column B", which can be rather confusing. "Leather seats" and "Sunroof" are much more descriptive.

The Word mail merge process

To get started, open a new document in Word and choose Tools | Letters and Mailings | Mail viagra brand cheap Merge from the menu bar. In the sidebar area, Word opens a Mail Merge helper that provides you with a wizard-like interface that walks you through the process.

Step 1: Select document type

Word's mail merge can be used to create form letters, e-mail messages, envelopes, labels, or directories. With a little imagination, these choices let you create just about any kind of document or communication you would need.

Figure B

Mail merge step 1: Determine your document type

Feel free to experiment with the different document types. For this example, we'll be creating an inventory sheet using Excel data. The best option to choose for this kind of mail merge is Letters, so I'll choose that option from the list of selections. When you've made your selection, click "Next: Starting Document".

Step 2: Select starting document

Any document you've created can be converted into a form letter. Or, if you want to start from scratch, you can use the current document (which, for me, is a blank document) and type your letter. You can also use any document template on your computer, or on Office Online, Microsoft's Web repository that contains hundreds of templates available for download.

This starting document is often referred to as the "master document" as well. The terms are interchangeable, although other Word features also use the term "master document", so be sure to keep things straight.

The starting document is the document that will ultimately contain the base form letter.

I'm going to use the blank document I have on the screen as the starting document.

Figure C

Mail merge step 2: Choose the starting document.

Once you've decided on the document that gets the honor of being the starting document, click the "Next: Select recipients" option. Notice that the wizard also allows you to go back to the previous step if you need to.

In step 4 of the wizard, you will be able to modify your letter.

Step 3: Select recipients

In the previous step, you chose what document to use as a form letter. In this step, you need to decide to which recipients you want to send the form letter. Word's mail merge feature lets you use a wide variety of data sources. In this case, we'll use an existing list. Click the Browse button to look for the Excel file you want to use for your mail merge.

Figure D

Mail merge step 3: Tell Word from where you intend to get your recipients.

The Browse button opens a window called "Select Data Source" from which you can connect Word to just about any database you like. From this window, choose your Excel inventory file and click the Open button.

Figure E

Select your Excel data file and click Open.

Most people are not familiar with "Named Ranges" in Excel (I'll cover them in a future article), so the resulting window might be a little confusing at first since it looks like gibberish. Notice that three of the four choices are the names of the individual sheets (Sheet1, Sheet2 and Sheet3). In my Excel file, the inventory information is on "Sheet1", so I will choose the corresponding option from the Select Table window. Note also the "First row of data contains column headers" option at the bottom of this window. As I mentioned before, it's really a good idea if you include headers in your spreadsheet. However, if you don't want to do so, make sure you uncheck this box. If you don't, Word will assume that the first row of your data contains headings.

Figure F

Select the sheet on which your information resides.

On the resulting window—the Mail Merge Recipients window—are a number of options that let you control what records you want to include in your merge. Note the checkbox to the left of each record. The check in the box indicates that this record will be included in your merge. If you don't want to include a particular record, click the box to remove the checkmark. You can also filter the records that you want to include in the merge by using the down arrows next to each heading. The buttons at the bottom of the window let you find specific records (Find), quickly select and deselect all of the records (Select All, Clear All), make sure that addresses are valid (Validate) and more. Click OK when you're done. Figure G below shows you the Mail Merge Recipients window while Figure H shows you your Word sidebar after you're done deciding which records to import.

Figure G

Which records do you want to include in your mail merge?

Figure H

If you want to make a change to your list, click the "Edit recipient list" option.

Step 4: Write your letter

Ok – this one isn't a letter (it's a form to slap onto the cars in our inventory), but Word doesn't know that. To Word, everything is a letter! On this step, you have the Word sidebar shown below in Figure I.

Figure I

The "More items" link is most appropriate for this example.

On this step, create your inventory sheet/flyer as your normally would. However, instead of typing in the individual inventory information, use fields instead. In this way, you're keeping your letter generic and letting Word do the work. You should also see a new toolbar added to your tool arsenal.

I'm not going to go over every option on the toolbar in this article, but will provide details on which buttons you need for most mail merge operations.

The first three buttons are pretty important. In order from left to right:

  • Main document setup: This is the same as step one of the wizard in that you select the type of document you intend to create.
  • Open data source: Again, this button loosely matches a step in the wizard; in this case, Step 2. When you click this button, Word opens up a dialog window asking you to choose the data file you want to use. If you want to connect to a different kind of source, such as an Access database, click the New Source button.
  • Mail merge recipients: This button opens the window you saw in the previous step where you can decide which recipients should be included in the final output.

Now, we'll on to making the appropriate changes to your letter to make it generic. Notice in the sidebar, now entitled "Write your letter", there are a number of options, including "Greeting line", "Postal bar code", and "More Items…"

Figure J

The mail merge toolbar makes using mail merge a little easier.

Take particular note of the sixth button from the left. I've highlighted it for you in Figure J. Click this button to open the Insert Merge Field window. Alternatively, you can click the "More Items…" option in the sidebar. Either way you do it, Word opens up a window from which you can select fields from Excel to add to your flyer. As you're typing your flyer, use this window to add a field where you would normally put in specific information about a vehicle. For example, rather than typing in the price of a vehicle, insert the "Price" field instead. Figure K shows you what my sample flyer looks like.

Figure K

My sample letter, with merge codes.

Bear in mind that you need to put spaces, commas and tabs where they belong. In the previous article on this topic, we used address fields, but still had to manually put the comma between the city and the state fields.

Click "Next: Preview your letters" when you're done with your flyer.

Step 5: Preview your letters

 

With your flyer crated, it's time to see the results. From the sidebar, click the "Next: Preview your letters" option. The result should look similar to what you see below in Figure L.

Figure L

Here's a preview of the flyer.

One thing you may notice right away is the formatting of the price is wrong. There is no dollar sign or comma where it belongs. To fix this, click the "Previous: Write your letter" option in the task pane. This will take you back to the "write your letter" step of the wizard.

Figure M

Use the "Previous" option to go back to the previous step.

Now, click somewhere in the Price field and press Alt + F9 on your keyboard, or, right-click the field and choose "Toggle Field Codes". Either way, you will get the result shown below in Figure N.

Figure N

The fields look a little different here. This is what the full field code looks like behind the scenes.

Note, if you use the Alt+F9 option, you will always get the field codes for all of the fields. If you right-click a field and choose Toggle Field Codes, you will get the field codes for just that field. It doesn't hurt to show the field codes, but, as you can probably see, it can muddy up your document.

In these field codes, we want to change the format so that it comes out as currency rather than as a plain number. To do so, we need to type in a little code, such as "{ MERGEFIELD "Price" \# $#,### }" The "\# $#,###" portion of this stuff tells Word that we want to format this field as a number with a dollar sign followed by # signs indicating where numbers from the price will go. Also note the inclusion of the comma. Don't worry that there is only a single # sign between the dollar sign and the comma. Word knows enough to out multiple digits in that space for amounts larger than or equal to $10,000. Look at Figure O. When you're done, click the "Next" option to go to the "Preview Your Letters" step again.

Figure O

The field codes are used to make granular changes to the field.

Now, take a look at Figure P below. This time, the price of the car is properly formatted and will look a lot more professional. Choose the "Next: Complete the merge" option.

Figure P

The result: A properly formatted dollar amount.

Step 6: Complete the merge

 

This part is easy! Your sidebar again changes to match the step you're on and looks a whole lot like what you see below (Figure Q).

Figure Q

Step 6: Finish your mail merge.

At this point, Word has not officially performed the merge. That is, your letter and data file are still mostly separate. When you click one of the two options—(1) Print; or (2) Edit individual letters—Word asks you what you want to merge.

Figure R

What records do you want to have printed?

Your options here are to merge all of your records, in which case you will get one page per recipient, or choose which records you want to include. When you choose the print option, Word sends your flyer right to your printer. If you made a mistake, you have to reprint the flyers. By choosing the "Edit individual letters" option, you make Word create a huge document that includes every letter just as if you'd typed the letter manually for each recipient. I usually prefer to use the latter option so I don't have to reprint things.

Harness the power

 

Now, you've seen Word's mail merge in action using its own limited database and with its ability to harness Excel's power. You've also seen two examples of what mail merge can do: create simple letters, or create non-standard documents such as flyers.

Permalink • Print • Comment

How do I… Put a Microsoft PowerPoint presentation on a CD?

Takeaway: If you've ever tried to transport or share a Microsoft PowerPoint presentation only to discover that essential pieces were missing and it wouldn't run properly, you'll appreciate the convenience and simplicity of the PowerPoint For CD feature. You can even include the Viewer for those who don't have PowerPoint installed.

This article is also available as a PDF download.

The Microsoft PowerPoint 2003 Package For CD feature is a flexible tool that allows you to either burn a presentation and all supporting files onto a CD or copy them to a specified folder. The package that's created using this tool includes image files, video clips, TrueType fonts, sound files, and other files used by the presentation. The package can also include the PowerPoint Viewer, making it easy to share the PowerPoint presentation with those who don't have PowerPoint installed on their workstations.

Creating a CD

To use the Package For CD feature to burn a CD, start by inserting a blank CD into your computer's CD writer. Next, open the PowerPoint presentation and click File | Package For CD, as shown in Figure A, to open the dialog box shown in Figure B.

Figure A

 

Figure B

 

Type a descriptive name for the package in the Name The CD text box. You can also click the Add Files button to add any files you want in the package that are not included in the package by default.

Now, click the Options button to open the dialog box shown in Figure C. Here, you can modify the default settings for creating the package:

  • PowerPoint Viewer: When this option is selected, the PowerPoint Viewer is included in the package.
  • Linked Files: Includes all the files that are linked to the package, such as videos and pictures.
  • Embedded TrueType Fonts: Embeds all the TrueType fonts within the presentation so that they will be available on other computers.
  • Password To Open Each File: Enter a password to protect each file in the package, including the PowerPoint presentation.
  • Password To Modify Each File: Enter a password to restrict modification of any file in the package.

Figure C

 

Once you've set the desired options, click OK to return to the Package For CD dialog box. To create the package and write it to the CD, click the Copy To CD button. The Copying Files To CD progress window will appear (Figure D), providing status information as the package is created and written to the CD.

Figure D

 

When the procedure is complete, the Copying Files To CD window will display the message shown in Figure E.

Figure E

 

After a few moments, the CD will eject from the drive and the Copying Files To CD window will close. Now you have the option of copying the same files to an additional CD (Figure F). Click Yes to create another CD or No to end the process.

Figure F

 

Copying to a folder

Although the feature is called Package For CD, PowerPoint doesn't require that a CD writer be installed on the workstation. viagra brand by online You can simply create a package and copy it to a folder for sharing with others.

To create a package and copy it to a folder, you follow the basic steps described above: Open the presentation and click File | Package For CD, then enter a package name, click the Add Files button if you want to include additional files, and click the Options button to modify the default settings for creating the package.

When you're finished, click the Copy To Folder button to open the dialog box shown in Figure G. Enter a name in the Folder Name text box and then click the Browse button to navigate to the location where you want the package saved.

Figure G

 

To finish the process, click OK. The package will be created and copied to the location you specified in the previous step. Surprisingly, you won't be notified that the procedure is complete.

To view the presentation and the files included in the package, open Windows Explorer and navigate to the location where you saved the package. Figure H shows an example of the files that are included in a package. In addition to the PowerPoint presentation and the supporting files, this package contains the PowerPoint Viewer (pptview.exe).

Figure H

Permalink • Print • Comment

How do I… Vary headers and footers in a Word document?

Takeaway: Word offers some basic tools on the Header And Footer toolbar, but more sophisticated setup requires a trip to the Layout tab. These tips will help your users fine-tune their document headers and footers.

This article is also available as a PDF download.

Well-crafted headers and footers add polish to your documents, and Word's basic header and footer tools make it a cinch to format text that appears on each page. However, what do you do if you want certain information to be printed differently on alternating pages, such as the page numbers of a book? Or how about skipping the header and footer on the title page of a document?

Although these types of configuration settings are not immediately obvious, once you know how to find them, you'll discover that they provide you with some slick formatting options and a great deal of control.

Finding the settings you need

Word is a fairly easy application to use, but some features are not located in the most intuitive place. This is the case for several settings used to work with headers and footers. The majority of header and footer options are located on the Header And Footer toolbar. (To open this toolbar, click View | Header And Footer.) As you can see in Figure A, the toolbar provides options for AutoText, page numbers, inserting the date and time, and several other handy features. However, some of the more advanced options require a trip to the Page Setup dialog box.

Figure A

 

The Layout tab in the Page Setup dialog contains additional options that allow you to control the way that headers and footers are printed on the page. To access these settings, shown in Figure B, click the Page Setup button on the Header And Footer toolbar (or choose File | Page Setup) and click the Layout tab.

Figure B

 

To create alternating headers and footers, select the Different Odd And Even option. When this option is selected, you can enter one set of headers and footers that will be displayed on the odd-numbered pages of the document and then enter a different set of headers and footers for the even-numbered pages. For example, in Figure C, we set up our headers so that the page numbers appear on the outside edges of the page.

Figure C

 

Another Layout tab option, Different First Page, allows you to use a different header and footer (or none at all) on the first page of a document. This option is especially helpful when working with documents that contain a title page, which typically doesn't include a page number. When the Different First Page option is selected, you can enter one set of headers and footers that will be displayed only on the first page of the document and then enter another set of headers and footers for all subsequent pages. If you're omitting headers and footers from the first page, simply leave those areas blank.

As long as we're looking at Word's less obvious header and footer settings, let's touch on the From Edge settings in the Layout tab. These settings allow you to control the position of a header or footer relative to the top or bottom edge of the page. For example, you might want to use these settings to adjust the viagra blue pill location of the header and footer on a page that has a border. Just enter the desired distance from the edge of the page, measured in inches. You can apply the From Edge settings to specific sections or to all headers and footers in a document.

Although these three configuration options are primarily used only in special circumstances, knowing where they are located and how to use them can enable you to produce a professional-looking document instead of scratching your head, wasting time, and being forced to improvise.

Permalink • Print • Comment

How do I… Create a user-defined function in Microsoft Excel

Takeaway: Microsoft Excel allows users to create their own user-defined functions. Using the power of Visual Basic for Applications (VBA), you can code complicated formulas only once and use them again and again in your spreadsheets and workbooks. These functions can be used just like any built-in function already available in Excel. Here's how you create one.

Sometimes you find yourself in a situation where you can't get Microsoft Excel to do exactly what you want it to do without coding a complicated formula over and over again. In such a scenario, you often have to spend an unacceptable amount of time finding circular logic errors or fixing syntax problems. Using the power of Visual Basic for Applications (VBA), you can code that complicated formula only once and use it again and again in a user-defined function.

Build your function

According to Microsoft, to create a user-defined function in Excel, you first call up the Visual Basic Editor, which is located in the Tools | Macros menu. Once in the editor, navigate to Insert | Module to open a blank module screen. This is where you'll type in your code. (See Figure A.)

Figure A

Visual Basic Editor

For example, let's assume you want to calculate the commissions earned on fees charged, but you want to give a break to your best clients. You can type in an IF statement in each cell in your workbook, or you can create a single function with an If-Then-Else statement.

Here is the code to create our user-defined Commission() function:

Function Commission(Fee)
    If Fee <= 1000 Then Commission = Fee * 0.1 Else Commission = Fee * 0.05
viagra best prices /> End Function

This function will charge a commission of 10 percent for fees less than or equal to $1,000 and 5 percent on all other fees.

While the commission calculation formula would be simple enough to include in each cell individually, it could quickly become a quagmire if we had a more complicated set of criteria to run through. In such instances, a user-defined function can save us lots of trouble.

Our user-defined function operates the same way as any other Excel function operates, as you can see in Figure B. The cells in Column C contain the Commission() function and calculate the commission based on the criteria provided by the user-defined function we created.

Figure B

Example calculation

With this technique, you can create very complicated functions and applications without resorting to extended formulas that reside within the cells themselves. This means your Excel applications can be easier to follow and adjust in the future.

Permalink • Print • Comment

How to sort a single column in Excel without disrupting the rest of the spreadsheet

Date: January 19th, 2008

Author: Susan Harkins

We tend to view spreadsheet data as a whole, and that’s as it should be. Seldom does a single column of values mean much to us without some related data to define it. Together, seemingly useless values become information. In fact, that’s the definition of data and information. Information is an aggregate — a collection of data that’s greater than the sum of its parts.

Occasionally, the big picture gets in the way. That happens when you need to view a subset of the data. Actually, viewing that subset isn’t the problem, but manipulating it can be. For instance, suppose you want to sort a unique list of cities, countries, ZIP codes, and so on. A simple change of perspective is all you really need.

Copy the single column or subset to an out of the way spot so you can sort it separately from the source spreadsheet. To do this, select the column you want to sort by clicking the column’s header cell.

jan2008blog5fig1r.jpg

Next, choose Filter from the Data menu and then select Advanced Filter. In the Advanced Filter dialog box, click the Copy To Another Location option. If you want a unique list, be sure to click the Unique Records Only option. Then, enter an out-of-the-way cell in the Copy To option. Or click that option and then click a cell.

jan2008blog5fig2r.jpg

Click OK to copy the contents of the column. Now, you can viagra australia no prescription sort the copied list by clicking any cell in it and choosing Sort from the Data menu. By default, Excel selects the Header Row option. Be sure to update this option accordingly.

jan2008blog5fig3r.jpg

Then, click OK. The result is a sorted list. Of course, this list isn’t dynamic. As you add records to the spreadsheet, you’ll have to re-create the copied list.

jan2008blog5fig4r.jpg

Permalink • Print • Comment
« Previous PageNext Page »
Made with WordPress and a healthy dose of Semiologic • Sky Gold skin by Denis de Bernardy