PowerPoint - Unwanted dialog

  • Thread starter dozer threeohnine
  • Start date
D

dozer threeohnine

I'm performing an automation task using VC7:

- Open a presentation
- Save as HTML (using ppSaveAsHTML)

....All goes well until the saveas. At that point a dialog pops up asking if
the user would like to save additional information in the event the
presentation is getting sent back to the original author... My code makes
no changes to the original content, just saves a new version in HTML format.


Has anyone else noticed this, and if so know how to keep the dialog from
appearing?

TIA,
-D
 
S

Steve Rindsberg

Dozer threeohnine said:
I'm performing an automation task using VC7:

- Open a presentation
- Save as HTML (using ppSaveAsHTML)

....All goes well until the saveas. At that point a dialog pops up asking if
the user would like to save additional information in the event the
presentation is getting sent back to the original author... My code makes
no changes to the original content, just saves a new version in HTML format.

Has anyone else noticed this, and if so know how to keep the dialog from
appearing?

What version of PPT are you automating, and can you post the relevant code
snippet?
 
D

dozer threeohnine

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::ppAlertsNone; // A (vain?)
attempt to eliminate all user interaction...

//
try
{
// Create and initialize the PowerPoint document
PowerPoint::presentationsPtr 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::ppSaveAsHTML, // '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
 
S

Steve Rindsberg

I'm guessing that revision tracking is on and that changes have been made to
the copy of the document you're working on.

It might be enough to set the document's .Saved property to True

Otherwise, have a look at the .HasRevisionInfo property. Haven't messed with
it myself but it should at least tell you the revision status of the
presentation.

If the current user isn't the original author, you may not be able to change
the revision status of the doc.

Dozer threeohnine said:
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::ppAlertsNone; // A (vain?)
attempt to eliminate all user interaction...

//
try
{
// Create and initialize the PowerPoint document
PowerPoint::presentationsPtr 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::ppSaveAsHTML, // '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
 
D

dozer threeohnine

I used GetSaved() to determine if PowerPoint thought that any changes had
been made, and it indicated they had not. HasRevisionInfo also indicated a
status of 0 (ppRevisionInfoNone)... Setting the saved property did not
appear to make a difference (ie - the dialog still shows up).

Is there a quick way of handling the dialog event perhaps...?

Thanks for the assistance,
-D
 
S

Steve Rindsberg

Dozer threeohnine said:
I used GetSaved() to determine if PowerPoint thought that any changes had
been made, and it indicated they had not. HasRevisionInfo also indicated a
status of 0 (ppRevisionInfoNone)... Setting the saved property did not
appear to make a difference (ie - the dialog still shows up).

Is there a quick way of handling the dialog event perhaps...?

Enumerating the windows collection looking for one with that title and sending
it a keystroke, maybe?
Thanks for the assistance,

Well ... the attempt, at least.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top