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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA Shell and Wait

Status
Not open for further replies.

jgspencer

Technical User
Apr 10, 2009
9
US
I need help with some code regarding shell and wait. I am trying to write a shell that triggers a .exe file and regrinds hours in the POS system that my restaurants use. I need to have the startdate equal the cell in Sheet 1 Cell A1 and then go back to Monday and stop before Sunday. A few things I am having trouble with:

-How do I set the startdate to equal that cell and format the start date to "yyyyddmm" and run the .exe file to loop from startdate to Monday and stop before Sunday.
-If the file does not exist, how do I handle the error so the loop continues.
-Also, I need it to also incorporate a shell and wait that will not continue to the next step of code until the shell has finished but to stop running after 3 minutes if the shell does not complete the task.

I have read about the shell and wait function but I don't really understand it that much. Here is what I have so far even though it's not much:

Sub GndHours()

On Error GoTo GndErr

Dim RetVal
RetVal = Shell("C:\aloha\bin\grind.exe /date yyyyddmm")

ExitHere:
Exit Sub

GndErr:
Select Case Err.Number
Case Else
Resume ExitHere
End Select
End Sub

Your help will be much appreciated.
 


Hi,

Welcome to Tek-Tips.

You will get a better response in Forum707. Please post VBA questions there. This forum is suited for MS Office application questions that do not require code.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top