Loading User Form Before the Worksheet Loads

imran.khan.r

New Member
Joined
Feb 19, 2009
Messages
8
Hi,

I want to add a form that has only User ID, Password and Login button. In short a Login Form. I want this form to be loaded before the worksheet opens. I tried

Private Sub Worksheet_Activate()
frmLogin.Load
End Sub

but this is not working. Also I am using this User ID & Password to send mails automatically from Lotus Notes. In other works it is asking for the user's User ID & Password of Lotus Notes.

Please help.:confused:
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
File-level Password protection is already an intrinsic feature of Excel. Why not use it? Any effort you make to create a pre-load or on-load routine can be easily disabled by the user by merely not allowing macros to run.
 
Last edited:
Upvote 0
I just remembered. I read a clever article about a week ago.

The user designed his file so that all but one tab was hidden. If the user chose not to allow macros when they opened the file, the user would see only one tab that said, in essence, "Sorry, but you can't use this file unless you allow macros."

If the user did allow macros, then the first tab of the application displayed. In your case, you could make that a logon.
 
Upvote 0
Hi nbrcrunch,

Thanks a ton for the info. I tried doing the same. But due to restrictions I am unable to do and also the user wants it to be in the fashion that I have mentioned in the question.

Can you please help me out with some code for that?

Thanks again..
 
Upvote 0
Well, excel itself contains inbuilt password protection feature.. I don’t really understand your desire of new login form….well, check in excel setting whether macro is enabled or not,…if not then enable the macro first and reopen the workbook. (look in excel options>macro settings)
 
Upvote 0
You should use the Workbook_Open event rather than the worksheet_activate one and you want the Show method, not Load:
Code:
Private Sub Workbook_Open()
frmLogin.Show
End Sub

Note that this needs to go in the ThisWorkbook module in order to work.
 
Upvote 0
Thanks a ton, rorya.. this worked.

Chris, the purpose of is actually taking the mail ID file name as User ID & Lotus Notes Password to send mails automatically from background. It is just to get the input from user in the form of User ID & Password. I am not setting any restriction or preventing access.
 
Upvote 0

Forum statistics

Threads
1,207,259
Messages
6,077,349
Members
446,279
Latest member
hoangquan2310

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