VBA/Excel/Access/Word/Outlook/MailMerge — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:47, 26 мая 2010
Connecting Word with Access and MailMerge
Sub MailmergeLetter()
Dim myLetter As Document
Documents.Open FileName:="C:\Letter.doc"
Set myLetter = Documents("Letter.doc")
myLetter.MailMerge.OpenDataSource Name:="C:\store.mdb", Connection:="TABLE Employees"
End Sub
Merge to a new document and use only records 1 to 3
Sub MailmergeLetter()
Dim myLetter As Document
Documents.Open FileName:="C:\Letter.doc"
Set myLetter = Documents("Letter.doc")
myLetter.MailMerge.OpenDataSource Name:="C:\mydb.mdb", Connection:="TABLE Employees"
With myLetter.MailMerge
.Destination = wdSendToNewDocument
With .DataSource
.FirstRecord = 1
.LastRecord = 3
End With
.Execute
End With
End Sub