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

  • Thread starter Thread starter ss_era
  • Start date Start date
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
 
sStr = dir("c:\alpha*.txt")
if sStr <> "" then
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\" & sStr, _
Destination:=Range("C3"))

. . .
End With
End if
 

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