March 20th, 2013, 07:41 AM
Open a Word document in which the file name is user input
I am trying to have the user input a filename with extension, and then have a c# program open that file in MS Word 2010. However, I cannot seem to figure it out. Any help? I am running Visual Studio 2010 and have a console application.
Here is the code so far...
using word = Microsoft.Office.Interop.Word;
static void Main(string args)
System.Console.Write("Enter the file name: ");
String fileName = System.Console.ReadLine();
FileStream fileStream = new FileStream(@"H:\SNH\" + fileName, FileMode.Open);
However, it seems like it runs but does nothing...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.