Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

deleting an AllowEditRange

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eric - 24 Jan 2005 06:04 GMT
I'm getting an "Application or Object defined error" when I run the
following and it tries to delete an AllowEditRange

Private Sub defineEditableRanges()
   ' defines the areas that can be edited on the protected worksheet.
   Const roomsTitle = "RoomNamesAndNumbers"
   Const deptTitle = "DeptAndPersonnel"
   Dim myRange As Range
   Dim wkSheet As Worksheet
   Set myRange = Columns("A:B")
   Set wkSheet = ActiveSheet
   ' first clear out any old ones -----------------------------> I need
something like this or else I'll get an error when I try to add the same
range again
   For Each er In wkSheet.Protection.AllowEditRanges
       If er.Title = roomsTitle Then
           er.Delete ------------------------------------------> Where I
get the error
       ElseIf er.Title = deptTitle Then
           er.Delete
       End If
   Next
   wkSheet.Protection.AllowEditRanges.Add Title:=roomsTitle, Range:=myRange
   Set myRange = Rows("4:5")
   wkSheet.Protection.AllowEditRanges.Add Title:=deptTitle, Range:=myRange
End Sub

TIA for any insights
Doug Robbins - 24 Jan 2005 10:32 GMT
This newsgroup is for vba as it applies to Word.  You should post your
question to the microsoft.public.excel.programmning newsgroup to get help
with Excel.

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> I'm getting an "Application or Object defined error" when I run the
> following and it tries to delete an AllowEditRange
[quoted text clipped - 25 lines]
>
> TIA for any insights
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.