I hope someone can help me with this.
I am opening an excel object using the:
_XlApp = GetObject(, "excel.Application")
syntax. Excel, itself, is being called from a browser control.
I have tried microsofts suggestion
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B317109 to
no avail.
If anyone knows of anyway to terminate the excel process under these
circumstances, please help.
Thank You,
Anthony Terra
Senior Software Engineer
¤ I hope someone can help me with this.
¤
¤ I am opening an excel object using the:
¤ _XlApp = GetObject(, "excel.Application")
¤ syntax. Excel, itself, is being called from a browser control.
¤
¤ I have tried microsofts suggestion
¤ http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B317109 to
¤ no avail.
¤
¤ If anyone knows of anyway to terminate the excel process under these
¤ circumstances, please help.
Are you creating any implicit Excel objects? This usually occurs when you create a new application
object but don't set it to an object variable so that it can be destroyed.
You may want to post a bit more code so we can see what you are doing.
Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
I am having a similar problem. Here is my code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Put user code to initialize the page here
' Excel stuff
' Resist the temptation to use an Office 10 reference; webserver6
has Excel 5!
Dim obExcelApp As Object
Dim obWorkBook As Object
Dim obWorkBooks As Object
Dim obWorkSheets As Object
Dim obWorkSheet As Object
Dim inRow As Short
Dim strRangeLast, strRangeFirst, strRangeDate, strRangeMethod
<snip>
' Open the file
Try
obExcelApp = Interaction.CreateObject("Excel.Application")
Try
obWorkBooks = obExcelApp.Workbooks
obWorkBook = obWorkBooks.Open("M:\Travel\blah.xls")
obWorkSheets = obWorkBook.worksheets
obWorkSheet = obWorksheets.Item("blah")
Dim bDone As Boolean = False
For inRow = 3 To 99
<snip>
Next
If Not bDone Then
txtStatus.Text += "File is too large!" & vbCrLf
End If
obWorkBook.Close()
Catch ex As Exception
txtStatus.Text += "Can't open file!" & vbCrLf
txtStatus.Text += ex.Message & vbCrLf
End Try
NAR(obWorkSheet)
NAR(obWorkSheets)
NAR(obWorkBook)
NAR(obWorkBooks)
obExcelApp.quit()
Catch ex As Exception
txtStatus.Text += "Can't start Excel!" & vbCrLf
txtStatus.Text += ex.Message & vbCrLf
End Try
NAR(obExcelApp)
GC.Collect()
End Sub
' COM object destroyer - see KB317109
Private Sub NAR(ByVal o As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(o)
Catch
Finally
o = Nothing
End Try
End Sub
> I hope someone can help me with this.
>
[quoted text clipped - 14 lines]
>
> Senior Software Engineer
John Murray - 08 Apr 2004 23:58 GMT
May not work, but I have had some luck with this, add the following:
GC.WaitForPendingFinalizers();
after your call to GC.Collect()
"Gavin Jacobs" <notachance@inhell.net> wrote in news:eyVv7taHEHA.828
@TK2MSFTNGP12.phx.gbl:
> I am having a similar problem. Here is my code:
<snip>
> NAR(obExcelApp)
> GC.Collect()
> End Sub
<snip
Santhosh Pillai [MS] - 09 Apr 2004 07:19 GMT
This code works for me from a VB.NET application.
You should keep in mind that Microsoft does not recommend or support
server-side Automation of Office.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;257757
> I am having a similar problem. Here is my code:
>
[quoted text clipped - 73 lines]
> >
> > Senior Software Engineer