>>>>>>Thierry
>>>>>>
>>>>>>Thanks - that worked for the client's W7 machine ...... but not for the W8 ! - both running Excel 2010. I will investigate a bit more.... and might be back for more help in due course.
>>>>>>
>>>>>>Thanks for assistance so far.
>>>>>>
>>>>>>Barry
>>>>>>
>>>>>>>what about
>>>>>>>
>>>>>>>COPY TO C:\myfolder\mysheet.XLS TYPE XL5
>>>>>>>
>>>>>
>>>>>FWIW, with COPY TO, you should pretty much always use XL5 rather than XLS. XLS is Excel 2.0 format; many things have changed since then, most importantly, handling of dates and maximum # of rows (and columns, I think).
>>>>>
>>>>>Tamar
>>>>
>>>>Tamar
>>>>Thanks for the pointer. As a related issue - do you know if the ChartWizard method is defunct in Excel2010 - I have encountered a problem with an existing charting application which uses the ChartWizard to get a basic chart in place for me to amend via automation.
>>>>It runs fine against Excel2003 but it now has to run against 2010. I am getting Error message: "OLE IDispatch exception code 0 from S: This object has no title... " and it occurs on the line which calls the ChartWizard.
>>>>
>>>
>>>Seems to still be there:
http://office.microsoft.com/en-us/excel-help/create-a-chart-in-a-worksheet-HP005199491.aspx>>>
>>>Tamar
>>
>>Tamar,
>>Yeah the Chartwizard exists in Excel2010 & 2007, the problem appears to be with the Chartwizard method. I think I have tracked down the problem to the Chartwizard method in Excel2007/2010 not liking multiple data series ....seems fine in Excel2003.
>>
>>As far as I can work out Excel 2007/10 chartwizard method will not accept more than one series data range; 2003 will accept it. To get round this I set the source data outside the wizard and then call the wizard to put in titles etc.
>>
>>This works in all Excel Versions
>>
>>lcRange = "A1:A14,B1:B14"
>>oSourceRange = oWorkBook.Sheets("DataSheet").Range(lcRange)
>>oChart1.ChartWizard(oSourceRange,xlColumn,,xlColumns,1,1,.T.,"Chart Title","X-axis title","Y-axis title")
>>
>>This works in Excel 2003, but not in 2007/10 (note additional data series)
>>
>>lcRange = "A1:A14,B1:B14,C1:C14"
>>oSourceRange = oWorkBook.Sheets("DataSheet").Range(lcRange)
>>oChart1.ChartWizard(oSourceRange,xlColumn,,xlColumns,1,1,.T.,"Chart Title","X-axis title","Y-axis title")
>>
>>To get it to work in 2007/10
>>
>>jcRange = 'A1:A14,B1:14,C1:C14'
>>oSourceRange = oWorkBook.Sheets("DataSheet").Range(jcRange)
>>oChart1.select
>>oWorkbook.activechart.SetSourceData(oSourceRange)
>>oChart1.ChartWizard(oSourceRange,xlColumn,,xlColumns,1,1,.T.,"Chart Title","X-axis title","Y-axis title")
>>
>>
>>The data source range can be left out of the ChartWizard parameter listing - although curiously, it will
>> now accept the extended data source range i.e. once it has been set up.
>>
>>Barry
>
>Try setting the range to 'A1:C14' instead of listing each column separately.
>
>Tamar
Fair comment.... but I was simplifying somewhat... I actually require a non-contiguous range so will need to list each column separately. Even so, I found that trying "A1:C14" failed, but "A1:B14" worked. Which supports the idea that the ChartWizard in 2007/10 is, for some reason, struggling with more than one data series.
I have a solution to the problem that allows the code to work in all Excel versions (to date!) , but thought it might be worth posting this information as a "gotcha" for others (assuming I am not missing something).
Barry.