共享一段Excel导入Notes的代码
2007-07-29 18:03
211 查看
Sub Click(Source As Button)
'-------------------------------------------------------------
'-- PeiQingbin Excle导入--2
'-------------------------------------------------------------
Dim ws As New NotesUIWorkspace 'workspace
Dim ss As New NotesSession 'session
Dim db As NotesDatabase 'database
Dim item As NotesItem 'notes item
Dim files As Variant 'file name
Dim schar As String 'cell content
Dim doc As NotesDocument 'notes document
Dim dc As NotesDocumentCollection 'notes documents collection
Dim excelapplication 'Excel
Dim i,j As Integer 'number counter
Dim rowcount As Integer 'rows that need operate
Set db = ss.currentdatabase
Set dc=db.UnprocessedDocuments
rowcount=dc.Count
Messagebox("您选中了" + Cstr(rowcount) + "条记录,请您准备好文件,本次操作仅导入文件中的前" + Cstr(rowcount) + "条记录。" + Chr(13)+Chr(10)+"如果文件内数据行数不足,将以空值或0添入数据库。")
files = ws.openfiledialog(False,"请选择要导入的Excel文件","Excel file/*.xls")
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 '从第二行开始读取
Set doc=dc.GetFirstDocument
While Not (doc Is Nothing)
doc.sjfypc = excelsheet.cells(i,1).value '实际发运批次
doc.fyzt = excelsheet.cells(i,2).value '发运状态
doc.jtfysj = excelsheet.cells(i,3).value '具体发运时间
doc.fy_loadmark="Excel 导入 at " + Cstr(Now())
Call doc.save(False,False) '保存
i=i+1
Set doc=dc.GetNextDocument(doc)
Wend
excelworkbook.close(False)
excelapplication.quit
Set excelapplication = Nothing
End If
End Sub
'-------------------------------------------------------------
'-- PeiQingbin Excle导入--2
'-------------------------------------------------------------
Dim ws As New NotesUIWorkspace 'workspace
Dim ss As New NotesSession 'session
Dim db As NotesDatabase 'database
Dim item As NotesItem 'notes item
Dim files As Variant 'file name
Dim schar As String 'cell content
Dim doc As NotesDocument 'notes document
Dim dc As NotesDocumentCollection 'notes documents collection
Dim excelapplication 'Excel
Dim i,j As Integer 'number counter
Dim rowcount As Integer 'rows that need operate
Set db = ss.currentdatabase
Set dc=db.UnprocessedDocuments
rowcount=dc.Count
Messagebox("您选中了" + Cstr(rowcount) + "条记录,请您准备好文件,本次操作仅导入文件中的前" + Cstr(rowcount) + "条记录。" + Chr(13)+Chr(10)+"如果文件内数据行数不足,将以空值或0添入数据库。")
files = ws.openfiledialog(False,"请选择要导入的Excel文件","Excel file/*.xls")
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 '从第二行开始读取
Set doc=dc.GetFirstDocument
While Not (doc Is Nothing)
doc.sjfypc = excelsheet.cells(i,1).value '实际发运批次
doc.fyzt = excelsheet.cells(i,2).value '发运状态
doc.jtfysj = excelsheet.cells(i,3).value '具体发运时间
doc.fy_loadmark="Excel 导入 at " + Cstr(Now())
Call doc.save(False,False) '保存
i=i+1
Set doc=dc.GetNextDocument(doc)
Wend
excelworkbook.close(False)
excelapplication.quit
Set excelapplication = Nothing
End If
End Sub
相关文章推荐
- 一段通过OLE将Notes View中的内容导入Excel的示范代码
- 如何在VB中操作EXCEL(一段代码,两个可以使用的过程)
- 实现ADO,Excel,Aceess,.NET托管代码见的相互导入导出,利用代码实现数据的相互转换
- 知识共享图文直播---(一)将数据库中的数据加载到MSFlexGrid空间中再导入Excel
- 共享一段CMPP编程时候,移动网关返回CMPP_SUBMIT_RESP消息中,解析Msg_Id字段的代码
- 使用JS代码把WEB页面的数据导入Excel,代码如下:
- C#导入导出数据到Excel的通用类代码
- NET与EXCEL的有效导入代码
- Excel 数据导入到 Access、Sql Server 中示例代码
- C#winform多个03Excel导入SQL数据库部分代码
- EXCEL导入Java代码
- PHP导入导出excel表格图片的代码和方法大全
- larave5.6 将Excel文件数据导入数据库代码实例
- 如何用VB写一段代码获得Excel文件中紀錄行的行数和列数?
- Excel数据导入Mysql数据库的实现代码
- [导入]一段显示下载进度条的下载文件代码
- Excel导入到notes中
- [学习笔记]EXCEL导入功能java代码实现
- 导入Excel到Notes的通用ScriptLibrary
- PHP导入导出Excel代码