View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] john.kreps@gmail.com is offline
external usenet poster
 
Posts: 1
Default Copy picture and remove event code

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