|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim excelApplication As Variant
Dim excelWorkbook As Variant
Dim excelSheet As Variant
Dim i As Integer
Dim Mood As String
Dim selection As Variant
On Error Goto Err1
Set excelApplication = CreateObject("Excel.Application")
Set excelWorkbook = excelApplication.Workbooks.Add
Set excelSheet = excelWorkbook.Worksheets("Sheet1")
'定义excel的列值
excelSheet.Cells(1,1).Value = "序号"
excelSheet.Cells(1,2).Value = "项目编码"
excelSheet.Cells(1,3).Value = "项目型号"
excelSheet.Cells(1,4).Value = "项目描述"
excelSheet.Cells(1,5).Value = "维护人员"
excelSheet.Cells(1,6).Value = "备注"
i = 1
Set db = session.CurrentDatabase
'获取视图
Set view = db.GetView("项目清单")
Set doc = view.GetFirstDocument
While Not(doc Is Nothing)
i = i + 1
'定义域名
excelSheet.Cells(i,1).Value = i-1
excelSheet.Cells(i,2).Value = doc.P_Code(0)
excelSheet.Cells(i,3).Value = doc.P_Name(0)
excelSheet.Cells(i,4).Value = doc.P_Desc(0)
Print "引出第" & I & "个记录成功,请稍候!"
Set doc = view.GetNextDocument(doc)
Wend
excelWorkbook.SaveAs("c:\项目清单.xls")
Msgbox "报表引出成功,请到C盘根目录下查找!",48,"提示"
excelApplication.Quit
Set excelApplication = Nothing
Exit Sub
Err1:
Msgbox "发生错误,请与管理员联系!",48,"提示"
|
|