MSDN Example for PowerPoint Automation fails to work



Hello all

I based a new project on the info found here:
http://support.microsoft.com/kb/q169505/

I have these three imports in all of my wrapper classes:

#import "C:\\Program Files\\Common Files\Microsoft Shared\\OFFICE11\
\MSO.DLL" \
named_guids, \
rename("RGB", "MsoRGB")

// The following #import is necessary for MS Office without
raw_interfaces_only.. It defines VBEPtr among other things.
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\
\VBE6EXT.OLB" raw_interfaces_only

// Import PPT's interfaces.
#import "C:\\Program Files\\Microsoft Office\\OFFICE11\\MSPPT.OLB" \
rename("ExitWindows", "MsoExitWindows"), \
rename("FindText", "MsoFindText")


I went through and created the different menu handlers like the
example tells you to. But in the menu handler to Create a
Presentation this error is thrown:
error C2039: 'Add' : is not a member of 'CPresentations'

Inside of CPresentations no Add function was created during the Class
Creation Wizard, so I don't see how the example code could have worked
when MSDN put it up.

Has anyone been able to automate creation of presentation and slides
in PowerPoint?

I am using VS2005 and PowerPoint 2003.

Here is the function from the example, slightly tweaked since the
class creation added the "C" to the Presentation class, and the
example didn't use it that way:

void CMainFrame::OnPowerpointCreatepresentation()
{
CPresentations PresCollection;

// Make sure there is a dispatch pointer for PowerPoint.
if(m_ppt.m_lpDispatch == NULL) {

// Display a message indicating that PowerPoint is not running.
MessageBox(_T("PowerPoint is not running. Start PowerPoint"));
} else {

// Bring PowerPoint to the front.
m_ppt.Activate();

// Attach the presentations collection to the PresCollection
// variable.
PresCollection.AttachDispatch(m_ppt.get_Presentations());

PresCollection.Add(1);
}
}

.



Relevant Pages

  • Re: Content Control and automated ppt construction
    ... awesome - powerpoint backgrounds, ... > creation of PowerPoint presentations. ... > description, creation date, creator ... modification and approval of slide and ...
    (microsoft.public.powerpoint)
  • Re: Can I create a custom autocontent Wizard?
    ... Toolbox: http://skp.mvps.org/toolbox ... templates for the creation of these slides. ... create an autocontent wizard that would contain all of the information ... does not change and coach someone who is new to PowerPoint through the ...
    (microsoft.public.powerpoint)
  • Suggestions for next version
    ... Full support for creating DVD's, including animated DVD menu creation. ... Integration with PowerPoint. ... Integrated paint program ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: Launching a PowerPoint presentation
    ... Create and distribute a self-running PowerPoint presentation ... > normal window where the various windows are listed on in the Outline ... > "creation" window, i.e. two columns, does not appear. ... > will see the presentation itself and not the "creation" mode type. ...
    (microsoft.public.powerpoint)