06-22-2010, 06:04 AM
When I am creating an Excel file through VBA, how can adjust the "file's access level" to read/write by ALL users?
06-22-2010, 08:18 AM
Not quite sure what you mean. I presume this file will reside on a network? If so, each users access rights are defined by the network server. So if a user does not have read/write permission for the drive/folder the file will be saved in, they cannot save any changes to the file in that location. They may not even be able to open it, depending on whether they have read access or not.
Or, am I picking this up wrong and you're referring to creating a new sheet that advises to open as read-only when the user opens the file? If so, when you save the sheet you can use the ReadOnlyRecommended:=True/False.
06-22-2010, 08:31 AM
My workbook is in a shared folder. I had to change the access level of this folder to read/write by ALL users to have everyone else be able to use this file (edit it). Because this file creates another workbook right next to itself, this new file can not be altered (edited) by other users, unless I go and change the access level of this new created file to all users again (manually). I was hoping to find a way to do this through code while I am creating the file.
06-22-2010, 08:43 AM
I'm afraid it's not the new file you're creating that's causing this problem, but the permissions the users have on the network. It sounds like the sharing options that are set up, have been set up for the files that already exist within the folder. The users need to have read/write access to the folder itself. Once they have this, then any new files created there they will be able to edit.
06-22-2010, 08:50 AM
Then how would you explain the fact that I am able to go using my own login and change the access to this file to all, and then it will be fine.
The fact that I am working on the file that I am creating it myself (through code of course), gives me the previllage to change this file's access level to be edited by all other users.
If I don't do this no one can edit this except admin and myslef.
Since I can do this manually, I think there should be a way to do it through code.
06-22-2010, 01:02 PM
The fact you are able to go in and changes privileges for other users and groups for the file suggests you either have admin access or have been given higher access for this folder (perhaps you're an owner?)
As I said previously, the problem is the way each users (or groups) access has been set up for the folder. Basically, you're going in and giving access to that specific file. What the users really need, is read/write access to the entire folder. That way, they will still have read/write access for any newly created files. So the simplest option would be for you to change their access rights for the folder (not individual files).
Yes of course, there's always (or almost always) a way to do anything with code so if you really wanted to get down to the nitty gritty I'm sure you could come up with a way of changing user privileges but that would require your "program" so to speak, to gain trusted access to the network server and give those privileges, not an easy task.
06-22-2010, 04:23 PM
No I am not an admin and I am not doing it for them one by one.
I just do it in my own account.
As I had mentioned the folder was created under all users and shared documents (of a PC that is accessable by network users), and also I had changed its (the folder's) access level to (read/write by) all users. But the new created workbook in the same folder (using code) won't create a file with the same access level.
Am I doing anything wrong?
Thank you for your time.
06-24-2010, 11:28 AM
Ok, although you're not changing each users access one-by-one, I presume you're changing a group access which each user is part of? Perhaps they are also part of another group who's access is denied and thus causing a conflict? Without being able to look at it personally, it's hard to tell as there's a number of reasons this could be happening.
First off, have you tried creating a new workbook manually and saving it in the folder to see if they can access that without you changing anything?
06-25-2010, 08:54 AM
Yes I have. They can't change anything until I do make the change (If I am remembering right, off top of my head through file's property>security tab, change the access to that file to read/write by all).
Thanks again for your time.
Any more thought? :huh: