Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save on Exit

Status
Not open for further replies.

choppysuey

Technical User
Mar 28, 2001
54
US
Hi I would like to save a second copy of an Excel worksheet onto a network drive upon a user exiting Excel. What event do I tie my subroutine to in order to trigger my subroutine? I was hoping that there was an unload or quit event in Excel that I can tie my subroutine too. Any suggestions?
 
Workbook_BeforeClose

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Thx John, I'm still pretty new with VB, but I'm not able to find the Workbook object. Within the Visual Basic Editor, I'm only seeing the worksheet and in the project explorer the only thing I see is ThisWorkbook under Excel objects. Where is the Workbook_BeforeClose event?
 
Is that what you are looking for?
Excel.JPG
 
Double click on ThisWorkbook. Then on the right pane, click on the top left dropdown and change from General to Workbook. Then change the top right dropdown from Open to BeforeClose.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Got it. Thx to both of ya. I knew it was something simple like that.
 
Happy to help!
[cheers]

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top