Microsoft word

There is visual basics in microsoft word and i want to know how to program it to open another program.  i know some visual basics.  I tried  this:

Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Private Sub Command1_Click()
    ShellExecute Me.hwnd, "open", "C:\Program Files\Acceleration Software\Net Butler\NetButler.exe", "", "", 5 'SW_SHOW = 5

just everythin on their proper lines (this form cuts them up)

So, this answer wont work so don't give it to me....thanks...
mrcool4444Asked:
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.

gkanaanCommented:
This definitly works in VB, i use it all the time... Shell is a built in function in VB, type Shell in the VB editor, go to it's beginning and press F1, you'll get more help on it

hWnd=Shell("C:\blah.exe", vbNormalFocus)

if Shell succeeds it will return a handle to the program that just ran

ShellExecute should also run, but it is a more complicated function that can do more complicated stuff then simple Shell. I use it in one of my software to make VB open a webpage in the user's default browser...
0
mrcool4444Author Commented:
okay, you are not understanding me....i am talking about visual basics IN microsoft word.  what you told me above doesn't work also just to let you know.  i am going to reject your answer, but if you can make it so it will work in microsoft word, i will accept it.
0
mannoCommented:
From the Word help:

Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)      ' Run Calculator.

0

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
mrcool4444Author Commented:
That works.  Thank you!
0
mrcool4444Author Commented:
That works.  Thank you!
0
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.