ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   focus (https://www.excelbanter.com/excel-programming/300621-focus.html)

Art[_6_]

focus
 
Hi

I've got a form from which my users will select files. If they double click a text box, the open file dialog will appear and they can choose their file. The problem is that after they select their file they need to click out of the text box before any other control will respond. For example, there's a button that basically says "okay get the file". If I select a file, and then hit the button -- I have to hit the button twice. OR if I select a file, go to another text box to get a different type of file, I have to click that other text box before it will hear the double click

Any suggestions

Art

Earl Kiosterud[_3_]

focus
 
Art,

You can give the "Okay, get the file" button the focus with the SetFocus
method:

Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Value = Application.GetOpenFilename
OkayGetTheFileButton.SetFocus

Now the text box no longer has focus, so any button can be clicked, and the
Enter key can also be used for button OkayGetTheFileButton, since it has
focus.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Art" wrote in message
...
Hi,

I've got a form from which my users will select files. If they double

click a text box, the open file dialog will appear and they can choose their
file. The problem is that after they select their file they need to click
out of the text box before any other control will respond. For example,
there's a button that basically says "okay get the file". If I select a
file, and then hit the button -- I have to hit the button twice. OR if I
select a file, go to another text box to get a different type of file, I
have to click that other text box before it will hear the double click.

Any suggestions?

Art





All times are GMT +1. The time now is 01:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com