I have a 2 Dim array from an excel file with 3 columns. The first column is ID, next is lastname, the 3rd is firstname.
I already put all the data in a 2 dim array where Array(NumberOfRowsInExcel,
1-3). 1 for the ID, 2 for the lastname and 3 for the firstname col in excel.
Now I have several folders and directories with document files that has this filenaming format.
The # represents any random number.
Now what i want to do is crawl all docs in a folder then parse the firstname and lastname from the filename then compare that to the 2 dim array. If there is a perfect match, rename the file appending the Array(x,1) value or the ID column in excel to that doc file.
Example: There is a match in the array. Append it to the very start of the filename then add underscore something like this.
If there's no match on the array, move it to a folder named "unmatched".
Above example lets say Bryan Adams has been parsed from the filename.
Let x = counter.
If Array(x, 2) = Adams and Array(x,3) = Bryan then
Name "path\filename.doc" as "path\" & array(x,1) & "_" & "filename.doc"
filecopy to unmatched folder
Basically that's what i want to do. Can somebody help me out patch things right? I haven't done any programming in VB6 for a year. Thanks.
By the way, this is my code to to extract the data from excel and put it in an array just in case.
Set xlApp = New Excel.Application
Set xlWbk = xlApp.Workbooks.Open("C:\EMR\drv_patient_list.xls")
Set xlWks = xlWbk.Sheets(1)
arv = xlWks.Range("A1:H" & xlWks.UsedRange.Rows.Count).Value
lngRowCount = LastRowInSheet(xlWks)
ReDim arrData(1 To lngRowCount, 1 To 3)
For i = 2 To lngRowCount
For j = 1 To 3
arrData(i, j) = xlWks.Cells(i, j).Value