H
Haydn Robinson
I'm using C# for Word interop and can't find another newsgroup so here goes.
I'm creating an instance of Word 2007 SP1 and successfully loading in a
file. However, when I ask it to close all documents, it fails with a COM
error of "Command Failed", HRESULT -2146824090.
The code I'm using is as follows:
// To open the document...
// Not included all variables, but should be obvious what they are...
object format = WdOpenFormat.wdOpenFormatAuto;
this.wordApplication.Documents.Open(
ref theFilename,
ref missing,
ref isReadOnly,
ref oFalse,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref format,
ref missing,
ref isVisible,
ref missing,
ref missing,
ref missing,
ref missing);
And to close all documents...
object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
object missing = System.Type.Missing;
this.wordApplication.Documents.Close(ref saveChanges, ref missing, ref
missing);
When I open another document I get another window for Word which I don't
want (all documents must open in the same window).
Any suggestions welcome.
Thanks.
Haydn
I'm creating an instance of Word 2007 SP1 and successfully loading in a
file. However, when I ask it to close all documents, it fails with a COM
error of "Command Failed", HRESULT -2146824090.
The code I'm using is as follows:
// To open the document...
// Not included all variables, but should be obvious what they are...
object format = WdOpenFormat.wdOpenFormatAuto;
this.wordApplication.Documents.Open(
ref theFilename,
ref missing,
ref isReadOnly,
ref oFalse,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref format,
ref missing,
ref isVisible,
ref missing,
ref missing,
ref missing,
ref missing);
And to close all documents...
object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
object missing = System.Type.Missing;
this.wordApplication.Documents.Close(ref saveChanges, ref missing, ref
missing);
When I open another document I get another window for Word which I don't
want (all documents must open in the same window).
Any suggestions welcome.
Thanks.
Haydn