Jump to content

Home

I need help with complicated computer stuff


Guest Jabba The Hunt

Recommended Posts

Guest Jabba The Hunt

Ok ive recently got VB (Visual Basic) and Im trying to run programs from a form, (just for the hell of it really) anyway a guy I know told me to use the Shell command to do this, so i had a look through the Msdn library and found the code, ive been working on getting it write now for about an hour and it just wont work - if you are interested im trying to get word to run as the test piece, heres the code

 

Private Sub Word_Click()

Shell("C:\Program Files\Microsoft Office\Office\WINWORD.EXE", [Windowstyle As VbAppwinstyle = vbMinimizedFocus]) As Double

End Sub

 

Word is the name of the button to activate word suprisingly.

 

If any of you amazingly intelligent monkeys can help then I would be very grateful.

 

------------------

"Getting Drunk is great you should try it sometime"

 

"I did once, I just cant remember if I enjoyed it or not"

 

jabbathehunt@hotmail.com

Link to comment
Share on other sites

Guest Jabba The Hunt

Me doing A level computer course, me have to learn it, me need help, please?

 

------------------

"Getting Drunk is great you should try it sometime"

 

"I did once, I just cant remember if I enjoyed it or not"

 

jabbathehunt@hotmail.com

Link to comment
Share on other sites

Guest Hans The Great

I am a VB Programmer and the language does not suck, in fact it gets better all the time. As for your question Jabba: Some of those MSDN examples are not 100% correct, be wary about using them.

The Shell() command is actually a function that returns a value (integer). This number is the process handle, the shelled program's "ID number". Try using this code:

Dim X as Integer

X = Shell({Application Path})

(Note:If you get an "Error 53" message, then that means that the file path is incorrect)

Also,do you want to open Word minimized? That is what your code will do.

 

A better option might be to instantiate the Word object itself from within your code and work with it that way (This is what I usually do, I have'nt used Shell in a while). Check out the MSDN Online site for more info on that.

 

[This message has been edited by Hans The Great (edited September 10, 2001).]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...