PC Review


Reply
Thread Tools Rate Thread

Where to ask- running Excel from .NET?

 
 
JustMe
Guest
Posts: n/a
 
      23rd Mar 2010
Hi all,

I have been over at the MSDN forums and someone pointed me here.

I am trying to create an instance of Excel from within .NET so I can
populate it with some data and save it. All works fine. However, after I
tell excel to quit (which it appears to do), if I go into task manager, I can
see it is still running. And if I do the process again, I get 2 copies of
Excel in task manager. This is with Excel 2007 and Win XP.

I have tried a bunch of things, none of which have worked.

One possibility is that I work in at a defense contractor and it might be
that they have some policy or other behind the scene add on that might be
keeping Excel from exiting properly.

Anyway, I am hoping that there is a forum here where someone might have some
ideas as to what might be keeping Excel from completely closing as it should.
If so, could you point me in the correct direction?

Yes, I can provide much more details once I find the appropriate place to
discuss it.

Thank you,

JustMe

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      23rd Mar 2010
I'm not sure if this is still a problem under NET, but under native
COM, Excel would remain running if there was any reference to it that
was not specifically set to Nothing (VB, null in C++). Try tearing
down any reference type variables to Nothing and see if this helps.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Tue, 23 Mar 2010 12:07:01 -0700, JustMe
<(E-Mail Removed)> wrote:

>Hi all,
>
>I have been over at the MSDN forums and someone pointed me here.
>
>I am trying to create an instance of Excel from within .NET so I can
>populate it with some data and save it. All works fine. However, after I
>tell excel to quit (which it appears to do), if I go into task manager, I can
>see it is still running. And if I do the process again, I get 2 copies of
>Excel in task manager. This is with Excel 2007 and Win XP.
>
>I have tried a bunch of things, none of which have worked.
>
>One possibility is that I work in at a defense contractor and it might be
>that they have some policy or other behind the scene add on that might be
>keeping Excel from exiting properly.
>
>Anyway, I am hoping that there is a forum here where someone might have some
>ideas as to what might be keeping Excel from completely closing as it should.
> If so, could you point me in the correct direction?
>
>Yes, I can provide much more details once I find the appropriate place to
>discuss it.
>
>Thank you,
>
>JustMe

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      23rd Mar 2010
The difficulty of releasing Excel in .Net seems to crop up regularly (not
that I know much about it!)

See
System.Runtime.InteropServices.Marshal.ReleaseComObject
and
GC.Collect()
in this article
http://support.microsoft.com/kb/317109

Typically ReleaseComObject is wrapped up in a function, plenty of examples
'out there'

Regards,
Peter T

PS I like the conspiracy theory though!


"JustMe" <(E-Mail Removed)> wrote in message
news:058FE52E-0053-419D-ACE3-(E-Mail Removed)...
> Hi all,
>
> I have been over at the MSDN forums and someone pointed me here.
>
> I am trying to create an instance of Excel from within .NET so I can
> populate it with some data and save it. All works fine. However, after I
> tell excel to quit (which it appears to do), if I go into task manager, I
> can
> see it is still running. And if I do the process again, I get 2 copies of
> Excel in task manager. This is with Excel 2007 and Win XP.
>
> I have tried a bunch of things, none of which have worked.
>
> One possibility is that I work in at a defense contractor and it might be
> that they have some policy or other behind the scene add on that might be
> keeping Excel from exiting properly.
>
> Anyway, I am hoping that there is a forum here where someone might have
> some
> ideas as to what might be keeping Excel from completely closing as it
> should.
> If so, could you point me in the correct direction?
>
> Yes, I can provide much more details once I find the appropriate place to
> discuss it.
>
> Thank you,
>
> JustMe
>



 
Reply With Quote
 
JustMe
Guest
Posts: n/a
 
      25th Mar 2010
Chip,

It is and I have a bunch of code to prevent it. But, so far, it's not
solving the problem. Would this be the right forum to expound on the problem?

Thanks,

JustMe

"Chip Pearson" wrote:

> I'm not sure if this is still a problem under NET, but under native
> COM, Excel would remain running if there was any reference to it that
> was not specifically set to Nothing (VB, null in C++). Try tearing
> down any reference type variables to Nothing and see if this helps.
>
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional,
> Excel, 1998 - 2010
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
>
> On Tue, 23 Mar 2010 12:07:01 -0700, JustMe
> <(E-Mail Removed)> wrote:
>
> >Hi all,
> >
> >I have been over at the MSDN forums and someone pointed me here.
> >
> >I am trying to create an instance of Excel from within .NET so I can
> >populate it with some data and save it. All works fine. However, after I
> >tell excel to quit (which it appears to do), if I go into task manager, I can
> >see it is still running. And if I do the process again, I get 2 copies of
> >Excel in task manager. This is with Excel 2007 and Win XP.
> >
> >I have tried a bunch of things, none of which have worked.
> >
> >One possibility is that I work in at a defense contractor and it might be
> >that they have some policy or other behind the scene add on that might be
> >keeping Excel from exiting properly.
> >
> >Anyway, I am hoping that there is a forum here where someone might have some
> >ideas as to what might be keeping Excel from completely closing as it should.
> > If so, could you point me in the correct direction?
> >
> >Yes, I can provide much more details once I find the appropriate place to
> >discuss it.
> >
> >Thank you,
> >
> >JustMe

> .
>

 
Reply With Quote
 
JustMe
Guest
Posts: n/a
 
      25th Mar 2010
Peter,

Yes, looked there, tried that. Didn't fix it.

My guess is that there is a policy enforced (this is a high security
facility) that might be adding an additional thread to Excel. Something that
works fine with excel normally, but is conflicting with Excel when used via
COM.

Would this be the right forum to expand on the issue or is there a better
forum to do so?

Thanks,

JustMe


"Peter T" wrote:

> The difficulty of releasing Excel in .Net seems to crop up regularly (not
> that I know much about it!)
>
> See
> System.Runtime.InteropServices.Marshal.ReleaseComObject
> and
> GC.Collect()
> in this article
> http://support.microsoft.com/kb/317109
>
> Typically ReleaseComObject is wrapped up in a function, plenty of examples
> 'out there'
>
> Regards,
> Peter T
>
> PS I like the conspiracy theory though!
>
>
> "JustMe" <(E-Mail Removed)> wrote in message
> news:058FE52E-0053-419D-ACE3-(E-Mail Removed)...
> > Hi all,
> >
> > I have been over at the MSDN forums and someone pointed me here.
> >
> > I am trying to create an instance of Excel from within .NET so I can
> > populate it with some data and save it. All works fine. However, after I
> > tell excel to quit (which it appears to do), if I go into task manager, I
> > can
> > see it is still running. And if I do the process again, I get 2 copies of
> > Excel in task manager. This is with Excel 2007 and Win XP.
> >
> > I have tried a bunch of things, none of which have worked.
> >
> > One possibility is that I work in at a defense contractor and it might be
> > that they have some policy or other behind the scene add on that might be
> > keeping Excel from exiting properly.
> >
> > Anyway, I am hoping that there is a forum here where someone might have
> > some
> > ideas as to what might be keeping Excel from completely closing as it
> > should.
> > If so, could you point me in the correct direction?
> >
> > Yes, I can provide much more details once I find the appropriate place to
> > discuss it.
> >
> > Thank you,
> >
> > JustMe
> >

>
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Word (and Excel) code from within Excel, to process both file types IanKR Microsoft Excel Programming 2 19th May 2009 11:47 PM
Excel 2007 Goal Seek Macro Running 7 times slower than Excel 2003 Thomas Shortt Microsoft Excel Programming 0 15th Sep 2008 04:32 PM
Running a macro from Access in excel and then refreshing external data in excel cstraim@yahoo.com Microsoft Excel Programming 1 31st Aug 2006 08:25 PM
Userfrom code in written in Excel 2000 running in Excel 97 KimberlyC Microsoft Excel Programming 1 11th Feb 2004 08:45 PM
VB code needed for running newer excel version macros in older excel versions Tom Microsoft Excel Programming 6 16th Oct 2003 03:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:10 AM.