ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button on Userform calling GetOpenFilename (https://www.excelbanter.com/excel-programming/325845-button-userform-calling-getopenfilename.html)

Werner Rohrmoser

Button on Userform calling GetOpenFilename
 
Hello,

Situation:
Userform with Button, Button_Click Procedure contains "Application.GetOpenFilename".
When I have done my file selection the GetOpenFilename dialog
will be closed and I see the calling Userform.
Now the Userform seems to be not modal, I can select cells,
sheets, but I can't enter values in the cells.

Question:
How can I avoid this behaviour, I'd like to have a modal userform as it is declared.
Thanks

Best Regards
Werner

Harald Staff

Button on Userform calling GetOpenFilename
 
Hi Werner

Weird. I never noticed.
Seems to behave ok if you hide - show the userform though:

Private Sub CommandButton1_Click()
Me.Hide
TextBox1.Text = Application.GetOpenFilename
Me.Show
End Sub

HTH. Best wishes Harald

"Werner Rohrmoser" skrev i melding
m...
Hello,

Situation:
Userform with Button, Button_Click Procedure contains

"Application.GetOpenFilename".
When I have done my file selection the GetOpenFilename dialog
will be closed and I see the calling Userform.
Now the Userform seems to be not modal, I can select cells,
sheets, but I can't enter values in the cells.

Question:
How can I avoid this behaviour, I'd like to have a modal userform as it is

declared.
Thanks

Best Regards
Werner




Werner Rohrmoser

Button on Userform calling GetOpenFilename
 
Harald,

thanks, I've tested it and it works.

Regards
Werner


"Harald Staff" wrote in message ...
Hi Werner

Weird. I never noticed.
Seems to behave ok if you hide - show the userform though:

Private Sub CommandButton1_Click()
Me.Hide
TextBox1.Text = Application.GetOpenFilename
Me.Show
End Sub

HTH. Best wishes Harald

"Werner Rohrmoser" skrev i melding
m...
Hello,

Situation:
Userform with Button, Button_Click Procedure contains

"Application.GetOpenFilename".
When I have done my file selection the GetOpenFilename dialog
will be closed and I see the calling Userform.
Now the Userform seems to be not modal, I can select cells,
sheets, but I can't enter values in the cells.

Question:
How can I avoid this behaviour, I'd like to have a modal userform as it is

declared.
Thanks

Best Regards
Werner



All times are GMT +1. The time now is 08:28 AM.

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