Excel to Word Macro and reference library

richard12

New Member
Joined
Feb 9, 2017
Messages
23
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:
Code:
 Dim wordApp As Word.Application
 Dim wordDoc As Word.Document
 Set wordApp = CreateObject("Word.Application")  'results in error message
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.
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
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Upvote 0

Forum statistics

Threads
1,214,656
Messages
6,120,762
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top