View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Typemismatch when duplicating graph

Hi,

Looks like a bug. Try referencing the latest chart object.

Dim list As Worksheet, graf As ChartObject

list.ChartObjects(1).Duplicate
Set graf = list.ChartObjects(list.ChartObjects)

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"PBradac" wrote in message
...
Long time ago I have created a VBA code in which I create several
graphs from data in worksheets. It was developed and is still working
in Excel 2003.

Now with Excel 2007 and Excel 2010 Beta I get

Run-time error '13':
Type mismatch

when program control reaches the line:

Set graf = list.ChartObjects(1).Duplicate

The variables are explicitly declared with:

Dim list As Worksheet, graf As ChartObject

Any ideas how to solve the problem?

TIA, Primoz