Opening Programs RRS feed

  • Question

  • Hi


    I need to open Powerpoint presentations in powerpoint viewer. I wrote a small program using Powerpont on the computer and not in my program.


    I use a form with 10 text boxes to select the files and run them. I used the first option below since it work nice when some files is pictures or songs. I made my default for PPT to go to the viewer and it worked fine till my computer got lost and I had to use some one elses.


    I then went to the second option but now have a file name proplem


    Please Help



    System.Diagnostics.Process.Start(TextBox.Text) – This will open any defauld program witch is nice but it does not solve my proplem.

    'System.Diagnostics.Process.Start("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW") – Opens the viewer but I cannot open a file directly in the viewer.



    Shell(Viewer & TextBox.Text) – Works great as long as my file name is only one word, unfortunenately mine is more than that and there is a lot.

    'Shell("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE /s c:\dir\my new presentation.ppt")


    Friday, October 28, 2011 7:58 PM


All replies

  • Try:

    string presentation = string.Format("/s \"{0}\"", Path.GetFullPath(TextBox.Text));
    System.Diagnostics.Process.Start(Viewer, presentation);

    If you enter the path into your textBox.Text, this will work.  For example, this will work if the textbox contains:

    c:\dir\my new presentation.ppt

    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Friday, October 28, 2011 8:45 PM
  • Ok

    Not working as I hoped, I see the idea but I am not winning. I am using VB code and this seem to be something else.

    The text box does contain c:\dir\my new presentation.ppt if its helpful.


    Saturday, October 29, 2011 2:26 AM
  • You can try:

    Process.Start(Path Of the Viewer,Path Of the ppt file);

    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Edited by Paul Zhou Tuesday, November 1, 2011 7:21 AM
    • Marked as answer by Paul Zhou Monday, November 7, 2011 7:54 AM
    Tuesday, November 1, 2011 7:20 AM
  • I tried with code as below with Office 2010. It worked fine code is as below.


    static void Main(string[] args)
                System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Microsoft Office\Office14\POWERPNT.EXE", @"c:\presentation1.pptx");

    Thank You, Sudhakar
    Tuesday, November 1, 2011 2:12 PM