|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function RunShell(strCommand As String)
' Procedure : RunShell
' Description: Run a command then wait until it is completed.
' Copyright: Chris Greaves Inc.
' Inputs: STRING Dos-level command
' Returns: None
' Assumes: Nothing
' Side Effects:
' Tested: By the calls below.
Dim retval, test
Dim lngTasksInd As Long
Dim strAr() As String
ReDim strAr(0)
For lngTasksInd = 1 To Tasks.Count
strAr(UBound(strAr)) = Tasks(lngTasksInd).Name
ReDim Preserve strAr(UBound(strAr) + 1)
Next lngTasksInd
ReDim Preserve strAr(UBound(strAr) - 1)
retval = Shell(strCommand, vbNormalFocus) ' Run command prompt
For lngTasksInd = 1 To Tasks.Count
Dim strTask As String
' On Error GoTo EndedAlready
strTask = Tasks(lngTasksInd).Name ' remember this task
Dim lngArInd As Long
For lngArInd = 0 To UBound(strAr)
If strTask = strAr(lngArInd) Then ' remembered was alerady known
strTask = "" ' so flag it by "EMPTY"
Exit For
Else
End If
Next lngArInd
If strTask <> "" Then ' if NON-empty then was NOT already known
Exit For
Else
End If
Next lngTasksInd
Do
DoEvents
test = Tasks.Exists(strTask)
Loop Until test = 0
'EndedAlready:
'Sub TESTRunShell()
' Call RunShell("c:\command.com")
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |