Seite 1 von 1

makepy.py excel - create diagram

Verfasst: Mittwoch 19. Juli 2006, 15:09
von Wolf
Ich habe eine 'Microsoft Excel 11.0 Object Library' aus dem 'EXCEL.EXE'-File erstellt und kann jetzt Excel-Diagramme aus python generieren. Aber wenn ich spezielle Variablen, wie z.B. die 'MajorGridlines" benutze, bekomme ich eine Fehlermeldung.

####### VB-Example
ActiveChart.Axes(xlValue).MajorGridlines.Select
With Selection.Border
.Weight = xlHairline
End With
End Sub
#######

####### Python-Example
c = excel.ActiveChart
c.Axes(excelcom.constants.xlValue).MajorGridlines.Weight = excelcom.constants.xlHairline
#######

Ich bekomme folgenden Fehler: [color=red] AttributeError: '<win32com.gen_py.Microsoft Excel 11.0 Object Library.Gridlines instance at 0x21599600>' object has no attribute 'Weight' [/color]

Wieso kann ich die 'MajorGridlines' nicht manipulieren? Kann es sein, dass mir in meiner Library was fehlt. Wenn ja, was kann ich außer EXCEL.EXE noch heranziehen?

Verfasst: Mittwoch 19. Juli 2006, 15:46
von N317V
So mal aus dem Ärmel geschüttelt: werden solche Graphiken nicht per eingebettetem MS Graph realisiert?

edit: Grad nachgeschaut. Das Programm heißt GRAPH.EXE

Verfasst: Donnerstag 20. Juli 2006, 12:32
von Wolf
Meine Frage ist beantwortet!

Looking at your VBA code, it seems like Weight is a property of Border, not of MajorGridlines.

You may want to try MajorGridlines.Border.Weight = ...

best regards, g

Verfasst: Donnerstag 20. Juli 2006, 12:47
von N317V
Wolf hat geschrieben:Looking at your VBA code, it seems like Weight is a property of Border, not of MajorGridlines.
*handaufstirnschlag* Sorry, das hätt ich auch sehen müssen.