Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 6th, 2007, 04:01 PM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Disable Delete and Insert capability in worksheet

In my excel worksheet I don’t want user to delete and insert row or columns (right click/delete/insert)
How could I take out that functionality from my work sheet?
Is there any way I can gray out those 2 things from right click, that will help I guess.
Thanks in advance.


  #2 (permalink)  
Old August 6th, 2007, 11:22 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Just check if the following link can help you

http://vbadud.blogspot.com/2007/04/d...ght-click.html
Cheers
Shasur

http://www.dotnetdud.blogspot.com
  #3 (permalink)  
Old August 8th, 2007, 11:36 AM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your feedback.
I tried that

Application.CommandBars("CELL").Enabled = False

That disappear whole right click capability.
Is there way can I take off only Insert and Delete from right click on a specific worksheet?
thanks


  #4 (permalink)  
Old August 9th, 2007, 12:23 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Here you have it

Sub Disable_Buttons()

Dim oC1 As CommandBar

Set oC1 = Application.CommandBars("CELL")
oC1.Controls("Cu&t").Enabled = False
oC1.Controls("&Copy").Enabled = False

End Sub

Cheers
Shasur

http://www.dotnetdud.blogspot.com
  #5 (permalink)  
Old August 9th, 2007, 12:36 PM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Shasur for your reply.
It works great for cut and copy.

I was looking for Insert and Delete.
Maybe I didn't explain enough earlier.
I use similar way, you did for delete and insert
but didn't work. Any idea?
Thanks






  #6 (permalink)  
Old August 10th, 2007, 07:21 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Can you try the following

oC1.Controls("&Insert...").Enabled = False
oC1.Controls("&Delete...").Enabled = False

Cheers
Shasur

http://www.dotnetdud.blogspot.com
  #7 (permalink)  
Old August 15th, 2007, 01:52 PM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Same as before no right click menu.
Even if I open another excel spreadsheet no right click capability unless I close the existing one.
I deleted the code still there is no right click menu.
I thing something with excel macro causing.


  #8 (permalink)  
Old August 16th, 2007, 08:47 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can turn that on

oC1.Controls("Cu&t").Enabled = True
oC1.Controls("&Copy").Enabled = True
oC1.Controls("&Insert...").Enabled = True
oC1.Controls("&Delete...").Enabled = True

after your job is done

cheers
shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable GridView delete button for a user rao965 ASP.NET 2.0 Professional 0 May 9th, 2008 12:30 PM
INSERT, UPDATE, DELETE dagad ASP.NET 2.0 Professional 0 September 27th, 2006 01:22 AM
How can i Insert , delete data from datagrid ?? jay4ever_2000 ASP.NET 1.0 and 1.1 Professional 1 February 17th, 2006 03:35 PM
Update, insert and delete Trigger khautinh SQL Server 2000 2 September 17th, 2003 11:45 AM
API to disable CTRL ALT DELETE key stroke Dhodie Pro VB 6 2 July 9th, 2003 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.