different user question

viper

Active Member
Joined
Feb 15, 2002
Messages
382
What's the correct way to use vba to open a file as readonly? I've looked at the help in vb but can't get the code to work properly. I want to allow varied access to different users of my file. Some will have all access and others I want to limit to view only, no printing, changing, etc. I have my file set up now so that upon opening it disables the File menu, asks for a password before printing, I even have the main sheet hidden and requires a password before viewing, but this seems like alot of different things to add to a file instead of just allowing certain access to different users.

If I can just do something like:
dim name as string

name = Inputbox("Enter your name")
if name = "Joe" then
activeworkbook.open(readonly)
elseif
name = "Sara" then
activeworkbook.open
end if
something along those lines.

thanks,
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Different point - if you are varying access by user...

If running Windows NT then rather than allow people to enter their name, use

USER = Environ("Username")

so USER would be "jbloggs" or "jb" etc...

You can then set the access rights from this. In short it's a lot more secure as no-one is able to "be" anyone else unless they know other peoples login codes to MS Office which is unlikely.
 
Upvote 0

Forum statistics

Threads
1,217,673
Messages
6,137,921
Members
450,098
Latest member
Ikmal Sabri

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