word对象的释放?
xjbx 博客专家认证 2003-08-06 11:11:12 c/s 方式,批量拆离“word对象”,但没法释放对象,在进程中有很多的“word”。我用set ...=nothing没法实现,导致最后系统资源耗尽。请高手指点,谢谢。
我的代码如下:
On Error Goto errnum
Dim Session As New NotesSession
Dim cdb As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
'包含对象的RTF 域
Dim item As Variant
' OLE控件句柄
Dim handle As Variant
Dim i As Integer
i=0
'在数据库中查找指定的文档
Set cdb=session.CurrentDatabase
Set view=cdb.GetView("ByTimeFWback")
Set doc = view.GetFirstDocument
While Not(doc Is Nothing)
Forall o In doc.EmbeddedObjects
Set handle=o.Activate(false)
If ( Not handle Is Nothing ) Then
handle.Saveas("d:\doc\"+doc.UniversalID+".doc")
i=i+1
Set handle= Nothing
End If
End Forall
Set doc = view.GetNextDocument(doc)
Wend
Msgbox "共计转换" +Cstr(i)+ "条记录"
errnum:
Msgbox "错误是:"+Error$+"在"+Cstr(Erl())+"行"