HI,
I have a button on a form, which on click need to open an excel sheet and then need to ask a question to user, weather to open the form or not and then if the anwer is Yes, then open the form, else do not open the form.
I have written the code for generating and opneing excel in the click event of the button, followed by code to open the form. Then in the open event of the form, written the following code.
Private Sub Form_Open(Cancel As Integer)
If MsgBox("Are you sure you want to open?", vbYesNo) = vbYes Then
Me.Form.Visible = True
Else
Me.Form.Visible = False
End If
End Sub
But bofore the excel gets generated, this dialog is asking weather to open the form or not.
Please help me.
Regards
RK Veluvali
I have a button on a form, which on click need to open an excel sheet and then need to ask a question to user, weather to open the form or not and then if the anwer is Yes, then open the form, else do not open the form.
I have written the code for generating and opneing excel in the click event of the button, followed by code to open the form. Then in the open event of the form, written the following code.
Private Sub Form_Open(Cancel As Integer)
If MsgBox("Are you sure you want to open?", vbYesNo) = vbYes Then
Me.Form.Visible = True
Else
Me.Form.Visible = False
End If
End Sub
But bofore the excel gets generated, this dialog is asking weather to open the form or not.
Please help me.
Regards
RK Veluvali