LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How can I catch a Paste action and default it to PasteSpecial-

Yes it is. I am using xl2003 right now

But ID's have changed in the past as well. This particular button has
enhanced functionality - so it isn't just an ID change, but it did replace
the ID 22 button.

--
Regards,
Tom Ogilvy


"Peter T" wrote:

Search for 22 resulted in c being nothing.


I wonder if is XL version dependant, from the immediate window in my
XL2000 -

?Application.CommandBars.FindControl(ID:=22).Capti on
&Paste

Regards,
Peter T

"Tom Ogilvy" wrote in message
...
Just some added info: Perhaps more is needed:

? application.CommandBars("Standard").Controls(12).C aption
&Paste
? application.CommandBars("Standard").Controls(12).I D
6002


set c = Application.CommandBars("Standard").FindControl(ID :=6002)
? c.Caption
&Paste

Search for 22 resulted in c being nothing.
--
Regards,
Tom Ogilvy



"Ardus Petus" wrote:

Here is one solution, catching all possibilities of Pasting.
To enable special pasting, run SetMyPaste
To reset to normal pasting, run: ResetMyPaste

HTH
--
AP

'------------------------
Option Explicit

Sub SetMyPaste()
SetAllPaste (True)
End Sub

Sub ResetMyPaste()
SetAllPaste (False)
End Sub

Private Sub SetAllPaste(bSet As Boolean)
Dim aCb As Variant
Dim iCb As Integer
aCb = Array("Standard", "Edit", "Cell")
For iCb = LBound(aCb) To UBound(aCb)
setPaste aCb(iCb), bSet
Next iCb
If bSet Then
Application.OnKey "^v", "MyPaste"
Else
Application.OnKey "^v"
End If
End Sub

Private Sub setPaste(sCb As Variant, bSet As Boolean)
Const iIdPaste = 22
Dim cbcControl As CommandBarControl
For Each cbcControl In CommandBars(sCb).Controls
With cbcControl
If .ID = iIdPaste Then
If bSet Then
.OnAction = "MyPaste"
Else
.Reset
End If
Exit For
End If
End With
Next cbcControl
End Sub

Private Sub MyPaste()
If Application.CutCopyMode Then
Selection.PasteSpecial Paste:=xlPasteValues
End If
End Sub
'-------------------------------

"srinu1264" a

écrit
dans le message de news:
...

Hi ,

How can I catch a Paste action behaviour(Paste menu click and ^v) and
default it to PasteSpecial-Values.

I should be able to catch these events and call my custom subroutine

to
handle the situations.

thanks
Vasu


--
srinu1264

------------------------------------------------------------------------
srinu1264's Profile:
http://www.excelforum.com/member.php...o&userid=34155
View this thread:

http://www.excelforum.com/showthread...hreadid=544626







 
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
Make Paste values default... DanF Excel Discussion (Misc queries) 0 July 4th 08 07:21 AM
can you change the default paste method? (paste values) David A Brown Excel Discussion (Misc queries) 3 December 18th 07 09:59 AM
How do I capture user paste action and convert to Paste Special DonC Excel Programming 0 November 19th 04 01:43 PM
How to catch copy/paste & cut/paste ? Arifi Koseoglu Excel Programming 4 February 26th 04 12:42 PM


All times are GMT +1. The time now is 05:13 AM.

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

About Us

"It's about Microsoft Excel"