Microsoft KB Archive/110230

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

= 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:

  Open the database file in Word.   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.   Press CTRL+HOME to position the insertion point at the beginning of the document.   From the Edit menu, choose Replace.   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.   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.   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.   From the Tools menu, choose Stop Recorder. </li></ol>

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.