下午琢磨了几种代码,还是这个最简单省事(CS。 BS的没有找到合适的研究,谁有啊??)
1、把要导入的excel文件放服务器上("C:071212.xls" windows)
2、建立一个代理,代码见后。(域名啊啥的,注释里有,应该能看明白吧?兄弟?)
3、用notes客户端调用这个代理执行一边即可。
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
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
'导入excel中的记录到notes。 一行作为一个文档保存,可以指定任意表单名
Set db = session.CurrentDatabase'
Set excelApplication = CreateObject("Excel.Application")
excelApplication.Visible = True '显示EXCEL 也可以隐藏
Set excelWorkbook = excelApplication.Workbooks.open("C:071212.xls")
Set excelSheet = excelWorkbook.Worksheets("sheet1")
For x = 2 To 168 '从第二行到第168行导入NOTES
Set doc = New NotesDocument(db)
doc.Form="topicForm" '赋表单名
doc.deleted = "0" '未删除标记
doc.school = excelSheet.Cells(x,1).Value
doc.arrivedate = excelSheet.Cells(x,2).Value
doc.visitors = excelSheet.Cells(x,3).Value
doc.compere = excelSheet.Cells(x,4).Value
doc.clerk = excelSheet.Cells(x,5).Value
doc.content = excelSheet.Cells(x,6).Value
Call doc.Save(True,True)
Next
'excelApplication.quit
Set excelApplication = Nothing
End Sub

