我的shell函数没有启动.bat作业。有人可以帮忙吗?
Public Sub TESTRUN()
Dim Command As String
Dim pathcrnt As String
Dim RetVal
pathcrnt = ActiveWorkbook.path
Command = "RunMGALFA -ain:" & Range("AinFile") & " -val:" & Range("ValDate") & " -run:" & Range("RunNumber")
Open pathcrnt & "\test.bat" For Output As #1
Print #1, Command
Close #1
Shell pathcrnt & "\test.bat", vbMaximizedFocus
End Sub
答案 0 :(得分:1)
除非RunMGALFA
与pathcrnt
位于同一目录或系统%PATH%
变量中注册的位置,否则您的脚本将无效。
我建议在生成的脚本中提供RunMGALFA
的完整路径:
Command = "C:\Path\To\RunMGALFA -ain:" & Range("AinFile") & " -val:" & Range("ValDate") & " -run:" & Range("RunNumber")