Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert Excel Chart in Word
Message
From
22/07/2011 11:54:15
 
 
To
21/07/2011 09:50:46
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01518504
Message ID:
01518917
Views:
35
Hi Tamar,

have you any idea on how to size the chart? It is getting inserted way too big.

>>>>
>>>>	oChart = oWorkbook.Charts.Add()
>>>>	oChart.ChartWizard(m.oSourceRange,  -4102, 4 , 2, 1, 0, .T., [My Chart Title])
>>>>
>>>>
>>>>Collapse(0) collapses the range to a point at the end of the range. Ah, just looked at the code again. Later on, I delete the bookmark.
>>>>
>>>>Tamar
>>>
>>>Thanks I can do that.
>>>
>>>How do I define the oSourceRange (I have to admit that I never grokked the Range thing with automation)?
>>>
>>>I have data in A1 to D7. I have code like this:
>>>
>>>
LOCAL loXL AS Excel.APPLICATION
>>>LOCAL loXLWorkbook as EXCEL.Workbook
>>>
>>>m.loXL = CREATEOBJECT("Excel.Application")
>>>m.loXLWorkbook = m.loXL.Workbooks.Add()
>>>
>>>m.lnRowCount = 0
>>>SCAN
>>>	m.lnRowCount = m.lnRowCount + 1
>>>	m.loXLWorkbook.ActiveSheet
>>>	m.loXLWorkbook.ActiveSheet.Cells[m.lnRowCount,1].VALUE = c_TurnaroundChart.Y
>>>	m.loXLWorkbook.ActiveSheet.Cells[m.lnRowCount,2].VALUE = c_TurnaroundChart.M
>>>	m.loXLWorkbook.ActiveSheet.Cells[m.lnRowCount,3].VALUE = c_TurnaroundChart.TotalReceived
>>>	m.loXLWorkbook.ActiveSheet.Cells[m.lnRowCount,4].VALUE = c_TurnaroundChart.AvgTurnaround
>>>ENDSCAN
>>>
>>>
>>>m.loChart1 = m.loXLWorkbook.Charts.Add()
>>>				
>>>m.loSourceRange = m.loXLWorkbook.ActiveSheet.Range("A1:D" + transform(m.lnRowCount))
>>>m.loChart1.ChartWizard(m.loSourceRange,  -4102, 4 , 2, 1, 0, .T., [My Chart Title])
>>>
>>>I get an OLE error: unknown name on this line:
>>>
>>>
m.loSourceRange = m.loXLWorkbook.ActiveSheet.Range("A1:D" + transform(m.lnRowCount))
>>>
>>>Also, where can I get the parameter values for ChartWizard? The Object Browser only shows three options for the second parameter, none of which are -4102!
>>
>>It turns out that if I define the Source Range before adding the chart it works!
>
>Glad you figured it out. (I'm at a client site all day on Wednesdays, so don't get in here at all.)
>
>Tamar
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform