Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 Display Modes
  #1 (permalink)  
Old October 17th, 2006, 07:23 AM
Authorized User
 
Join Date: Dec 2003
Location: Vashi, Navi Mumbai, Maharashtra, India.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default Click even code for open DOS .EXE

In click event it is passable to open DOS file like in E:\fpd26\foxpro.exe file

Mohamed Mohiddin
Officer
__________________
Mohamed Mohiddin
Officer
Reply With Quote
  #2 (permalink)  
Old October 18th, 2006, 08:32 AM
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

Yes, look for help with the SHELL command.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #3 (permalink)  
Old October 18th, 2006, 01:10 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec(ping -n 3 -w 1000 " & sAddress)

This will ping the address specified in the sAddress variable.
If you want the window to stay open while the operation is running, then do this:

Set objExecObject = objShell.Exec("%comspec% /c ping -n 3 -w 1000 " & sAddress)

Or

Set objExecObject = objShell.Exec("%comspec% /k ping -n 3 -w 1000 " & sAddress)

By using %comspec%, this script will run in any Windows environment, as opposed to using "cmd.exe" or some other variant.

Does this help?



mmcdonal
Reply With Quote
  #4 (permalink)  
Old October 18th, 2006, 01:11 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I forgot to mention, you will need to declare objShell and objExecObject, but you don't have to type the variable. Or you can use variant.

Dim objShell
Dim objExecObject As Variant



mmcdonal
Reply With Quote
  #5 (permalink)  
Old October 18th, 2006, 01:20 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Its all coming back to me now...

You will also want your executable to be in your path statement.

Oooh, You can run path using the above code, then take the path as the variable, then add the path to your executable to the path variable, then pass the path variable back using set path.

Who here remembers DOS?!


'------------------

Do While Not objExecObject.StdOut.AtEndOfStream
   strText = objExecObject.StdOut.ReadAll()

   If InStr(strText, "Path") > 0 Then
        sPath = strText & ";" & "C:\Program Files\FoxPro\"
   End If
Loop

Set objExecObject = objShell.Exec(set path sPath)
Set objExecObject = objShell.Exec(foxpro.exe)

HTH
(I'll start drinking decaffeinated...)



mmcdonal
Reply With Quote
Reply


Thread Tools
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
Right click to Open a menu peace2007 Ajax 2 November 5th, 2007 02:25 AM
how to open new window on button click nittin14 ASP.NET 1.0 and 1.1 Basics 8 April 28th, 2007 01:13 AM
How open a DOS-box from Access 2003 cvandijk Access VBA 1 January 31st, 2005 10:02 AM
On click open a report vita Access 4 October 2nd, 2003 07:47 AM
Writing VBA Code for DOS Commands dgarcia1128 Access VBA 7 August 3rd, 2003 09:07 AM



All times are GMT -4. The time now is 01:35 AM.


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