急 急...生成word时出现"该文件正在由另一程序在使用" 请问如何解决??

解决方案 »

  1.   

    Dim WordApp As Microsoft.Office.Interop.Word.Application
    Dim WordDoc As Microsoft.Office.Interop.Word.DocumentTry
        WordApp = New Microsoft.Office.Interop.Word.ApplicationClass
        WordDoc = WordApp.Documents.Add    WordDoc.Paragraphs.Last.Range.Text = "test data"    WordApp.Visible = False
        WordApp.PrintPreview = False    WordDoc.SaveAs(Server.MapPath(strPath))Catch ex As Exception
        ret = ex.MessageFinally
        If Not WordDoc Is Nothing Then
            WordDoc.Close()
        End If    If Not WordApp Is Nothing Then
            WordApp.Quit()
        End If    GC.Collect()
    End Try
      

  2.   

    对,你看下后台的进程,应该是有winword,生成该word文件后你没有关闭该进程