View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sarah (OGI) Sarah (OGI) is offline
external usenet poster
 
Posts: 128
Default Type Mismatch Error

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