ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I do this autoselect with GetOpenFileName or the Dir function? (https://www.excelbanter.com/excel-programming/429220-can-i-do-autoselect-getopenfilename-dir-function.html)

plh

Can I do this autoselect with GetOpenFileName or the Dir function?
 
I have an application that is semi-automated in that to kick it off I use the
GetOpenFileName method to allow the user (me) to select 51 files for processing.
There are always 51 files, always with the extension ".txt", and always arranged
in descending order by date of creation. Right now I open the dialog box, which
has the .txt filter active, arrange in descending order by date, highlight, hold
down the shift key & count down the 51 files as I hit the down arrow key. I was
wondering if there is some way to automate that part of it using the "dir"
function. The procedure is always the same. I don't really have to open the
dialog box, because the files to be processed always reside in the same place.
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??

r

Can I do this autoselect with GetOpenFileName or the Dir function?
 


Sub test_SFO()
Dim FSO As Object
Dim F
Dim Fo
Dim s As String

Set FSO = CreateObject("Scripting.FileSystemObject")
s = "D:\Documents and Settings\mensar\Documenti\lavoro\prove excel2"

If FSO.FolderExists(s) Then
Set Fo = FSO.GetFolder(s)
For Each F In Fo.Files
Debug.Print F.Name
Debug.Print F.Type
Next
End If
End Sub

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"plh" wrote:

I have an application that is semi-automated in that to kick it off I use the
GetOpenFileName method to allow the user (me) to select 51 files for processing.
There are always 51 files, always with the extension ".txt", and always arranged
in descending order by date of creation. Right now I open the dialog box, which
has the .txt filter active, arrange in descending order by date, highlight, hold
down the shift key & count down the 51 files as I hit the down arrow key. I was
wondering if there is some way to automate that part of it using the "dir"
function. The procedure is always the same. I don't really have to open the
dialog box, because the files to be processed always reside in the same place.
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??



All times are GMT +1. The time now is 11:21 PM.

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