File name seach within open filetype

A

Andrew

Ladies & Gents,

I use a macro to open a number of files with a similar name, format & save
them, then open a number of different files with simlar names, format & save
those. The files are named *A.csv, and *B.csv. All of the file reside in
the same folder, but that folder changes regularly, and is not the same
folder which holds the macro. The code below will open mulitple files with
a similar type;

Sub Look_For_File_Type() ' Test 3
Dim fn As Variant, f As Integer
fn = Application.GetOpenFilename(" Text files,*.csv", 1, "Select One Or
More Files To Open", , True)
If TypeName(fn) = "Boolean" Then Exit Sub
For f = 1 To UBound(fn)
Debug.Print "Selected file #" & f & ": " & fn(f)
Workbooks.Open fn(f)
MsgBox ActiveWorkbook.Name, , "Active Workbook Name:"
ActiveWorkbook.Close False ' close the active workbook without
saving any changes
Next f
End Sub

How do I make the code search for all *A.csv files?



Thanks in advance.

Andrew
 

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

Top