Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 10th, 2004, 03:44 PM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Call VB Exe from VB Program

How do I call a VB executable from a VB program?

Example

Private sub cmdText1_click()
' Syntax to call VB program called myprogram.exe which is residing in a different directory or server.

End sub


Thanks,
Judy
  #2 (permalink)  
Old February 10th, 2004, 03:45 PM
Friend of Wrox
 
Join Date: Aug 2003
Location: , , .
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Assuming this is a standard exe the call is Shell.
  #3 (permalink)  
Old February 10th, 2004, 04:25 PM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

I tried your suggestion.

shell myprogram.exe

I got an error message "object required" and it is sitting on the line shell myprogram.exe.

Myprogram.exe is a VB Project which I turned into an executable file. Can anyone please help me how to go about calling or executing an executable file inside a VB Project?

Thanks,
Judy
  #4 (permalink)  
Old February 10th, 2004, 04:28 PM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

I got it. Sorry. I forgot that I should be putting the file path too.
  #5 (permalink)  
Old February 10th, 2004, 05:02 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

The use of the SHELL command is as follows.
Code:
   Dim dblRetVal as Double

   dblRetVal = Shell("C:\MyPath\MyProgram.exe", vbMaximizedFocus)
   If it runs OK, dblRetVal is a unique number. If the .EXE fails, dblRetVal is zero and you can do some error trapping. The windows style vbMaximizedFocus is one of a few constants. See help for SHELL to get a complete list.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
  #6 (permalink)  
Old December 12th, 2004, 11:17 AM
Registered User
 
Join Date: Dec 2004
Location: Mumbai, Mahrashtra, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to imheretolearn
Default

does this work if executable's folder is in system path, if yes can i update PATH variable of the system via VB's packagin & installation add-in's setup?

jay


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call VB exe in another vb program Swati Chari BOOK: ASP.NET Website Programming Problem-Design-Solution 1 March 14th, 2008 11:43 AM
call external program from vb.net praswani Pro VB.NET 2002/2003 2 October 18th, 2007 07:19 AM
Running an external program (.exe) in VB.net webgen VS.NET 2002/2003 1 July 18th, 2005 12:57 PM
Use VB to call Matlab to execute program fennsc VB How-To 0 March 14th, 2005 09:57 PM
How to call a program in as400 through vb 6 gokul VB Databases Basics 0 October 20th, 2004 03:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.