导到Excel,

Sub Click(Source As Button)
 Dim ws As New NotesUIWorkspace
 Dim session As New notessession
 
 Dim uidoc As NotesUIDocument
 Dim doc As NotesDocument
 Dim files As Variant
 Dim v As Variant
 Dim excelApplication As Variant
 Dim excelWorkbook As Variant
 Dim excelsheet As Variant
 
 ret = Messagebox("Are you sure you want to export data to excel」ソ",4 + 32,"")
 If  ret= 7 Then
  Exit Sub
 End If
 
 files = ws.SaveFileDialog( False,"File name",, "c:/", "data.xls")
 
 Set excelApplication=CreateObject("Excel.Application")
 Set excelWorkbook = excelApplication.Workbooks.Add
 Call excelWorkbook.SaveAs(files(0))
 
 
 Set excelsheet=excelWorkbook.Sheets.add
 
 excelsheet.name="itemname"
 
 excelSheet.Cells(1,1).Value="FormName"
 excelSheet.Cells(1,2).Value="FieldName"
 excelSheet.Cells(1,3).Value="FieldType"
 excelSheet.Cells(1,4).Value="FieldSize"
 excelSheet.Cells(1,5).Value="values"
 count=2
 
 Dim db As NotesDatabase
 Dim view As notesview
 Dim vdoc As NotesDocument
 
 Set db=session.CurrentDatabase
 Set view=db.GetView("AllDoc")
 Set vdoc=view.GetFirstDocument
 While Not(vdoc Is Nothing)
  excelSheet.Cells(count,1).Value=vdoc.FormName(0)
  excelSheet.Cells(count,2).Value=vdoc.FieldName(0)
  excelSheet.Cells(count,3).Value=vdoc.FieldType(0)
  excelSheet.Cells(count,4).Value=vdoc.FieldSize(0)
  excelSheet.Cells(count,5).Value=vdoc.values(0)
  count=count+1
  Set vdoc =view.GetNextDocument(vdoc)
 Wend
 excelWorkbook.save
 excelWorkbook.close(False)
 excelApplication.Quit
 Set excelApplication=Nothing
 ret =Messagebox("The data export succeed」。",0 + 64,"S")
End Sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值