ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro which import alfa*.txt file, how to ? (https://www.excelbanter.com/excel-programming/307836-macro-import-alfa%2A-txt-file-how.html)

ss_era

macro which import alfa*.txt file, how to ?
 
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:\a lfa*.txt", _
Destination:=Range("C3"))

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

Thanks

Tom Ogilvy

macro which import alfa*.txt file, how to ?
 
sStr = dir("c:\alpha*.txt")
if sStr < "" then
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\" & sStr, _
Destination:=Range("C3"))

. . .
End With
End if

--
Regards,
Tom Ogilvy

"ss_era" wrote in message
om...
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:\a lfa*.txt", _
Destination:=Range("C3"))

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

Thanks





All times are GMT +1. The time now is 07:34 AM.

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