PDA

View Full Version : userform cancel button



jw01
12-29-2010, 04:34 PM
hello

wondering if i can get some input from you guys regarding my macro

seem to be getting an issue that is lagging my report behind.

i have 4 buttons on my userform
1) sign-off ....2) clear ....3)cancel.....4) save/close

3) cancel appears to be giving me issues, as everytime i hit cancel, it should technially just exit or "hide" the userform for the individual to make changes or w.e to the file.

-the userform is triggered when the person exits the file (before close)

but everytime i hit cancel, it goes to save, and pretty much closes the file in a way.

can someone pls help



Public blnCancelled As Boolean
Private Sub cmdCancel2_Click()
blnCancelled = True
Me.Hide

End Sub


Private Sub cmdSaveClose_Click()
ActiveWorkbook.Save
Unload Me
End Sub


and this code is in my userform module...and for some apparent reason, when i click on "cancel' button as i mentioned before, it does not close or hide the user form, instead ask me save and closes the file. any input would be very appreciated! pls adn thxs agani!

Bob Phillips
12-29-2010, 04:44 PM
I notice it is cmdCancel2, is there a cmdCancel button as well, is there a spurious button?

mikerickson
12-29-2010, 04:57 PM
According to this, there is no cmdCancel
http://www.mrexcel.com/forum/showthread.php?t=518044

jw01
12-29-2010, 09:58 PM
hey guys

yeah there is no prior cancel1.....just goes straight to cancel2, i should rename it, but regardless not sure why it simply wont close or hide the userform when i press cancel, instead go for save?....can i post my file up here?

GTO
12-30-2010, 01:05 AM
hey guys

yeah there is no prior cancel1.....just goes straight to cancel2, i should rename it, but regardless not sure why it simply wont close or hide the userform when i press cancel, instead go for save?....can i post my file up here?

Yes - you should be able to attach a workbook, as long as its below 1MB.

Press the <Go Advanced> button, located below the Quick Reply msg box that you probably typed your question in. In the new window that opens, scroll down to see the <Manage Attachments> button. It is pretty self explanatory after that.

Good luck :-)

Mark

Bob Phillips
12-30-2010, 04:05 AM
Personally, as you are cross-posting and not owning up to it, I don't care whether it works or not.