VB 6 doesn't like "objProcess.Terminate()" ???

I have a small script called "terminate.vbs" that I run by double-clicking on it.
But, if I use it in MS-Visual Basic 6 it won't run or compile.  It doesn't like the line "objProcess.Terminate()".
The line also is colored red like a syntax error.  Why is that?

here's a clip - at the bottom is the line
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcessList
LVL 15
Who is Participating?
Hello ZabagaR,

take out the () it says to VB that it is expecting input

hope this helps a bit
ZabagaRAuthor Commented:
Thanks.  That worked.  I just don't understand why it would differ between the .vbs text-file version the same code under VB6.
I'd expect it to be the same...maybe without the "()" in both.

Did you know because you looked it up somewhere or just from experience?  I searched the internet for a bit, trying to find an explanation but never found one.
(which is why I ended up posting here).

Thanks again,
its the difference in syntax, this is something you see after walking through the vb dialects, vb, vbs and vba and luckily for us its vb.net now so more of the same little syntax differences to keep up with :-)

but i tested it first in Excel VBA before posting :)

thanks for the grade
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.