xref: /aoo41x/main/wizards/source/depot/Internet.xba (revision cdf0e10c)
1*cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
2*cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Internet" script:language="StarBasic">REM  *****  BASIC  *****
4*cdf0e10cSrcweirOption Explicit
5*cdf0e10cSrcweirPublic sNewSheetName as String
6*cdf0e10cSrcweir
7*cdf0e10cSrcweirFunction CheckHistoryControls()
8*cdf0e10cSrcweirDim bLocGoOn as Boolean
9*cdf0e10cSrcweirDim Firstdate as Date
10*cdf0e10cSrcweirDim LastDate as Date
11*cdf0e10cSrcweir	LastDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
12*cdf0e10cSrcweir	FirstDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
13*cdf0e10cSrcweir	bLocGoOn = FirstDate &lt;&gt; 0 And LastDate &lt;&gt; 0
14*cdf0e10cSrcweir	If bLocGoOn Then
15*cdf0e10cSrcweir		If FirstDate &gt;= LastDate Then
16*cdf0e10cSrcweir			Msgbox(sMsgStartDatebeforeEndDate,16, sProductname)
17*cdf0e10cSrcweir			bLocGoOn = False
18*cdf0e10cSrcweir		End If
19*cdf0e10cSrcweir	End If
20*cdf0e10cSrcweir	CheckHistoryControls = bLocGoon
21*cdf0e10cSrcweirEnd Function
22*cdf0e10cSrcweir
23*cdf0e10cSrcweir
24*cdf0e10cSrcweirSub InsertCompanyHistory()
25*cdf0e10cSrcweirDim StockName as String
26*cdf0e10cSrcweirDim CurRow as Integer
27*cdf0e10cSrcweirDim sMsgInternetError as String
28*cdf0e10cSrcweirDim CurRate as Double
29*cdf0e10cSrcweirDim oCell as Object
30*cdf0e10cSrcweirDim sStockID as String
31*cdf0e10cSrcweirDim ChartSource as String
32*cdf0e10cSrcweir	If CheckHistoryControls() Then
33*cdf0e10cSrcweir		StartDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
34*cdf0e10cSrcweir		EndDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
35*cdf0e10cSrcweir		DlgStockRates.EndExecute()
36*cdf0e10cSrcweir		If StockRatesModel.optDaily.State = 1 Then
37*cdf0e10cSrcweir			sInterval = &quot;d&quot;
38*cdf0e10cSrcweir			iStep = 1
39*cdf0e10cSrcweir		ElseIf StockRatesModel.optWeekly.State = 1 Then
40*cdf0e10cSrcweir			sInterval = &quot;w&quot;
41*cdf0e10cSrcweir			iStep = 7
42*cdf0e10cSrcweir			StartDate = StartDate - WeekDay(StartDate) + 2
43*cdf0e10cSrcweir			EndDate = EndDate - WeekDay(EndDate) + 2
44*cdf0e10cSrcweir		End If
45*cdf0e10cSrcweir		iEndDay = Day(EndDate)
46*cdf0e10cSrcweir		iEndMonth = Month(EndDate)
47*cdf0e10cSrcweir		iEndYear = Year(EndDate)
48*cdf0e10cSrcweir		iStartDay = Day(StartDate)
49*cdf0e10cSrcweir		iStartMonth = Month(StartDate)
50*cdf0e10cSrcweir		iStartYear = Year(StartDate)
51*cdf0e10cSrcweir&apos;		oDocument.AddActionLock()
52*cdf0e10cSrcweir		UnprotectSheets(oSheets)
53*cdf0e10cSrcweir		InitializeStatusline(&quot;&quot;, 10, 1)
54*cdf0e10cSrcweir		oBackGroundSheet = oSheets.GetbyName(&quot;Background&quot;)
55*cdf0e10cSrcweir		StockName = DlgStockRates.GetControl(&quot;lstStockNames&quot;).GetSelectedItem()
56*cdf0e10cSrcweir		CurRow = GetStockRowIndex(Stockname)
57*cdf0e10cSrcweir		sStockID = oFirstSheet.GetCellByPosition(SBCOLUMNID1, CurRow).String
58*cdf0e10cSrcweir		ChartSource = ReplaceString(HistoryChartSource, sStockID, &quot;&lt;StockID&gt;&quot;)
59*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, iStartDay, &quot;&lt;StartDay&gt;&quot;)
60*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, cStr(iStartMonth-1), &quot;&lt;StartMonth&gt;&quot;)
61*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, iStartYear, &quot;&lt;StartYear&gt;&quot;)
62*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, iEndDay, &quot;&lt;EndDay&gt;&quot;)
63*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, cStr(iEndMonth-1), &quot;&lt;EndMonth&gt;&quot;)
64*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, iEndYear, &quot;&lt;EndYear&gt;&quot;)
65*cdf0e10cSrcweir		ChartSource = ReplaceString(ChartSource, sInterval, &quot;&lt;interval&gt;&quot;)
66*cdf0e10cSrcweir		oStatusLine.SetValue(2)
67*cdf0e10cSrcweir		If GetCurrentRate(ChartSource, CurRate, 1) Then
68*cdf0e10cSrcweir			oStatusLine.SetValue(8)
69*cdf0e10cSrcweir			UpdateValue(StockName, Today, CurRate)
70*cdf0e10cSrcweir			oStatusLine.SetValue(9)
71*cdf0e10cSrcweir			UpdateChart(StockName)
72*cdf0e10cSrcweir			oStatusLine.SetValue(10)
73*cdf0e10cSrcweir		Else
74*cdf0e10cSrcweir			sMsgInternetError = Stockname &amp; &quot;: &quot; &amp; sNoInternetDataAvailable &amp; chr(13) &amp; sCheckInternetSettings
75*cdf0e10cSrcweir			Msgbox(sMsgInternetError, 16, sProductname)
76*cdf0e10cSrcweir		End If
77*cdf0e10cSrcweir		ProtectSheets(oSheets)
78*cdf0e10cSrcweir		oStatusLine.End
79*cdf0e10cSrcweir		If oSheets.HasbyName(sNewSheetName) Then
80*cdf0e10cSrcweir			oController.ActiveSheet = oSheets.GetByName(sNewSheetName)
81*cdf0e10cSrcweir		End If
82*cdf0e10cSrcweir&apos;		oDocument.RemoveActionLock()
83*cdf0e10cSrcweir	End If
84*cdf0e10cSrcweirEnd Sub
85*cdf0e10cSrcweir
86*cdf0e10cSrcweir
87*cdf0e10cSrcweir
88*cdf0e10cSrcweirSub InternetUpdate()
89*cdf0e10cSrcweirDim i as Integer
90*cdf0e10cSrcweirDim StocksCount as Integer
91*cdf0e10cSrcweirDim iStartRow as Integer
92*cdf0e10cSrcweirDim sUrl as String
93*cdf0e10cSrcweirDim StockName as String
94*cdf0e10cSrcweirDim CurRate as Double
95*cdf0e10cSrcweirDim oCell as Object
96*cdf0e10cSrcweirDim sMsgInternetError as String
97*cdf0e10cSrcweirDim sStockID as String
98*cdf0e10cSrcweirDim ChartSource as String
99*cdf0e10cSrcweir&apos;	oDocument.AddActionLock()
100*cdf0e10cSrcweir	Initialize(True)
101*cdf0e10cSrcweir	UnprotectSheets(oSheets)
102*cdf0e10cSrcweir	StocksCount = GetStocksCount(iStartRow)
103*cdf0e10cSrcweir	InitializeStatusline(&quot;&quot;, StocksCount + 1, 1)
104*cdf0e10cSrcweir	Today = CDate(Date)
105*cdf0e10cSrcweir	For i = iStartRow + 1 To iStartRow + StocksCount
106*cdf0e10cSrcweir		StockName = oFirstSheet.GetCellbyPosition(SBCOLUMNNAME1, i).String
107*cdf0e10cSrcweir		sStockID = oFirstSheet.GetCellByPosition(SBCOLUMNID1, i).String
108*cdf0e10cSrcweir		ChartSource = ReplaceString(sCurChartSource, sStockID, &quot;&lt;StockID&gt;&quot;)
109*cdf0e10cSrcweir		If GetCurrentRate(ChartSource, CurRate, 0) Then
110*cdf0e10cSrcweir			InsertCurrentValue(CurRate, i, Now)
111*cdf0e10cSrcweir		Else
112*cdf0e10cSrcweir			sMsgInternetError = Stockname &amp; &quot;: &quot; &amp; sNoInternetDataAvailable &amp; chr(13) &amp; sCheckInternetSettings
113*cdf0e10cSrcweir			Msgbox(sMsgInternetError, 16, sProductname)
114*cdf0e10cSrcweir		End If
115*cdf0e10cSrcweir		oStatusline.SetValue(i - iStartRow + 1)
116*cdf0e10cSrcweir	Next
117*cdf0e10cSrcweir	ProtectSheets(oSheets)
118*cdf0e10cSrcweir	oStatusLine.End
119*cdf0e10cSrcweir&apos;	oDocument.RemoveActionLock
120*cdf0e10cSrcweirEnd Sub
121*cdf0e10cSrcweir
122*cdf0e10cSrcweir
123*cdf0e10cSrcweir
124*cdf0e10cSrcweirFunction GetCurrentRate(sUrl as String, fValue As Double, iValueRow as Integer) as Boolean
125*cdf0e10cSrcweirDim sFilter As String
126*cdf0e10cSrcweirDim sOptions As String
127*cdf0e10cSrcweirDim oLinkSheet As Object
128*cdf0e10cSrcweirDim sDate as String
129*cdf0e10cSrcweir	If oSheets.hasByName(&quot;Link&quot;) Then
130*cdf0e10cSrcweir		oLinkSheet = oSheets.getByName(&quot;Link&quot;)
131*cdf0e10cSrcweir	Else
132*cdf0e10cSrcweir		oLinkSheet = oDocument.createInstance(&quot;com.sun.star.sheet.Spreadsheet&quot;)
133*cdf0e10cSrcweir		oSheets.insertByName(&quot;Link&quot;, oLinkSheet)
134*cdf0e10cSrcweir		oLinkSheet.IsVisible = False
135*cdf0e10cSrcweir	End If
136*cdf0e10cSrcweir
137*cdf0e10cSrcweir	sFilter = &quot;Text - txt - csv (StarCalc)&quot;
138*cdf0e10cSrcweir	sOptions = sCurSeparator &amp; &quot;,34,SYSTEM,1,1/10/2/10/3/10/4/10/5/10/6/10/7/10/8/10/9/10&quot;
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir	oLinkSheet.LinkMode = com.sun.star.sheet.SheetLinkMode.NONE
141*cdf0e10cSrcweir	oLinkSheet.link(sUrl, &quot;&quot;, sFilter, sOptions, 1 )
142*cdf0e10cSrcweir	fValue = oLinkSheet.getCellByPosition(iValueCol, iValueRow).Value
143*cdf0e10cSrcweir	If fValue = 0 Then
144*cdf0e10cSrcweir		Dim sValue as String
145*cdf0e10cSrcweir		sValue = oLinkSheet.getCellByPosition(1, iValueRow).String
146*cdf0e10cSrcweir		sValue = ReplaceString(sValue, &quot;.&quot;,&quot;,&quot;)
147*cdf0e10cSrcweir		fValue = Val(sValue)
148*cdf0e10cSrcweir	End If
149*cdf0e10cSrcweir	GetCurrentRate = fValue &lt;&gt; 0
150*cdf0e10cSrcweirEnd Function
151*cdf0e10cSrcweir
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir
154*cdf0e10cSrcweirSub UpdateValue(ByVal sName As String, fDate As Double, fValue As Double )
155*cdf0e10cSrcweirDim oSheet As Object
156*cdf0e10cSrcweirDim iColumn As Long
157*cdf0e10cSrcweirDim iRow As Long
158*cdf0e10cSrcweirDim i as Integer
159*cdf0e10cSrcweirDim oCell As Object
160*cdf0e10cSrcweirDim LastDate as Date
161*cdf0e10cSrcweirDim bLeaveLoop as Boolean
162*cdf0e10cSrcweirDim RemoveCount as Integer
163*cdf0e10cSrcweirDim iLastRow as Integer
164*cdf0e10cSrcweirDim iLastLinkRow as Integer
165*cdf0e10cSrcweirDim dDate as Date
166*cdf0e10cSrcweirDim CurDate as Date
167*cdf0e10cSrcweirDim oLinkSheet as Object
168*cdf0e10cSrcweirDim StartIndex as Integer
169*cdf0e10cSrcweirDim iCellValue as Long
170*cdf0e10cSrcweir	&apos; Insert Sheet with Company - Chart
171*cdf0e10cSrcweir	sName = CheckNewSheetname(oSheets, sName)
172*cdf0e10cSrcweir	If NOT oSheets.hasByName(sName) Then
173*cdf0e10cSrcweir		oSheets.CopybyName(&quot;Background&quot;, sName, oSheets.Count)
174*cdf0e10cSrcweir		oSheet = oSheets.getByName(sName)
175*cdf0e10cSrcweir		iCurRow = SBSTARTROW
176*cdf0e10cSrcweir		iMaxRow = iCurRow
177*cdf0e10cSrcweir		oCell = oSheet.getCellByPosition(SBDATECOLUMN, iCurRow)
178*cdf0e10cSrcweir		oCell.Value = fDate
179*cdf0e10cSrcweir	End If
180*cdf0e10cSrcweir	sNewSheetName = sName
181*cdf0e10cSrcweir	oLinkSheet = oSheets.GetByName(&quot;Link&quot;)
182*cdf0e10cSrcweir	oSheet = oSheets.getByName(sName)
183*cdf0e10cSrcweir	iLastRow = GetLastUsedRow(oSheet)- 2
184*cdf0e10cSrcweir	iLastLinkRow = GetLastUsedRow(oLinkSheet)
185*cdf0e10cSrcweir	iCurRow = iLastRow
186*cdf0e10cSrcweir	bLeaveLoop = False
187*cdf0e10cSrcweir	RemoveCount = 0
188*cdf0e10cSrcweir	&apos; Delete all Cells in Date Area
189*cdf0e10cSrcweir	Do
190*cdf0e10cSrcweir		oCell = oSheet.GetCellbyPosition(SBDATECOLUMN,iCurRow)
191*cdf0e10cSrcweir		If oCell.CellStyle = sColumnHeader Then
192*cdf0e10cSrcweir			bLeaveLoop = True
193*cdf0e10cSrcweir			StartIndex = iCurRow
194*cdf0e10cSrcweir			iCurRow = iCurRow + 1
195*cdf0e10cSrcweir		Else
196*cdf0e10cSrcweir			RemoveCount = RemoveCount + 1
197*cdf0e10cSrcweir			iCurRow = iCurRow - 1
198*cdf0e10cSrcweir		End If
199*cdf0e10cSrcweir	Loop Until bLeaveLoop
200*cdf0e10cSrcweir	If RemoveCount &gt; 1 Then
201*cdf0e10cSrcweir		oSheet.Rows.RemoveByIndex(iCurRow, RemoveCount-1)
202*cdf0e10cSrcweir	End If
203*cdf0e10cSrcweir	For i = 1 To iLastLinkRow
204*cdf0e10cSrcweir		oCell = oSheet.GetCellbyPosition(SBDATECOLUMN,iCurRow)
205*cdf0e10cSrcweir		iCellValue = oLinkSheet.GetCellByPosition(0,i).Value
206*cdf0e10cSrcweir		If iCellValue &gt; 0 Then
207*cdf0e10cSrcweir			oCell.SetValue(oLinkSheet.GetCellByPosition(0,i).Value)
208*cdf0e10cSrcweir		Else
209*cdf0e10cSrcweir			oCell.SetValue(StringToDate(oLinkSheet.GetCellByPosition(0,i).String)
210*cdf0e10cSrcweir		End If
211*cdf0e10cSrcweir		oCell = oSheet.GetCellbyPosition(SBVALUECOLUMN,iCurRow)
212*cdf0e10cSrcweir		oCell.SetValue(oLinkSheet.GetCellByPosition(4,i).Value)
213*cdf0e10cSrcweir		If i &lt; iLastLinkRow Then
214*cdf0e10cSrcweir			iCurRow = iCurRow + 1
215*cdf0e10cSrcweir			oSheet.Rows.InsertByIndex(iCurRow,1)
216*cdf0e10cSrcweir		End If
217*cdf0e10cSrcweir	Next i
218*cdf0e10cSrcweir	iMaxRow = iCurRow
219*cdf0e10cSrcweirEnd Sub
220*cdf0e10cSrcweir
221*cdf0e10cSrcweir
222*cdf0e10cSrcweirFunction StringToDate(DateString as String) as Date
223*cdf0e10cSrcweirDim ShortMonths(11)
224*cdf0e10cSrcweirDim DateList() as String
225*cdf0e10cSrcweirDim MaxIndex as Integer
226*cdf0e10cSrcweirDim i as Integer
227*cdf0e10cSrcweir	ShortMonths(0) = &quot;Jan&quot;
228*cdf0e10cSrcweir	ShortMonths(1) = &quot;Feb&quot;
229*cdf0e10cSrcweir	ShortMonths(2) = &quot;Mar&quot;
230*cdf0e10cSrcweir	ShortMonths(3) = &quot;Apr&quot;
231*cdf0e10cSrcweir	ShortMonths(4) = &quot;May&quot;
232*cdf0e10cSrcweir	ShortMonths(5) = &quot;Jun&quot;
233*cdf0e10cSrcweir	ShortMonths(6) = &quot;Jul&quot;
234*cdf0e10cSrcweir	ShortMonths(7) = &quot;Aug&quot;
235*cdf0e10cSrcweir	ShortMonths(8) = &quot;Sep&quot;
236*cdf0e10cSrcweir	ShortMonths(9) = &quot;Oct&quot;
237*cdf0e10cSrcweir	ShortMonths(10) = &quot;Nov&quot;
238*cdf0e10cSrcweir	ShortMonths(11) = &quot;Dec&quot;
239*cdf0e10cSrcweir	For i = 0 To 11
240*cdf0e10cSrcweir		DateString = ReplaceString(DateString,CStr(i+1),ShortMonths(i))
241*cdf0e10cSrcweir	Next i
242*cdf0e10cSrcweir	DateString = ReplaceString(DateString, &quot;.&quot;, &quot;-&quot;)
243*cdf0e10cSrcweir	StringToDate = CDate(DateString)
244*cdf0e10cSrcweirEnd Function
245*cdf0e10cSrcweir
246*cdf0e10cSrcweir
247*cdf0e10cSrcweirSub UpdateChart(sName As String)
248*cdf0e10cSrcweirDim oSheet As Object
249*cdf0e10cSrcweirDim oCell As Object, oCursor As Object
250*cdf0e10cSrcweirDim oChartRange As Object
251*cdf0e10cSrcweirDim oEmbeddedChart As Object, oCharts As Object
252*cdf0e10cSrcweirDim oChart As Object, oDiagram As Object
253*cdf0e10cSrcweirDim oYAxis As Object, oXAxis As Object
254*cdf0e10cSrcweirDim fMin As Double, fMax As Double
255*cdf0e10cSrcweirDim nDateFormat As Long
256*cdf0e10cSrcweirDim aPos As Variant
257*cdf0e10cSrcweirDim aSize As Variant
258*cdf0e10cSrcweirDim oContainerChart as Object
259*cdf0e10cSrcweirDim mRangeAddresses(0) as New com.sun.star.table.CellRangeAddress
260*cdf0e10cSrcweir	mRangeAddresses(0).Sheet = GetSheetIndex(oSheets, sNewSheetName)
261*cdf0e10cSrcweir	mRangeAddresses(0).StartColumn = SBDATECOLUMN
262*cdf0e10cSrcweir	mRangeAddresses(0).StartRow = SBSTARTROW-1
263*cdf0e10cSrcweir	mRangeAddresses(0).EndColumn = SBVALUECOLUMN
264*cdf0e10cSrcweir	mRangeAddresses(0).EndRow = iMaxRow
265*cdf0e10cSrcweir
266*cdf0e10cSrcweir	oSheet = oDocument.Sheets.getByName(sNewSheetName)
267*cdf0e10cSrcweir	oCharts = oSheet.Charts
268*cdf0e10cSrcweir
269*cdf0e10cSrcweir	If Not oCharts.hasElements Then
270*cdf0e10cSrcweir		oSheet.GetCellbyPosition(2,2).SetString(sName)
271*cdf0e10cSrcweir		oChartRange = oSheet.getCellRangeByPosition(SBDATECOLUMN,6,5,SBSTARTROW-3)
272*cdf0e10cSrcweir		aPos = oChartRange.Position
273*cdf0e10cSrcweir		aSize = oChartRange.Size
274*cdf0e10cSrcweir
275*cdf0e10cSrcweir		Dim oRectangleShape As New com.sun.star.awt.Rectangle
276*cdf0e10cSrcweir		oRectangleShape.X = aPos.X
277*cdf0e10cSrcweir		oRectangleShape.Y = aPos.Y
278*cdf0e10cSrcweir		oRectangleShape.Width = aSize.Width
279*cdf0e10cSrcweir		oRectangleShape.Height = aSize.Height
280*cdf0e10cSrcweir		oCharts.addNewByName(sName, oRectangleShape, mRangeAddresses(), True, False)
281*cdf0e10cSrcweir		oContainerChart = oCharts.getByName(sName)
282*cdf0e10cSrcweir		oChart = oContainerChart.EmbeddedObject
283*cdf0e10cSrcweir		oChart.Title.String	= &quot;&quot;
284*cdf0e10cSrcweir		oChart.HasLegend = False
285*cdf0e10cSrcweir		oChart.diagram = oChart.createInstance(&quot;com.sun.star.chart.XYDiagram&quot;)
286*cdf0e10cSrcweir		oDiagram = oChart.Diagram
287*cdf0e10cSrcweir		oDiagram.DataRowSource = com.sun.star.chart.ChartDataRowSource.COLUMNS
288*cdf0e10cSrcweir		oChart.Area.LineStyle = com.sun.star.drawing.LineStyle.SOLID
289*cdf0e10cSrcweir		oXAxis = oDiagram.XAxis
290*cdf0e10cSrcweir		oXAxis.TextBreak = False
291*cdf0e10cSrcweir		nDateFormat = oXAxis.NumberFormats.getStandardFormat(com.sun.star.util.NumberFormat.DATE, oDocLocale)
292*cdf0e10cSrcweir
293*cdf0e10cSrcweir		oYAxis = oDiagram.getYAxis()
294*cdf0e10cSrcweir		oYAxis.AutoOrigin = True
295*cdf0e10cSrcweir	Else
296*cdf0e10cSrcweir		oChart = oCharts(0)
297*cdf0e10cSrcweir		oChart.Ranges = mRangeAddresses()
298*cdf0e10cSrcweir		oChart.HasRowHeaders = False
299*cdf0e10cSrcweir		oEmbeddedChart = oChart.EmbeddedObject
300*cdf0e10cSrcweir		oDiagram = oEmbeddedChart.Diagram
301*cdf0e10cSrcweir		oXAxis = oDiagram.XAxis
302*cdf0e10cSrcweir	End If
303*cdf0e10cSrcweir	oXAxis.AutoStepMain = False
304*cdf0e10cSrcweir	oXAxis.AutoStepHelp = False
305*cdf0e10cSrcweir	oXAxis.StepMain = iStep
306*cdf0e10cSrcweir	oXAxis.StepHelp = iStep
307*cdf0e10cSrcweir	fMin = oSheet.getCellByPosition(SBDATECOLUMN,SBSTARTROW).Value
308*cdf0e10cSrcweir	fMax = oSheet.getCellByPosition(SBDATECOLUMN,iMaxRow).Value
309*cdf0e10cSrcweir	oXAxis.Min = fMin
310*cdf0e10cSrcweir	oXAxis.Max = fMax
311*cdf0e10cSrcweir	oXAxis.AutoMin = False
312*cdf0e10cSrcweir	oXAxis.AutoMax = False
313*cdf0e10cSrcweirEnd Sub
314*cdf0e10cSrcweir
315*cdf0e10cSrcweir
316*cdf0e10cSrcweirSub CalculateChartafterSplit(SheetName, NewNumber, OldNumber, NoteText, SplitDate)
317*cdf0e10cSrcweirDim oSheet as Object
318*cdf0e10cSrcweirDim i as Integer
319*cdf0e10cSrcweirDim oValueCell as Object
320*cdf0e10cSrcweirDim oDateCell as Object
321*cdf0e10cSrcweirDim bLeaveLoop as Boolean
322*cdf0e10cSrcweir	If oSheets.HasbyName(SheetName) Then
323*cdf0e10cSrcweir		oSheet = oSheets.GetbyName(SheetName)
324*cdf0e10cSrcweir		i = 0
325*cdf0e10cSrcweir		bLeaveLoop = False
326*cdf0e10cSrcweir		Do
327*cdf0e10cSrcweir			oValueCell = oSheet.GetCellbyPosition(SBVALUECOLUMN, SBSTARTROW + i)
328*cdf0e10cSrcweir			If oValueCell.CellStyle = CurrCellStyle Then
329*cdf0e10cSrcweir				SplitCellValue(oSheet, OldNumber, NewNumber, SBVALUECOLUMN, SBSTARTROW + i, &quot;&quot;)
330*cdf0e10cSrcweir				i = i + 1
331*cdf0e10cSrcweir			Else
332*cdf0e10cSrcweir				bLeaveLoop = True
333*cdf0e10cSrcweir			End If
334*cdf0e10cSrcweir		Loop Until bLeaveLoop
335*cdf0e10cSrcweir		oDateCell = oSheet.GetCellbyPosition(SBDATECOLUMN, SBSTARTROW + i-1)
336*cdf0e10cSrcweir		oDateCell.Annotation.SetString(NoteText)
337*cdf0e10cSrcweir	End If
338*cdf0e10cSrcweirEnd Sub
339*cdf0e10cSrcweir</script:module>