Sub Initialize '导入员工信息数据,并创建PBC 'By YBq '20080606 'Msgbox "begin execute the agent..." Dim ws As New NotesUIWorkspace 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 Set db = session.CurrentDatabase '新增 Set excelApplication = CreateObject("Excel.Application") excelApplication.Visible = True '显示EXCEL Set excelWorkbook = excelApplication.Workbooks.open("D:/test/TestImportData.xls") Set excelSheet = excelWorkbook.Worksheets("ImportData") i=3 stemp=excelSheet.Cells(i,1).value Do Until Cstr(stemp)="" ' Msgbox "stemp not empty" Set doc = New NotesDocument(db) doc.Form="FPBC" '赋表单名 doc.StaffName = excelSheet.Cells(i,1).Value doc.StaffID = excelSheet.Cells(i,2).Value doc.StaffNotesID = excelSheet.Cells(i,3).Value doc.PositionName = excelSheet.Cells(i,4).Value doc.BUFU = excelSheet.Cells(i,5).Value doc.PLFU = excelSheet.Cells(i,6).Value doc.Dept = excelSheet.Cells(i,7).Value '导入后的文档状态都置为草稿 doc.WFStatus = "0" Call doc.Save(True,True) i = i+1 '计数器加1 stemp = excelSheet.Cells(i,1).Value '修改循环条件的值,防止死循环 Loop Call ws.viewrefresh excelApplication.quit Set excelApplication = Nothing End Sub
Excel导入到notes中
最新推荐文章于 2024-06-18 13:33:56 发布
本文介绍了一段使用VBA从Excel导入员工信息至Notes数据库的代码实现过程。该过程涉及Excel应用程序操作、读取指定工作表数据及在Notes中创建相应文档等内容。
3942

被折叠的 条评论
为什么被折叠?



