5,889
社区成员
发帖
与我相关
我的任务
分享
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace 'workspace
Dim ss As New NotesSession 'session
Dim db As NotesDatabase 'database
Dim files As Variant 'file name
Dim schar As String 'cell content
Dim doc As NotesDocument 'notes document
Dim excelapplication
Dim i,sheet
Set db = ss.currentdatabase
files = ws.openfiledialog(False,"URLDB","Excel file/*.xls")
sheet = 1
If Not(Isempty(files)) Then
Set excelapplication = createobject("excel.application")
Set excelworkbook = excelapplication.workbooks.open(files)
If excelworkbook Is Nothing Then
excelapplication.quit
Exit Sub
End If
Set excelsheet = excelworkbook.worksheets(1)
i = 2
Do Until Cstr(excelsheet.cells(i,1).value) =""
Set doc = New NotesDocument(db)
doc.Form = "MainForm"
doc.EPNo = excelsheet.cells(i,1).value
doc.TopDepart = excelsheet.cells(i,2).value
doc.DeDepart = excelsheet.cells(i,3).value
doc.Depart = excelsheet.cells(i,4).value
doc.ChineseName = excelsheet.cells(i,5).value
Call doc.save(False,False)
i=i+1
Loop
excelworkbook.close(False)
excelapplication.quit
Set excelapplication = Nothing
End If
End Sub