How To Open a Word File in MS Office 2000 using c#.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • komal99sonu
    New Member
    • May 2007
    • 1

    How To Open a Word File in MS Office 2000 using c#.net

    I require the code to open a word file i MS Office 2000 using c# .net.The file is already saved at a predefine path.
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by komal99sonu
    I require the code to open a word file i MS Office 2000 using c# .net.The file is already saved at a predefine path.
    See http://www.thescripts.com/forum/thre...erop.Word.html.
    There maybe a problem if you only have Word 2000, so post back if the thread doesn't help. Since you have Word 2K, I would use post #2 in the thread for the code, but don't forget to set a reference to Microsoft Word x.x Object Library on the COM tab. --Sam

    Comment

    • mwalts
      New Member
      • May 2007
      • 38

      #3
      Originally posted by SammyB
      See http://www.thescripts.com/forum/thre...erop.Word.html.
      There maybe a problem if you only have Word 2000, so post back if the thread doesn't help. Since you have Word 2K, I would use post #2 in the thread for the code, but don't forget to set a reference to Microsoft Word x.x Object Library on the COM tab. --Sam
      I tend to avoid automation of specific programs like that unless you have very specific requirements. Now you did say you wanted it to open in Word 2000, but is it a problem if it opens in the user's default .doc program?

      If you use something like this

      Code:
      System.Diagnostics.Process pRun = new Process();
      
      pRun.StartInfo.FileName = @"C:\SomePath\TheFile.doc";
      
      pRun.StartInfo.UseShellExecute = true;
      
      pRun.Start();
      It will open in whatever program they have that handles .doc's. Just like a double click on the file.

      -mwalts

      Comment

      • SammyB
        Recognized Expert Contributor
        • Mar 2007
        • 807

        #4
        Good point! I just assumed the Komal was going to use other Word objects. Thanks! --Sam

        Comment

        • altafhussain
          New Member
          • Jun 2007
          • 4

          #5
          Originally posted by komal99sonu
          I require the code to open a word file i MS Office 2000 using c# .net.The file is already saved at a predefine path.


          System.Diagnost ics.Process.Sta rt("pathname\fi name.doc");

          Comment

          Working...