XL'97 - Cut CommandButton Anomoly

  • Thread starter Thread starter RWN
  • Start date Start date
R

RWN

This is more of a "huh" question than a major problem.

An associate at work wrote the following code;
"ActiveSheet.Shapes("CommandButton1").Select
Selection.Cut"

It causes an error when the "Selection Cut" statement attempts to
execute. It states that the cut method is invalid on an OLE object (or
words to that effect).
It runs fine in XL 2k & 03 *and* can also be executed without problem in
the immediate VBA window in '97.

As I said, it is not major (I replaced the "ActiveSheet.....Select" with
"ActiveSheet....Delete") and killed the "Selection.Cut" statement.
I'm just wondering what I'm not understanding (albeit there are many
things that confuse me!).
 
If the code is being executed from a commandbutton then change that
commandbutton's TakeFocusOnClick property to false.
 
Thanks Tom, (yes it is from the Command button). I'll give it a go when
I'm back at work.
Is this unique to '97?
On both 2k and 2k it works with the property set to true.
 
The problem I describe is unique to xl97. Whether that is your problem
remains to be seen.
 
Worked like a charm!
Thanks Tom, if not for you I'd have lost all my hair!
 

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

Back
Top