Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Detecting Save event in Word.

Detecting Save event in Word.

Detecting Save event in Word.

I was asked to develop a routine (read script, macro, etc.) to intercept the Save or Save As box in MS Word 97, so I can display a form that forces the user to name the file to be saved with a uniform, sort-of-standardized file name. Let's say the document is a bibliography, from a department called Genetic Research, and the latest version is 4. The name should be BI_GenRs_04.doc and the main concern in this office is that the users keep naming the files at their will. Does anyone out there knows how can I intercept the event so I can use my very own "Save" box?

RE: Detecting Save event in Word.

Each "built in" command can be overridden in Word by creating a macro which will do what you wish, and then name it the same as the original command.  (See Tools, Macro, Macros, Macros in:  Word Commands)

First, build a dialog box which forces the user to input a file name exactly as you wish it to be formatted.  Add a Save button (later you can add cancel, etc). Name the file SaveDialog2

Then record the coding for saving a file -- call it SaveTest.  Use a dummy file and dummy file name.

Move this code to the Save button "On Click" event on SaveDialog2.

Change the "dummy" file names to variables based on the names given to the text box you built in the SaveDialog2 form.

Also, to test at runtime, put a message box at the top of all code, such as MsgBox "Hi, Aristarco"

While in edit mode, change the name of the SaveDialog2 macro to FileSave.

When you click File ¦ Save on the menu, first your custom dialog box should appear.
When Save is clicked on your dialog (after putting in the file name), the macro should pick up the variable from the dialog box, place it into the code also behind the Save button, and save the document.

This is just a start.  Some other housekeeping should be done as well, such as clearing the screen, etc.


Input File Name:  ____________


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close