xlsheet.cells(i, 6).value = rst_tsf.fields("anchai")
xlsheet.cells(i, 7).value = rst_tsf.fields("rengong")
xlsheet.cells(i, 8).value = rst_tsf.fields("dongli")
xlsheet.cells(i, 9).value = rst_tsf.fields("qita")
if i > 22 then
xls.activewindow.smallscroll down:=1 '活动窗口内容向下滚动1行
end if
i = i + 1
rst_tsf.movenext
loop
xlsheet.range(xlsheet.cells(6, 3), xlsheet.cells(i - 1, 9)).numberformatlocal = "0.00_ " '保留两位小数
'*********************************添加边框**********************************
xlsheet.range(xlsheet.cells(3, 1), xlsheet.cells(i - 1, 9)).borders.linestyle = xlcontinuous
'******************************************************************************
xls.activesheet.pagesetup.bottommargin = application.inchestopoints(2.2) '设置下侧面边距
xls.activesheet.pagesetup.footermargin = application.inchestopoints(1) '设置页脚高
xls.activesheet.pagesetup.centerfooter = "&10" & rst_qm.fields(0) & chr(10) & chr(10) & rst_qm.fields(1) & chr(10) & chr(10) & rst_qm.fields(2) '加页脚
xls.activewindow.view = xlpagebreakpreview '分页预览
xls.activewindow.zoom = 100
'***************************关闭记录集*******************
if con.state = adstateopen then
rst_tsf.close
rst_qm.close
set rst_tsf = nothing
set rst_qm = nothing
con.close
set con = nothing
end if
set xlsheet = nothing
end sub