I'm writing a macro that will merge content from various Word documents, but I want to be able to pull certain configuration info out of an Excel file. It seems that should be relatively easy, but when I try to open the Excel workbook from within the Word macro, I get a run-time error. Here's the relevant code:
This is the exact error message I see:
I've tried this code with Excel both running and closed, and with the particular xlsx file both open and closed. I've also tried saving in several other (older) Excel formats. No dice. At one point, I started getting a different error, but then I restarted both Word and Excel and haven't reproduced that error since.
Run-time error '429':
ActiveX component can't create object
[End] [Debug] [Help]
Note that I'm currently using the downloadable demo of Mac Office 2011 (until my purchased copy arrives). I have to wonder if that's the problem. Alternatively, I wonder if I simply cannot access an Excel workbook from within a Word macro. Unfortunately, there doesn't yet appear to be much discussion online with regard to Mac Office VBA programming. Any help would be appreciated!
Note that I have the following references in place:
- Visual Basic for Applications
- Microsoft Word 14.0 Object Library
- Microsoft Forms 2.0 Object Library
- Microsoft Office 14.0 Object Library
- Microsoft Excel 14.0 Object Library