I have an issue in VB.Net trying to create Word and Excel Objects using a service.
Error message in the Event Viewer shows "Cannot create ActiveX component."
The issue only occurs on Windows 11 and the same code & service works as it should in Windows 10.
I have a service that runs as Local System account. Every 10 minutes it runs and has code to gather the text out of Word and Excel and writes to a SQL DB.
The code that fails is below in the Try/Catch:
Dim objWordApplication As Object = Nothing
Try
objWordApplication = CreateObject("Word.Application")
objExcelApplication = CreateObject("Excel.Application")
MicrosoftOfficeInstalled = True
Catch ex As Exception
MicrosoftOfficeInstalled = False
gEventLog.WriteEntry("Office Not Detected: " & ex.Message & " ")
End Try
It appears the CreateObject is failing, but I can't determine why, nor can i determine how to get more information written to the event log, like maybe a message number that i can research further.
Any help would be greatly appreciated.
Brian