A Mousemove event within a RichTextBox is fired and so it appears to the user that is where the focus is. However, the underlying spreadsheet can still have the focus with any keystroke being received there. I have been unable to find any code to use with the Mousemove event to bring the focus back to the Userform and the RichTextBox.
Private Sub RBXDups_MouseMove(ByVal Button As Integer, _ ByVal Shift As Integer, ByVal X As stdole.OLE_XPOS_PIXELS, _ ByVal Y As stdole.OLE_YPOS_PIXELS) Me.Textbox1.value = X & " =X Y=" & Y Me.RichTextBox1.SetFocus end sub
The textbox displays the XY cordinates, but the focus remains with and the sheet receives the keystrokes. Right clicking within the Richtextbox moves the focus and keystrokes are processed by the userform.
How to get the focus back to the Userform and Richtextbox with a VBA command?