C
Code Numpty
I have the following vb script that uses the Excel object to search for files
containing a certain part number. I would like the search results to appear
in a new Excel workbook but if there is more than one file address returned I
only get one in the workbook.
--------------------------------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
dim partnum
partnum = Inputbox("Enter Part Number")
MsgBox(partnum)
Set objSearch = objExcel.FileSearch
objSearch.Lookin = "D:\"
objSearch.SearchSubfolders = TRUE
objSearch.FileName = "*.xls"
objSearch.TextOrProperty = partnum
objSearch.Execute
For Each strFile in objSearch.FoundFiles
objExcel.Cells(1, 1).Value = (strfile)
Next
MsgBox "Search Complete"
containing a certain part number. I would like the search results to appear
in a new Excel workbook but if there is more than one file address returned I
only get one in the workbook.
--------------------------------------------------------------------------------
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
dim partnum
partnum = Inputbox("Enter Part Number")
MsgBox(partnum)
Set objSearch = objExcel.FileSearch
objSearch.Lookin = "D:\"
objSearch.SearchSubfolders = TRUE
objSearch.FileName = "*.xls"
objSearch.TextOrProperty = partnum
objSearch.Execute
For Each strFile in objSearch.FoundFiles
objExcel.Cells(1, 1).Value = (strfile)
Next
MsgBox "Search Complete"