Question on FileClose Routine

  • Thread starter Montana DOJ Help Desk
  • Start date
M

Montana DOJ Help Desk

Word 2000

I have the following routine:

Sub FileClose()

CommandBars("Locates").Visible = False
CheckRequiredBookmarks
ActiveDocument.Close (wdSaveChanges)

End Sub

This will run when the user selects File > Close, or clicks the "x" to close
the document, but not when ALT+F4 is used or when the user closes Word. Is
there a way to make this routine run anytime the user takes an action that
causes the document to be closed?

-- Tom

State of Montana
Department of Justice Help Desk

"Making the world a safer place."
 
H

Helmut Weber

Hi Tom,
Sub Autoexit()
MsgBox "autoexit" ' or whatever
Application.Quit
End Sub
 
J

JB

Montana said:
Word 2000

I have the following routine:

Sub FileClose()

CommandBars("Locates").Visible = False
CheckRequiredBookmarks
ActiveDocument.Close (wdSaveChanges)

End Sub

This will run when the user selects File > Close, or clicks the "x" to close
the document, but not when ALT+F4 is used or when the user closes Word. Is
there a way to make this routine run anytime the user takes an action that
causes the document to be closed?

-- Tom

State of Montana
Department of Justice Help Desk

"Making the world a safer place."
Also have a look at this article

J
 
M

Montana DOJ Help Desk

Helmut,

Thanks for the suggestion. I should have thought about that, seeing as how
I've written auto macros before, and my current project includes an AutoOpen
macro, but it just didn't occur to me.

It appears that AutoExit won't do what I want, so I ended up using
AutoClose, which works even when Word is terminated by ending the task in
Task Manager.

--

State of Montana
Department of Justice Help Desk

"Making the world a safer place."
 

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

Similar Threads


Top