W
webstuff
Hi,
I'm getting a 'Type mismatch' exception when calling the
Word.Application.Documents.Open method when using the Office XP 2003
PIAs. the actual error is:
System.Runtime.InteropServices.COMException (0x80020005): Type
mismatch.
This method works when using the Office XP PIAs (not that this fact is
much to go by) but sadly:
1) the number of arguments changes between versions of the PIA
2) this error occurs
Has anyone had a similar problem? My code couldn't be simpler (minus
exception handling):
private static Word.Document openDocument(Word.Application application,
string sFileName)
{
Word.Document dDocument = null;
object oReadOnly = true;
object oIsVisible = false;
object oMissing = System.Reflection.Missing.Value;
dDocument = application.Documents.Open(
ref sFileName,
ref oMissing,
ref oReadOnly,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oIsVisible,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing);
return dDocument;
}
Can anyone help?! Alternatives/workarounds/hair replacement therapy all
welcome...
Cheers,
Rich
I'm getting a 'Type mismatch' exception when calling the
Word.Application.Documents.Open method when using the Office XP 2003
PIAs. the actual error is:
System.Runtime.InteropServices.COMException (0x80020005): Type
mismatch.
This method works when using the Office XP PIAs (not that this fact is
much to go by) but sadly:
1) the number of arguments changes between versions of the PIA
2) this error occurs
Has anyone had a similar problem? My code couldn't be simpler (minus
exception handling):
private static Word.Document openDocument(Word.Application application,
string sFileName)
{
Word.Document dDocument = null;
object oReadOnly = true;
object oIsVisible = false;
object oMissing = System.Reflection.Missing.Value;
dDocument = application.Documents.Open(
ref sFileName,
ref oMissing,
ref oReadOnly,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing,
ref oIsVisible,
ref oMissing,
ref oMissing,
ref oMissing,
ref oMissing);
return dDocument;
}
Can anyone help?! Alternatives/workarounds/hair replacement therapy all
welcome...
Cheers,
Rich