Thread
:
How do I use VB to set permissions for cell ranges in Excel 2K3?
View Single Post
#
2
Posted to microsoft.public.excel.programming
David Lloyd[_3_]
external usenet poster
Posts: 37
How do I use VB to set permissions for cell ranges in Excel 2K3?
Chris:
You can use the Users property of the AllowEditRange class to specify the
users. For example:
Public Function AddEditRange()
Dim aer As AllowEditRange
Set aer = ActiveSheet.Protection.AllowEditRanges.Add(Title:= "Range1",
Range:=Range("A1"))
aer.Users.Add "Thomas Jefferson", True
Set aer = Nothing
End Function
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
"Chris @ EB" <Chris @
wrote in message
...
I'm trying to use a macro / Visual Basic to select a cell's contents
(contains the Windows user ID) and then set permissions on a specific range
of cells so that only that user can edit the cells. I can do this manually
using ToolsProtection"Allow Users to Edit Ranges . . ." dialog box. But,
I
need to do this for 100 users and repeat it every month, so I'd like to use
a
script. I can define and name the ranges and set the passwords using a
script in Excel, but can't figure out how to access the "Permissions"
settings to specify users. Anyone have any idea?
Reply With Quote
David Lloyd[_3_]
View Public Profile
Find all posts by David Lloyd[_3_]