On-sheet activeX component disables copy/paste

  • Thread starter Thread starter hbj
  • Start date Start date
H

hbj

Hi xlgurus,

I have inserted an ActiveX pushbutton to a worksheet, the position of whichfollows the selected cell. The corresponding VBA code is triggered by event Worksheet_SelectionChange. The purpose is to make it easier to toggle value in a specific column of selected row. By occasion, when I tested it I found that normal Copy/Paste is disabled. This happens at the very line whereI set the position of the control:
ActiveSheet.OLEObjects("cmdSetReset").Top = rngAct.Top

Any ideas...

Hakan
 
Hi Hakan,

Am Wed, 2 Jul 2014 07:36:46 -0700 (PDT) schrieb hbj:
ActiveSheet.OLEObjects("cmdSetReset").Top = rngAct.Top

try:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
cmdSetReset.Top = Target.Top
End Sub


Regards
Claus B.
 
Hi Hakan,



Am Wed, 2 Jul 2014 07:36:46 -0700 (PDT) schrieb hbj:






try:



Private Sub Worksheet_SelectionChange(ByVal Target As Range)

cmdSetReset.Top = Target.Top

End Sub





Regards

Claus B.

--

Vista Ultimate / Windows7

Office 2007 Ultimate / 2010 Professional

Thank you Claus,

Your code is of cource shorter, but it does not solve the main problem. When the code runs it grayes out the Clipboard tool. Only Paste as image is available.

Håkan
 
Thank you Claus,
Your code is of cource shorter, but it does not solve the main problem. When the code runs it grayes out the Clipboard tool. Only Paste as image is available.

Håkan
By default, executing VBA clears the Clipboard of its current contents.

--
-
Garry

Free Usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
By default, executing VBA clears the Clipboard of its current contents.



--

-

Garry

Well Garry,

It seems that this is not quite the truth. You can have lot of code in the Worksheet_SelectionChange() procedure, still the Clipboard is not cleared = you can use copy/paste.

In fact, programatically affecting the properties of the embedded ActiveX control clears the clipboard. This fact is partly discussed in the link below:
http://msdn.microsoft.com/en-us/library/office/aa221581(v=office.11).aspx

I think I'd better explicitely activate the ActiveX control, when needed.

HÃ¥kan
 
Well Garry,

It seems that this is not quite the truth. You can have lot of code in the Worksheet_SelectionChange() procedure, still the Clipboard is not cleared = you can use copy/paste.

In fact, programatically affecting the properties of the embedded ActiveX control clears the clipboard. This fact is partly discussed in the link below:
http://msdn.microsoft.com/en-us/library/office/aa221581(v=office.11).aspx

I think I'd better explicitely activate the ActiveX control, when needed.

HÃ¥kan
Sorry but the article you link to does not support your reply!

--
-
Garry

Free Usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
Well Garry,

It seems that this is not quite the truth. You can have lot of code in the Worksheet_SelectionChange() procedure, still the Clipboard is not cleared = you can use copy/paste.

In fact, programatically affecting the properties of the embedded ActiveX control clears the clipboard. This fact is partly discussed in the link below:
http://msdn.microsoft.com/en-us/library/office/aa221581(v=office.11).aspx

I think I'd better explicitely activate the ActiveX control, when needed.

HÃ¥kan
Sorry.., my bad!
I stand corrected as I should have explicitly stated *some" VBA, not all
as my statement suggests. I was thinking in the context of your scenario!<g>

--
-
Garry

Free Usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
Back
Top