Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default End a procedure form a UserForm

I use a MsgBox with vbYesNoCancel to end a procedure if the No button is
clicked. However, the end users don't take the time to read the message and
just click Yes to get past it.

I want to use a LARGE UserForm with Yes & No command buttons to accomplish
the same thing. If the end user clicks Yes, the UserForm will unload and the
procedure will continue. What code can I put into the No command button to
end the procedure that launched the UserForm when the No button is clicked?

Thanks,

Sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default End a procedure form a UserForm

Unload UserForm1 'or whatever number it is.

This takes control back to the macro that showed the UserForm.


"Sam" wrote in message
...
I use a MsgBox with vbYesNoCancel to end a procedure if the No button is
clicked. However, the end users don't take the time to read the message
and
just click Yes to get past it.

I want to use a LARGE UserForm with Yes & No command buttons to accomplish
the same thing. If the end user clicks Yes, the UserForm will unload and
the
procedure will continue. What code can I put into the No command button to
end the procedure that launched the UserForm when the No button is
clicked?

Thanks,

Sam



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default End a procedure form a UserForm

This might be more clear.

If you put a command button on the form:

Private Sub CommandButton1_Click()
Unload Me
End Sub

If you put a command button on a sheet:

Private Sub CommandButton1_Click()
Unload UserForm1
End Sub


"Sam" wrote in message
...
I use a MsgBox with vbYesNoCancel to end a procedure if the No button is
clicked. However, the end users don't take the time to read the message
and
just click Yes to get past it.

I want to use a LARGE UserForm with Yes & No command buttons to accomplish
the same thing. If the end user clicks Yes, the UserForm will unload and
the
procedure will continue. What code can I put into the No command button to
end the procedure that launched the UserForm when the No button is
clicked?

Thanks,

Sam



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default End a procedure form a UserForm

Try this:

Private sub cmdNo_Click
Unload UserForm
Exit Sub
End Sub
--
I am running on Office 2003, unless otherwise stated.


"Sam" wrote:

I use a MsgBox with vbYesNoCancel to end a procedure if the No button is
clicked. However, the end users don't take the time to read the message and
just click Yes to get past it.

I want to use a LARGE UserForm with Yes & No command buttons to accomplish
the same thing. If the end user clicks Yes, the UserForm will unload and the
procedure will continue. What code can I put into the No command button to
end the procedure that launched the UserForm when the No button is clicked?

Thanks,

Sam

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
End a procedure from a UserForm Sam Excel Programming 1 July 22nd 09 09:22 PM
How to jump from a Form procedure to a Workbook or Module procedure? T. Erkson Excel Programming 4 January 25th 07 07:15 PM
Cancel a Procedure through a Userform jumpjump[_3_] Excel Programming 1 August 30th 05 09:52 AM
Exiting a procedure with a userform jumpjump[_4_] Excel Programming 2 August 30th 05 09:04 AM
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM


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