ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Invoking Mail Merge from Excel (https://www.excelbanter.com/excel-programming/281088-invoking-mail-merge-excel.html)

John Topley

Invoking Mail Merge from Excel
 
I invoke a mail merge from Excel where my calling Excel workbook
(TestMailMerge.xls) is also the data source for the Mail Merge. When I
close my Excel workbook, I get a message saying my Excel workbook is
available for editing; an instance appears to have been opened as
read-only by the Mail Merge.

My mail merge code is as follows:

ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\Documents and Settings\John Topley\My
Documents\TestMailMerge.xls", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er
ID=Admin;Data Source=C:\Documents and Settings\John Topley\My
Documents\TestMailMerge.xls;Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB:D" _
, SQLStatement:="SELECT * FROM `Year7$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess

With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With


My environment is Windows XP and and Excel/Word 2002.

How can I close the Mail Merge instance of "TestMailMerge.xls" (Read
only) and remove the "error" message?

Thanks in advance for your help.

John Topley

Invoking Mail Merge from Excel
 
(John Topley) wrote in message . com...

This appears to have been a temporary aberration as the problem has
"resolved" itself.

-------------------------------------------------------------------------------



I invoke a mail merge from Excel where my calling Excel workbook
(TestMailMerge.xls) is also the data source for the Mail Merge. When I
close my Excel workbook, I get a message saying my Excel workbook is
available for editing; an instance appears to have been opened as
read-only by the Mail Merge.

My mail merge code is as follows:

ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\Documents and Settings\John Topley\My
Documents\TestMailMerge.xls", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er
ID=Admin;Data Source=C:\Documents and Settings\John Topley\My
Documents\TestMailMerge.xls;Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB:D" _
, SQLStatement:="SELECT * FROM `Year7$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess

With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With


My environment is Windows XP and and Excel/Word 2002.

How can I close the Mail Merge instance of "TestMailMerge.xls" (Read
only) and remove the "error" message?

Thanks in advance for your help.



All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com