EXCEL VBA: Application.FileSearch Error in Running Excel 2013
Solved/Closed
g.cabal
Posts
3
Registration date
Thursday June 16, 2016
Status
Member
Last seen
June 17, 2016
-
Jun 16, 2016 at 01:32 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 28, 2016 at 12:00 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 28, 2016 at 12:00 PM
Related:
- Vba filesearch
- Vba case like - Guide
- Number to words in excel formula without vba - Guide
- Vba check if value is in array - Guide
- Vba color index - Guide
- How to open vba in excel - Guide
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jun 16, 2016 at 11:07 AM
Jun 16, 2016 at 11:07 AM
Hi G.Cabal,
I have no experience with FileSearch, but it seems to be replaced by FindFile in later excel versions.
May the 3rd reply in the link below further guide you:
https://www.mrexcel.com/board/threads/excel-2010-vba-replacement-for-application-filesearch.643288/
Good luck and best regards,
Trowa
I have no experience with FileSearch, but it seems to be replaced by FindFile in later excel versions.
May the 3rd reply in the link below further guide you:
https://www.mrexcel.com/board/threads/excel-2010-vba-replacement-for-application-filesearch.643288/
Good luck and best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jun 28, 2016 at 12:00 PM
Jun 28, 2016 at 12:00 PM
Hi Giezel,
Try the code below and see if it yields the desired results.
Enter folder path on code line 8.
Data from .txt files will be pasted in column A of the active sheet.
Best regards,
Trowa
Monday, Tuesday and Thursday are usually the days I'll respond. Bear this in mind when awaiting a reply.
Try the code below and see if it yields the desired results.
Enter folder path on code line 8.
Data from .txt files will be pasted in column A of the active sheet.
Sub OpenFiles() Dim MyFolder As String Dim MyFile As String Dim Filename As String Dim cRow As Integer MyFolder = "Folder path here" MyFile = Dir(MyFolder & "\*.txt") cRow = 2 Do While MyFile <> "" Filename = MyFolder & "\" & MyFile Open Filename For Input As #1 Do Until EOF(1) Line Input #1, textline If textline <> vbNullString Then ActiveSheet.Range("A" & cRow).Value = textline End If cRow = cRow + 1 Loop Close #1 MyFile = Dir() Loop End Sub
Best regards,
Trowa
Monday, Tuesday and Thursday are usually the days I'll respond. Bear this in mind when awaiting a reply.
Jun 17, 2016 at 07:03 AM
Jun 17, 2016 at 07:09 AM
I already resolved the .FileSearch but my problem is the replace of the code below:
For i = 1 To Application.SelectedItems.Count
Call ReadData(.SelectedItems(i), DataCol)
DataCol = DataCol + 1
Sheets(DataSheet).Select
Next i
Thanks.
Jun 20, 2016 at 11:56 AM
What are you trying to achieve with that piece of code?
Best regards,
Trowa
Jun 22, 2016 at 04:49 AM
Sorry for late reply.
If .txt file/s are found the content of all text files will copied to the sheet in new sheet name