Excel导入到notes中

本文介绍了一段使用VBA从Excel导入员工信息至Notes数据库的代码实现过程。该过程涉及Excel应用程序操作、读取指定工作表数据及在Notes中创建相应文档等内容。
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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值