如题

解决方案 »

  1.   

    是一个对话框,内容如下:
    Excel.exe已经产生错误,将被Windows关闭。您将需要重新启动程式。已经建立错误日志。用VBA也经常这样。主要是在关闭Excel的程序时会有这个提示。
      

  2.   

    找到原因了,用excel.quit后,仍然还有Excel.exe进程在系统中
    谁能说一下怎样强行中止进程了
    用sendmessage好像也不行,还是我不会用
      

  3.   

    你是生成一个worksheet还是一个workbook?
      

  4.   

    你是生成一个worksheet还是一个workbook?
    我是要退出程序,运行没问题,但是用application.quit之后,还是有Excel进程在任务栏内,不知如何处理
      

  5.   

    Private Sub Class_Terminate()
        
        Set m_oWorkSheet = Nothing
        Set m_oChart = Nothing
        Set m_oWorkBook = Nothing
        
        
        
        If m_bVisible Then
            m_oExcelApp.Visible = True
        Else
            m_oExcelApp.Quit
            Set m_oExcelApp = Nothing
        End If
    End Sub
      

  6.   

    If m_bVisible Then
            m_oExcelApp.Visible = True
        Else
            m_oExcelApp.Quit
            Set m_oExcelApp = Nothing
        End If执行Quit之后在进程管理器中可以看到进程依然存在
      

  7.   

    Private objSheet     As Worksheet    'Object Reference to Excel Worksheet
    Private objExcel     As Excel.Application    'Excel InstancePrivate Sub Form1_Terminate()
        '   Free up memory before we go...
        Screen.MousePointer = vbDefault
        
        Set objSheet = Nothing
        Set objExcel = Nothing
        Set Form1= NothingEnd Sub
      

  8.   

    Private objSheet As Worksheet 'Object Reference to Excel Worksheet
    Private objExcel As Excel.Application 'Excel InstancePrivate Sub Form_Terminate()
    Me.Hide
        
    ' Free up memory before we quit...
    Screen.MousePointer = vbDefaultSet objSheet = Nothing
    Set objExcel = Nothing
    Set frmTest= Nothing
        End
    End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        '   Going somewhere or Close?
        If MsgBox("Close the Example Form?", vbYesNo, "VB Excel Example") = vbYes Then
            Cancel = 0
            Form_Terminate
        Else
            Cancel = 1
        End If
    End Sub
      

  9.   

    ExcelBook.close(true)
    ExcelApp.quit
    set ExcelApp=nothing
      

  10.   

    qinglangee(礳矶)ExcelBook.close(true)
    ExcelApp.quit
    set ExcelApp=nothing同意。
    没有vb环境了,没有验证,记得是这样。
      

  11.   

    我曾经遇到过类似的问题, 这个问题在于Excel的quit方法是异步的, 意思是说如果你调用了quit方法之后,其实excel也许并没有退出。你最好在程序中强行发送一个退出的消息给excel,让excel进程退出。