none
Word MailMerge and Smart Quotes RRS feed

  • Question

  • Greetings,

    I am using the Word interop MailMerge interface to merge a csv data file with a Word 2007 document. It works fine until the data contains smart quotes ( “ ... , ... ” ) with a comma in-between. It seems that Word is interpreting the smart quotes as straight double quotes which happen to be text delimiters. The Header Records Delimiters dialog box pops up and the merge fails regardless of choosing the appropriate delimiters.

    Merging manually with an Excel exported csv seems to work. It prompts me to choose a delimiter, but the merge still succeeds.

    Is there anyway to make this work with the interop?

     

    Thanks

    Wednesday, November 30, 2011 5:02 PM

Answers

  • Hi Joseph

    Mmm. have you tried putting a pair of straight quotes around the smart quotes? It's not clear from your problem description whether this is something you've tried.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by josephpk Thursday, December 1, 2011 7:48 PM
    Wednesday, November 30, 2011 11:25 PM
    Moderator

All replies

  • Hi Joseph

    Mmm. have you tried putting a pair of straight quotes around the smart quotes? It's not clear from your problem description whether this is something you've tried.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by josephpk Thursday, December 1, 2011 7:48 PM
    Wednesday, November 30, 2011 11:25 PM
    Moderator
  • Hi Cindy,

    Putting a straight quote next to a smart quote does work, I had not tried this before.

    I noticed that manually merging in Word defaults to the OLE DB Database Files source, which does not have a problem with smart quotes. Its when specifying the "Recover Text from Any File via Converter (*.*)", does Word prompt the delimiter dialog box, which leads me to think this is what OpenDataSource is using.

    Is there a way to tell OpenDataSource to use the OLE DB Database driver? Or am I not clear about this?

     

    Thank you for your expertise.

    Thursday, December 1, 2011 5:08 PM
  • Hi Joseph

    Yes, you can force Word to use OLE DB as the mail merge connection method. It's been a LOOOOONG time since I was "into" this stuff, so I can't provide any useful detail, but perhaps a helpful hint:

    Record a macro while linking up the way that gives you the best result, then look at how Word records OpenDataSource.


    Cindy Meister, VSTO/Word MVP
    Thursday, December 1, 2011 6:29 PM
    Moderator