Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Thanked 0 Times in 0 Posts

    Mail merge (VB6+Sql Server+Word 97)

    We are trying to automate Mailmerge using Word97 with SqlServer 7.0 as datasource.
    When we specify odbc direct driver instead of DSN name the code doesnot work(throws "Error 4198:Command Failed"), In the same code if a Dsn is specified then code goes through well.

    Please let us know if this feature is supported in Word97 or not. are there any documentation from MS stating this feature is supported or not?

    Below code:
    Private Sub Command1_Click()
    Dim x As New Word.Application
    x.Documents.Add "D:Program FilesMicrosoft"
    x.ActiveDocument.MailMerge.OpenDataSource Name:="", Connection:="Driver={Sql Server};Server=winxprc1;DatabaseName=NorthWind;Uid =sa;Pwd;"

    End Sub

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 93 Times in 89 Posts

    Re: Mail merge (VB6+Sql Server+Word 97)

    This article doesn't answer your question, but I found it interesting:
    <A target="_blank" HREF=>Mail Merge: Part I, from Microsoft Office and VBA Developer, October 2000</A>

    I have forgotten and changed computers, but there is a way to determine the exact command string that the successful DSN represents. Have you done that and is it what you are using for your merge?

    If you get desperate... <A target="_blank" HREF=>HOWTO: Programmatically Create a DSN for SQL Server with VB</A>

Posting Permissions

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