I have a macro that ideally would run automatically whenever the user closes
out of the workbook. I know how to set a macro to run this way when OPENING
the workbook, but is the reverse possible?
I have a macro that ideally would run automatically whenever the user closes
out of the workbook. I know how to set a macro to run this way when OPENING
the workbook, but is the reverse possible?
Wuddus,
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'your code
End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
"Wuddus" <[email protected]> wrote in message
news:[email protected]...
>I have a macro that ideally would run automatically whenever the user
>closes
> out of the workbook. I know how to set a macro to run this way when
> OPENING
> the workbook, but is the reverse possible?
Yes it's possible,
Go to the Visual Basic Editor, select This Workbook by double clicking.
In the box that appears on the left hand side select Workbook and on the right hand side select BeforeClose
Then put your macro code inbetween this and it will run before you close the worksheet.
Hope this does what you're after
Regards
Carl
Thanks! I didn't know about that one at all. (And thanks for the fast reply,
too: Maybe I can get this thing done this morning yet!)
"Paul B" wrote:
> Wuddus,
>
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
> 'your code
> End Sub
>
> --
> Paul B
> Always backup your data before trying something new
> Please post any response to the newsgroups so others can benefit from it
> Feedback on answers is always appreciated!
> Using Excel 2002 & 2003
>
> "Wuddus" <[email protected]> wrote in message
> news:[email protected]...
> >I have a macro that ideally would run automatically whenever the user
> >closes
> > out of the workbook. I know how to set a macro to run this way when
> > OPENING
> > the workbook, but is the reverse possible?
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks