Results 1 to 3 of 3

Thread: Windows 10|Word 2010 Mail Merge with Excel data via Visual Foxpro

  1. #1
    Junior Member
    Join Date
    Aug 2016
    Posts
    2
    Rep Power
    0

    Windows 10|Word 2010 Mail Merge with Excel data via Visual Foxpro

    Hi,

    I have a Visual FoxPro(VFP) application that has been doing mail merges into Word using the VFP ODBC driver and a VFP table.

    After some of my clients have upgraded to Windows 10 and Word 2010 that merge no longer works. My investigation would appear to indicate that the ODBC driver is no longer recognized by Win 10|Word 2010.

    So I thought I'd try to use an Excel file (xls) and use that for the merge.

    Everything works except when I run this code
    Code:
    oDocument.MailMerge.OpenDataSource( cResultFile, ;		&& 01 - Name - Data Source File Name
    				    0, ;				&& 02 - Format - wdOpenFormat
    				    .F.,;				&& 03 - ConfirmConversions - Display Convert File Dialog Box
    				    .F.,;				&& 04 - ReadOnly				
                                        ,;					&& 05 - LinkToSource - Perform Query Specified by Connection & SQL Statement Each Time
                                        .F.,;				&& 06 - AddToRecentFiles - Add File Name to the List of Recently Used Files in File Menu
                                        ,;					&& 07 - PasswordDocument - Password Used to Open the Data Source
                                        ,;					&& 08 - PasswordTemplate - Password used to Open the Template
                                        ,;					&& 09 - Revert - Controls what happens if Name is the file name of an Open Document
                                        ,;					&& 10 - WritePasswordDocument - Password used to save changes to the document
                                        ,;					&& 11 - WritePasswordTemplate - Password used to save changes to the template
                                        ,;					&& 12 - Connection - A Range within which the Query Specified by SQLStatement is to be performed
                                        ,;					&& 13 - SQLStatement - Defines Query options for retrieving data
                                        , ;					&& 14 - SQLStatement1 - Used if the query string is longer than 255 characters
                                        ,;					&& 15 - OpenExclusive - .T. to open exclusively
                                        )					&& 16 - SubType -
    I get a dialog asking me to select a Table, which is actually the name of the Worksheet in the XLS file and there isn't any other Table or Range in the file.

    If I click on OK, the merge goes through as designed.

    I've uploaded the message as shown below.

    VFP_to_Word_Merge_Select_Table_Dialog.jpg

    Any help will be greatly appreciated, my clients are not too happy ...

  2. #2
    Junior Member
    Join Date
    Aug 2016
    Posts
    2
    Rep Power
    0
    The code isn't coming out very cleanly, I've attached an image ...

    VFP_to_Word_Code_Prompting_Table_Selection.jpg

  3. #3
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Not sure this would work, give it a try.

    Convert the range into a table. Select the range > Go to INSERT > Table.
    You can rename the table. To do so, select any cell in the table, Go to DESIGN and you can see the table name there. Just rename it.

    Use this name in the code.

    Again I'm not sure this would work.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Word 2010 add-ins not working with macro code
    By mackypogi in forum Word Help
    Replies: 1
    Last Post: 05-29-2014, 12:06 PM
  2. Replies: 1
    Last Post: 12-23-2013, 10:09 PM
  3. Ribbon Calendar DatePicker Word 2007-2010
    By Excel Fox in forum Download Center
    Replies: 24
    Last Post: 09-23-2013, 09:07 AM
  4. Replies: 3
    Last Post: 06-26-2013, 11:42 PM
  5. Data Sortin_ MS Excel 2010
    By blake85 in forum Excel Help
    Replies: 2
    Last Post: 03-01-2013, 11:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •