Macro doesn't work any more

Discussion in 'Word VBA' started by Peter, Aug 26, 2014.

  1. Peter

    Peter

    Joined:
    Aug 26, 2014
    Messages:
    1
    Likes Received:
    0
    Hi,

    I have made a macro in word which have worked perfectly until last week. It is a macro which ensure that the word document is connected to an excel spreadsheet, regardless of whether the files are copied to another folder in a mail merge.

    Do you know what is wrong with the following macro?

    Private Sub Document_Open()
    Dim Aktuelsti As String, Saldodata As String

    Aktuelsti = ActiveDocument.Path

    Saldodata = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "User ID=Admin;" & _
    "Data Source=" & Aktuelsti & "\data.xls;" & _
    "Mode=Read;" & _
    "Extended Properties=""HDR=YES;IMEX=1;"";" & _
    "Jet OLEDB:System database="""";" & _
    "Jet OLEDB:Registry Path="""";" & _
    "Jet OLEDB:Database Passw"

    ActiveDocument.MailMerge.OpenDataSource _
    Name:=Aktuelsti & "\data.xls", _
    LinkToSource:=True, _
    Format:=wdOpenFormatAuto, _
    SQLStatement:="SELECT * FROM `Dansk$`", _
    SQLStatement1:="", _
    SubType:=wdMergeSubTypeAccess
     
    Peter, Aug 26, 2014
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Neve

    Macro created in Word doesn't work

    Dave Neve, Dec 21, 2003, in forum: Word VBA
    Replies:
    3
    Views:
    105
    Howard Kaikow
    Dec 21, 2003
  2. Bill Cunningham

    Macro Button doesn't work

    Bill Cunningham, Jan 14, 2004, in forum: Word VBA
    Replies:
    3
    Views:
    403
    Bill Cunningham
    Jan 15, 2004
  3. bluejackethive72
    Replies:
    1
    Views:
    125
    Jay Freedman
    Mar 8, 2006
  4. MJones
    Replies:
    4
    Views:
    178
    MJones
    Jan 15, 2007
  5. Microsmith
    Replies:
    3
    Views:
    111
    Microsmith
    Jul 25, 2007
  6. Co
    Replies:
    2
    Views:
    134
    Graham Mayor
    Jan 15, 2008
  7. peter.mcclymont@gmail.com

    Word Macro Doesn't Work

    peter.mcclymont@gmail.com, Apr 14, 2008, in forum: Word VBA
    Replies:
    2
    Views:
    279
    peter.mcclymont@gmail.com
    Apr 14, 2008
  8. Dan B
    Replies:
    8
    Views:
    167
    Dan B
    Apr 18, 2008
Loading...