Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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.
Reply With Quote
  #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
Reply With Quote
  #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.
Reply With Quote
  #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
Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:02 PM.


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