Type Mismatch Error

S

Sarah (OGI)

I'm getting a type mismatch error, at the point of 'For Each pic In
wsSource.Pictures' in the following code - any ideas why this might be?

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

Set wsSource = Workbooks("test.xls").Worksheets("Summary")
Set wsDest = Worksheets("PC (Chart)-NI-MONTH")

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
============
 
P

paul.robinson

Hi
I don't think worksheets or even workbooks have a picture object. Try
Shape in the Shapes class (this may pick up comments and buttons
however).

regards
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Copy current color of conditional formatted cell 4
MACRO HELP PLEASE 15
MACRO HELP CONTINUED 3
Not getting "argument type mismatch" 4
MACRO help 9
Array coding type mismatch 6
Mismatch Error 6
type mismatch 1

Top