selecting a file automatically

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

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
 
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????
 
By first, I mean the file you would see at the top of the
list when the "Open" dialog box is displayed. Thanks
 
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top