Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. power point automation.

power point automation.

Scheduled Pinned Locked Moved C / C++ / MFC
helptestingtoolsquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SRKSHOME
    wrote on last edited by
    #1

    Hi, I have some powerpoint addins which are to be added to powerpoint programmatically.The problem in the below code is it always says power application object cannot be created while running the program. but powerpoint application object will create during debugging the program. hence I am not able to figure out the problem. Could any one help me please?

    void InstallPptAddins(LPCTSTR strAddinPath)
    {
    CFileFind m_fileFind;
    CString strAddin;

    PowerPoint::\_Application Ppt; //Powerpoint object
    PowerPoint::AddIns m\_pptAddIns;
    PowerPoint::AddIn m\_pptAddIn;
    
    if(!Ppt.CreateDispatch("PowerPoint.Application"))
    {
    	Log("Error:fn::InstallPptAddins() Couldn't open Powerpoint Application\\n");
    	return;
    }
    

    try
    {

    if(Ppt.GetVersion()=="12.0")
    {
    	PowerPoint::Presentations m\_Sets(Ppt.GetPresentations());
    	PowerPoint::\_Presentation m\_Set(m\_Sets.Add(TRUE));
    
    	strAddin = strAddinPath;
    	strAddin += "DSAFO5PP.ppa";
    
    
    	if(m\_fileFind.FindFile(strAddin))
    	{
    		m\_pptAddIns = Ppt.GetAddIns();
    		m\_pptAddIn = m\_pptAddIns.Add(strAddin);
    	
    		//Revove first if it already installed
    		m\_pptAddIn.SetLoaded(FALSE);
    		m\_pptAddIn.SetAutoLoad(FALSE);
    		m\_pptAddIn.SetRegistered(FALSE);
    
    		//Install the addins
    		m\_pptAddIn.SetLoaded(TRUE);
    		m\_pptAddIn.SetAutoLoad(TRUE);
    		m\_pptAddIn.SetRegistered(TRUE);
    
    		Log("AFO Powerpoint add-in is added.\\n");
    		
    	}
    	else
    	Log("Couldn't find Powerpoint add-in %s\\n",strAddin);
    

    }
    catch(...)
    {
    Log("Error::Couldn't install Powerpoint add-ins.Please add it manually\n\n");
    }

    Ppt.Quit();
    

    }

    V 1 Reply Last reply
    0
    • S SRKSHOME

      Hi, I have some powerpoint addins which are to be added to powerpoint programmatically.The problem in the below code is it always says power application object cannot be created while running the program. but powerpoint application object will create during debugging the program. hence I am not able to figure out the problem. Could any one help me please?

      void InstallPptAddins(LPCTSTR strAddinPath)
      {
      CFileFind m_fileFind;
      CString strAddin;

      PowerPoint::\_Application Ppt; //Powerpoint object
      PowerPoint::AddIns m\_pptAddIns;
      PowerPoint::AddIn m\_pptAddIn;
      
      if(!Ppt.CreateDispatch("PowerPoint.Application"))
      {
      	Log("Error:fn::InstallPptAddins() Couldn't open Powerpoint Application\\n");
      	return;
      }
      

      try
      {

      if(Ppt.GetVersion()=="12.0")
      {
      	PowerPoint::Presentations m\_Sets(Ppt.GetPresentations());
      	PowerPoint::\_Presentation m\_Set(m\_Sets.Add(TRUE));
      
      	strAddin = strAddinPath;
      	strAddin += "DSAFO5PP.ppa";
      
      
      	if(m\_fileFind.FindFile(strAddin))
      	{
      		m\_pptAddIns = Ppt.GetAddIns();
      		m\_pptAddIn = m\_pptAddIns.Add(strAddin);
      	
      		//Revove first if it already installed
      		m\_pptAddIn.SetLoaded(FALSE);
      		m\_pptAddIn.SetAutoLoad(FALSE);
      		m\_pptAddIn.SetRegistered(FALSE);
      
      		//Install the addins
      		m\_pptAddIn.SetLoaded(TRUE);
      		m\_pptAddIn.SetAutoLoad(TRUE);
      		m\_pptAddIn.SetRegistered(TRUE);
      
      		Log("AFO Powerpoint add-in is added.\\n");
      		
      	}
      	else
      	Log("Couldn't find Powerpoint add-in %s\\n",strAddin);
      

      }
      catch(...)
      {
      Log("Error::Couldn't install Powerpoint add-ins.Please add it manually\n\n");
      }

      Ppt.Quit();
      

      }

      V Offline
      V Offline
      VC Maniac
      wrote on last edited by
      #2

      missing closing curly braces for

      if(Ppt.GetVersion()=="12.0")
      {

      S 1 Reply Last reply
      0
      • V VC Maniac

        missing closing curly braces for

        if(Ppt.GetVersion()=="12.0")
        {

        S Offline
        S Offline
        SRKSHOME
        wrote on last edited by
        #3

        may be missed out during caopying the code.It is proper on my machine.But that is not the reason.It is compiling with no error.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups