用Vb调用Excel,经常出现Excel错误,如何处理

用Vb调用Excel,经常出现Excel异常,如何避免
如题

------解决方案--------------------
什么异常?连问题都不愿意说明么
------解决方案--------------------
程序加断点,分段执行,先把错误范围缩小,再排查

------解决方案--------------------
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

------解决方案--------------------
Private objSheet As Worksheet 'Object Reference to Excel Worksheet
Private objExcel As Excel.Application 'Excel Instance

Private Sub Form1_Terminate()
' Free up memory before we go...
Screen.MousePointer = vbDefault

Set objSheet = Nothing
Set objExcel = Nothing
Set Form1= Nothing

End Sub
------解决方案--------------------
Private objSheet As Worksheet 'Object Reference to Excel Worksheet
Private objExcel As Excel.Application 'Excel Instance

Private Sub Form_Terminate()
Me.Hide

' Free up memory before we quit...
Screen.MousePointer = vbDefault

Set objSheet = Nothing
Set objExcel = Nothing
Set frmTest= Nothing
End
End Sub

Private 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

------解决方案--------------------
学习...
------解决方案--------------------
ExcelBook.close(true)
ExcelApp.quit
set ExcelApp=nothing
------解决方案--------------------
学习
------解决方案--------------------
qinglangee(礳矶)

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

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