Click to See Complete Forum and Search --> : Words with intelligience?
totoro
April 5th, 2005, 10:27 PM
I have a web page with a hyperlink that will launch MS words to open a doc. Upon clicking the save button on MS Words, I want to update my project database. But how can I detect the save action on MS words and make it run an external prog/script to update the database? Please help!
Zeb
April 5th, 2005, 11:01 PM
word has a vba editor that lets you write macros and code in a basic style language.
open a new document, click "tools"->"macro"->"visual basic editor".
if it isn't already open, double click the "thisdocument" item in the project explorer window (there will be more than one, for this example, do the one under the current document, not the Normal template)
in the code window, from the object dropdown (top left) select "Document". In the events list there is a "Close" event. This will fire when the document is closed, so you can put vb code in there to do what you want.
that's a start.
more advanced, and maybe a little closer to what you want, there is a "DocumentBeforeSave" event on the application object. I'll point you to the help on that one, but in the help contents under "Getting started with MS word visual basic" -> "Working with word events" -> "Using events with the application object" is where you want to look.
I did all this using word 2000. the basics will be the same on other versions of word, so this should get you started.
totoro
April 6th, 2005, 04:08 AM
Do I have to write a macro for all my documents? Is the macro associated with only a single doc? How does a macro works??? Please advise..
Krzemo
April 6th, 2005, 06:27 AM
Do I have to write a macro for all my documentsU can place a macro on normal.dot and assign it to toolbar or shortcut.
U can also write add-in for it, but IMHO this subject exceeds the usual usage of this forum.
Best regards,
Krzemo.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.