Excel导入到notes中

来源:互联网 发布:淘宝寄快递怎么算钱 编辑:程序博客网 时间:2024/05/24 16:16
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
原创粉丝点击