Process.start("WINWORD")


Hey people,

I'm using visual basic express to write a small program that stores information about a few files and orders them according to a certain theme, so they are a bit organised. At the moment everything is working fine, and I figured I could add the possibility to open some of the file types by clicking a button. Normally no problem, but it seems that word doesn't want to open a file when I try to open it. Word will open, but he'll give an error about the file.
Can someone tell me what's wrong ?

[code]
Dim materiaal As ToddlerDataSet.MateriaalRow
materiaal = myToddlerDataSet.Materiaal.FindByMateriaalID(MateriaalDataGridView.Tag.ToString())

If (materiaal.URL.EndsWith(".doc")) Then
System.Diagnostics.Process.Start("WINWORD", materiaal.URL)
End If
[/code]

[839 byte] By [Lilendian] at [2007-12-21]
# 1

What you are doing appears to be correct and works fine for me provided the path to the file is correct.

What is the error you are receiving?

Also, for simplicity you may want to try replacing:

System.Diagnostics.Process.Start("WINWORD", materiaal.URL)

with:

System.Diagnostics.Process.Start(materiaal.URL)

As the system should be responsible for choosing which application to load the document within which is especially useful when Word doesn't exist on the system or it is not the default handler for .doc files.

BrendanGrant at 2007-9-10 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2

The error is in dutch so I can't just copy-paste.
Word says that an error occured when opening the file
In the details it says that the file can't be found.

So I tried your solution, and when I don't use the WINWORD process name, it works just fine.
Kind of wierd that it doesn't want to work when I specify the process name.
Thank you very much, now I can continue working

Lilendian at 2007-9-10 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...