Version is 2003. Here's the gist of the code:
#include <...>
#include <...>
#include <...etc.
//
//// Import the definitions for MS PowerPoint Object Library
....
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll" \
:
:
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.
olb"
#import "C:\Program Files\Microsoft Office\OFFICE11\MSPPT.OLB" \ ...etc
:
:
// PowerPoint document format codes
enum
{
:
:
ppSaveAsDefault = 11,
ppSaveAsHTML = 12,
ppSaveAsHTMLv3 = 13,
ppSaveAsHTMLDual = 14,
ppSaveAsMetaFile = ...
:
:
etc...
};
using namespace std;
int main(int argc, char* argv[])
{
// Save the source and destination file names
char *pSrcFileName = argv[1]; //"c:\\test.xls";
char *pDestFileName = argv[2]; //"c:\\test.html";
:
: etc...
// Initialize the COM environment
CoInitialize(NULL);
// Create and initialize an instance of the Excel application
PowerPoint::_ApplicationPtr ppt_app;
ppt_app.CreateInstance("PowerPoint.Application");
ppt_app->DisplayAlerts = PowerPoint:
pAlertsNone; // A (vain?)
attempt to eliminate all user interaction...
//
try
{
// Create and initialize the PowerPoint document
PowerPoint:
resentationsPtr oPresentations = ppt_app->GetPresentations()
;
// Open the Presentation
PowerPoint::_PresentationPtr oPres = oPresentations->Open(pSrcFileName,
True,
False,
False);
if(oPres != NULL)
{
// Build the target file path & name
VARIANT vtFile;
vtFile.vt = VT_BSTR;
vtFile.bstrVal = sDestFile;
// Save the converted document
oPres->SaveAs((_bstr_t)&vtFile, // Path and
file name of target
PowerPoint:
pSaveAsHTML, // 'SaveAs'
file type
Office::msoFalse); // Embed True
type fonts?
oPres->Close();
ppt_app->Quit();
return true;
}else{
cout << "Could not open file blah blah blah...
ppt_app->Quit();
return ...
}
}
catch(_com_error &e)
{
:
:
// Print COM errors.
printf("Error\n");
etc ...%s\n", (LPCSTR) bstrDescription);
....
return...;
}
// Deinitialize the COM environment
CoUninitialize();
}
....as I said, the dialog appears as soon as SaveAs() is executed...
-D