VB中使用EXCEL输出[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 mi6236 的 blog

                xlsheet.range(xlsheet.cells(23 + (countpage - 1) * 18, 1), xlsheet.cells(i, 10)).borders.linestyle = xlcontinuous '中间页加边框
            end if
            i = i + 2 '加一条空行
       
            '******************************在非尾页写入签名**************************************
            xlsheet.range(xlsheet.cells(i, 1), xlsheet.cells(i, 10)).mergecells = true
            xlsheet.cells(i, 1).value = space(64) & rst_qm.fields(0)
            xlsheet.rows(i).rowheight = 30
            i = i + 1 '换行
            xlsheet.range(xlsheet.cells(i, 1), xlsheet.cells(i, 10)).mergecells = true
            xlsheet.cells(i, 1).value = space(50) & rst_qm.fields(1)
            xlsheet.rows(i).rowheight = 15
            i = i + 1
            xlsheet.range(xlsheet.cells(i, 1), xlsheet.cells(i, 10)).mergecells = true
            xlsheet.cells(i, 1).value = space(55) & rst_qm.fields(2)
            xlsheet.rows(i).rowheight = 30
            '****************************************************************************
           
            xlsheet.hpagebreaks.add (xlsheet.rows(i + 1)) '添加分页符
            countpage = countpage + 1 '换页
        end if
        i = i + 1
        rst_gcl.movenext
    loop
        xlsheet.range(xlsheet.cells(23 + (countpage - 1) * 18, 1), xlsheet.cells(i - 1, 10)).borders.linestyle = xlcontinuous '尾页加边框
        i = i + 1 '加入一空行
        '*********************************在尾页加签名***************************************
        xlsheet.range(xlsheet.cells(i, 1), xlsheet.cells(i, 10)).mergecells = true
        xlsheet.cells(i, 1).value = space(64) & rst_qm.fields(0)
        xlsheet.rows(i).rowheight = 30
        i = i + 1 '换行
        xlsheet.range(xlsheet.cells(i, 1), xlsheet.cells(i, 10)).mergecells = true
        xlsheet.cells(i, 1).value = space(50) & rst_qm.fields(1)
        xlsheet.rows(i).rowheight = 15
        i = i + 1
        xlsheet.range(xlsheet.cells(i, 1), xlsheet.cells(i, 10)).mergecells = true
        xlsheet.cells(i, 1).value = space(55) & rst_qm.fields(2)
        xlsheet.rows(i).rowheight = 30
        '***********************************************************************************
        xls.activewindow.view = xlpagebreakpreview '分页预览
        xls.activewindow.zoom = 100
   
    if con.state = adstateopen then
        rst_gcl.close
        rst_qm.close
        set rst_gcl = nothing
        set rst_qm = nothing
        con.close
        set con = nothing
    end if
    set xlsheet = nothing
end sub

 

option explicit

public sub toexceltsf(byref xlbook, byref xls)
    dim con as new adodb.connection
    dim rst_tsf as new adodb.recordset
    dim rst_qm as new adodb.recordset

本文关键:VB中使用EXCEL输出
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top