Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default closing current file only

How do I make it so that when a user clicks the Excel Right Hand close
(X) it shuts down my file1.xls and not all the other open excel files
or the excel application. This is what i've currently using but i'm
not happy with it closing all other peoples excel files. I'm a quite
new to VB but picking it up as I go along.



Sub auto_close()
Sheets("Intro").Visible = True
Sheets("IC").Visible = False
Sheets("PCP").Visible = False

Dim response As Integer
Dim Names As Range
Set Names = Sheets("DATA").Range("B1")
response = MsgBox(prompt:="Are you sure " & Names & " you want
to exit?", Buttons:=vbYesNo)
If response = vbYes Then

ThisWorkbook.Save
Toolbars(1).Visible = True
Application.CommandBars("Worksheet Menu Bar").Enabled = True
Application.CommandBars("Formatting").Enabled = True
Application.CommandBars("Standard").Enabled = True
Application.DisplayFormulaBar = True
Application.CommandBars("Formatting").Visible = True
Application.Caption = "Microsoft Excel"
ActiveWorkbook.Close


Else: ExecuteExcel4Macro "HALT(TRUE)"


End If



End Sub
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
Closing and reopening the same file Tom Excel Discussion (Misc queries) 16 March 11th 09 09:31 PM
How to skip the save file notoification on file closing? Dan Excel Worksheet Functions 1 August 19th 07 02:26 PM
Closing the current focused sheet Pietro Excel Discussion (Misc queries) 3 February 22nd 07 11:15 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
HTML Help not closing the file pod Excel Discussion (Misc queries) 0 April 18th 05 04:45 PM


All times are GMT +1. The time now is 05:38 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"