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;
				objSSWs = ppApp.SlideShowWindows;

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

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

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

I have tried with


but not worked.

Recommended Answers

All 3 Replies

i also need help on opening , manipulating and closing of slides. Plz help.


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

And whilst you are debugging, check that objSlides.Count is greater than zero :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.