ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a file automatically (https://www.excelbanter.com/excel-programming/312406-selecting-file-automatically.html)

JT[_2_]

selecting a file automatically
 
I'm kinda of stuck and would appreciate your help. I have
a macro where the "open" dialog box is displayed.
Currently the user selects which file they want to
select. (Users are supposed to select the first one but
not everyone is following the "rules" .)

To resolve this issue, we would like the macro to select
the first file automatically. However, I'm having trouble
coming up with the code to do this. The name for the
first file is always something different.

Any suggestions would be greatly appreciated. Thanks....JT

Tom Ogilvy

selecting a file automatically
 
Define what you mean by first file.

a file listing can be sorted by several attributes, so saying first file
isn't definitive. latest date/earliest date, alphabetically,
largest/smallest????

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I'm kinda of stuck and would appreciate your help. I have
a macro where the "open" dialog box is displayed.
Currently the user selects which file they want to
select. (Users are supposed to select the first one but
not everyone is following the "rules" .)

To resolve this issue, we would like the macro to select
the first file automatically. However, I'm having trouble
coming up with the code to do this. The name for the
first file is always something different.

Any suggestions would be greatly appreciated. Thanks....JT




JT[_2_]

selecting a file automatically
 
By first, I mean the file you would see at the top of the
list when the "Open" dialog box is displayed. Thanks


-----Original Message-----
Define what you mean by first file.

a file listing can be sorted by several attributes, so

saying first file
isn't definitive. latest date/earliest date,

alphabetically,
largest/smallest????

--
Regards,
Tom Ogilvy

"JT" wrote in

message
...
I'm kinda of stuck and would appreciate your help. I

have
a macro where the "open" dialog box is displayed.
Currently the user selects which file they want to
select. (Users are supposed to select the first one but
not everyone is following the "rules" .)

To resolve this issue, we would like the macro to select
the first file automatically. However, I'm having

trouble
coming up with the code to do this. The name for the
first file is always something different.

Any suggestions would be greatly appreciated.

Thanks....JT


.


Tom Ogilvy

selecting a file automatically
 
Again, I can change that if I display the listing using the detail option
and clicking on any of the attributes. I don't know that there is a default
first file.

try this

sName = Dir("C:\MyFiles\*.xls")
msgbox sName

and see if that gives you want you want. (but I would test it pretty
thoroughly before I decided that it will work reliably).

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
By first, I mean the file you would see at the top of the
list when the "Open" dialog box is displayed. Thanks


-----Original Message-----
Define what you mean by first file.

a file listing can be sorted by several attributes, so

saying first file
isn't definitive. latest date/earliest date,

alphabetically,
largest/smallest????

--
Regards,
Tom Ogilvy

"JT" wrote in

message
...
I'm kinda of stuck and would appreciate your help. I

have
a macro where the "open" dialog box is displayed.
Currently the user selects which file they want to
select. (Users are supposed to select the first one but
not everyone is following the "rules" .)

To resolve this issue, we would like the macro to select
the first file automatically. However, I'm having

trouble
coming up with the code to do this. The name for the
first file is always something different.

Any suggestions would be greatly appreciated.

Thanks....JT


.





All times are GMT +1. The time now is 07:17 PM.

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