Spaces in Paths and Winword.exe

  • Thread starter Thread starter gazza67
  • Start date Start date
G

gazza67

Hi,

I have a simple problem I am sure somebody can solve very easily.

I want to do this;

OpenFileDialog theDiag = new OpenFileDialog();
theDiag.ShowDialog();

Process.Start("winword", theDiag.FileName);

My problem is that the path name from theDiag.FileName sometimes has a
space in it. When this happen winword seems to think that there is a
space delimited list of files that it should open (ie it thinks that
there is more than one file to open).

Thanks in advance
Gary
 
Gary,

Just put the filename in double quotes and it should work fine.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top