can't activate chart

M

matthias.rother

hi,

i have a public sub "gen_chart" with the following parameter value
( myobject as object,mychart as chart)


when i call this sub from a form he stops at the following line
("cur_sheets.ChartObjects(cur_chart).Activate")

text = object not set

Private Sub gen_foto(cur_sheets As Object, cur_chart As String, name
As String, _
min_x As Single, max_x As Single, min_y As
Single,
_
max_y As Single, position As Integer, show_legend
As Boolean, change_color As Boolean, _
colls() As Variant, Optional name_x As String,
Optional name_y As String)


'cur_sheets As String --> Names des Sheets
'cur_chart As String --> Name des Charts
'name as string --> Charttopic
'min_x As Single --> MIN X-Achse
'max_x As Single --> MAX X-Achse
'min_y As Single --> MIN Y-Achse
'max_y As Single --> MAX Y-Achse
'position as integer --> 0 (großes foto),1=zielfoto(links_oben),
2=zielfoto(rechts_oben),3=zielfoto(links_unten),
4=zielfoto(rechts_unten)
'show_legend as boolean --> Show Legend ?
'change_color as boolean --> change background color to orange
'colls() as variant --> Datenreihe (1.dimension = reihe(1-3) |
2.dimension = 0(name),1(x_wert1),2(y_wert1),3(x_wert2),4(y_wert2)


'Optional name_x As String --> Name X-Achse
'Optional name_y As String --> name Y-Achse


cur_sheets.ChartObjects(cur_chart).Activate


On Error Resume Next
'del all collections
Dim del_i As Integer
For del_i = 0 To 20
ActiveChart.SeriesCollection(1).Delete
Next del_i


ActiveChart.ChartType = xlXYScatter


ActiveChart.ChartArea.Select
Selection.AutoScaleFont = False
With Selection.Font
.name = "Arial"
.FontStyle = "fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
..
..
..
..


can anybody help me =???
 
J

JLGWhiz

It is trying to tell you that you have not defined the cur_sheet, or
cur_chart objects.

You need a statement like:

Set cur_sheet = Worksheets("Sheet1")
Set cur_chart = Sheets("Chart1")

changing the names of the sheets to your actual sheet names, of course.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top