Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I print an Excel Autoshape on a Word doc using mailmerge? | Mailmerge | |||
mailmerge using Word/Excel 500.00 in Excel shows as 500 nt 500.00 | Mailmerge | |||
Excel as mailmerge data source | Mailmerge | |||
excel hangs in mailmerge | Microsoft Word Help | |||
Mailmerge from EXCEL, custom format problem | Mailmerge |