G
gazza67
Hi,
I want to do something that I thought would be simple but i cant seem
to work it out, perhaps someone out there could help me.
I want to browse for a file (it will be a word document), save the file
name to a string and then at some later stage open that file with word.
The operating system will be windows 2000 (dont know if that makes a
difference or not).
string pathToWord = "c:\\Program File\\Microsoft
Office\\Office\\winword.exe";
OpenFileDialog theDiag = new OpenFileDialog();
theDiag.ShowDialog();
string theFileName = theDiag.FileName; // note the file name is
c:\Test Directory\testFile.doc
Process.Start (pathToWord, theFileName);
This resulted in word trying to open two files called c:\test and
Directory\testFile.doc.
Could someone tell me what I can do to make word see this filename
correctly?
Another question is, if I dont include the pathToWord and just rely on
Windows to work out how to open a .doc file it takes almost 30 seconds
to open the document (it does it successfully - but it takes too long)
- even though if I go into the file explorer and double click on the
..doc file it will open inside word immediately. I dont really want to
include the path for word (since it may be different on different
computers) - how do I get around this problem?
Gary
I want to do something that I thought would be simple but i cant seem
to work it out, perhaps someone out there could help me.
I want to browse for a file (it will be a word document), save the file
name to a string and then at some later stage open that file with word.
The operating system will be windows 2000 (dont know if that makes a
difference or not).
string pathToWord = "c:\\Program File\\Microsoft
Office\\Office\\winword.exe";
OpenFileDialog theDiag = new OpenFileDialog();
theDiag.ShowDialog();
string theFileName = theDiag.FileName; // note the file name is
c:\Test Directory\testFile.doc
Process.Start (pathToWord, theFileName);
This resulted in word trying to open two files called c:\test and
Directory\testFile.doc.
Could someone tell me what I can do to make word see this filename
correctly?
Another question is, if I dont include the pathToWord and just rely on
Windows to work out how to open a .doc file it takes almost 30 seconds
to open the document (it does it successfully - but it takes too long)
- even though if I go into the file explorer and double click on the
..doc file it will open inside word immediately. I dont really want to
include the path for word (since it may be different on different
computers) - how do I get around this problem?
Gary