lotus notes库中数据导出到excel中

来源:互联网 发布:元组python 编辑:程序博客网 时间:2024/05/22 08:03

 关于lotus notes数据库和excel中数据交互的问题,今天把导出到excel中的方法写下来。

 '导出excel
 Dim excelApplication As Variant
 Dim excelWorkbook As Variant
 Dim excelSheet As Variant
 
 Set excelApplication = CreateObject("Excel.Application")
 'Set excelWorkbook = excelApplication.Workbooks.Open(filepath)
 Set excelWorkbook = excelApplication.Workbooks.Add
 Set excelSheet = excelWorkbook.Worksheets(1)
 
 '第一行
 excelSheet.Range("A1:K1").MergeCells = True
 excelSheet.Range("A1:K1").Font.Name = "宋体"     '字体
 excelSheet.Range("A1:K1").Font.Size = "12"       '大小
 excelSheet.Range("A1:K1").HorizontalAlignment = -4108    '居中
 excelSheet.Range("A1:K1").VerticalAlignment = -4108      '居中 
 excelSheet.Range("A1:K1").Value = "员工调查意见汇总报表"
 
 '定义第二行开始的格式
 excelSheet.Range("A2:A13").Font.Name = "宋体"     '字体
 excelSheet.Range("A2:A13").Font.Size = "10"       '大小
 excelSheet.Range("B2:K13").Font.Name = "宋体"     '字体
 excelSheet.Range("B2:K13").Font.Size = "10"       '大小
 excelSheet.Range("B2:K13").HorizontalAlignment = -4108    '居中
 excelSheet.Range("B2:K13").VerticalAlignment = -4108      '居中 
 '第二行
 'excelSheet.Range("A2").Value = "员工调查意见汇总报表"
 excelSheet.Cells(2,2).Value = "问卷发送总数"
 excelSheet.Cells(2,3).Value = "问卷回收总数"
 excelSheet.Cells(2,4).Value = "非常满意"
 excelSheet.Cells(2,5).Value = "满意"
 excelSheet.Cells(2,6).Value = "中立"
 excelSheet.Cells(2,7).Value = "部分不满意"
 excelSheet.Cells(2,8).Value = "不满意"
 excelSheet.Cells(2,9).Value = "没有指定"
 excelSheet.Cells(2,10).Value = "不适用"

 excelapplication.workbooks(1).SaveAs(filepath) 
 excelapplication.workbooks.close

 

原创粉丝点击