VBS and VB simple question

Hi, I'm new here and i am currently learning
Visual Basic.
I was messing around writing a program in VBS with notepad
and i couldent use the shell command.
i allways get an error saying
type missmatch: "Shell"
i typed this into notepad and saved it as .vbs

Shell "C:\notepad.exe"

I got nothing, just an error.
But i can do it in a VB editor.
I have no idea why its doing that.
Thanks for your help!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
This is because not all functions available within VB are available with VBScript.

VBScript is designed for client side web browser scripting (though of course it can do many other things as well). As a result there are a number of limitations. For example there are no native file handling commands in vbscript, you cannot use API functions either. However many of the things that can be achieved in VB can be achieved in VBScript using alternative methods. For example the Shell command that you refer to can be achieved using this code:

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.Run "c:\notepad.exe"
Set wshShell = Nothing


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OverdrivEAuthor Commented:
Thank you very much!!!
:D :D
TimCotteeHead of Software ServicesCommented:
You need to accept a comment as answer now to close out this thread.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

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.