Hi Forum
Hope all is well. I am trying to pause the execution of a sub routing until there is a user intervention, however it seems my userform is not active until I navigate away from it and back.
Excel Version: 2010
Operating System: windows 7
Forum Experience Level: Novice
Programing Level: Novice
Problem: When a loop finishes I want to use the state change of a command button to call the next sub-routine and pass a string value to the sub-routine.
Sub name activeDirectory
String pctCompl
First attempt
Next I ‘ loop has finished
MsgBox " Sub1 Complete ok when ready to continue " ‘ stop and wait for ok
activeDirectory pctCompl
end sub
Works fine but I don’t want to use a msgbox for my user input.
Second attempt
The user form has an option button for the change of state
Next I ‘ Loop finishes and command button is false
Do While UserForm1.OptionButton1.Value = False
Application.Wait Now + TimeValue("00:00:01") ‘ do something innocuous
Loop
activeDirectory pctCompl
End Sub
Does not work, however works if I do the following steps
It’s like the Userform1 is disabled for input from its existing controls but if I interrupt it with a msgbox or toggle away it seems to work fine, strange.
Hope someone can assist
Best Regards
Rob
Hope all is well. I am trying to pause the execution of a sub routing until there is a user intervention, however it seems my userform is not active until I navigate away from it and back.
Excel Version: 2010
Operating System: windows 7
Forum Experience Level: Novice
Programing Level: Novice
Problem: When a loop finishes I want to use the state change of a command button to call the next sub-routine and pass a string value to the sub-routine.
Sub name activeDirectory
String pctCompl
First attempt
Next I ‘ loop has finished
MsgBox " Sub1 Complete ok when ready to continue " ‘ stop and wait for ok
activeDirectory pctCompl
end sub
Works fine but I don’t want to use a msgbox for my user input.
Second attempt
The user form has an option button for the change of state
Next I ‘ Loop finishes and command button is false
Do While UserForm1.OptionButton1.Value = False
Application.Wait Now + TimeValue("00:00:01") ‘ do something innocuous
Loop
activeDirectory pctCompl
End Sub
Does not work, however works if I do the following steps
- Wait until the next I loop completes
- Select the command button, button does not change its state
- toggle away from Userform1 using the keyboard “ Alt” and “Tab” keys to go to a different screen
- toggle back
- command button has changed its state to true and program works fine
It’s like the Userform1 is disabled for input from its existing controls but if I interrupt it with a msgbox or toggle away it seems to work fine, strange.
Hope someone can assist
Best Regards
Rob