Override (excel,powerpoint,etc) built-in commands

S

sos00

Hi guys,

is there any way to override excell built-in commands by using vba ?

i could override Word commands by creating a procedure with the name of
original word command... but i can't do that in excell..
(i.e override edit-copy command or edit-undo command)

Thanx
 
T

Tony Jollans

It can't be done in the same way as Word, but you can set the OnAction
property of a control to a macro of your own. Note, however, that this
overrides the control only and not the function itself so, for example, ..

Application.CommandBars("worksheet menu
bar").Controls("Edit").Controls("Copy").OnAction = "mycopy"

... does not override the copy icon on the standard toolbar. That would
also require ...

Application.CommandBars("standard").Controls("Copy").OnAction = "mycopy"

It also does not override keyboard shortcuts, such as Ctrl+c, which requires
a different technique ...

Application.OnKey "^c", "mycopy"

So, yes, it can be more-or-less be done but it is more involved - and
doesn't stop user customization - although with 2003 (and maybe 2002) you
can disable customization separately ...

Application.commandbars.disablecustomize
 
S

sos00

Thank u,
it was very useful to me
:)


Tony Jollans said:
It can't be done in the same way as Word, but you can set the OnAction
property of a control to a macro of your own. Note, however, that this
overrides the control only and not the function itself so, for example, ..

Application.CommandBars("worksheet menu
bar").Controls("Edit").Controls("Copy").OnAction = "mycopy"

... does not override the copy icon on the standard toolbar. That would
also require ...

Application.CommandBars("standard").Controls("Copy").OnAction = "mycopy"

It also does not override keyboard shortcuts, such as Ctrl+c, which
requires
a different technique ...

Application.OnKey "^c", "mycopy"

So, yes, it can be more-or-less be done but it is more involved - and
doesn't stop user customization - although with 2003 (and maybe 2002) you
can disable customization separately ...

Application.commandbars.disablecustomize
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top