C
Charles Parker
I am using COM and WORD automation to open and save a document file to HTML
format. The problem I am having is I have one document that displays a
Microsoft Visual Basic dialog box with the message "Sub or Function not
defined". I need to suppress this dialog from being displayed. I have
suppressed all the other dialogs that have popped up except this one. How do
I suppress this using COM automation. In fact I would like to just get a COM
error but this message or error does not produce a COM error.
The code being used is a s follows:
hr = pWordApp.CreateInstance(__uuidof(Word::Application));
if (SUCCEEDED(hr))
{
vtFileFormat.vt = VT_I4;
vtFileFormat.intVal = wdFormatHTML;
pWordDocs = pWordApp->GetDocuments();
pWordApp->PutDisplayAlerts(Word::wdAlertsNone);// Do not display the
overwrite dialog
pWordDoc = pWordDocs->Open(vtFileName, &vtMissing, &vtReadOnly,
&vtAddToMRU);
pWordDoc->SaveAs(vtFileNameHTML, &vtFileFormat, &vtMissing, &vtMissing,
&vtAddToMRU);
pWordDoc->Close(&vtSaveChanges);
}
This message is display both during Open and Close. Is there a way to
suppress this or all possible dialog boxes? The PutDisplayAlerts method is
not working for this message. Thanks in advance.
Charles...
format. The problem I am having is I have one document that displays a
Microsoft Visual Basic dialog box with the message "Sub or Function not
defined". I need to suppress this dialog from being displayed. I have
suppressed all the other dialogs that have popped up except this one. How do
I suppress this using COM automation. In fact I would like to just get a COM
error but this message or error does not produce a COM error.
The code being used is a s follows:
hr = pWordApp.CreateInstance(__uuidof(Word::Application));
if (SUCCEEDED(hr))
{
vtFileFormat.vt = VT_I4;
vtFileFormat.intVal = wdFormatHTML;
pWordDocs = pWordApp->GetDocuments();
pWordApp->PutDisplayAlerts(Word::wdAlertsNone);// Do not display the
overwrite dialog
pWordDoc = pWordDocs->Open(vtFileName, &vtMissing, &vtReadOnly,
&vtAddToMRU);
pWordDoc->SaveAs(vtFileNameHTML, &vtFileFormat, &vtMissing, &vtMissing,
&vtAddToMRU);
pWordDoc->Close(&vtSaveChanges);
}
This message is display both during Open and Close. Is there a way to
suppress this or all possible dialog boxes? The PutDisplayAlerts method is
not working for this message. Thanks in advance.
Charles...