C
C#8mo ago
M B V R K

Marshal.GetActiveObject("Word.Application") fall in exception

I'm working on a .NET Framework console application, I have added the Microsoft.Office.Interop.Word as a reference I have wrote a line of code that get an object from the opening instance of Microsoft Word as following :
Application wordApp = Marshal.GetActiveObject("Word.Application") as Application;
Application wordApp = Marshal.GetActiveObject("Word.Application") as Application;
The issue: When I run the application, it always throw an exception for that line as shown in the attached video Please does anyone has any idea or solution for this issue ? Massive thanks in advance <3
2 Replies
SpReeD
SpReeD8mo ago
Try to cast to Word.Application
M B V R K
M B V R KOP8mo ago
Still the same issue
Want results from more Discord servers?
Add your server