-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEXCEL_CHART_ERROR_BAR_LIBR.bas
executable file
·96 lines (80 loc) · 3.43 KB
/
EXCEL_CHART_ERROR_BAR_LIBR.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Attribute VB_Name = "EXCEL_CHART_ERROR_BAR_LIBR"
'--------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------
Option Explicit 'Requires that all variables to be declared explicitly.
Option Base 1 'The "Option Base" statement allows to specify 0 or 1 as the
'default first index of arrays.
'--------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------
'************************************************************************************
'************************************************************************************
'FUNCTION : EXCEL_CHART_ERROR_BAR_ADD_FUNC
'DESCRIPTION :
'LIBRARY : EXCEL_CHART
'GROUP : ERROR_BAR
'ID : 001
'AUTHOR : RAFAEL NICOLAS FERMIN COTA
'************************************************************************************
'************************************************************************************
Function EXCEL_CHART_ERROR_BAR_ADD_FUNC(ByRef CHART_OBJ As Excel.Chart, _
ByVal SERIE_NAME_STR As Variant, _
ByVal RNG_ADDRESS_STR As String, _
ByVal AMOUNT_VAL As Long)
Dim SERIES_OBJ As Excel.Series
On Error GoTo ERROR_LABEL
CHART_FORMAT_FRAME_FUNC = False
Set SERIES_OBJ = CHART_OBJ.SeriesCollection.NewSeries
With SERIES_OBJ
.name = SERIE_NAME_STR
.Values = RNG_ADDRESS_STR
.ChartType = xlXYScatter
'.ErrorBar Direction:=xlX, Include:=xlNone, Type:=xlFixedValue, Amount:=10000
'.ErrorBar Direction:=xlX, Include:=xlUp, Type:=xlFixedValue, Amount:=20
.ErrorBar direction:=xlX, Include:=xlPlusValues, _
Type:=xlFixedValue, amount:=AMOUNT_VAL 'data_values.Rows.Count
.MarkerBackgroundColorIndex = xlAutomatic
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
With .Border
.WEIGHT = xlHairline
.LineStyle = xlNone
End With
With .ErrorBars.Border
.LineStyle = xlContinuous 'xlGray25
.ColorIndex = 3 '15 /57 /3
.WEIGHT = xlThin 'xlHairline
'End With
.ErrorBars.EndStyle = xlNoCap
End With
Set SERIES_OBJ = Nothing
EXCEL_CHART_ERROR_BAR_ADD_FUNC = True
Exit Function
ERROR_LABEL:
EXCEL_CHART_ERROR_BAR_ADD_FUNC = False
End Function
'************************************************************************************
'************************************************************************************
'FUNCTION : EXCEL_CHART_ERROR_BAR_SET_FUNC
'DESCRIPTION :
'LIBRARY : EXCEL_CHART
'GROUP : ERROR_BAR
'ID : 002
'AUTHOR : RAFAEL NICOLAS FERMIN COTA
'************************************************************************************
'************************************************************************************
Function EXCEL_CHART_ERROR_BAR_SET_FUNC(ByRef SERIE_OBJ As Excel.Series, _
ByRef AMOUNT_ARR As Variant, _
ByRef MINUS_ARR As Variant)
On Error GoTo ERROR_LABEL
EXCEL_CHART_ERROR_BAR_SET_FUNC = False
SERIE_OBJ.ErrorBar direction:=xlY, Include:=xlBoth, _
Type:=xlCustom, amount:=AMOUNT_ARR, _
MinusValues:=MINUS_ARR
EXCEL_CHART_ERROR_BAR_SET_FUNC = True
Exit Function
ERROR_LABEL:
EXCEL_CHART_ERROR_BAR_SET_FUNC = False
End Function