F
fumade
hi Cindy
I cannot get active word instance,It throws exception message
Message = "Operation unavailable (Exception from HRESULT: 0x800401E3
(MK_E_UNAVAILABLE))"
But i can create a new word instance by
Application app = new ApplicationClass();
or
Type t = System.Type.GetTypeFromProgID("Word.Application", "localhost");
Application WordApplication =
(ApplicationClass)System.Activator.CreateInstance(t);
My code:
Type typWordApp = typeof(Application);
if (typWordApp != null)
{
try
{
WordApplication =
(ApplicationClass)Marshal.GetActiveObject
("Word.Application");
WordApplication.Visible = false;
}
catch(Exception e)
{
// EventLog.WriteEntry("TestWord",e.Message);
}
Can you give me some clues why this code does'nt work?
Thanks.
I cannot get active word instance,It throws exception message
Message = "Operation unavailable (Exception from HRESULT: 0x800401E3
(MK_E_UNAVAILABLE))"
But i can create a new word instance by
Application app = new ApplicationClass();
or
Type t = System.Type.GetTypeFromProgID("Word.Application", "localhost");
Application WordApplication =
(ApplicationClass)System.Activator.CreateInstance(t);
My code:
Type typWordApp = typeof(Application);
if (typWordApp != null)
{
try
{
WordApplication =
(ApplicationClass)Marshal.GetActiveObject
("Word.Application");
WordApplication.Visible = false;
}
catch(Exception e)
{
// EventLog.WriteEntry("TestWord",e.Message);
}
Can you give me some clues why this code does'nt work?
Thanks.