Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy picture and remove event code
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 wrote in message oups.com... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How I remove protection from a picture in excel? | Excel Discussion (Misc queries) | |||
Can VSTO handle a Picture click event in Excel? | Excel Programming | |||
copy charts & paste as picture, hide chart, size & place same picture as chart | Excel Programming | |||
Copy Sheets minus Worksheet Change Event code & Macro Buttons | Excel Programming |