A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

PowerPoint automation in C++: Error, There is no active presentation



 
 
Thread Tools Display Modes
  #1  
Old December 8th, 2009, 11:15 AM posted to microsoft.public.office.developer.automation,microsoft.public.win32.programmer.ole,comp.os.ms-windows.programmer.ole,microsoft.public.powerpoint
RAHUL
external usenet poster
 
Posts: 9
Default PowerPoint automation in C++: Error, There is no active presentation

Hi All,

I am doing office automation in my C++ application using the folloing
code. Most of the time the code runs fine, but on some windows XP
machines with PowerPoint 2003 (11.8307.8221 SP3) installed the source
line marked with "ERROR" throws exception saying "Invalid request.
There is no active presentation.". If I reexecute the code on this
machine then it runs successfully (The error comes for the first time
only)
i.e. If POWERPNT.exe is already running in background then the error
never comes, But the error always come on that machine when the code
is run first time.

Is this happening due to some corrupt installation or registry value?
Is there a way to get more information as "why is the error
happening"?
Any help is greatly appreciated.

CApplication powerPointApp;
COleException exception;
if (!powerPointApp.CreateDispatch(L"Powerpoint.Applic ation",
&exception))
{
CPresentations presSet(powerPointApp.get_Presentations());
CPresentation thempPPT(presSet.Open(strTempFileName, // Filename
true, // Readonly
false, // Untitled
false // WithWindow
));

VARIANT vtIndexSrc;
vtIndexSrc.vt = VT_I4;
vtIndexSrc.lVal = 1; // The PPT file always have 1 slide

CSlides tempPPTSlides(thempPPT.get_Slides());
CSlide singleSlide(tempPPTSlides.Item(vtIndexSrc)); // "ERROR"
}


Thanks in advance
Rahul

  #2  
Old December 15th, 2009, 08:59 PM posted to microsoft.public.office.developer.automation,microsoft.public.win32.programmer.ole,comp.os.ms-windows.programmer.ole,microsoft.public.powerpoint
sasha
external usenet poster
 
Posts: 1
Default PowerPoint automation in C++: Error, There is no active presentation

RAHUL wrote:

Is this happening due to some corrupt installation or registry value?
Is there a way to get more information as "why is the error
happening"?
Any help is greatly appreciated.



I would imagine that something hasn't had a chance to fully
load/initialize by the time you are trying to get slides. Either process
an event (ready, loaded - whatever are they?) or insert a small wait period.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.