I need some code to determine if a document is a mailmerge document or should I say if it has a datasource ( what do you call the document that has a datasource, "form letter").
I have tried these coding methods, but they all return False.
#1
With oMainDoc.MailMerge
.Execute
If .State = wdMainAndDataSource Then
retval = "True"
Else
retval = "False"
End If
End With
#2
If oMainDoc.MailMerge.MainDocumentType = wdNotAMergeDocument Then
retval = "Not a mail merge main document"
Else
retval = "Document is a mail merge main document."
End If
#3
With oMainDoc
If .MailMerge.MainDocumentType = -1 Then
retval = "False"
Else
retval = "True"
End If
End With
#4
If oMainDoc.MailMerge.DataSource.Name <> "" Then
retval = "False"
Else
retval = "True"
End If
Thanks for any help.
I have tried these coding methods, but they all return False.
#1
With oMainDoc.MailMerge
.Execute
If .State = wdMainAndDataSource Then
retval = "True"
Else
retval = "False"
End If
End With
#2
If oMainDoc.MailMerge.MainDocumentType = wdNotAMergeDocument Then
retval = "Not a mail merge main document"
Else
retval = "Document is a mail merge main document."
End If
#3
With oMainDoc
If .MailMerge.MainDocumentType = -1 Then
retval = "False"
Else
retval = "True"
End If
End With
#4
If oMainDoc.MailMerge.DataSource.Name <> "" Then
retval = "False"
Else
retval = "True"
End If
Thanks for any help.