View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default How to copy a drawing image between sheets

Picture and Pictures is a 'hidden' object and collection at the
DrawingObject level, should work fine in xl2000.

Type don't paste -
Dim pic as picture
After pressing Enter picture will revert to Picture

In a panel object browser F2 right click and select 'Show Hidden Members'

Did you try the macros.

Regards,
Peter T

"clara" wrote in message
...
Hi Peter,

Thanks for your code, unfortunately, I am using Excel 2000 and I can not
find Pictures property of object Worksheet.

Clara
--
thank you so much for your help


"Peter T" wrote:

Hi Clara,

It's not clear if you want to copy individual pictures or all pictures

from
one sheet to another. Here's a pair of macros to do both -

Sub CopyAllPictures()
Dim r As Long, c As Long
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim pic As Picture

Set wsSource = Worksheets("Sheet1")
Set wsDest = Worksheets("Sheet2")

r = wsSource.Rows.Count
c = wsSource.Columns.Count

For Each pic In wsSource.Pictures
With pic.TopLeftCell
If .Row < r Then r = .Row
If .Column < c Then c = .Column
End With
Next

wsDest.Activate
wsDest.Cells(r, c).Activate

wsSource.Pictures.Copy
wsDest.Paste

wsDest.Cells(r, c).Activate

End Sub

Sub CopyOnePicture()
Dim wsSource As Worksheet
Dim wsDest As Worksheet

Set wsSource = Worksheets("Sheet1")
Set wsDest = Worksheets("Sheet2")

Set pic = wsSource.Pictures("Picture 1")

pic.Copy
wsDest.Paste

With wsDest.Pictures(wsDest.Pictures.Count)
.Left = pic.Left
.Top = pic.Top
End With

End Sub

Regards,
Peter T

"clara" wrote in message
...
Hi all

while copying data, I want to copy images between sheets. How can I do

it?


Clara

thank you so much for your help