Hi,
I'm hoping for help modifying the below (or possibly scrap) script.
Routine:
Return all MS Word File Names from a folder (sub folders would be even better) that contain a string in the First Page Header.
For instance the user would like all files that pertain to "Pellet Tech". So, she adds the folder path to cell Worksheets("Data").Range("I1") and adds the string ("Pellet Tech") to Worksheets("Data").Range("J1")
The Front Header is the below which notes "Pellet Tech" in the Apply to:
This script only returns all the file names from a particular folder regardless of extension:
Thanks for any help with this
I'm hoping for help modifying the below (or possibly scrap) script.
Routine:
Return all MS Word File Names from a folder (sub folders would be even better) that contain a string in the First Page Header.
For instance the user would like all files that pertain to "Pellet Tech". So, she adds the folder path to cell Worksheets("Data").Range("I1") and adds the string ("Pellet Tech") to Worksheets("Data").Range("J1")
The Front Header is the below which notes "Pellet Tech" in the Apply to:
This script only returns all the file names from a particular folder regardless of extension:
VBA Code:
Sub LoopThroughFiles()
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim i As Integer
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.getfolder(Worksheets("Data").Range("I1"))
For Each oFile In oFolder.Files
Worksheets("Data").Cells(i + 1, 1) = oFile.Name
i = i + 1
Next oFile
End Sub
Thanks for any help with this