I have been Running this VB script to kill my Exell process for over a week now and it just stoped working tonight. This is the error i get:
:-2147217404
Line 12, Column 21
OK Abort
This error pops up at the end of this section on the VB script:
ifwindowopen>Microsoft Excel*
VBSTART
Sub killProcess(pgm)
set wmi = getobject("winmgmts:")
sQuery = "select * from win32_process " & "where name='" & pgm & "'"
set processes = wmi.execquery(sQuery)
for each process in processes
process.terminate
next
End Sub
VBEND
VBRun>KillProcess,excel.exe
else
endif
Error When Running VB script.
Moderators: Dorian (MJT support), JRL
Works fine here. Please provide this info;
1) What version of Macro Scheduler.
2) In your editor, what shows as line 12?
Also, please check the ends of each line for any trailing spaces.
Personally, I put the IfWindowOpen after the VBEND, and exclude the "else" unless I have stuff to excecute, like this;
1) What version of Macro Scheduler.
2) In your editor, what shows as line 12?
Also, please check the ends of each line for any trailing spaces.
Personally, I put the IfWindowOpen after the VBEND, and exclude the "else" unless I have stuff to excecute, like this;
Code: Select all
IfWindowopen>Microsoft Excel*
VBRun>KillProcess,excel.exe
Endif