VB 实现 数据快速导入EXCEL
来源:百度文库 编辑:神马文学网 时间:2024/04/28 02:11:25
新闻简介:VB 实现 数据快速导入EXCEL
'***********************************************************************/
'* Function Name: ToExcel */
'* Input Arguments: */
'* Out Arguments : */
'* : */
'* Description : */
'* Author : by yarno QQ:84115357 */
'* Date : 2005-11-25 */
'**
关 键 词: Excel
VB 实现 数据快速导入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 = "数据正在导出......"
exlapp.Visible = True
exlapp.DisplayAlerts = False
Dim exlsheet As Excel.Worksheet
Set exlsheet = exlbook.Worksheets.Add
exlsheet.Activate
Set exlsheet = exlsheet
exlsheet.Name = "我导出的数据"
'设置列宽
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 = "数据导出完毕!!"
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, pleasecontact us.
'***********************************************************************/
'* Function Name: ToExcel */
'* Input Arguments: */
'* Out Arguments : */
'* : */
'* Description : */
'* Author : by yarno QQ:84115357 */
'* Date : 2005-11-25 */
'**
关 键 词: Excel
VB 实现 数据快速导入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 = "数据正在导出......"
exlapp.Visible = True
exlapp.DisplayAlerts = False
Dim exlsheet As Excel.Worksheet
Set exlsheet = exlbook.Worksheets.Add
exlsheet.Activate
Set exlsheet = exlsheet
exlsheet.Name = "我导出的数据"
'设置列宽
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 = "数据导出完毕!!"
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, pleasecontact us.
VB 实现 数据快速导入EXCEL
VB 实现 数据快速导入EXCEL
VB 实现数据快速导入EXCEL - 软件开发网 - 提供编程开发资料的编程网
asp代码实现EXCEL数据导入到
excel导入VB
asp代码实现EXCEL数据导入到SQL数据库
将excel数据导入oracle中- -
将excel数据导入oracle中- -
用Excel记录单实现快速录入表格数据的方法 - excel综合问题 - Excel精英在...
在VB中把EXCEL文件导入MSFLEXGRID 之二
Excel中快速数据(图)
Excel 数据导入到 Access、Sql Server 中示例代码
从MySQL导入导出大量数据的程序实现方法
从MySQL导入导出大量数据的程序实现方法
探讨通过VB向EXCEL传输数据的方法--
EXCEL大量数据快速录入技巧
用C#快速往Excel写数据
EXCEL大量数据快速录入技巧1
EXCEL大量数据快速录入技巧2
EXCEL大量数据快速录入技巧(1)
EXCEL大量数据快速录入技巧
EXCEL大量数据快速录入技巧
EXCEL大量数据快速录入技巧+
如何实现VB与EXCEL的无缝连接