View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stephen Newman[_2_] Stephen Newman[_2_] is offline
external usenet poster
 
Posts: 18
Default Return Control to Userform

I have a userform with the following code attached to an image:

Private Sub Image1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
IsKeyPressed
If Ctrl = True Then
MsgBox "You double clicked the image" & vbNewLine & "while holding the
Ctrl key.", vbInformation, "Control Return Issue"
DoEvents
Else: MsgBox "You double clicked the image.", vbInformation, "Control
Return Issue"
End If
End Sub

In both cases when the code has completed control is not returned to
the userform until the user mouse clicks the form once. There are
additional buttons on the form, but even when I add a setFocus command
following the msgbox, the button is focused, but still needs the extra
mouse click to be operable.

I have tried adding the DoEvents command, but it still does not return
control to the userform.

Am I missing something? If so, could somebody please point out where
I'm wrong?