N
Nuno
Hello,
I'm using the COM office interface (Microsoft Office 11.0 Object
Library) to write directly in a word document using the Word.Range
interface.
All is ok in this process, my problem is that when i close the
document, if nothing is writed in the document i do not save anything
in my Word.Document.Close and Word.Application.Quit functions but when
i call the Quit function and for example is at least one instance of
the word in use/open then it allways return this error message boxes:
"Word cannot save this file because it is already open elsewhere. (c:
\document...\Normal.dot)"
and then gives an error.
"Run time error 5995 - Word cannot write to file"
Is there any way of avoid this problem? (if no word document instance
is open then this does not happen).
I realy don't care about the Normal.dot document, i don't change it,
so i don't want to save it, but it allways tells me this.
PS: my open function looks like this
Word.Application app = new Word.ApplicationClass();
object filename = str_doc_path;
object readOnly = false;
object confirmconversions = false;
object addToRecent = false;
object isVisible = true;
object writePasswordTemplate = false;
// Here is the way to handle parameters you don't care about in .NET
object missing = System.Reflection.Missing.Value;
// Open the document that was chosen by the dialog
Word.Document document = app.Documents.Open(
ref filename,
ref confirmconversions,
ref readOnly,
ref addToRecent,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref isVisible,
ref missing,
ref missing,
ref missing,
ref missing);
Nuno
I'm using the COM office interface (Microsoft Office 11.0 Object
Library) to write directly in a word document using the Word.Range
interface.
All is ok in this process, my problem is that when i close the
document, if nothing is writed in the document i do not save anything
in my Word.Document.Close and Word.Application.Quit functions but when
i call the Quit function and for example is at least one instance of
the word in use/open then it allways return this error message boxes:
"Word cannot save this file because it is already open elsewhere. (c:
\document...\Normal.dot)"
and then gives an error.
"Run time error 5995 - Word cannot write to file"
Is there any way of avoid this problem? (if no word document instance
is open then this does not happen).
I realy don't care about the Normal.dot document, i don't change it,
so i don't want to save it, but it allways tells me this.
PS: my open function looks like this
Word.Application app = new Word.ApplicationClass();
object filename = str_doc_path;
object readOnly = false;
object confirmconversions = false;
object addToRecent = false;
object isVisible = true;
object writePasswordTemplate = false;
// Here is the way to handle parameters you don't care about in .NET
object missing = System.Reflection.Missing.Value;
// Open the document that was chosen by the dialog
Word.Document document = app.Documents.Open(
ref filename,
ref confirmconversions,
ref readOnly,
ref addToRecent,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref isVisible,
ref missing,
ref missing,
ref missing,
ref missing);
Nuno