呵呵,谢谢了。 我的问题,少了单引号··· 下面是楼主想要的结果吧:
Dim flds As String
For Each c As Col In Tables("绩效计划表").Cols
If C.Visible Then
flds = flds & "," & c.name
End If
Next
flds= flds.Trim(",")
Dim s,f As String
For Each r As Row In Tables("绩效计划表").Rows
s = s & r("任意一个没有空值的显示列") & "','"
Next
s = "'" & s.trim("'").trim(",")
f = "任意一个没有空值的显示列 " & "In" & " (" & "" & s & "" & ")"
Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "Excel文件|*.xls" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ex As New Exporter
ex.SourceTableName = "绩效计划表" '指定导出表
ex.Filter = f
ex.FilePath = dlg.FileName '指定目标文件
ex.Format = "Excel" '导出格式为Excel
ex.Fields = flds '指定导出字段
ex.Export() '开始导出
End If