473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Spaces in Paths and Winword.exe

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

Dec 13 '06 #1
1 2498
Gary,

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

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"gazza67" <ga*******@gmail.comwrote in message
news:11*********************@n67g2000cwd.googlegro ups.com...
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

Dec 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jean-Marc Molina | last post by:
Hello, I can't find a way to execute a Windows application, whose directory path contains blank spaces, from a PHP script. I also wonder if the problem happens under Linux and other OS. ...
0
by: Just D. | last post by:
Guys, I'm writing the Windows Application and one of the ideas is to use a RichText field to store/show some formatted text, probably with pictures. The problem is that this RichEdit control is...
3
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these...
3
by: Luke - eat.lemons | last post by:
Hi, Could someone tell me the correct quotation to get around spaces in paths for: Server.MapPath("\\server\share\spaces in name.mdb") I know its bad practice to use spaces but...
2
by: Ken Brubaker | last post by:
Does the xsd.exe command line support paths with spaces? For example the xsd.exe /o: option specifies the output file name. How can I specify an output file path that has a space? I'v tried...
2
by: Lance Hoffmeyer | last post by:
Hey all, As always, thanks in advance! I am trying to save a ppt presentation but am having problems regarding spaces and am wondering if I am doing something wrong or whether this is a bug?...
1
by: tvjraman | last post by:
Visual Basic 6 I use Getobject() to get the object of Word application. I always get the first instance of Winword.exe I have a macro in another instance of Winword.exe I need to get the...
2
by: Dean Slindee | last post by:
Using this statement to utilize the spell checker in WinWord: WinOffice.clsWord.SpellChecker(txtNote.Text) 'this does not work because no main window is displayed 'Dim proc =...
2
ajester
by: ajester | last post by:
I need WinWord to look like it's being executed from the correct path: C:\Program Files\Microsoft Office\Office12\WinWord.exe when in reality it's being launch from a Java app using the path...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.