0

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

Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
				ppApp.Visible = MsoTriState.msoTrue;
				Presentations ppPresens = ppApp.Presentations;
				Presentation objPres = ppPresens.Open(fullPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
				Slides objSlides = objPres.Slides;
				Microsoft.Office.Interop.PowerPoint.SlideShowWindows objSSWs;
				Microsoft.Office.Interop.PowerPoint.SlideShowSettings objSSS;

				//Run the Slide show
				objSSS = objPres.SlideShowSettings;
				objSSS.StartingSlide = 1;
				objSSS.EndingSlide = objSlides.Count;
				objSSS.Run();
				objSSWs = ppApp.SlideShowWindows;

								for (int i = objSSS.StartingSlide; i <= objSSS.EndingSlide; i++)
				{
										System.Threading.Thread.Sleep(100);
					
				}				
				//Close the presentation
				objPres.Close();
				while (System.Runtime.InteropServices.Marshal.ReleaseComObject(objPres) > 0) { };
				objPres = null;

				while (System.Runtime.InteropServices.Marshal.ReleaseComObject(ppPresens) > 0) { };
				ppPresens = null;

				ppApp.Quit();
				while (System.Runtime.InteropServices.Marshal.ReleaseComObject(ppApp) > 0) { };
				ppApp = null;

I have tried with

System.Threading.Thread.Sleep(10000);

but not worked.

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Geekitygeek
0

Can you debug your application, step line by line, and tell us the line where the application closes immediately?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.