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
导到Excel,
最新推荐文章于 2024-10-04 20:57:51 发布