您的位置:首页 > 其它

Lotus script 打开现有文件向胡据库导入数据

2011-07-15 09:29 183 查看
参考 

Sub   Click(Source   As   Button)

Dim   ws   As   New   notesuiworkspace 
Dim   ss   As   New   notessession 
Dim   db   As   notesdatabase 
Dim   item   As   notesitem 
Dim   files   As   Variant 
Dim   schar   As   String 
Dim   doc   As   NotesDocument 
Dim   cpdoc   As   NotesDocument 
Dim   excelapplication 
Dim   i,sheet 

Set   db   =   ss.currentdatabase 
files   =   ws.openfiledialog(False, "请选择要导入的Excel文件 ", "Excel   file/*.xls ") 
If   Not(Isempty(files))   Then 
Set   excelapplication   =   createobject( "excel.application ") 
Set   excelworkbook   =   excelapplication.workbooks.open(files) 

Set   excelsheet   =   excelworkbook.worksheets(1) 
i   =   2 

Do   Until   Cstr(excelsheet.cells(i,1).value)   = " " 
Set   cpdoc   =   New   notesdocument(db) 

cpdoc.NumberID   =   excelsheet.cells(i,1).value 
cpdoc.company   =   excelsheet.cells(i,2).value 

i   =   i+1

Loop 

excelworkbook.close(False) 
excelapplication.quit 
Set   excelapplication   =   Nothing 

End   If 

End   Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  lotus excel button