Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M -WordMVP- Cindy M  -WordMVP- is offline
external usenet poster
 
Posts: 370
Default C# MailMerge from Excel

Hi ?B?Y2hyaXM=?=,

After the merge is done I still have WINWORD.EXE running under aspnet. I
know that GC is supposed to take care of that, but I have it in memory for a
long period of time. I tried to release them like this:

// Unload objects from the memory
System.Runtime.InteropServices.Marshal.ReleaseComO bject (wrdMailMerge);
System.Runtime.InteropServices.Marshal.ReleaseComO bject (oWordApp);
System.Runtime.InteropServices.Marshal.ReleaseComO bject (oWordDoc);

or like this:

wrdMailMerge = null;
oWordDoc = null;
oWordApp = null;

but none of those ways worked. any tricks?

Most "deterministic" method: Release the mailmerge and doc objects, as you do
above, by setting them to null. Now force GarbageCollection:
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
//Yes, you do it twice

Now, quit the application as Peter suggests (note that in C# you must pass a
ref obj parameter; you can pass "missing"), then perform the garbage
collection again.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I print an Excel Autoshape on a Word doc using mailmerge? TG in AZ Mailmerge 2 February 25th 06 04:15 PM
mailmerge using Word/Excel 500.00 in Excel shows as 500 nt 500.00 Switchengine Mailmerge 1 January 29th 06 07:53 PM
Excel as mailmerge data source Mary Ann Mailmerge 2 December 6th 05 06:10 PM
excel hangs in mailmerge harrow Microsoft Word Help 2 October 21st 05 04:48 AM
Mailmerge from EXCEL, custom format problem TonyB Mailmerge 1 December 1st 04 04:41 PM


All times are GMT +1. The time now is 04:55 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"