I am using Excel and Word 2013. I have the reference library with these references active (checked): Visual Basic for Applications, Microsoft Excel 15.0 Object Library, OLE Automation and Microsoft Word 15.0 Object Library. My problem is when I run the code:
The last line creates an error message: "Automation Error _ Library not Registered".
When I run the following code, it brings up the Word document but does not activate the mail merge so the Word reference seems to work.
This is my first try at using Excel to mailmerge a Word document. I know how easy it would be to open word and answer the SQL question, but I'd like to see if I can put a VB button in Excel and have an automated process. I would like to know what might be missing or not set right to change so the first code will run without an error message.
Richard
Code:
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Set wordApp = CreateObject("Word.Application") 'results in error message
When I run the following code, it brings up the Word document but does not activate the mail merge so the Word reference seems to work.
Code:
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("c:\users\shere\desktop\curtailmentchecklist.docx")
objWord.Visible = True 'Word opens with the document
This is my first try at using Excel to mailmerge a Word document. I know how easy it would be to open word and answer the SQL question, but I'd like to see if I can put a VB button in Excel and have an automated process. I would like to know what might be missing or not set right to change so the first code will run without an error message.
Richard