I am attempting to do a mail merge from Excel to a Word template via vbscript in a DTS package. Since named constants don't work in vbscript, I need to know how to reference to constants properly in vbscript.
Here is the statement I want to execute:
If doc.MailMerge.State = wdMainAndDataSource Then .Execute
Since wdMainAndDataSource is a named constant that can't be used in VBScript, I attempted to do this as instructed on the MSDN website:
If doc.MailMerge.State = doc.MailMerge.Constants.wdMainAndDataSource Then .Execute
But this gives me an error stating "Object doesn't support this property or method: 'doc.MailMerge.Constants'
I can reference other properties of doc.MailMerge such as doc.MailMerge.DataSource.FirstRecord, but not the constants.
Any ideas?
Here is the statement I want to execute:
If doc.MailMerge.State = wdMainAndDataSource Then .Execute
Since wdMainAndDataSource is a named constant that can't be used in VBScript, I attempted to do this as instructed on the MSDN website:
If doc.MailMerge.State = doc.MailMerge.Constants.wdMainAndDataSource Then .Execute
But this gives me an error stating "Object doesn't support this property or method: 'doc.MailMerge.Constants'
I can reference other properties of doc.MailMerge such as doc.MailMerge.DataSource.FirstRecord, but not the constants.
Any ideas?