Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default 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
------------------------------------------------------------------------


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
------------------------------------------------------------------------




  #3   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default 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


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

--






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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


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

--








  #5   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default 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


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










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort anomoly Hawthorne 53 Excel Worksheet Functions 2 May 18th 09 11:21 PM
Excel 2003 Pivot Table Anomoly Trevor Aiston[_2_] Excel Discussion (Misc queries) 8 November 25th 08 02:44 PM
Golf Handicap Anomoly.... Bill Foley Excel Worksheet Functions 7 December 23rd 06 11:45 PM
CommandButton Alvin Hansen[_2_] Excel Programming 3 August 16th 04 06:35 PM
Commandbutton David Fixemer Excel Programming 2 February 25th 04 10:18 PM


All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"