Gpg

hy all

i've a code for generate mail with word 2003, it's run fine but...

when i close word, my application is freezed until i kill word process in task manager.

anybody can help me

thank's a lot

Code Block

Dim wd As Word.Application

Dim doc As Word.Document

Dim oMissing As Object = System.Reflection.Missing.Value

On Error GoTo errchecker

'this is for setting toolsbar without error (cfr KB... )

Cursor = Cursors.WaitCursor

wd = New Word.ApplicationClass()

wd.Visible = False

doc = wd.Documents.Open("c:\test.dot", True)

doc.MailEnvelope.Item.To = strRecipient

doc.MailEnvelope.Item.Subject = strSubject

doc.ActiveWindow.EnvelopeVisible = True

doc.Activate()

doc.Saved = True

wd.Visible = True

doc = Nothing

wd = Nothing

Cursor = Cursors.Default

Return True

errchecker:

If Err.Number = -2147467259 Then : Resume

Else

doc = Nothing

wd = Nothing

Cursor = Cursors.Default

End If




Re: Visual Studio Tools for Office bug with msword 2003 and vb.net 2005

Gpg

this bug is only when i close word with enveloppe visible.

so, can i use another aproach for generate mail with an word content not as attachment, but in body of mail






Re: Visual Studio Tools for Office bug with msword 2003 and vb.net 2005

Gpg

finally,

Code Block

GC.Collect()

GC.WaitForPendingFinalizers()

GC.Collect()

GC.WaitForPendingFinalizers()

have resolved my difficult.

until i do these two collect / wait for pending finalizers, my app (or frameword ) have a reference.

Thank's pieter for your help