Run a batch file from VBA?

M

Marshall

I'm hoping to kill a leftover Excel process invoked from
Project via a batch file, but not sure whether I can run
a *.bat from within VBA?

If so, any hints as to how to go about it?
 
M

Mark Durrenberger

You might be able to "shell" it...

Mark


--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
N

Neil Peterson

Mark said:
You might be able to "shell" it...

That's actually a very astute statement. I use a batch file to run some
perl scripts to post-process html outputs. "might" describes its
operation quite well.

Sometimes the batch file runs. Other times it doesn't. So far I can't
find a consistant pattern. Has anyone else tried using "shell"?

Neil Peterson
 
M

Mark Durrenberger

If I'm reading your note properly, it sounds rather frustrating...

I use shell all over the place - here it is to launch the browser - you'll
have to search the web for the "operations" and "parameters" passed to the
shell function...

Mark


Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Sub lblURL_Click()
Me.Hide
ShellExecute Me.hwnd, "open", "http://www.michaelmoore.com/", vbNullString,
"", 0
Set frmSetupComplete = Nothing
End Sub

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
M

Marshall

Thanks guys, this has given me something to go on with.
Cheers.
-----Original Message-----
If I'm reading your note properly, it sounds rather frustrating...

I use shell all over the place - here it is to launch the browser - you'll
have to search the web for the "operations" and "parameters" passed to the
shell function...

Mark


Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Sub lblURL_Click()
Me.Hide
ShellExecute
Me.hwnd, "open", "http://www.michaelmoore.com/",
vbNullString,
 

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

Top