I'm trying to open a PowerPoint presentation directly in slide show mode. I've tried using a Process (as shown below), but I get an error message from PowerPoint saying it can't find the file, error message "PowerPoint can't read C://Users/Route%20Plotter.pptx". The issue is caused by the white space in the file name as it works when this is removed.
string powerPointPath = @"C:\Program Files\Microsoft Office 15\root\office15\powerpnt.exe";
string powerPointFilePath = "\"" + "C://Users/Route Plotter.pptx" + "\"";
Process powerPoint = new Process();
powerPoint.StartInfo.FileName = powerPointPath;
powerPoint.StartInfo.Arguments = " /S " + powerPointFilePath;
powerPoint.Start();
I've tried using the Office introp method (below), but can't get that to open directly in slideshow mode.
Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
pptApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
pptApp.Activate();
Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
Microsoft.Office.Interop.PowerPoint.Presentation p = ps.Open(powerPointFilePath,
Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue)
Any ideas how to stop it changing the whitespace to a %20 (I'm already adding quotes round the path), or another way to open the file directly into slideshow mode, would be appreciated.
(I'm using VS2013 and PowerPoint 2013).
@"path"for your file path? - helencrumpC:\Users\Route Plotter.pptx- DavidG