Set xlQuery = xlSheet.QueryTables.Add(rs, xlSheet.Range("A2"))
With xlQuery
.FieldNames = False
.AdjustColumnWidth = False
.Refresh
.Delete
End With
rs.Close
Set rs = Nothing
xlBook.Save
xlApp.DisplayAlerts = True
xlApp.WindowState = xlMinimized
xlApp.WindowState = xlMaximized
xlApp.Application.Visible = True
Set xlQuery = Nothing
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
复制代码
[attach]61961[/attach]作者: ejihua 时间: 2017-9-10 20:28
版主,多谢回复,提示找不出工程或库,Dim xlApp As New Excel.Application
另外,以前的代码不能修改使用吗?另一个表还想导出Excel固定格式。作者: Henry D. Sy 时间: 2017-9-10 21:23