none
How to open a remote ppt file by Microsoft.Office.Interop.PowerPoint? RRS feed

  • Question

  • Hi all

    I want to run a ppt file using c#, 32 bit Os,  windows 7. 

    Part of the code is as follows:

                //Create a new presentation based on a template.
                objApp = new PowerPoint.Application();
                objApp.Visible = MsoTriState.msoTrue;
                objPresSet = objApp.Presentations;
                string strPath = @"\\192.168.31.164\isoftShare\123.ppt";
                objPres = objPresSet.Open(strPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoFalse);
                objSlides = objPres.Slides;
    
                //Run the Slide
                objSSS = objPres.SlideShowSettings;
                objSSS.Run();
    
                //Wait for the slide show to end.
                objSSWs = objApp.SlideShowWindows;
                while (objSSWs.Count >= 1) System.Threading.Thread.Sleep(100);


    Here if the ppt file path (strPath) is the local file like "C:\123.ppt" then is no problem, but if the file path is a network path like "\\192.168.31.164\share\123.ppt" When I run my application COMException (0x80004005): PowerPoint could not open the file.

    if i open the "\\192.168.31.164\share\123.ppt" file manually by the Office PowerPoint 2007, it also work. but why use C# can't?

    I did a lot of googling but problem could not be resolved.

    Please help


    jakeyjia


    • Edited by jakeyjia Friday, December 2, 2011 5:34 AM
    • Moved by Cindy Meister MVPModerator Friday, December 2, 2011 7:40 AM not using VSTO technology (From:Visual Studio Tools for Office)
    Friday, December 2, 2011 5:30 AM

Answers

  • Hi Jakeyjia,

    Thanks for your post.

    Your issue might caused by permission settings. You probably don't allow to access the presentation shared on network with read/write permission, which means that the presentation is opened in read-only mode when you double click it to open it manually. You only have read permission and you specified the Open method to open it in read/write mode, which might cause the exception as your description.

    Could you have a try of opening the presentation in read-only mode, or assigning a read/write permission for you?

    In addition, I have tried to open a presentation which is shared on network programmatically by using both Office 2007 and Office 2010, and no such issue happen. You might need to provide more information if the issue is not caused by permission setting.

    I look forward to hearing of you soon.


    Calvin Gao[MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by jakeyjia Monday, December 12, 2011 9:23 AM
    Monday, December 5, 2011 3:52 AM
    Moderator

All replies

  • Hi Jakeyjia,

    Thanks for your post.

    Your issue might caused by permission settings. You probably don't allow to access the presentation shared on network with read/write permission, which means that the presentation is opened in read-only mode when you double click it to open it manually. You only have read permission and you specified the Open method to open it in read/write mode, which might cause the exception as your description.

    Could you have a try of opening the presentation in read-only mode, or assigning a read/write permission for you?

    In addition, I have tried to open a presentation which is shared on network programmatically by using both Office 2007 and Office 2010, and no such issue happen. You might need to provide more information if the issue is not caused by permission setting.

    I look forward to hearing of you soon.


    Calvin Gao[MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by jakeyjia Monday, December 12, 2011 9:23 AM
    Monday, December 5, 2011 3:52 AM
    Moderator
  • thanks! i should get the authentication before i try to open the ppt file~

     

    that  i use "net use [IPAdress] [Password]/user:[user name]" to get the authentication.

     


    jakeyjia
    Monday, December 12, 2011 9:23 AM