Here is what I am trying to do:
From VB.net open a word template --- Done
Populate it from a database ------Done
Have word report back with the saved file name so as I can add it to the database history ----Not done.

I know is has something to do with the close events in word but I am unable to get it working.
I have made a class which I think should work:

Dim WithEvents wordApplication As New Microsoft.Office.Interop.Word.Application

this gives me a drop down for

Private Sub wordApplication_DocumentBeforePrint(ByVal Doc As Microsoft.Office.Interop.Word.Document, ByRef Cancel As Boolean) Handles wordApplication.DocumentBeforePrint

but I dont know how to invoke this routine.

Any help greatly appreciated.

Recommended Answers

All 2 Replies

thanks for the info, I have tried that already but it refers to VS2002 and wordXP I am using VS2008 and word 2003, so when I try to run that code it doesn't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.