View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Syntax to close Workbook

Hi

Another way to deal with that is to store the workbook names in the Tag
property of each Page; and use the Change event; to close if open and Open
the workbook related to that page....

Dim wb As Workbook
Private Sub MultiPage1_Change()
If Not wb Is Nothing Then wb.Close False
Set wb = Workbooks.Open("c:\" & MultiPage1.SelectedItem.Tag)
'your code continues
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"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 !