Hi Team
I have a two part problem/question relating to a cell that has 3 steps:
- Starts with formula: “=Coding!$AK$13”
- Coverts to a (0) zero Value.
- Reverts back to having the above formula.
Steps .1 and .2 work as expected, but! I am having issues when using .SetFormula for Step .3.
Here what’s supposed to happen:
When the user clicks “Take Win”, the amount is added to the “Credit” Balance and sC02 is set to zero.
Sub cmdBtn_TakeWin
Dim sN01 As Object
Dim sR01 As Object
Dim sR02 As Object
Dim sC01 As Object
Dim sC02 As Object
Dim iCurVal As long
Dim iWins as Long
Dim iNewVal As long
sN01 = ThisComponent.CurrentController.ActiveSheet
sR01 = sN01.getCellRangebyName("G10")
sR02 = sN01.getCellRangebyName("O10")
sC01 = sR01.getCellByPosition(0,0)
sC02 = sR02.getCellByPosition(0,0)
iCurVal = sC01.Value
iWins = sC02.Value
iNewVal = iCurVal + iWins
sC01.Value = iNewVal
sC02.Value = 0
End Sub
When the user clicks “Play”, Step .3 inserts the formula.
Do I need to change the attribute of the cell…???
Sub cmdBtn_Play
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Calculate", "", 0, Array())
REM----------------------------------------------------------------------
Dim sN01 As Object
Dim sR01 As Object
Dim sR02 As Object
Dim sR03 As Object
Dim sC01 As Object
Dim sC02 As Object
Dim sC03 As Object
Dim iCurVal As long
Dim iBet as Long
Dim iNewVal As long
sN01 = ThisComponent.CurrentController.ActiveSheet
sR01 = sN01.getCellRangebyName("G10")
sR02 = sN01.getCellRangebyName("K10")
sR03 = sN01.getCellRangebyName("O10")
sC01 = sR01.getCellByPosition(0,0)
sC02 = sR02.getCellByPosition(0,0)
sC03 = sR03.getCellByPosition(0,0)
iCurVal = sC01.Value
iBet = sC02.Value
iNewVal = iCurVal - iBet
sC01.Value = iNewVal
sR03 = sN01.getCellRangebyName("O10")
sC03 = sR03.SetFormula = "=Coding!$AK$13"
End Sub
TIA
Mark