ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XL'97 - Cut CommandButton Anomoly (https://www.excelbanter.com/excel-programming/313939-xl97-cut-commandbutton-anomoly.html)

RWN

XL'97 - Cut CommandButton Anomoly
 
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!).

--
Regards;
Rob
------------------------------------------------------------------------



Tom Ogilvy

XL'97 - Cut CommandButton Anomoly
 
If the code is being executed from a commandbutton then change that
commandbutton's TakeFocusOnClick property to false.

--
Regards,
Tom Ogilvy

"RWN" wrote in message
...
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!).

--
Regards;
Rob
------------------------------------------------------------------------





RWN

XL'97 - Cut CommandButton Anomoly
 
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.

--
Regards;
Rob
------------------------------------------------------------------------
"Tom Ogilvy" wrote in message
...
If the code is being executed from a commandbutton then change that
commandbutton's TakeFocusOnClick property to false.

--
Regards,
Tom Ogilvy

"RWN" wrote in message
...
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!).

--
Regards;
Rob


----------------------------------------------------------------------

--







Tom Ogilvy

XL'97 - Cut CommandButton Anomoly
 
The problem I describe is unique to xl97. Whether that is your problem
remains to be seen.

--
Regards,
Tom Ogilvy


"RWN" wrote in message
...
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.

--
Regards;
Rob
------------------------------------------------------------------------
"Tom Ogilvy" wrote in message
...
If the code is being executed from a commandbutton then change that
commandbutton's TakeFocusOnClick property to false.

--
Regards,
Tom Ogilvy

"RWN" wrote in message
...
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!).

--
Regards;
Rob


----------------------------------------------------------------------

--









RWN

XL'97 - Cut CommandButton Anomoly
 
Worked like a charm!
Thanks Tom, if not for you I'd have lost all my hair!

--
Regards;
Rob
------------------------------------------------------------------------
"Tom Ogilvy" wrote in message
...
The problem I describe is unique to xl97. Whether that is your

problem
remains to be seen.

--
Regards,
Tom Ogilvy


"RWN" wrote in message
...
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.

--
Regards;
Rob


----------------------------------------------------------------------

--
"Tom Ogilvy" wrote in message
...
If the code is being executed from a commandbutton then change

that
commandbutton's TakeFocusOnClick property to false.

--
Regards,
Tom Ogilvy

"RWN" wrote in message
...
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!).

--
Regards;
Rob


----------------------------------------------------------------------
--












All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com