Hi
I have a legacy system that i wrote a few years ago that worked fine with office 2003 but we are planning an upgrade to office 2010. The application included a emailmerge button that performed a word mailmerge in the background. With office 2010 the code just steps through not appearing to do anything. I have the word 14 reference ticked and the basics of the code is below.
FYI the app will still use Access 2003 due to license issues.....
Any ideas? Has the word object model changed?
Thanks - Ant
dim obj as word.application
dim strEmailSubject as string
Set obj = CreateObject("Word.Application")
'now we open and execute the email merge in word
obj.Documents.Open strDocLocation
Set doc = obj.ActiveDocument
strEmailSubject = InputBox("Please Type Email Subject Line.", "Email Subject Line....")
doc.MailMerge.OpenDataSource strDataSource
doc.MailMerge.MailSubject = strEmailSubject
doc.MailMerge.MailFormat = wdMailFormatHTML
doc.MailMerge.MailAddressFieldName = "App_Email"
doc.MailMerge.Destination = wdSendToEmail
doc.MailMerge.Execute
I have a legacy system that i wrote a few years ago that worked fine with office 2003 but we are planning an upgrade to office 2010. The application included a emailmerge button that performed a word mailmerge in the background. With office 2010 the code just steps through not appearing to do anything. I have the word 14 reference ticked and the basics of the code is below.
FYI the app will still use Access 2003 due to license issues.....
Any ideas? Has the word object model changed?
Thanks - Ant
dim obj as word.application
dim strEmailSubject as string
Set obj = CreateObject("Word.Application")
'now we open and execute the email merge in word
obj.Documents.Open strDocLocation
Set doc = obj.ActiveDocument
strEmailSubject = InputBox("Please Type Email Subject Line.", "Email Subject Line....")
doc.MailMerge.OpenDataSource strDataSource
doc.MailMerge.MailSubject = strEmailSubject
doc.MailMerge.MailFormat = wdMailFormatHTML
doc.MailMerge.MailAddressFieldName = "App_Email"
doc.MailMerge.Destination = wdSendToEmail
doc.MailMerge.Execute