zoom38
01-29-2024, 08:50 PM
Hello, I have a UF with a ComboBox on it. After its created (initialized) I want the focus to immediately go to a cell without clicking on it. So far the focus remains on the UF ComboBox until the UF change event is activated by using
AppActivate ThisWorkbook.Windows(1).Caption
It will also change focus if I click on a cell or use the up/down arrow keys. I've tried the following both in the UF initialize sub and the standard module where the sub that "shows" the UF is, with no success:
Application.SendKeys ("{ESC}")
AppActivate ("Microsoft Excel") - Fails completely
AppActivate ThisWorkbook.Windows(1).Caption
AppActivate ActiveWorkbook.Windows(1).Caption
AppActivate ThisWorkbook.Windows(1).Caption = True
AppActivate ActiveWorkbook.Windows(1).Caption = True
Range("B7").Activate
I've attached a sample workbook for reference.
Gary
AppActivate ThisWorkbook.Windows(1).Caption
It will also change focus if I click on a cell or use the up/down arrow keys. I've tried the following both in the UF initialize sub and the standard module where the sub that "shows" the UF is, with no success:
Application.SendKeys ("{ESC}")
AppActivate ("Microsoft Excel") - Fails completely
AppActivate ThisWorkbook.Windows(1).Caption
AppActivate ActiveWorkbook.Windows(1).Caption
AppActivate ThisWorkbook.Windows(1).Caption = True
AppActivate ActiveWorkbook.Windows(1).Caption = True
Range("B7").Activate
I've attached a sample workbook for reference.
Gary