LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Userform Terminate

Hey Troops,
I would like to give the user the option to abort a Terminate (clicking the
red X) if they choose.
If there is data that the user input and they accidently terminate I was
trying to give the user the choice to abort the close and run another sub but
the form still closes and then runs the msgbox part of the code.

here's my code, any help would be greatly appreciated!!:

Private Sub UserForm_Terminate()

If (Me.BusName.Value) = "" Then
Unload Me
End If

If (Me.BusName.Value) < "" Then

Dim ua As String
ua = MsgBox("Do you wish to save the current data entered on this
form?", vbYesNo)
If ua = vbYes Then
Exit Sub
Else
If ua = vbNo Then
Unload Me
End If
End If
End If
End Sub
 
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
Terminate Excel with a Macro??? Ken Soenen Excel Programming 2 December 4th 05 04:10 PM
terminate a form tkaplan Excel Discussion (Misc queries) 5 October 24th 05 01:14 PM
terminate a runnig macro JH Excel Programming 6 February 12th 05 05:39 AM
Macros terminate early Pierre[_3_] Excel Programming 5 January 23rd 04 05:54 PM
Can't terminate the excel instance from VB Gerhard[_2_] Excel Programming 1 July 16th 03 11:06 AM


All times are GMT +1. The time now is 04:35 PM.

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"