Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA timed program 1

Status
Not open for further replies.

LSIGuy

MIS
Jun 26, 2002
18
US
I am trying to write a program that will ping a host through DOS every 30 min. I need to know how to write commands to DOS through Excels VBA and then how to make it issue that command every 30 min. The program must be running constantly so I was curious if any of you guys had any ideas... Thanks.
 
Here Goes

This first one goes in the sheet or wherever

Private Sub CommandButton1_Click()
Application.OnTime Now + TimeValue("00:30:00"), "Runme"
End Sub

This one goes in module1
Sub Runme()
Dim Shell, Word
Set Shell = CreateObject("WScript.Shell")
strProgToRun = "ping 1.2.3.4"
Shell.Run (strProgToRun)
End Sub
 
if you want it to do it every 30 mins
Sub Runme()
Dim Shell, Word
Set Shell = CreateObject("WScript.Shell")
Shell.Run ("ping 1.2.3.4")
Application.OnTime Now + TimeValue("00:30:00"), "Runme"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top