views:

198

answers:

2

I need to open several pdf, word and excel files from process.start like command, but only open one file at time.

+2  A: 

You can use WaitForExit with a process to pause execution until the application that handles the pdf, word, etc. file is closed. This will work if the user closes, for example, word instead of closing only the word document and leaving the word application running.

Dim proc As Process

proc = Process.Start("c:\tmp.jpg")
proc.WaitForExit()
proc = Process.Start("c:\tmp1.jpg")
proc.WaitForExit()
xpda
A: 

Its work without "proc.WaitForExit()", I can get several documents open at the same time with the following code:

Private Sub OpenDocument(ByVal strDocName as String)

   Dim proc as Process

   proc = Process.Start(strDocName)

End Sub
Bitnius
I thought you only wanted to open one at a time.
xpda
"I need to open several pdf, word and excel files"
Bitnius