Macro for gradually revealing contents cell by cell

Hi

Hope someone’s can help me with this. I am trying to create a macro that will gradually reveal a previously written list every time I click a button. I hide the text in the cells by changing it to white on white background and what I want the macro to do is to move to a cell below the current and to change the text color to black.

I thought it would be easy to just record a macro with two sub routines and perhaps edit them a bit. But no matter how i do it only one routine works, moving to the cell below - Unless I manually select a cell first.

Does anybody have an answer to why it doesn’t work.

Code posted below:

Edited for clarity:

Sub Main

 End Sub

sub Reveal_text
 rem ----------------------------------------------------------------------
 rem define variables dim document as object dim dispatcher as object
 rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoServ("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Color"
args2(0).Value = 0

dispatcher.executeDispatch(document, ".uno:Color", "", 0, args2())

end sub

I would suggest not to set text color and/or background color explicitly, but to use Conditional Formatting to apply (overlay) a “normal” readable cell style to the unveiled cells while veiled cells have a ‘Numbers’ format that hides every result or direct content.

A Sub providing the information can be assigned to the sheet event ‘Selection changed’. Some functions for call by formatting conditions can access this info then.

You may want to study this attachment.

@Lupp Thank You for advice and information. Most welcomed.

This routine will go DOWN one cell and change the text color to BLACK:

Sub Reveal_text
    dim document as  Object
    dim dispatcher as Object
    dim oCurrSel as   Object

    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, Array())
    oCurrSel = ThisComponent.getCurrentSelection()
    oCurrSel.CharColor = 0
End Sub