LibreOffice Version: 6.1.5.2
I know I’ve raised this question before but never got it resolved.
The following code in a new calc sheet gives no errors and runs fine with the first row filled
with 1 to 5 and 3 in cell 7 or G1. It also needs styles Red and Grn defined.
This identical code in my stock tracking spread sheet gives the error at the point marked
and stops everything else from working.
Any suggestions for tracking down this type of error in 3600+ lines of code is more
than welcome.
Thanks,
Mike
public const DowRowL = 0
public const LastColL =8
public const ColorBarOffsetL = 3
public const DOW = 3
Sub Main
colorBarSetFmtCondLO
End Sub
Sub colorBarSetFmtCondLO()
Dim srcOffset As Integer, whichDay As Integer
Dim cbCol as Long, oCell
whichDay = DoW
cbCol = LastColL - ColorBarOffsetL
srcOffset = 5
oCell = ThisComponent.CurrentController.ActiveSheet.GetCellbyPosition( _
cbCol, DowRowL)
offsetTo20DayAvg = 1 ' offset from cbCell to 20DayAvg cell
If whichDay = offsetTo20DayAvg Then srcOffset = srcOffset + 1
colorBarSetCondFormsLO(oCell, srcOffset, offsetTo20DayAvg)'<-- Expected =
End Sub
Sub colorBarSetCondFormsLO(cbCell, srcOffset as Integer, offset20DayAvg as integer)
Dim srcAddr As String, avg20dayAddr As String
srcAddr = "RC[-" & srcOffset & "]"
avg20dayAddr = "RC[" & offset20DayAvg & "]"
form = "=" & srcAddr & "+STYLE(IF(CURRENT() <" & avg20dayAddr & _
"; ""Red""; ""Grn"" ))"
cbCell.FormulaLocal = form
ThisComponent.CurrentController.Select(cbCell)
if msgbox(form, 1) = 2 then stop
End Sub
[Edit - Opaque] Removed “pre” tagging from non-code text