我估计我错误理解楼主的意思了,我做的是解决动态链接的代码,而你的要求好象是自动填入合并域的工作 ? '* +++++++++++++++++++++++++++++
'* Created By I Love You_Word!@ExcelHome 2005-4-26 6:02:49
'仅测试于System: Windows NT Word: 10.0 Language: 2052
'^The Code CopyIn [ThisDocument-ThisDocument]^'
'* -----------------------------'Private Sub Document_Close()
''每次退出时修改为普通WORD文档
' ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
'End Sub
Private Sub Document_Open()
'每次打开时指定数据源为同一路径下的该XLS 工作薄
Dim DataName As String
'先修改为普通WORD文档(去除数据源)
ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
DataName = ThisDocument.Path & "\评级记录.xls"
ActiveDocument.MailMerge.OpenDataSource Name:=DataName, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" & DataName & ";Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Databa" _
, SQLStatement:="SELECT * FROM `掏挖插入式$`", SQLStatement1:="", SubType:= _
wdMergeSubTypeAccess
End Sub
'---------------------- |