Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Closing and reopening the same file | Excel Discussion (Misc queries) | |||
How to skip the save file notoification on file closing? | Excel Worksheet Functions | |||
Closing the current focused sheet | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) | |||
HTML Help not closing the file | Excel Discussion (Misc queries) |