Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Chip Smith
 
Posts: n/a
Default Userform + close button

i have a user form and when you click the "Close" button at the bottom it
closes out of the macro/userform it looks like this right now..

Private Sub cmdClose2_Click()
Unload Me
End Sub

what can i add to this sub so that when the button is clicked it

1. saves the workbook
2. closes the worksheet/exit out of excel

thanks!

--
--Chip Smith--

  #2   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default Userform + close button


Just add the following to your code:

Unload Me
ActiveWorkbook.Save
Application.Quit

--
Kevin Backmann


"Chip Smith" wrote:

i have a user form and when you click the "Close" button at the bottom it
closes out of the macro/userform it looks like this right now..

Private Sub cmdClose2_Click()
Unload Me
End Sub

what can i add to this sub so that when the button is clicked it

1. saves the workbook
2. closes the worksheet/exit out of excel

thanks!

--
--Chip Smith--

  #3   Report Post  
Posted to microsoft.public.excel.misc
Harald Staff
 
Posts: n/a
Default Userform + close button

Hi Chip

What happens if the user has more than your file open in Excel ? Don't do
that.

Best wishes Harald

"Chip Smith" skrev i melding
...
i have a user form and when you click the "Close" button at the bottom it
closes out of the macro/userform it looks like this right now..

Private Sub cmdClose2_Click()
Unload Me
End Sub

what can i add to this sub so that when the button is clicked it

1. saves the workbook
2. closes the worksheet/exit out of excel

thanks!

--
--Chip Smith--



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
close button does not close goplayoutside Excel Discussion (Misc queries) 1 October 11th 05 03:42 PM
automatically close hyperlink with back button Holly Williams Excel Worksheet Functions 2 September 20th 05 02:10 PM
2003 - Close Button Unavailable Chrissy Excel Discussion (Misc queries) 3 June 16th 05 10:51 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
Use the X button on a userform Greg B Excel Discussion (Misc queries) 3 May 16th 05 09:19 AM


All times are GMT +1. The time now is 06:33 PM.

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

About Us

"It's about Microsoft Excel"