View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Syntax to close Workbook

If ActiveWorkbook.Name < ThisWorkbook.Name then
ActiveWorkbook.Close false
End If

"Eddie_SP" wrote:

Hi !

I have one Multipage with 6 pages.
When I click on the last page, it opens a workbook from the Server.
But when people click on any other page instead of last one, I need a
command to close this activeworkbook.

I tried in "Select Case" but it doesn't help me, because I will have to
change the body of the program...

I just needed something like:

IF ACTIVEWORKBOOK IS DIFFERENT FROM THIS WORKBOOK THEN

ACTIVEWORKBOOK.CLOSE FALSE


I just do not get the right syntax...


And if someone has a tip to give me about closing this recently opened file
in case someone choose another page, please feel free, it would help me a
lot !