Is there a way to set priorities to macros; that is, can I set a priority on one macro to force it to finish before a command button will trigger another macro?
to further complicate things, I'm using the OnTime command to cause a program to loop itself until a flag gets set by a command button; see below:
Note: the MakeEnaMeasurement routine takes mS to complete!
-------------------------------------------------------------
Sub MakeEnaMeasurement()
Set WB = Application.ActiveWorkbook
Set WSRD = WB.Sheets("RawData")
If WSRD.Cells(1, 3) = False Then GoTo SingleMeasurement
Application.OnTime Now + TimeValue("00:00:01"), "MakeEnaMeasurement"
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
SingleMeasurement:
Code
Goes
Here
<o> </o>End Sub
--------------------------------------------------------
CommandButton_Click()
Here
End Sub
------------------------------------------------------
Comment: now when the command button is hit; I want the code to make the single measurement (thus stop the 1-second loop) and then perform all the commands in the command button routine, if you notice I will then get the loop going again at the conclusion of the command button routine.
Is there a better way to do something like this?
The code works but sometimes it appears the code is jumping out of the middle of the measurment routine take care of the command button code?
Any help with setting priorities would help me.
Thanks
my problem is, I want to make sure the code is executed to the end
to further complicate things, I'm using the OnTime command to cause a program to loop itself until a flag gets set by a command button; see below:
Note: the MakeEnaMeasurement routine takes mS to complete!
-------------------------------------------------------------
Sub MakeEnaMeasurement()
Set WB = Application.ActiveWorkbook
Set WSRD = WB.Sheets("RawData")
If WSRD.Cells(1, 3) = False Then GoTo SingleMeasurement
Application.OnTime Now + TimeValue("00:00:01"), "MakeEnaMeasurement"
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
SingleMeasurement:
Code
Goes
Here
<o> </o>End Sub
--------------------------------------------------------
CommandButton_Click()
if WSRD.Cells(1, 3) = true then
WSRD.Cells(1, 3)= false (to my helper see comment below)
ContMeas = true
end if
More Code
GoesWSRD.Cells(1, 3)= false (to my helper see comment below)
ContMeas = true
end if
More Code
Here
if ContMeas = true then
ContMeas=false
WSRD.Cells(1, 3) = true
call MakeEnaMeasurement
end if
ContMeas=false
WSRD.Cells(1, 3) = true
call MakeEnaMeasurement
end if
End Sub
------------------------------------------------------
Comment: now when the command button is hit; I want the code to make the single measurement (thus stop the 1-second loop) and then perform all the commands in the command button routine, if you notice I will then get the loop going again at the conclusion of the command button routine.
Is there a better way to do something like this?
The code works but sometimes it appears the code is jumping out of the middle of the measurment routine take care of the command button code?
Any help with setting priorities would help me.
Thanks
my problem is, I want to make sure the code is executed to the end