Colin, really thank you for your walkthrough. Fix a lot and learn lots of good practices when coding VBA. The most troublesome part would be looking up in the enumeration references when I use late binding of Word.
By the way, I forgot one question:
Code:
With oDoc
With .MailMerge
.MainDocumentType = 0
.OpenDataSource Name:=ThisWorkbook.FullName, SQLStatement:="SELECT * FROM `Sheet1$`"
.DataSource.ActiveRecord = Selection.Rows(1).Row - 1
.ViewMailMergeFieldCodes = False
With .DataSource
Do
.FirstRecord = .ActiveRecord
.LastRecord = .ActiveRecord
'''
oDoc.MailMerge.Destination = 0
oDoc.MailMerge.Execute Pause:=False
'''
Set oLetter = oWord.ActiveDocument
'''
I have long wondered how I could do something like this:
Code:
Set oLetter = oDoc.MailMerge.Execute Pause:=False
Though I have set the object oLetter = the new document created by MailMerge, it refers to the actived ocument at the moment. I don't know if it is true or not. It is not safe when I refer to ActiveDocument all the time. The active document may not be the mail merge created document by accident.