THE ISSUE:
I cannot create a word or excel instance on my computer using VB.net or VBA. I have tried using CreateObject (VBA and VB.net) and "New Word.Document" (VB.net) I have programs that used to work, but now do not. The same programs work on other computers but not mine. I had this issue appear earlier this year and I tried reinstalling office, eventually I had to reset windows and it worked until now. Also, I believe the issue is related to another issue that has suddenly appeared that I previously had as well, if i right click a word document and click "Convert to PDF" (using Acrobat DC) I get an error that states:
"The Security level is set to High. Please run the application which created this document, in the "Security Warning" dialog select the check box "Always trust macros from this source" and enable macro's created by Adobe Systems Inc.""
I bring this up because the both these issues appeared together and both are related to Word. My gut feeling is there is some issue with a dll that I cant quite put my finger on. Based on the error message from "New Word.Document" and some googling, It seems to be acting like the system is recognizing the Word is installed. Which makes sense because I get the same errors whether Word is installed or not.
QUESTION:
What could be causing the error shown below?
ADDITIONAL INFO:
Windows 10 Office 2016 Visual Studio 2017
This is the code that has previously worked but no longer does. Note it has the New Word.Application commented out as I switch between for testing the issue.
Imports Word = Microsoft.Office.Interop.Word
Public Class Form1
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim appWord As Word.Application
try
appWord = CreateObject("Word.Application")
'appWord = New Word.Application
Catch ex As Exception
MsgBox(ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
End Sub
end Class
ERRORS:
I get errors using both CreateObject and New Word.Application. Here are the errors I receive.
USING CREATEOBJECT
Message:Cannot create ActiveX component.
StackTrace:at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName) at WindowsApp1.Form1.Button3_Click(Object sender, EventArgs e) in C:\Users\sevans\OneDrive\Work\Programs\In Developement\WindowsApp1\WindowsApp1\Form1.vb:line 7
Using CreateObject Output Shows Exception thrown: 'System.Exception' in Microsoft.VisualBasic.dll
USING NEW WORD.DOCUMENT
Message:Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000ffff Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)).
StackTrace:at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at WindowsApp1.Form1.Button3_Click(Object sender, EventArgs e) in C:\Users\sevans\OneDrive\Work\Programs\In Developement\WindowsApp1\WindowsApp1\Form1.vb:line 8
Output shows: Exception thrown: 'System.Runtime.InteropServices.COMException' in mscorlib.dll
REFERENCES TRIED:
Assemblies\Extensions Microsoft.Office.Interop.Word 15 Microsoft.Office.Interop.Word 14
COM Objects Microsoft Word 16.0 Object Library Microsoft Office 16.0 Object Library
User contributions licensed under CC BY-SA 3.0