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 OLEDBatabase Passw"
ActiveDocument.MailMerge.OpenDataSource _
Name:=Aktuelsti & "\data.xls", _
LinkToSource:=True, _
Format:=wdOpenFormatAuto, _
SQLStatement:="SELECT * FROM `Dansk$`", _
SQLStatement1:="", _
SubType:=wdMergeSubTypeAccess
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 OLEDBatabase Passw"
ActiveDocument.MailMerge.OpenDataSource _
Name:=Aktuelsti & "\data.xls", _
LinkToSource:=True, _
Format:=wdOpenFormatAuto, _
SQLStatement:="SELECT * FROM `Dansk$`", _
SQLStatement1:="", _
SubType:=wdMergeSubTypeAccess