we have invoice# to find in each text files and update link of the folder and file name in excel sheet.

Joined
May 27, 2022
Messages
7
Office Version
  1. 365
  2. 2011
Dim FSOLibrary As FileSystemObject Dim FSOFolder As Object Dim folderName As String

folderName = "D:\Renda center\EDI Files\January 2021"

Set FSOLibrary = New FileSystemObject

Sheets("Kick-outs").Range("B2").Select
i = 2
Do Until Sheet1.Range("B" & i) = ""
Sheet1.Range("B" & i).Select
inv = Trim(Sheet1.Range("B" & i))
Debug.Print inv

LoopAllSubFolders FSOLibrary.GetFolder(folderName)

i = i +1

loop
end sub

Sub LoopAllSubFolders(FSOFolder As Object)

Dim FSOSubFolder As Object Dim FSOFile As Object

For Each FSOSubFolder In FSOFolder.SubFolders LoopAllSubFolders FSOSubFolder Next

For Each FSOFile In FSOFolder.Files

Open FSOFile For Input As 1#

******* Help required to read text file and search invoice then update in excel.***********************

Debug.Print FSOFolder.Path
Debug.Print FSOFolder.Name
Debug.Print FSOFile
Next

End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
******* Help required to read text file and search invoice then update in excel.***********************
Please review the code and help on above comment mentioned areas.
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,558
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top