Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I use VB to set permissions for cell ranges in Excel 2K3?

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Permissions Daniel Smart Excel Discussion (Misc queries) 1 September 19th 08 09:08 PM
Assigning RMS permissions in Excel 2007 havenlad Excel Discussion (Misc queries) 0 January 15th 08 02:44 PM
Excel Permissions James A Excel Discussion (Misc queries) 1 September 23rd 06 01:49 AM
Excel Charts and Restricted Permissions Aaron West Excel Discussion (Misc queries) 0 June 27th 05 11:43 PM
Permissions to view only certain sheets in Excel Michael C Setting up and Configuration of Excel 2 March 16th 05 12:45 AM


All times are GMT +1. The time now is 08:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"