试试这样
Dim dlg As New FolderBrowserDialog
If dlg.ShowDialog = DialogResult.Ok Then
For Each c As String In DataTables("学生信息").GetValues("班级")
Dim ex As new Exporter
ex.SourceTableName = "学生信息"
ex.FilePath = dlg.SelectedPath & "\" & c & "\基本信息核对表.xlsx"
ex.Format = "Excel2007"
ex.Fields ="班级,学生姓名,身份证件号"
ex.filter = "班级 = '" & c & "'"
If filesys.fileexists(ex.filepath) Then
filesys.deletefile(ex.filepath)
End If
ex.Export()
Next
End If