PC Review


Reply
Thread Tools Rate Thread

disable clear all using VBA

 
 
Brad
Guest
Posts: n/a
 
      12th Feb 2008
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 With Quote
 
 
 
 
john
Guest
Posts: n/a
 
      12th Feb 2008
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 With Quote
 
Brad
Guest
Posts: n/a
 
      12th Feb 2008
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 With Quote
 
john
Guest
Posts: n/a
 
      12th Feb 2008
should have said I use 2003.

try this:
Application.CommandBars(1).Controls("Edit").Controls("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 With Quote
 
Brad
Guest
Posts: n/a
 
      12th Feb 2008
John,

Sub testclear()
Application.CommandBars(1).Controls("Edit").Controls("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").Controls("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 With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      12th Feb 2008
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").Controls("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").Controls("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 With Quote
 
john
Guest
Posts: n/a
 
      12th Feb 2008
Brad,
Both versions worked ok in 2003 for me. I can’t 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").Controls("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").Controls("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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Clear DContents command in excel - vba code?? dazzag82 Microsoft Excel Programming 2 7th Jan 2010 06:29 PM
XL2002 - Disable 'clear all' when protected Trevor Williams Microsoft Excel Misc 0 11th Dec 2008 11:35 AM
clear pivot table filters or disable dropdowns deb Microsoft Access 0 5th May 2008 02:04 PM
clear the clear the web page email attachment lines =?Utf-8?B?TUNyaWRlcg==?= Microsoft Excel Misc 0 11th Nov 2007 10:05 PM
How to clear out or temporarily disable SuperFetch ?? Synapse Syndrome Windows Vista General Discussion 4 15th Feb 2007 03:13 AM


Features
 

Advertising
 

Newsgroups
 


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