Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Syntax to close Workbook

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 !
  #2   Report Post  
Posted to microsoft.public.excel.programming
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 !

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Syntax to close Workbook

That's it Mr. Patrick Molloy ! \o/

Thank you man !!!



"Patrick Molloy" wrote:

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 !

  #4   Report Post  
Posted to microsoft.public.excel.programming
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 !

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Syntax to close Workbook

Jacob, this is great man !

Thank you very much for the tip.

Both methods worked perfectly !

Tks. =)


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Syntax to close Workbook

Do you mean

Sub Macro1()
ActiveSheet.Columns(7).Insert
ActiveSheet.Range("G1") = "Title"
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 !

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Syntax to close Excel workbook not saving changes Greyman Excel Programming 1 July 5th 08 03:38 AM
Hide all Sheets in Workbook then Close Workbook RyanH Excel Programming 0 January 29th 08 12:59 PM
Open New Workbook / Save and Close Current Workbook Joe K. Excel Programming 1 December 7th 07 08:04 PM
Help on Workbook close and workbook save events Adam Harding Excel Programming 1 September 29th 05 04:12 PM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"