locked
Run-Time error '5852' when using Word 2010 RRS feed

  • Question

  • Hi everyone,

    We are upgrading Word from 2003 to 2010. We have a set of contract documents that uses mailmerge. The VB script will open additional documents based on the datasource text file's fields. we get the '5852' error the second IF statement. In Word 2003, it will open all of the docs without any issues. In Word 2010, it fails every time.

    Here is a partial code and the first instance of the error is the IF statement in the first "else":

    Private Sub Document_Open()

    If ActiveDocument.MailMerge.DataSource.DataFields(55).Value = 15 Then
          Application.DisplayAlerts = wdAlertsNone
          Documents.Open FileName:="Z:\1-CheckListVOA.doc", ReadOnly:=True
           
          If ActiveDocument.MailMerge.DataSource.DataFields(73).Value <> "0.00" Then
             Documents.Open FileName:="Z:\1-LeaseNote.doc", ReadOnly:=True
             Documents.Open FileName:="Z:\24-FirstPayment.doc", ReadOnly:=True
          End If
       
          Documents.Open FileName:="Z:\1-LeasePriceLockIn.doc", ReadOnly:=True
          ActiveDocument.Fields.Update
       
          Documents.Open FileName:="Z:\1-LeaseWelcome.doc", ReadOnly:=True
          Documents.Open FileName:="Z:\2-Inventory.doc", ReadOnly:=True
          Documents.Open FileName:="Z:\6-AchDebitDP.doc", ReadOnly:=True
          Documents.Open FileName:="Z:\27-OwnRef.doc", ReadOnly:=True
       
          Documents("0-MasterDoc.doc").ActiveWindow.Visible = False
          Documents("1-CheckListVOA.doc").Activate
          SelectDocsAddl.Show
    Else

        Application.DisplayAlerts = wdAlertsNone

        Documents.Open FileName:="Z:\1-CheckList.doc", ReadOnly:=True
        Documents.Open FileName:="Z:\2-Inventory.doc", ReadOnly:=True
        Documents.Open FileName:="Z:\3-SiClubApp.doc", ReadOnly:=True

        ' The next line is where the error occurs'

        If ActiveDocument.MailMerge.DataSource.DataFields(73).Value <> "0.00" Then


           Documents.Open FileName:="Z:\4-CreditCardAuth.doc", ReadOnly:=True
           Documents.Open FileName:="Z:\5-CreditCardAuthMo.doc", ReadOnly:=True
           Documents.Open FileName:="Z:\6-AchDebitDP.doc", ReadOnly:=True
           Documents.Open FileName:="Z:\6-AchDebitMo.doc", ReadOnly:=True
        End If

    Any help with this is greatly appreciated.

    Thanks,

    John


    • Edited by jvarner Tuesday, September 18, 2012 6:15 PM
    • Moved by Mike Feng Wednesday, September 19, 2012 10:50 AM VBA (From:Visual Basic General)
    Tuesday, September 18, 2012 6:13 PM

All replies