Re: Macro Command to Exit

Giganews Newsgroups
Subject: Re: Macro Command to Exit
Posted by:  Chip Pearson (ch…@cpearson.com)
Date: Mon, 1 Jan 2007

If by "exit the workbook" you mean close the file, use something like

Workbooks("Book1.xls").Close SaveChanges:=True

No need to prompt the user to be sure to save the file. The code above will
save the file before closing, taking the decision whether to save out of the
hands of the user.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Zainuddin Zakaria" <sal…@tm.net.my> wrote in message
news:4599cc45…@news.tm.net.my...
> Hi again,
>
> This is related to the question below.
> Dave Peterson has kindly responded to that and it works.
> Thanks, Dave.
>
> My next question is how to exit the workbook (file) since there is no MENU
> bar again. I would like to have Macro command to do that (Exit) with a
> warning message to save first.
>
> Please help ... Thank you.
>
> Zainuddin Z
>
> "Dave Peterson" <peters…@verizonXSPAM.net> wrote in message
> news:<45991DBA.107C9A…@verizonXSPAM.net>...
>
>> One way is to just show the File|Save as dialog.
>
>> Option Explicit
>
>> Sub testme()
>
>> Application.Dialogs(xlDialogSaveAs).Show
>
>> End Sub
>
> "Zainuddin Zakaria" <sal…@tm.net.my> wrote in message
> news:45991483$1…@news.tm.net.my...
>> Hi all,
>>
>> I have hidden the MENU BAR using a macro command on purpose.
>>
>> For the user to 'save/save as' his work, I plan to have a button on that
>> worksheet. The user can open the FILE menu, using that button when
>> pressed. Can someone suggest a macro command for that button to work the
>> way I plan it to be if it is possible.
>>
>> Thank you so much.
>>
>> Zainuddin Z

Replies

None

In response to

Macro Command to Exit posted by Zainuddin Zakaria on Tue, 2 Jan 2007