VBA: Why must I set focus to control every time? VBA: Why must I set focus to control every time? vba vba

VBA: Why must I set focus to control every time?


Use .Value instead - that doesn't require setting focus first. From the documentation, for example for the TextBox control (emphasis mine):

While the control has the focus, the Text property contains the text data currently in the control; the Value property contains the last saved data for the control. When you move the focus to another control, the control's data is updated, and the Value property is set to this new value. The Text property setting is then unavailable until the control gets the focus again.