J
John
Hi everyone,
Thanks in advance for the help. I am sure this is an easy
loop, but I can't seem to get it to work, and I think I
have it set up erroneously. I am essentially trying to
loop through all csv files in a given directory, and open
them if the last part of their name = "Test" for example.
I started with the following code, but I think my problem
is in establishing the filepath.
Public Sub LoadWorksheets()
Dim wk as Workbook
Dim cur_sheet as Worksheet
Dim folder
folder = "T:\TestFolder\"
'//I think this is the problem
For each wk in folder
If Mid(wk.name,10,4) = "Test" then
cur_workbook = wk.name
Workbooks.Open Filename:="T:\TestFolder\" &
cur_workbook & ".csv", UpdateLinks:=False
End If
next wk
End Sub
Thanks again for any suggestions!
John
Thanks in advance for the help. I am sure this is an easy
loop, but I can't seem to get it to work, and I think I
have it set up erroneously. I am essentially trying to
loop through all csv files in a given directory, and open
them if the last part of their name = "Test" for example.
I started with the following code, but I think my problem
is in establishing the filepath.
Public Sub LoadWorksheets()
Dim wk as Workbook
Dim cur_sheet as Worksheet
Dim folder
folder = "T:\TestFolder\"
'//I think this is the problem
For each wk in folder
If Mid(wk.name,10,4) = "Test" then
cur_workbook = wk.name
Workbooks.Open Filename:="T:\TestFolder\" &
cur_workbook & ".csv", UpdateLinks:=False
End If
next wk
End Sub
Thanks again for any suggestions!
John