Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ============ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Type Mismatch Error
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 On Apr 29, 12:14*pm, Sarah (OGI) wrote: 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 ============ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
runtime error 13 - type mismatch error in Excel 97 on Citrix | Excel Programming | |||
Conditional Formatting - Run Time Error '13' Type Mismatch Error | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error | Excel Programming |