Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
Where do you run the code? Is it a Windows service or ASP.NET application? Do not know what caused things to get messed up, but this did fix my problem. I went to control panel, programs and features, selected office, pressed the change button, and selected quick repair. What ended up fixing my problem was preforming a quick repair on office. I am going to try and fix this so it is pointing to the WINWORD.exe for Word 2013 instead of Word 2010. What does not make sense is that it is looking for the wrong WINWORD.exe.
I've gone into the registry and it seems that the local server it is failing to communicate with is pointing to WINWORD.exe which makes sense. I've been doing some more research ( ) and I believe I may be getting closer to the source of the problem. So the source of this error is not the code.
I have tested my code on another machine and it works. If anyone has any insight to what I am missing or if I am doing something wrong I would appreciate the help. I have read that the following needs to be done, so I have made sure that word 2013 is installed on my machine and I have set the target CPU to 圆4 inside the application's properties. My problem is that an error keeps getting thrown at this point:Īpp = New .ApplicationĪ first chance exception of type '' occurred in mscorlib.dllĪdditional information: Retrieving the COM class factory for component with CLSID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: ox80080005 (COE_SERVER EXEC FAILURE)). I made sure to add the reference to in my application. When a button is clicked the word document will be created. I have created a simple windows form application.
I have found some tutorials online ( ) about how to create a word document programmatically. I have found that this can be done using the objects. Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.I am trying to create a word document using visual basic. Set wrd = GetObject(, "Word.Application") The following Microsoft Excel example starts Word (if it is not already running) and opens an existing document. To use Automation (formerly OLE Automation) to control Word from another application, use the Microsoft Visual Basic CreateObject or GetObject function to return a Word Application object. Properties and methods that can be used without the Application object qualifier are considered "global." To view the global properties and methods in the Object Browser, click at the top of the list in the Classes box. For example, instead of writing, you can write ActiveDocument.PrintOut. Many of the properties and methods that return the most common user-interface objects-such as the active document ( ActiveDocument property)-can be used without the Application object qualifier. The following example displays the user name for Word. Use the Application property to return the Application object. For example, the ActiveDocument property returns a Document object.
The Application object includes properties and methods that return top-level objects. Represents the Microsoft Word application.