M
monkeyboy
Sorry for the multiple posts...a little too quick pulling the trigger
I'm writing a small simulator that continuously runs a loop walking
out in time, the loop is in a module unassociated with a sheet. I'd
like it to respond to button clicks on the display sheet
("FLOWSHEET") to start and
stop. The only way I can seem to accoplish this is to put the
following within the main simulation loop
'grab any events happening outside the code on the FLOWSHEET
worksheet
ThisWorkbook.Worksheets("FLOWSHEET").Activate
DoEvents
This works, but is pretty slow, it there a better way to caputer
button clicks. The Button code is associated with the display sheet
("FLOWSHEET"). With out the above code, VB does not seem to register
the click events at all...
Private Sub ContinueButton1_Click()
g_Paused = False
Call MainLoop
End Sub
Private Sub PauseButton1_Click()
g_Paused = True
End Sub
Private Sub StartSimulation_Click()
g_Paused = False
Call MainProcedure
End Sub
Private Sub StopButton1_Click()
Call StopExecution
End Sub
I'm writing a small simulator that continuously runs a loop walking
out in time, the loop is in a module unassociated with a sheet. I'd
like it to respond to button clicks on the display sheet
("FLOWSHEET") to start and
stop. The only way I can seem to accoplish this is to put the
following within the main simulation loop
'grab any events happening outside the code on the FLOWSHEET
worksheet
ThisWorkbook.Worksheets("FLOWSHEET").Activate
DoEvents
This works, but is pretty slow, it there a better way to caputer
button clicks. The Button code is associated with the display sheet
("FLOWSHEET"). With out the above code, VB does not seem to register
the click events at all...
Private Sub ContinueButton1_Click()
g_Paused = False
Call MainLoop
End Sub
Private Sub PauseButton1_Click()
g_Paused = True
End Sub
Private Sub StartSimulation_Click()
g_Paused = False
Call MainProcedure
End Sub
Private Sub StopButton1_Click()
Call StopExecution
End Sub