从文档中分离excel附件到磁盘,再打开该xls文件

来源:互联网 发布:淘宝gxg官方店和旗舰店 编辑:程序博客网 时间:2024/05/29 23:22

 Dim   s   As   New   notessession
 Dim db As notesdatabase
 Dim view As NotesView
 Dim   doc   As   NotesDocument
 Dim neo As NotesEmbeddedObject
 Dim temVar As Variant
 Dim rtitem As NotesRichTextItem
 
 'Dim tempNeo As NotesEmbeddedObject
 
 Set db = s.CurrentDatabase
 Set view = db.GetView("dywdgl(bytime)")
 Set doc = view.GetFirstDocument
 
 If doc.HasEmbedded Then
  Msgbox("有附件")
 End If
 
 Set   rtitem   =   doc.GetFirstItem(   "zhengwen"   ) 


 Forall   o   In   rtitem.EmbeddedObjects 
  '把附件拆出来
  Call o.ExtractFile("d:\Lotus\Domino\Data\"+o.Name)
 End   Forall

 Set   excelapplication   =   CreateObject ( "Excel.Application")
 Set   excelworkbook   =   excelapplication.Workbooks.Open ("d:\123.xls")
 Messagebox ("已经打开xls文件")
 excelworkbook.close(False)
 excelapplication.quit
 Set excelapplication=Nothing