Morning All,
I found the following code online hoping that it would allow me to download multiple txt files onto the same sheet from a memory stick however when I try and run the program it faults out on the underlined line with "Object Doesn't Support This action" any ideas or suggestions would be appreciated
Sub GetTextFiles()
Dim lngCounter As Long, wbText As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeAllFiles
.LookIn = "E:/SBUB"
.Execute
For lngCounter = 1 To .FoundFiles.Count
If Right(.FoundFiles(lngCounter), 4) = ".txt" Then
Workbooks.OpenText .FoundFiles(lngCounter)
ActiveSheet.UsedRange.Copy
ActiveWorkbook.Close False
ThisWorkbook.Sheets.Add
ActiveSheet.Paste
End If
Next lngCounter
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
I found the following code online hoping that it would allow me to download multiple txt files onto the same sheet from a memory stick however when I try and run the program it faults out on the underlined line with "Object Doesn't Support This action" any ideas or suggestions would be appreciated
Sub GetTextFiles()
Dim lngCounter As Long, wbText As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.FileType = msoFileTypeAllFiles
.LookIn = "E:/SBUB"
.Execute
For lngCounter = 1 To .FoundFiles.Count
If Right(.FoundFiles(lngCounter), 4) = ".txt" Then
Workbooks.OpenText .FoundFiles(lngCounter)
ActiveSheet.UsedRange.Copy
ActiveWorkbook.Close False
ThisWorkbook.Sheets.Add
ActiveSheet.Paste
End If
Next lngCounter
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub