Microsoft KB Archive/110230

From BetaArchive Wiki

Recording a Macro That Strips Quotations Marks from DBF Files PSS ID Number: Q110230 Article last modified on 01-26-1994

2.00 2.00a 2.00a-CD 2.00b 2.00c

WINDOWS

The information in this article applies to:
- Microsoft Word for Windows versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c - Microsoft Windows operating system version 3.0 and 3.1

SYMPTOMS

Some database files (DBF) when imported into Word version 2.x for Windows are comma delimited and contain quotation marks. For example:

“Bruce”,“Wayne”,“Wayne Manor”,“Gotham City”

Using this file in a Word for Windows print merge will result in merged data with quotation marks.

WORKAROUND

It’s not possible to flag the DBF converter to strip out the quotation marks as the file is being loaded. You may easily remove them after the file has been opened, by using the following procedure to create a macro:

  1. Open the database file in Word.

  2. From the Tools menu, choose Record Macro and type the name “StripCommaQuotes”, or a similar name, in the Record Macro Name text box. Type a short description for the macro and if you wish, assign a key stroke. Choose OK.

  3. Press CTRL+HOME to position the insertion point at the beginning of the document.

  4. From the Edit menu, choose Replace.

  5. In the Find What text box, type a double quotation mark, a comma, and another double quotation mark (“,”). In the Replace With text box, type a comma (,). Choose the Replace All button.

    Note: If you are prompted to continue searching from the beginning, choose Yes.

  6. Press CTRL+HOME to place the insertion point at the beginning of your document. Press the DELETE key to delete the double quotation mark that remains at the beginning.

  7. Press CTRL+END to place your insertion point at the end of the document. Press the BACKSPACE key to delete the double quotation mark that remains at the end.

  8. From the Tools menu, choose Stop Recorder.

The file has been converted to a simple comma-delimited format that can be used by Word in a print merge.

In the future you can run the macro from the Tools menu by choosing Macro and selecting StripCommaQuotes (or whatever you named the macro in step 2 above), and choosing the Run button. You can also assign macros to the toolbar or run them with a key combination you assigned.

REFERENCES

“Microsoft Word for Windows User’s Guide,” version 2.0, pages 766-768

Additional reference words: w4wmerge 2.00 2.00a 2.00a-CD 2.00b 2.00c

=================================================================

Copyright Microsoft Corporation 1994.