VBA Login Form not Working

Amitdas

New Member
Joined
Apr 27, 2019
Messages
22
Hi, Expert I am new in a Excel. I went to get you expert solution for Excel VBA. I create a Excel Data entry UserForm & Excel LogIn From Option. But I face some Problems, When I open the Excel file then First show log in option But when I cancel the loginform then it show my Data Entry userform2. This issue is my Problems.

NB: login Form1 is working but when i cancel then it show the Data Entry Form2.
 
Yes all of think i have to understand to you,

Only one things e.g when i trying to re open the excel sheet again after 2 or 3 minute , the excel sheet is opening without any login form.

this is the problem i can not understand to you clearly.

we are in Excel 2016
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
.
You can use GOOGLE TRANSLATE to better understand me.


I was able to reproduce your problem by clicking on the UserForm RED X in the upper right corner ... instead of clicking on the QUIT button.

To stop that error, I placed this macro in the UserForm2 macro code :

Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  If CloseMode = vbFormControlMenu Then
    Cancel = True
    MsgBox "Please use the Close Form button!"
  End If
End Sub


Download workbook : https://www.amazon.com/clouddrive/share/EuwoDEFfwNLfE7VXduYGHkm08OaQ0q5D03010ipQkKg
 
Upvote 0
VBA Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = vbFormControlMenu Then
    Cancel = True
End If

End Sub

This code prevents the use of the red "X" in the userform.
 
Upvote 0
Which is exactly what Logit said almost a year ago!!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top