I am running a VBA macro from Word 2013. I\'m trying to run an executable file which requires an argument/parameter of a filename. For example, c:\\myfilefilter.exe f
this works for me (from MsAccess 2013 VBA)
Dim wShell As New WshShell
Dim wsExec As WshExec
Dim cmdline As String
cmdline = "notepad c:\somefile.txt"
Debug.Print Now, cmdline
Set wsExec = wShell.Exec(cmdline)
Do While wsExec.Status = 0
DoEvents
Loop
Debug.Print Now, "done"
You could try this. Works for me.
Const BatchFileName = "P:\Export.bat"
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
wsh.Run BatchFileName, windowStyle, waitOnReturn
Kill BatchFileName