You can't use Terminate, the form is shutting down at this point. Add an OK
button and check it in there.

Signature
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
>I have a form that I'm trying to add some code to that will require a
> combobox to be filled in before it is closed.
[quoted text clipped - 15 lines]
>
> Any ideas?
Gojavid - 05 Jun 2007 16:17 GMT
> You can't use Terminate, the form is shutting down at this point. Add an OK
> button and check it in there.
Thanks for the advice. I have the form open as part of the
workbook_open so I just added the code to that.
Maybe you could change the Cancel's button .takefocusonclick property to false.
> I have a form that I'm trying to add some code to that will require a
> combobox to be filled in before it is closed.
[quoted text clipped - 15 lines]
>
> Any ideas?

Signature
Dave Peterson
Gojavid - 05 Jun 2007 16:34 GMT
I'm interested... How do I refer to the cancel button?
Dave Peterson - 05 Jun 2007 16:45 GMT
I put a textbox and two commandbuttons on a small userform. This was the code
behind it:
Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "trying to exit"
'and never let them (just for testing)
Cancel = True
End Sub
Private Sub UserForm_Initialize()
With Me.CommandButton1
.Caption = "Cancel"
.TakeFocusOnClick = False
End With
With Me.CommandButton2
.Caption = "Ok"
End With
End Sub
> I'm interested... How do I refer to the cancel button?

Signature
Dave Peterson
Dave Peterson - 05 Jun 2007 16:52 GMT
Ps.
I figured your code would have at least two buttons on it.
One that has a caption of "ok" (or something like that).
And one that has a caption of "Cancel") (or equivalent).
> I put a textbox and two commandbuttons on a small userform. This was the code
> behind it:
[quoted text clipped - 24 lines]
>
> Dave Peterson

Signature
Dave Peterson
Gojavid - 06 Jun 2007 15:16 GMT
It works great. Thanks for the advice!
> Ps.
>
[quoted text clipped - 36 lines]
>
> Dave Peterson