G
Gustyn
OK, I am trying to write an event handler that will close a new document in
word when it is called by MsWord. The problem is that when I try to call
newDoc->Close(), I get the following error:
..\MSWordEmbedControl.cpp(92) : error C2385: ambiguous access of 'Close'
could be the 'Close' in base 'Microsoft::Office::Interop::Word::_Document'
or could be the 'Close' in base
'Microsoft::Office::Interop::Word:ocumentEvents2_Event'
If I specifically call this->Word::_Document->Close() it then tells me it
will fail at runtime.
How am I supposed to close a document?
My Word object is instantiated as follows:
Using namespace Microsoft::Office:Interop::Word
Word::ApplicationClass msWord;
this->msWord = gcnew Word::ApplicationClass;
My Eventhandler is set up as follows:
void OnNewDoc(Document ^ newDoc) {
if (!this->bDeactivateEventProtection){
Object ^ myMissing=Type::Missing;
thisDoc=this->msWord->ActiveDocument;
newDoc->Close(myMissing,myMissing,myMissing);
else{
this->bDeactivateEventProtection=false;
};
It is Attached to the event as follows:
msWord->ApplicationEvents4_Event_NewDocument += gcnew
Word::ApplicationEvents4_NewDocumentEventHandler(this,&MSWordEmbed::MSWordEmbedControl::OnNewDoc);
word when it is called by MsWord. The problem is that when I try to call
newDoc->Close(), I get the following error:
..\MSWordEmbedControl.cpp(92) : error C2385: ambiguous access of 'Close'
could be the 'Close' in base 'Microsoft::Office::Interop::Word::_Document'
or could be the 'Close' in base
'Microsoft::Office::Interop::Word:ocumentEvents2_Event'
If I specifically call this->Word::_Document->Close() it then tells me it
will fail at runtime.
How am I supposed to close a document?
My Word object is instantiated as follows:
Using namespace Microsoft::Office:Interop::Word
Word::ApplicationClass msWord;
this->msWord = gcnew Word::ApplicationClass;
My Eventhandler is set up as follows:
void OnNewDoc(Document ^ newDoc) {
if (!this->bDeactivateEventProtection){
Object ^ myMissing=Type::Missing;
thisDoc=this->msWord->ActiveDocument;
newDoc->Close(myMissing,myMissing,myMissing);
else{
this->bDeactivateEventProtection=false;
};
It is Attached to the event as follows:
msWord->ApplicationEvents4_Event_NewDocument += gcnew
Word::ApplicationEvents4_NewDocumentEventHandler(this,&MSWordEmbed::MSWordEmbedControl::OnNewDoc);