Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel 2010 Automation issue with workbook object
Message
De
11/12/2013 03:39:44
 
 
À
10/12/2013 13:05:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01589653
Message ID:
01589814
Vues:
52
This message has been marked as the solution to the initial question of the thread.
>>>>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 && XL5 instead of XLS
>>>>>
>>>
>>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform