R
Robert Jones
I want to be able to run a mail merge using data from a SQL database, but I
don't want to have to set up an odc datasource for everyone who will be
running the mail merge. I can't guarantee a shared network drive so sharing
an odc isn't an option either. If you look at the options for a mail merge:
ActiveDocument.MailMerge.OpenDataSource Name:="Name_Address.odc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:= _
"Provider=MSDASQL.1;Persist Security Info=True;Extended
Properties=""DSN=MyLetters;UID=Work;APP=Microsoft Office
2003;WSID=12345;DATABASE=MyDatabase;Trusted_Connection=Yes"";Initial
Catalog=iMIS" _
, SQLStatement:="SELECT * FROM ""Name_Address""", SQLStatement1:="",
_
SubType:=wdMergeSubTypeOther
it looks as if the mail merge already has all the SQL information it needs
in the Connection and SQLStatement properties. Is there a way to avoid
having to specify the odc file?
don't want to have to set up an odc datasource for everyone who will be
running the mail merge. I can't guarantee a shared network drive so sharing
an odc isn't an option either. If you look at the options for a mail merge:
ActiveDocument.MailMerge.OpenDataSource Name:="Name_Address.odc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:= _
"Provider=MSDASQL.1;Persist Security Info=True;Extended
Properties=""DSN=MyLetters;UID=Work;APP=Microsoft Office
2003;WSID=12345;DATABASE=MyDatabase;Trusted_Connection=Yes"";Initial
Catalog=iMIS" _
, SQLStatement:="SELECT * FROM ""Name_Address""", SQLStatement1:="",
_
SubType:=wdMergeSubTypeOther
it looks as if the mail merge already has all the SQL information it needs
in the Connection and SQLStatement properties. Is there a way to avoid
having to specify the odc file?