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