.net automation crashes Word

H

Haim Katz

I have an Winform app which I upgraded from vs.net2002 to vs.net 2003. I
have one form which captures the on closing event in a word app and saves
the document to a database. It worked fine before I upgraded the
application. Now it still saves the document to the database, but word then
crashes. Are there new interop files for vs.net2003?

Haim Katz

Private Sub myapp_ApplicationEvents2_Event_DocumentBeforeSave(ByVal Doc As
Microsoft.Office.Interop.Word.Document, ByRef SaveAsUI As Boolean, ByRef
Cancel As Boolean) Handles myapp.ApplicationEvents2_Event_DocumentBeforeSave
Select Case saveflag
Case doctype.templateOld
Dim intresp As DialogResult
intresp = MessageBox.Show("Do you want to save this
document as a template?", "Warning", MessageBoxButtons.YesNo)
If intresp = DialogResult.Yes Then
saveflag = 0
Dim mydoc as Word.documentClass =
me.g_myapp.activedocument
Dim docname as string = mydoc.fullname
mydoc.close()
// save the file to a database. It works in both
..net2002 and .net2003

saveflag = 1
Cancel = True
// Word then crashes and asks me if it wants to recover the document
End If
End Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top