Toon posts:

[VBA] Sub aanroep: Eigenschap\methode wordt niet ondersteund

Pagina: 1
Acties:
  • 457 views sinds 30-01-2008
  • Reageer

Verwijderd

Topicstarter
Als ik in Excel de volgende macro probeer uit te voeren ( openSheets ) krijg ik bij de laatste instructie ( setSeries(plotChart) ) de foutmelding dat het Object de methode of eigenschap niet ondersteund.

Visual Basic:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Sub openSheets()
    Dim plotChart As Chart
   
    Set plotChart = openPlotChart("TestChart")
    plotChart.SeriesCollection.Add (Worksheets("Sheet1").Range("B1:B9"))
    setSeries (plotChart)
End Sub


Function openPlotChart(naam As String) As Chart
 Charts.Add
 'Charts(1).name = naam
 Set openPlotChart = Charts(1)
End Function

Sub setSeries(pChart As Chart, Optional index As Integer = 1)
   
    pChart.SeriesCollection(index).XValues = Array(0.1, 4, 3, 4, 5, 6, 5)
    pChart.SeriesCollection(index).Type = xlXYScatter
End Sub 



Heb geen idee wat ik fout doe, iemand anders misschien wel?

  • Daos
  • Registratie: Oktober 2004
  • Niet online
Het is dit:
Visual Basic:
6
    Call setSeries(plotChart)

of dit:
Visual Basic:
6
    setSeries plotChart


Dit staat in de help bij Call Statement:
Remarks
You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist. If you use either Call syntax to call any intrinsic or user-defined function, the function's return value is discarded.