View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Message box & close worksheet

Jock,

Try this :-

Private Sub CommandButton1_Click()
response = MsgBox("Do you wish to order another item?", vbYesNo)
If response = vbYes Then
MsgBox ("YES")
'TextBox3.SetFocus
Else
ThisWorkbook.Close savechanges:=True
End If
End Sub

Mike

"Jock" wrote:

Code bolow doesn't close the worksheet when 'no' is chosen rather than yes.
Any ideas?
Private Sub CommandButton1_Click()

MsgBox("Do you wish to order another item?", _
vbYesNo)

If response = vbYes Then
If vbYes Then
TextBox3.SetFocus
Else
ThisWorkbook.Close True
End If
End If

End Sub
--
tia

Jock