How do I? Get Excel to do something when I close a workbook

E

emu_tails

I'm trying to write two seperate macros to make changes to a workbook
when I open it and close it.

When I open the workbook I want to go to fullscreen - which I've
managed to do. However!

When I close the workbook I want to cancel the fullscreen option.

I've tried several things including the WorkBookBeforeClose sub. I can
get Excel to make the changes when I write and run a macro to close the
workbook. But when I use the Close function in the File menu, Excel
stays in fullscreen mode!! Quite frustrating!

Can anyone help??

Many thanks.

Andrew.
 
R

Ron de Bruin

Place this events in the Thisworkbook mudule

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayFullScreen = False
End Sub

Private Sub Workbook_Open()
Application.DisplayFullScreen = True
End Sub
 
E

emu_tails

Thanks for the help!!

I've put the VB into the right module. However, if I say try writing a
macro to close the workbook (ThisWorkbook.Close) then the fullscreen
won't change?

Any ideas?
 

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

Top