How to control Ms Powerpoint 2007 Slide show using C# 3.5?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2006
Posts: 116
Reputation: bhavna_816 is an unknown quantity at this point 
Solved Threads: 0
bhavna_816 bhavna_816 is offline Offline
Junior Poster

How to control Ms Powerpoint 2007 Slide show using C# 3.5?

 
0
  #1
Dec 18th, 2008
hi all,

i want to run the slide show say ten slides and then close it programaatically , but in my code given below it opens the slide show and closes immediately ... ..
please give me a solution to this problem


  1. Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
  2. ppApp.Visible = MsoTriState.msoTrue;
  3. Presentations ppPresens = ppApp.Presentations;
  4. Presentation objPres = ppPresens.Open(fullPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
  5. Slides objSlides = objPres.Slides;
  6. Microsoft.Office.Interop.PowerPoint.SlideShowWindows objSSWs;
  7. Microsoft.Office.Interop.PowerPoint.SlideShowSettings objSSS;
  8.  
  9. //Run the Slide show
  10. objSSS = objPres.SlideShowSettings;
  11. objSSS.StartingSlide = 1;
  12. objSSS.EndingSlide = objSlides.Count;
  13. objSSS.Run();
  14. objSSWs = ppApp.SlideShowWindows;
  15.  
  16. for (int i = objSSS.StartingSlide; i <= objSSS.EndingSlide; i++)
  17. {
  18. System.Threading.Thread.Sleep(100);
  19.  
  20. }
  21. //Close the presentation
  22. objPres.Close();
  23. while (System.Runtime.InteropServices.Marshal.ReleaseComObject(objPres) > 0) { };
  24. objPres = null;
  25.  
  26. while (System.Runtime.InteropServices.Marshal.ReleaseComObject(ppPresens) > 0) { };
  27. ppPresens = null;
  28.  
  29. ppApp.Quit();
  30. while (System.Runtime.InteropServices.Marshal.ReleaseComObject(ppApp) > 0) { };
  31. ppApp = null;

I have tried with
  1. System.Threading.Thread.Sleep(10000);
but not worked.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC