Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default disable clear all using VBA

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default disable clear all using VBA

change "e" on edit to uppercase "E" - this worked ok for me.

Sub testclear()
Application.CommandBars("Edit").Controls("Clear"). Enabled = False
End Sub

--
JB


"Brad" wrote:

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default disable clear all using VBA

With the upper case E
I'm getting a run-time error 5

Invalid procedure call or agrument.

"john" wrote:

change "e" on edit to uppercase "E" - this worked ok for me.

Sub testclear()
Application.CommandBars("Edit").Controls("Clear"). Enabled = False
End Sub

--
JB


"Brad" wrote:

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default disable clear all using VBA

should have said I use 2003.

try this:
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled = False
--
JB


"Brad" wrote:

With the upper case E
I'm getting a run-time error 5

Invalid procedure call or agrument.

"john" wrote:

change "e" on edit to uppercase "E" - this worked ok for me.

Sub testclear()
Application.CommandBars("Edit").Controls("Clear"). Enabled = False
End Sub

--
JB


"Brad" wrote:

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default disable clear all using VBA

John,

Sub testclear()
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled =
False
End Sub

Is still giving me the same error message as before - any other suggestions.
I appreciate the input.


"john" wrote:

should have said I use 2003.

try this:
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled = False
--
JB


"Brad" wrote:

With the upper case E
I'm getting a run-time error 5

Invalid procedure call or agrument.

"john" wrote:

change "e" on edit to uppercase "E" - this worked ok for me.

Sub testclear()
Application.CommandBars("Edit").Controls("Clear"). Enabled = False
End Sub

--
JB


"Brad" wrote:

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default disable clear all using VBA

You are going to need completely different code for 2003 and 2007. 2003 uses
command bars so John's code is close so long as you are using the same
language. To be more robust you would be better off using ID's... Check out
this link... At this site you will also find a pile of stuff on XL2007 which
no longer uses command bars but instead uses a Ribbon...

http://www.rondebruin.nl/menuid.htm
http://www.rondebruin.nl/tips.htm
--
HTH...

Jim Thomlinson


"Brad" wrote:

John,

Sub testclear()
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled =
False
End Sub

Is still giving me the same error message as before - any other suggestions.
I appreciate the input.


"john" wrote:

should have said I use 2003.

try this:
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled = False
--
JB


"Brad" wrote:

With the upper case E
I'm getting a run-time error 5

Invalid procedure call or agrument.

"john" wrote:

change "e" on edit to uppercase "E" - this worked ok for me.

Sub testclear()
Application.CommandBars("Edit").Controls("Clear"). Enabled = False
End Sub

--
JB


"Brad" wrote:

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default disable clear all using VBA

Brad,
Both versions worked ok in 2003 for me. I cant immediately think what you
may be doing that would cause your problem & I am about to leave the office.
Hopefully, someone else in the community reading this may be able to offer
further guidance.

--
JB


"Brad" wrote:

John,

Sub testclear()
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled =
False
End Sub

Is still giving me the same error message as before - any other suggestions.
I appreciate the input.


"john" wrote:

should have said I use 2003.

try this:
Application.CommandBars(1).Controls("Edit").Contro ls("Clear").Enabled = False
--
JB


"Brad" wrote:

With the upper case E
I'm getting a run-time error 5

Invalid procedure call or agrument.

"john" wrote:

change "e" on edit to uppercase "E" - this worked ok for me.

Sub testclear()
Application.CommandBars("Edit").Controls("Clear"). Enabled = False
End Sub

--
JB


"Brad" wrote:

I have tried several versions of the following code and have been
unsuccessful on disabling the "clear all" feature in version 2003 and 2007.
Any suggestions?

Sub testclear()
Application.CommandBars("edit").Controls("Clear"). Enabled = False
End Sub

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
Transfer a name from one cell to another but leave clear if clear? Scoober Excel Worksheet Functions 3 May 22nd 09 02:55 AM
XL2002 - Disable 'clear all' when protected Trevor Williams Excel Discussion (Misc queries) 0 December 11th 08 11:35 AM
Create a Clear button to clear unprotected cells Jcraig713 Excel Programming 2 November 26th 07 03:55 PM
clear the clear the web page email attachment lines MCrider Excel Discussion (Misc queries) 0 November 11th 07 10:05 PM
Clear all? sdmccabe Excel Discussion (Misc queries) 3 December 16th 05 07:51 PM


All times are GMT +1. The time now is 05:50 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"