macro which import alfa*.txt file, how to ?

S

ss_era

Hi,
I need an help on how to make a macro getting any of the alfa*.txt
from a directory (ex. alfa1.txt alfa2.txt etc etc)
I used :
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\alfa*.txt", _
Destination:=Range("C3"))

....but this didn't work. Is there a way to insert a jolly character
instaed of * (star) ?

Thanks
 
T

Tom Ogilvy

sStr = dir("c:\alpha*.txt")
if sStr <> "" then
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\" & sStr, _
Destination:=Range("C3"))

. . .
End With
End if
 
Top