Control user access using VBA through Account information

Likith

New Member
Joined
Dec 26, 2018
Messages
9
Hello,

I am just looking for some help here.

Is there any way to create a VBA code to control "Access to excel" based on Account information

For example, The excel file should open to only specific users based on their account information (Email) which are added in our VBA code.

Any thoughts are much appreciated!

Regards,
Likith
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You could add a workbook open event and check their username.

Unfortunately they would need to enable macros first...

VBA Code:
Private Sub Workbook_Open() 

If Environ("username") <> my.name then
thisWorkbook.Close SaveChanges:=False
end if

End Sub


Password protection is probably the best bet.
 
Upvote 0

Forum statistics

Threads
1,215,365
Messages
6,124,512
Members
449,167
Latest member
jrob72684

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