I have been using the Microsoft Office Interop Word for quite some time without any issues, but now all of a sudden it has stopped working. It now gives me the exception message
Word could not fire the event
I'm running the latest update of Windows 10 Pro - 1809, I have office 2016 installed also with the latest updates. And I'm running Visual studio 2017
I use the code below to test the issue:
using System;
using Word = Microsoft.Office.Interop.Word;
namespace WordTesting
{
class Program
{
static void Main(string[] args)
{
Word.Application application = new Word.Application();
application.Visible = false;
Word.Document document = null;
try
{
document = application.Documents.Open(@"C:\Users\caspe\Desktop\TEST.docx", Visible: false);
}
catch (Exception e)
{
application.Quit();
Console.WriteLine("Exception: {0}", e.Message);
}
Console.ReadKey();
}
}
}
Here are my References:
The Code above throws a:
Exception thrown: 'System.Runtime.InteropServices.COMException' in WordTesting.exe
And the Console.Writeline is:
Exception: Word could not fire the event
Full exception:
System.Runtime.InteropServices.COMException: 'Word could not fire the event.'
UPDATE
I have just tested my build on another windows 10 machine with build 180 and there it works like a charm
I hope someone can find a solution to the issue, because I haven't been able to find one.
Okay this is a strange solution. But I found it in here last post on this page and here
So basically it's a region thing. I had my region to ENG[DAN], because Denmark. But when I changed everything to ENG[US] it worked again.
I have some other parts of my implementation that still doesn't work, but for now this is good enough.