I have a simple c# application, (which helps entering Header/Footer.)
So all works fine, but when any Dialogue (eg. Select Font) in Word ist opened, I can't connect the "ActiveDocument.Name" any more.
private IopW.Application wordApp;
private IopW.Document wordDoc;
...
wordDoc = wordApp.Documents.Open(Datei);
...
try
{
if (wordApp != null && wordApp.ActiveDocument != null)
{
Console.Write(wordApp.ActiveDocument.name);
// Works fine, **if no Dialog is opened** in Word.
// but when any Dialog is opened i get the error:
// System.Runtime.InteropServices.COMException:
// "Aufruf wurde durch Aufgerufenen abgelehnt.
// (Ausnahme von HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))"
// In English: "Call was rejected by callee"
}
} catch
{
...
}
Try/catch does not prevent the error beeing printed.
Remember: wordApp.ActiveDocument != null, but wordApp.ActiveDocument.name is rejected.
So:
User contributions licensed under CC BY-SA 3.0