你做一个按钮,然后运行代码。
Dim dlg As New FolderBrowserDialog
If dlg.ShowDialog = DialogResult.Ok Then
For Each file As String In FileSys.GetFiles(dlg.SelectedPath)
Dim fullname As String = FileSys.GetName(file)
Dim ext As String = fullname.Substring(fullname.IndexOf("."))
Dim name As String = left(fullname, 5)
Dim fdr = DataTables("表A").Find("款号 = '" & Name & "'")
If fdr IsNot Nothing Then
Select Case ext
Case ".jpg"
fdr("照片") &= fullname & vbcrlf
FileSys.CopyFile(file, DataTables("表A").DataCols("照片").DefaultFolder & "\" & fullname, True)
Case ".xls", ".xlsx"
fdr("资料") &= fullname & vbcrlf
FileSys.CopyFile(file, DataTables("表A").DataCols("资料").DefaultFolder & "\" & fullname, True)
End Select
End If
Next
End If
[此贴子已经被作者于2013-1-9 18:12:39编辑过]