ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Controlling scroll bars in file dialog (https://www.excelbanter.com/excel-programming/370936-controlling-scroll-bars-file-dialog.html)

RD[_2_]

Controlling scroll bars in file dialog
 
Does anybody have any idea how to control the scroll bars in the file dialog
that would appear when you want to open a file or multiple files.

Basicailly, I'd like the scroll bar to be at the beginning the first time
it's run. Then each subsequent time the macro runs, it would record the last
position of the file list and use it the next time open is called.

I found doc's for controlling the scroll bars of your own list boxes, but
how to control the system open scroll bars baffles me.

NickHK

Controlling scroll bars in file dialog
 
With the Open dialog, you have no option to set the initial name and
therefore no hope to preselect a file and move the scroll-bars. The
GetSaveAsFilename, does have an initialname property, but does not select
the file anyway.
The main problem is that because you are showing a Dialog, it is shown
modally; hence no code runs until it is dismissed.

To me, the easiest solution would be to make you own (simplified) file
dialog userform, then you can control any and all aspects of its behaviour.
Use a listview control to get the same look as the standard Windows dialogs.
The alternative is supplying a hook to the Windows GetOpenFileName API and
use SendMessage to make your changes. Note that this method substantially
more complex the solution above.

But with MultiSelect set to True, can the user not select all the files
needed in one go ?

NickHK

"RD" wrote in message
...
Does anybody have any idea how to control the scroll bars in the file

dialog
that would appear when you want to open a file or multiple files.

Basicailly, I'd like the scroll bar to be at the beginning the first time
it's run. Then each subsequent time the macro runs, it would record the

last
position of the file list and use it the next time open is called.

I found doc's for controlling the scroll bars of your own list boxes, but
how to control the system open scroll bars baffles me.





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

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