View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
carlo carlo is offline
external usenet poster
 
Posts: 367
Default Auto running a macro on closing

I don't know exactly what you mean by "give the user time to print"
but if you want to run a macro before closing go to your workbook
in the vba editor and write following:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'here is your macro
End Sub

if you want to cancel the closing you can use
Cancel = true

hth

Carlo

On Nov 22, 9:05 am, Jimmy D wrote:
I have a set of data sums which are updated from anther excel document daily
and I need to be able to record these figures to be able to work out how much
work has been done between yesterday and today.
Since this document will be a template for other users I would like to be
able to automatically run a macro on shutdown to copy the values from today
to another position so as to be able to use them tomorrow. The macro is
simple enough. My problem is how do I make it run with no input from the
user? But still give the user time to print a report prior to the macro
running.
--
Jimmy