locked
Word 2007 Broken Merge/Macros after Updates RRS feed

  • Question

  • I have three users that terminal serve into a Windows 2008R2 server ... their word macro merges worked on Friday, after updates on Saturday, they are now broken. I've run a debug on the macros, and it breaks at the line that goes to find the datasource, which is on another server...

    Anyone know which update may have broken this access? Or if there is different code for me to use to get around this? (code below - the line it breaks at is in bold)

    Sub Document_Certificate()
    '
    ' Certificate Document Processing
    ' Macro recorded 07/13/2007 by stevew
    '
        msg = "Press OK to Start Certificate Process"
        MsgBox msg, vbOKOnly
       
        On Error GoTo ClsError
        ChangeFileOpenDirectory "G:\rtfmaster\NComputer"
        Documents.Open FileName:="certform.dotm", ConfirmConversions:=False, _
            ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
            PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
            WritePasswordTemplate:="", Format:=wdOpenFormatAuto
         With ActiveDocument.MailMerge
            .OpenDataSource Name:="u:\mrgfls\emc14.csv", SQLStatement:="SELECT * FROM u:\mrgfls\emc14.csv"
            .Destination = wdSendToNewDocument
            .MailAsAttachment = False
            .MailAddressFieldName = ""
            .MailSubject = ""
            .SuppressBlankLines = True
            With .DataSource
                .FirstRecord = wdDefaultFirstRecord
                .LastRecord = wdDefaultLastRecord
            End With
            .Execute Pause:=False
        End With
        ChangeFileOpenDirectory "u:\mrgfls\"
        ActiveDocument.SaveAs FileName:="Certificate_1.Doc", FileFormat:=wdFormatDocument _
            , LockComments:=False, Password:="", AddToRecentFiles:=False, _
            WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
             SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
            False
            ActiveDocument.Close (savechanges = "No")
    ClsError:
        ActiveDocument.Close (savechanges = "No")
        msg = "Certificate Process Completed"
        MsgBox msg, vbOKOnly

    End Sub

    ========

    Thanks!

    Jilltre


    Jill Trehearne
    Monday, April 18, 2011 5:47 PM

All replies

  • If you are always using the same data source, why not save the mail merge main document with it attached?


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "jilltre800" wrote in message news:2dceebf2-1286-42fd-8824-0e45df92d0df@communitybridge.codeplex.com...

    I have three users that terminal serve into a Windows 2008R2 server ... their word macro merges worked on Friday, after updates on Saturday, they are now broken. I've run a debug on the macros, and it breaks at the line that goes to find the datasource, which is on another server...

    Anyone know which update may have broken this access? Or if there is different code for me to use to get around this? (code below - the line it breaks at is in bold)

    Sub Document_Certificate()
    '
    ' Certificate Document Processing
    ' Macro recorded 07/13/2007 by stevew
    '
        msg = "Press OK to Start Certificate Process"
        MsgBox msg, vbOKOnly

        On Error GoTo ClsError
        ChangeFileOpenDirectory "G:\rtfmaster\NComputer"
        Documents.Open FileName:="certform.dotm", ConfirmConversions:=False, _
            ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
            PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
            WritePasswordTemplate:="", Format:=wdOpenFormatAuto
         With ActiveDocument.MailMerge
            .OpenDataSource Name:="u:\mrgfls\emc14.csv", SQLStatement:="SELECT * FROM u:\mrgfls\emc14.csv"
            .Destination = wdSendToNewDocument
            .MailAsAttachment = False
            .MailAddressFieldName = ""
            .MailSubject = ""
            .SuppressBlankLines = True
            With .DataSource
                .FirstRecord = wdDefaultFirstRecord
                .LastRecord = wdDefaultLastRecord
            End With
            .Execute Pause:=False
        End With
        ChangeFileOpenDirectory "u:\mrgfls\"
        ActiveDocument.SaveAs FileName:="Certificate_1.Doc", FileFormat:=wdFormatDocument _
            , LockComments:=False, Password:="", AddToRecentFiles:=False, _
            WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
             SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
            False
            ActiveDocument.Close (savechanges = "No")
    ClsError:
        ActiveDocument.Close (savechanges = "No")
        msg = "Certificate Process Completed"
        MsgBox msg, vbOKOnly

    End Sub

    ========

    Thanks!

    Jilltre


    Jill Trehearne


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Monday, April 18, 2011 8:06 PM
  • same data source, but not the same data.. we have it setup that they can export out of a sql application to a particular .csv file.. this data changes with each export.. once the document is merged, the data in the csv file is no longer needed, and gets over written by the next export process... each person has different export needs from the database, so they each have their own folder on the other server they save the .csv folder into..  because each user has a login script that connects them to their own U: drive.. it's a generic path as far as the macro is concerned (U:\MRGFLS)... hope that makes sense...
    Jill Trehearne
    Monday, April 18, 2011 8:13 PM