日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

VB 實(shí)現(xiàn) 數(shù)據(jù)快速導(dǎo)入EXCEL

 靜水若深 2009-09-06
 
    新聞簡介:VB 實(shí)現(xiàn) 數(shù)據(jù)快速導(dǎo)入EXCEL
'***********************************************************************/
'* Function Name: ToExcel */
'* Input Arguments: */
'* Out Arguments : */
'* : */
'* Description : */
'* Author : by yarno QQ:84115357 */
'* Date : 2005-11-25 */
'**
        關(guān) 鍵 詞:   Excel 

VB 實(shí)現(xiàn) 數(shù)據(jù)快速導(dǎo)入EXCEL

'***********************************************************************/
'* Function Name: ToExcel */
'* Input Arguments: */
'* Out Arguments : */
'* : */
'* Description : */
'* Author : by yarno QQ:84115357 */
'* Date : 2005-11-25 */
'***********************************************************************/
Public Function ToExcel()

On Error GoTo ErrorHandler

Dim exlapp As Excel.Application
Dim exlbook As Excel.Workbook
Set exlapp = CreateObject("Excel.Application")
Set exlbook = exlapp.Workbooks.Add
exlapp.Caption = "數(shù)據(jù)正在導(dǎo)出......"
exlapp.Visible = True
exlapp.DisplayAlerts = False

Dim exlsheet As Excel.Worksheet


Set exlsheet = exlbook.Worksheets.Add

exlsheet.Activate
Set exlsheet = exlsheet
exlsheet.Name = "我導(dǎo)出的數(shù)據(jù)"


'設(shè)置列寬
exlapp.ActiveSheet.Columns(1).ColumnWidth = 10

exlapp.ActiveSheet.Columns(2).ColumnWidth = 20


StrSql = "你的SQL語句"

Set exl_rs = PubSysCn.Execute(StrSql)

exlsheet.Range("A2").CopyFromRecordset exl_rs

exl_rs.Close
Set exl_rs = Nothing


exlapp.Worksheets("sheet1").Delete
exlapp.Worksheets("sheet2").Delete
exlapp.Worksheets("sheet3").Delete
exlapp.DisplayAlerts = True
exlapp.Caption = "數(shù)據(jù)導(dǎo)出完畢!!"
exlapp.Visible = True

Set exlapp = Nothing
Set exlbook = Nothing
Set exlsheet = Nothing



Exit Function

ErrorHandler:
MsgBox "EXCEL : " & err.Number & " : " & err.Description
End Function  

If you believe an article violates your rights or the rights of others, please contact us.

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多