Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Graficos con Automatizacion
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00699987
Message ID:
00700483
Views:
11
This message has been marked as the solution to the initial question of the thread.
>WITH oExcel
> .Range("B2:C12").Select
>
> .Charts.Add
> .ActiveChart.ChartType = -4102
> Source=.Sheets("Hojas1").Range("B2:C12")
> .ActiveChart.SetSourceData (Source,.ActiveChart.PlotBy =1)
> .ActiveChart.Location (1,"C_Graficos")
> With OExcel.ActiveChart
> .HasTitle = .T.
> .ChartTitle.Characters.Text = "grafica"
> EndWith
>
> .ActiveChart.HasLegend = .T.
>
>******Sale que tengo un error (codigo de error 0x80020006: nombre desconocido)
>******no me reconoce esta sentencia, o como puedo insertarle la etiquetas
>
> .ActiveChart.ApplyDataLabels (.Type=3, .LegendKey=.F., .HasLeaderLines=.T.)
>****
> With oExcel.ActiveChart
> .Elevation = 25
> .Perspective = 30
> .Rotation = 0
> .RightAngleAxes = .T.
> .HeightPercent = 70
> EndWith
>
>ENDWITH
>
>Sera que hay alguna solucion ?


Tienes que entender que VBA usa el concepto de variable por nombre ("named variables"). VFP no lo usa. O sea que en VFP no puedes decir .ActiveChart.ApplyDataLabels (.Type=3, .LegendKey=.F., .HasLeaderLines=.T.)

Corre lo siguiente:
WITH oExcel
    .Range("B2:C12").Select
    .Charts.Add
    .ActiveChart.ChartType = -4102
    * Source=.Sheets("Hojas1").Range("B2:C12")   && incorrecto. Falta .Source y no hace falta
    *.ActiveChart.SetSourceData (Source,.ActiveChart.PlotBy =1)  && mismo problema con named vars
    .ActiveChart.Location (1,"C_Graficos")
    With OExcel.ActiveChart
      .HasTitle = .T.
      .ChartTitle.Characters.Text = "grafica"
    EndWith
    .ActiveChart.HasLegend = .T.

    *.ActiveChart.ApplyDataLabels (.Type=3, .LegendKey=.F., .HasLeaderLines=.T.)
    .ActiveChart.ApplyDataLabels(3,.F.,.T.)   && línea corregida
    * para ser mas claro puedes hacer:
    * ExcelType=3
    * ExcelLegendKey=.F.
    * ExcelHasLeaderLines=.T.
    * .ActiveChart.ApplyDataLabels(ExcelType,ExcelLegendKey,ExcelHasLeaderLines)
    * o usar constantes (fijate en el Wiki de VFP por el archivo de constantes (.H) de Excel

    With oExcel.ActiveChart
        .Elevation = 25
        .Perspective = 30
        .Rotation = 0
        .RightAngleAxes = .T.
        .HeightPercent = 70
    EndWith
ENDWITH
Nota: usa < pre > para formatear código en mensajes en UT.

HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform