Override 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
 
G

Guest

Yeah, I guess, you have to basically remove the edit copy and edit undo
commands from the applicable toolbars, and insert what you want, but there
are still the shortcut keys to worry about... As for overriding without
designing your own actions? Hmm... Anyone else?

What I described above is working with the CommandBars object.
 
S

sos00

Thanks ...

but in Word we can override word commands completely.
for example when we create a sub as below

sub editcopy
MsgBox "Edit->Copy overrided"
end sub

all of commands which point to edit->copy will be override
(i.e pressing Ctrl+C , clicking Edit-Copy menu and etc)
 
G

Guest

Hmm.. I just tried what you described, and it actually worked for Word.
Surprise to me. As for Excel, well... I couldn't exactly say where it goes.
Because the question becomes, does it apply to the "ThisWorkbook", to a
"worksheet", or as just a generic module. In word, I put the command you
described in a Module on it's own and it worked fine. I also tried to review
the Object Browser, and found no instructions for that feature, same results
as in Excel. My only thought was that perhaps some sort of addin would
facilitate it. Or when going to paste the item within the current workbook,
that the change command picks up on it. Or... If you are trying to prevent
copying from Excel to anything, if you can check say the clipboard or some
variable to see if there is a copied region and the workbook loses focus,
then it either alerts the user, or dumps the clipboard...

At least it may be a way around the inability to directly override the
copy/cut option(s).. ???
 
S

sos00

Thanks,
Or... If you are trying to prevent
copying from Excel to anything, if you can check say the clipboard or some
variable to see if there is a copied region and the workbook loses focus,
then it either alerts the user, or dumps the clipboard...

At least it may be a way around the inability to directly override the
copy/cut option(s).. ???

Yes, before i found this feature of Word, i tried this way but somethings
could not be captured anyway !
i.e Paste action or Undo/Redo actions !

when u open Macro dialog in Word, there is a "MacroIn" field that when u set
it to Word Commands u can see
all of this commands.
i didn't found anything like "Excel Commands" in excel's Macro dialog.


i think, like Word, this could be DDE commands of these applications.
so if capturing DDE commands be available , i think it could be it !
anyone have some info abt this ??
 
G

Guest

Just throwing something out there, review the references that are used in
your Excel VBA code. May have DDE there, I'm going to look right now.
 

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