Dim dlg As New SaveFileDialog '定一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xls" '设置筛选器
Dim ss As String
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
ss = dlg.FileName
If FileSys.FileExists("& ss &") = True Then
FileSys.DeleteFile("& ss &",2,2) '则彻底删
End If
Dim cn As String
For Each cl As Col In Tables("S运输合同查询_Table1").Cols
Dim p As String = cl.Name
If Tables("S运输合同查询_Table1").Cols(p).Visible Then
cn = cn & p & ","
End If
Next
cn = cn.TrimEnd(",","")
Dim ex As New Exporter
ex.SourceTableName = "S运输合同查询_Table1" '指定导出表
ex.FilePath = ss '指定目标文件
ex.Format = "Excel" '导出格式为Excel
ex.Fields = cn '指定导出字段
ex.Export() '开始导出
End If

此主题相关图片如下:未命名.jpg