Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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
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
How I remove protection from a picture in excel? Graphics747 Excel Discussion (Misc queries) 1 October 22nd 08 05:38 AM
Can VSTO handle a Picture click event in Excel? Yuhong Excel Programming 0 December 3rd 04 05:37 PM
copy charts & paste as picture, hide chart, size & place same picture as chart Gunnar Johansson Excel Programming 0 October 30th 04 01:22 AM
Copy Sheets minus Worksheet Change Event code & Macro Buttons Bob[_36_] Excel Programming 0 October 8th 03 01:17 AM


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

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

About Us

"It's about Microsoft Excel"