Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sort anomoly | Excel Worksheet Functions | |||
Excel 2003 Pivot Table Anomoly | Excel Discussion (Misc queries) | |||
Golf Handicap Anomoly.... | Excel Worksheet Functions | |||
CommandButton | Excel Programming | |||
Commandbutton | Excel Programming |