PC Review


Reply
Thread Tools Rate Thread

Copy picture and remove event code

 
 
john.kreps@gmail.com
Guest
Posts: n/a
 
      19th Mar 2007
Background:
1. User clicks button that copies picture from a worksheet to the
clipboard (CopyReport routine).
2. User pastes clipboard to a new workbook.

Issue:
The pasted picture retains code attached to its click event
(Picture1_Click).

Question:
How can I modify the CopyReport code to remove the picture's
associated Picture1_Click routine when the picture is pasted to
another workbook. The code would need to appear within Picture1_Click.

TIA...

Sub CopyReport()

Application.ScreenUpdating = False

'Copy to pictures to clipboard
Sheet4.Select
ActiveSheet.Shapes.Range(Array("Picture 1", "Picture 2")).Select
Selection.Copy
Sheet2.Select

End Sub

Sub Picture1_Click()

If Not Sheet1.Visible Then
If MsgBox("Do you want to unhide the underlying report?",
vbYesNo, "Unhide Worksheet") = vbYes Then
Sheet1.Visible = xlSheetVisible
Else
Exit Sub
End If
Else
Sheet1.Activate
End If

End Sub

 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      19th Mar 2007
You don't you paste code, so I assume you use .Paste. using .PasteSpecial
means the code is not included. Change to suit:

ActiveSheet.Shapes("Picture 1").Copy
ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False,
DisplayAsIcon:=False

NickHK

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Background:
> 1. User clicks button that copies picture from a worksheet to the
> clipboard (CopyReport routine).
> 2. User pastes clipboard to a new workbook.
>
> Issue:
> The pasted picture retains code attached to its click event
> (Picture1_Click).
>
> Question:
> How can I modify the CopyReport code to remove the picture's
> associated Picture1_Click routine when the picture is pasted to
> another workbook. The code would need to appear within Picture1_Click.
>
> TIA...
>
> Sub CopyReport()
>
> Application.ScreenUpdating = False
>
> 'Copy to pictures to clipboard
> Sheet4.Select
> ActiveSheet.Shapes.Range(Array("Picture 1", "Picture 2")).Select
> Selection.Copy
> Sheet2.Select
>
> End Sub
>
> Sub Picture1_Click()
>
> If Not Sheet1.Visible Then
> If MsgBox("Do you want to unhide the underlying report?",
> vbYesNo, "Unhide Worksheet") = vbYes Then
> Sheet1.Visible = xlSheetVisible
> Else
> Exit Sub
> End If
> Else
> Sheet1.Activate
> End If
>
> End Sub
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fire event code with Hyperlink and copy/paste RadioButtons ryguy7272 Microsoft Excel Programming 3 6th May 2010 07:46 PM
Event drivin copy and paste code GoBucks Microsoft Excel Programming 7 7th May 2009 03:04 PM
Event Code Error trying to insert a picture pmnaughton Microsoft Excel Programming 2 16th Jan 2009 04:16 PM
Does DataSet.Copy() remove event handlers? =?Utf-8?B?QmrDuHJuIFRlcmplIFN2ZW5uZXM=?= Microsoft ADO .NET 0 5th Mar 2007 12:14 PM
COPY & PAST -REMOVE HANDLES EVENT Agnes Microsoft VB .NET 0 29th Aug 2005 10:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:15 AM.