Im trying to write in a Word document from Excel VBA code, to place the data from am Excel table into a report. I added the "Microsoft Office 16.0 Object Library" to be able to work with Word objects from Excel, and in my code I defined variables as Word.Application, but when I run it, my program can't recognize this type.
In the "Tools >> References..." dialog box I can see that the location of this library is in "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\MSO.DLL", but when I access this folder "OFFICE16", to check what's inside, I can't find the archive MSO.DLL (I only see the "Office Setup Controller" folder, and the LICLUA.EXE archive).
"Microsoft Office 16.0 Object Library" does not contain the classes, etc., you are looking for, i.e., Word classes. Scroll further down in the References dialog to find "Microsoft Word 16.0 Object Library", and select it.
Then open the Object Browser (under the VBA Editor's View menu); select Word from the upper dropdown list (which usually shows ) to see a top-level view of this library's classes. You can click on a class name to see its members, and click on a member name to see more info on it in the pane at the bottom (which has a draggable border, so you can make it taller/shorter).
@PacoDeBenito I realize this is an older thread and hopefully you've already found a solution. I wanted to post for anyone else who comes across this thread having the same issue. I was struggling with this same thing. I had the "Microsoft Office 16.0 Object Library" selected in References but VBA was still not recognizing the Word.Application object. After searching through the list I found an available reference called "Microsoft Word 16.0 Object Library" and as soon as I activated that, the Word.Application object worked perfectly. I hope this helps!
A friend of mine is missing the Microsoft Office XX.0 Object Library. He has office 2016 installed. He is using a code that I generated to export a bill of materials from Inventor to excel. A reference to the Microsoft Office XX.0 Object Library is required. This object Library is not present in the References window (VBA>Tools>References). Is there a way to download another/find in his directory?. Would I be able to give him a copy of my object library? If so, what would be the filename for the library?
I figured it out though. The main issue I was having was determining the location and name of the dll file. For me, the object library was only missing from the references window while using vba editor in Inventor. When I open up excel and pull up its vba window, the object library was not missing from the list.
So I clicked on the Microsoft Office 16.0 Object Library from the excel vba references window and it shows the full file path. But it cuts off before the end. I had a nightmare with this and Microsoft help chat/calls.
The next morning I opened Visual Studio 2015 and opened a Visual Basic > Windows > Classic Desktop > Console Application. From the Solution Explorer, I right clicked References > Add Reference. A window came up with an extensive list of object libraries. I found the Microsoft Office 16.0 Object Library that I was looking for, and when I put the cursor over the listed object library, it displayed the full path and file name uncut and uncensored.
Finally, I went back into the inventor vba window > Tools > References. I then clicked browse in the new window and found my dll file. It was named Office once it was in the References window. I closed the references window and reopened it to find the Microsoft Office 16.0 Object Library just as it should be. All of this just so I can create File Dialogs!
Anyways, I can't imagine I am the only one in the world who had or is having this issue with an object library. For Office 2016, here is the full file path, which I imagine will be the same for any user because I believe it is a default directory:
If anyone is having a similar issue with an object library and they know it is on their computer somewhere, employ the aforementioned method using Visual Studio 2015; Community Edition should work fine.
In Outlook VBA editor, if you desire to use the objects of other applications, such as Microsoft Excel or Word, you have to add the according object library references in the first place. This article will share you the concrete steps.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt mdf and outlook repair software products. For more information visit
www.datanumen.com
This article shows how to check for misspelled words in a document (in a WPF Rich TextBox) using the COM Object "Microsoft Word Object Library".
To exploit the Spellchecker feature in our app, we are using the Microsoft Word Object Library. This is a COM object and you can add the COM DLL into your project by right-clicking the project's References then selecting "Add Reference" then go to the "COM" Tab and select "Microsoft Word 14.0 Object Library" then click "OK".
Now we add a Rich TextBox in the WPF Grid (to show the contents), a List Box (to show suggested words for a misspelled word) and a button (to check spelling). So in this way we add a DLL reference and finish our GUI design for this app.
On running this app, we paste the contents on the Rich TextBox using a default Cut-Copy-Paste context menu (see below).
Logic
In order to check the spelling and get spelling suggestions for a misspelled word, we create the following objects:
Microsoft.Office.Interop.Word.Application appWord;
Microsoft.Office.Interop.Word.SpellingSuggestions CorrectionsCollection;
To check the spellings, we first parse the text written in the TextBox and retireve all the wrods.
Then for each word, we call the "CheckSpelling" method of the Word.Application object.
IsWordCorrect = appWord.CheckSpelling(word, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt, ref nullArgmnt);
In the preceding method, only the first argument, "word", is a required argument but all the other arguments are optional. For more details, refer to the MSDN documentation at:
-us/library/office/ff822597.aspx
If we get the "IsWrodCorrect" boolean flag as false (in other words a misspelled word) then we highlight the word with a different color in the RichTextBox as follows:
3a8082e126