B
BillR
I have mailmerge files that are passed among various users,
where the document path may change. To ensure a proper link the the
merge
data file, I had code that saves the document path as a document
property.
When the file is opened, the current path is checked against that
property.
If they do not match (if the file is in a different directory), I
reestablish
the link to the datasource (an Excel file and a named worksheet in the
file,
in the same directory as that document.)
Until I changed computers a week ago, the following code worked to
reestablish
that connection:
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=strDataSourceName, _
LinkToSource:=True, _
AddToRecentFiles:=False, _
Connection:="WORKSHEET Variables$", SQLStatement:="",
SQLStatement1:="", _
SubType:=wdMergeSubTypeWord2000
End With
I included the Word2000 subtype to avoid prompts to select the
datasource.
My old PC was on Windows 2000, and I was using Office XP. My new
computer uses Windows XP Pro, but we're still on Office XP.
The old code no longer works. In fact, now, even if I try to do a
basic mailmerge wizard connection to the Excel source, I am presented
with a bewildering array of options to choose from, offering ODBC,
OLE, DDE, etc.
I think my old computer had ODBC installed, but am not sure. I don't
want to have to rely on that installation.
Can anyone suggest why this code is no longer working? And what I can
do to fix it to link to the Excel file and the worksheet with my data?
Thanks in advance!
Bill
where the document path may change. To ensure a proper link the the
merge
data file, I had code that saves the document path as a document
property.
When the file is opened, the current path is checked against that
property.
If they do not match (if the file is in a different directory), I
reestablish
the link to the datasource (an Excel file and a named worksheet in the
file,
in the same directory as that document.)
Until I changed computers a week ago, the following code worked to
reestablish
that connection:
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=strDataSourceName, _
LinkToSource:=True, _
AddToRecentFiles:=False, _
Connection:="WORKSHEET Variables$", SQLStatement:="",
SQLStatement1:="", _
SubType:=wdMergeSubTypeWord2000
End With
I included the Word2000 subtype to avoid prompts to select the
datasource.
My old PC was on Windows 2000, and I was using Office XP. My new
computer uses Windows XP Pro, but we're still on Office XP.
The old code no longer works. In fact, now, even if I try to do a
basic mailmerge wizard connection to the Excel source, I am presented
with a bewildering array of options to choose from, offering ODBC,
OLE, DDE, etc.
I think my old computer had ODBC installed, but am not sure. I don't
want to have to rely on that installation.
Can anyone suggest why this code is no longer working? And what I can
do to fix it to link to the Excel file and the worksheet with my data?
Thanks in advance!
Bill