Office中国论坛/Access中国论坛
标题:
将查询内容导出到某固定表
[打印本页]
作者:
huangyz_xy
时间:
2009-3-5 15:28
标题:
将查询内容导出到某固定表
我需要将查询的内容导出到一张EXCEL表中怎么实现?如果需要连续导多个用什么代码实现?
作者:
雨农
时间:
2009-3-5 16:13
给你个代码看看,我写的
Set xlapp = CreateObject("Excel.Application")
Set xlapp = New Excel.Application
Set xlbook = xlapp.Workbooks.Add
Set xlsheet = xlbook.Worksheets(1)
xlapp.Application.ScreenUpdating = False
xlapp.Visible = True
xlapp.Application.ActiveSheet.Rows("1:1").Select
xlapp.Application.selection.Insert Shift:=xldown
xlapp.Application.ActiveSheet.Range("A1") = "SHIPPMENT TO USA " & date
xlapp.Worksheets(1).Range("A1").Select
With xlsheet
.Cells(1, 1).ColumnWidth = 3
.Cells(1, 2).ColumnWidth = 10
.Cells(1, 3).ColumnWidth = 15
.Cells(1, 4).ColumnWidth = 10
.Cells(1, 5).ColumnWidth = 10
.Cells(1, 6).ColumnWidth = 10
.Cells(1, 7).ColumnWidth = 5
.Cells(2, 1) = ""
.Cells(2, 2) = "JobLot"
.Cells(2, 3) = "Co-Loader"
.Cells(2, 4) = "P.O.L"
.Cells(2, 5) = "P.O.D"
.Cells(2, 6) = "Vel/Vovage"
.Cells(2, 7) = "ETD"
...............................
end with
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3