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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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,214,632
Messages
6,120,655
Members
448,975
Latest member
sweeberry

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