我的成功例子,与大家分享: GC.Collect() Dim word_app As Word._Application = Nothing Dim word_doc As Word._Document = Nothing Dim ex As Exception Try word_app = New Word.Application() Catch ex Response.Write(ex.Message) End Try Dim docs As Word.Documents = word_app.Documents word_app.Visible = True word_doc = docs.Open(file) //file为要操作的文件 word_doc.Activate() ......... //中间代码 docs.Close() word_app.Quit() word_app = Nothing GC.Collect()
doc = nothing
app = nothing
之类的
GC.Collect()
Dim word_app As Word._Application = Nothing
Dim word_doc As Word._Document = Nothing
Dim ex As Exception
Try
word_app = New Word.Application()
Catch ex
Response.Write(ex.Message)
End Try
Dim docs As Word.Documents = word_app.Documents
word_app.Visible = True
word_doc = docs.Open(file) //file为要操作的文件
word_doc.Activate() ......... //中间代码
docs.Close()
word_app.Quit()
word_app = Nothing
GC.Collect()