Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I m new to Excel Programming, I was trying to Release the Range Object that I got using the below code, Excel.Range oRange; //Decl oRange = (Excel.Range)m_oWorkSheet.Cells.Find(strSearchFor, m_oWorkSheet.Cells[nHeaderRow, iter], Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlWhole, m_objOpt, Excel.XlSearchDirection.xlNext, false, m_objOpt, m_objOpt); //Get Range Object Marshal.ReleaseComObject(oRange); //Release Range Object My Problem is when I get Range Object in the above specified way Excel Instance keep running afte releasing other COM Object. If I get it using below specified way Excel Instance is killed at the end. "oRange.get_Range(strStartRng, strStartRng)" Is there any other way to release the Range Object? Thanks in Advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Within Excel, the range is releaseable if it set to Nothing:
Sub dural() Dim r As Range Set r = Range("A1") MsgBox (r.Address) Set r = Nothing End Sub -- Gary''s Student - gsnu200825 "Kart" wrote: Hello, I m new to Excel Programming, I was trying to Release the Range Object that I got using the below code, Excel.Range oRange; //Decl oRange = (Excel.Range)m_oWorkSheet.Cells.Find(strSearchFor, m_oWorkSheet.Cells[nHeaderRow, iter], Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlWhole, m_objOpt, Excel.XlSearchDirection.xlNext, false, m_objOpt, m_objOpt); //Get Range Object Marshal.ReleaseComObject(oRange); //Release Range Object My Problem is when I get Range Object in the above specified way Excel Instance keep running afte releasing other COM Object. If I get it using below specified way Excel Instance is killed at the end. "oRange.get_Range(strStartRng, strStartRng)" Is there any other way to release the Range Object? Thanks in Advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Releasing Outlook | Excel Programming | |||
Releasing reference to the Application object before exiting | Excel Programming | |||
Releasing arrays? | Excel Discussion (Misc queries) | |||
returning pivottable object from a range object | Excel Programming | |||
Range object to Array object conversion | Excel Programming |