ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GetOpenFilename changes dialog to modless (https://www.excelbanter.com/excel-programming/305098-getopenfilename-changes-dialog-modless.html)

Alex Trueman

GetOpenFilename changes dialog to modless
 
Hi,

I have a modal dialog with a browse button. Clicking the button uses the
GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone tell
me why this happens and how to prevent it or cure it?

Thanks,
Alex

NickHK

GetOpenFilename changes dialog to modless
 
Alex,
Using something like:
UserForm1.Show vbModal
and
TextBox1.Text=Application.GetOpenFileName()

has no effect on the modality of the userform for me.

Are you doing the same ?

NickHK

"Alex Trueman" wrote in message
...
Hi,

I have a modal dialog with a browse button. Clicking the button uses the
GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone tell
me why this happens and how to prevent it or cure it?

Thanks,
Alex




Alex Trueman

GetOpenFilename changes dialog to modless
 
NickHK,

I'm using the same syntax as you (see below) except that I'm changing
the value property not the text property. I thought that maybe the
modality was being changed so that the 'open' dialog could be displayed.

frmImportVarMods.Show vbModal

and

tbxImportFile.Value = Application.GetOpenFilename( _
filefilter:="text(*.txt),*.txt,all (*.*),*.*", _
Title:="Import File", MultiSelect:=False)

Alex

NickHK wrote:

Alex,
Using something like:
UserForm1.Show vbModal
and
TextBox1.Text=Application.GetOpenFileName()

has no effect on the modality of the userform for me.

Are you doing the same ?

NickHK

"Alex Trueman" wrote in message
...

Hi,

I have a modal dialog with a browse button. Clicking the button uses the
GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone tell
me why this happens and how to prevent it or cure it?

Thanks,
Alex





Alex Trueman

GetOpenFilename changes dialog to modless
 
Further to last message:

The modality is affected but not completely changed. I can access cells
and the formula editor but not the menus.

Alex

Alex Trueman wrote:

NickHK,

I'm using the same syntax as you (see below) except that I'm changing
the value property not the text property. I thought that maybe the
modality was being changed so that the 'open' dialog could be displayed.

frmImportVarMods.Show vbModal

and

tbxImportFile.Value = Application.GetOpenFilename( _
filefilter:="text(*.txt),*.txt,all (*.*),*.*", _
Title:="Import File", MultiSelect:=False)

Alex

NickHK wrote:

Alex,
Using something like:
UserForm1.Show vbModal
and
TextBox1.Text=Application.GetOpenFileName()

has no effect on the modality of the userform for me.

Are you doing the same ?

NickHK

"Alex Trueman" wrote in message
...

Hi,

I have a modal dialog with a browse button. Clicking the button uses the
GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone tell
me why this happens and how to prevent it or cure it?

Thanks,
Alex






NickHK

GetOpenFilename changes dialog to modless
 
Alex,
You are able to place the cursor there, but no text can be entered.
I guess that is what Excel takes to be Modal.

NickHK

"Alex Trueman" wrote in message
...
Further to last message:

The modality is affected but not completely changed. I can access cells
and the formula editor but not the menus.

Alex

Alex Trueman wrote:

NickHK,

I'm using the same syntax as you (see below) except that I'm changing
the value property not the text property. I thought that maybe the
modality was being changed so that the 'open' dialog could be displayed.

frmImportVarMods.Show vbModal

and

tbxImportFile.Value = Application.GetOpenFilename( _
filefilter:="text(*.txt),*.txt,all (*.*),*.*", _
Title:="Import File", MultiSelect:=False)

Alex

NickHK wrote:

Alex,
Using something like:
UserForm1.Show vbModal
and
TextBox1.Text=Application.GetOpenFileName()

has no effect on the modality of the userform for me.

Are you doing the same ?

NickHK

"Alex Trueman" wrote in message
...

Hi,

I have a modal dialog with a browse button. Clicking the button uses

the
GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone

tell
me why this happens and how to prevent it or cure it?

Thanks,
Alex







Alex Trueman

GetOpenFilename changes dialog to modless
 
Thanks NickHK

NickHK wrote:

Alex,
You are able to place the cursor there, but no text can be entered.
I guess that is what Excel takes to be Modal.

NickHK

"Alex Trueman" wrote in message
...

Further to last message:

The modality is affected but not completely changed. I can access cells
and the formula editor but not the menus.

Alex

Alex Trueman wrote:


NickHK,

I'm using the same syntax as you (see below) except that I'm changing
the value property not the text property. I thought that maybe the
modality was being changed so that the 'open' dialog could be displayed.

frmImportVarMods.Show vbModal

and

tbxImportFile.Value = Application.GetOpenFilename( _
filefilter:="text(*.txt),*.txt,all (*.*),*.*", _
Title:="Import File", MultiSelect:=False)

Alex

NickHK wrote:


Alex,
Using something like:
UserForm1.Show vbModal
and
TextBox1.Text=Application.GetOpenFileName()

has no effect on the modality of the userform for me.

Are you doing the same ?

NickHK

"Alex Trueman" wrote in message
...


Hi,

I have a modal dialog with a browse button. Clicking the button uses


the

GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone


tell

me why this happens and how to prevent it or cure it?

Thanks,
Alex







Tom Ogilvy

GetOpenFilename changes dialog to modless
 
In Excel 97, there was no option to show Userforms as modeless. However,
Stephen Bullen discovered the "bug" you highlight - that showing the
getopenfilename dialog made the userform modeless. He and Rob Bovey later
discovered that showing getopenfilename actually called an API function
which was the actual cause of this effect. I don't remember the details,
but you can check out the procedure at Stephen's site (where he has
converted it to use the API call rather than showing the getopenfilename).

http://www.BSMLTD.ie

go to the excel page from there.

--
Regards,
Tom Ogilvy

"Alex Trueman" wrote in message
...
Thanks NickHK

NickHK wrote:

Alex,
You are able to place the cursor there, but no text can be entered.
I guess that is what Excel takes to be Modal.

NickHK

"Alex Trueman" wrote in message
...

Further to last message:

The modality is affected but not completely changed. I can access cells
and the formula editor but not the menus.

Alexy

Alex Trueman wrote:


NickHK,

I'm using the same syntax as you (see below) except that I'm changing
the value property not the text property. I thought that maybe the
modality was being changed so that the 'open' dialog could be

displayed.

frmImportVarMods.Show vbModal

and

tbxImportFile.Value = Application.GetOpenFilename( _
filefilter:="text(*.txt),*.txt,all (*.*),*.*", _
Title:="Import File", MultiSelect:=False)

Alex

NickHK wrote:


Alex,
Using something like:
UserForm1.Show vbModal
and
TextBox1.Text=Application.GetOpenFileName()

has no effect on the modality of the userform for me.

Are you doing the same ?

NickHK

"Alex Trueman" wrote in message
...


Hi,

I have a modal dialog with a browse button. Clicking the button uses


the

GetOpenFilename method to populate a text box. For some reason, after
running GetOpenFilename the dialog changes to modeless. Can anyone


tell

me why this happens and how to prevent it or cure it?

Thanks,
Alex









Alex Trueman

GetOpenFilename changes dialog to modless
 
Thanks Tom,

That site has some awesome resources.

Alex

Tom Ogilvy wrote:
In Excel 97, there was no option to show Userforms as modeless. However,
Stephen Bullen discovered the "bug" you highlight - that showing the
getopenfilename dialog made the userform modeless. He and Rob Bovey later
discovered that showing getopenfilename actually called an API function
which was the actual cause of this effect. I don't remember the details,
but you can check out the procedure at Stephen's site (where he has
converted it to use the API call rather than showing the getopenfilename).

http://www.BSMLTD.ie

go to the excel page from there.



All times are GMT +1. The time now is 06:33 AM.

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