Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP to Excel Chart problem...
Message
From
10/10/1998 13:00:31
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/10/1998 15:08:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00144375
Message ID:
00145679
Views:
40
>Thanks for your previous answer but one confusion.
>Example:
>These are the macro statements in Excel
> Sheets("Chart1").Select
> ActiveChart.Walls.Select
> Selection.Interior.ColorIndex = xlNone
> ActiveChart.SeriesCollection(1).Select
> With Selection.Border
> .ColorIndex = 17
> End With
> Selection.Interior.ColorIndex = xlNone
>End Sub
>
>These are what I think should be the Foxpro statements but the last 2 do not work. They give an error.
>o_xlsheet.Chartobjects(1).chart.walls.Interior.ColorIndex = -4142 &&good line
>o_xlsheet.Chartobjects(1).chart.SeriesCollection(1).border.ColorIndex = 17
>o_xlsheet.Chartobjects(1).chart.SeriesCollection(1).Interior.ColorIndex = -4142
>
>Can you tell me what I am doing wrong.
>TIA
>Robert
Robert,
Translating macro if you have used
o_xlsheet.Sheets("Chart1").Select
o_xlsheet.ActiveChart.  && Instead of o_xlsheet.Chartobjects(1).chart.
there wouldn't be any error. Funny terminology is somewhat different (to me maybe) between VB and VFP. Chartobject is a container for embedded charts (Excel doesn't threat chart on a separate sheet as embedded ? Instead of chartobjects container, "chart1" sheet is the container itself - makes sense). Referring to it can be via , selection + activechart or charts(nIndex) ( instead of chartobjects(nIndex).chart - chartobject has border and interior props in addition to chart ref prop). Now add these lines to previous sample code before "=sys(3006,val(nlLocaleId))
" line to see difference. Notice referencing of two different charts.
with ox.charts(1)  && This is our chart created on a separate sheet
 .walls.Interior.ColorIndex = -4142 &&good line
 .SeriesCollection(2).border.ColorIndex = 17
 .SeriesCollection(2).Interior.ColorIndex = -4142
endwith
with ox.Sheets("Sheet1")  
  .Select
  .chartobjects.Add(100, 100, 200, 200)  && Embedded chart on sheet1
  with .chartobjects(1).chart
    .chartwizard(ox.sheets("Sheet1").range("A1:D3"),;
	                   -4099,5,2,0,1,1,"","","","") && Easy range :)
    .plotby = 2
    .walls.Interior.ColorIndex = -4142 &&good line
    with .SeriesCollection(1)
       .border.ColorIndex = 17
       .Interior.ColorIndex = -4142
    endwith   
  endwith
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform