How can I hide/show a shape of my spreadsheet using a macro?

In VBA I was using this code:

Worksheets("Example").Shapes("TheShape").Visible = False

is there something which does the same on LibreOffice Calc?

Shapes and pictures are located on the Drawpage. They are accessed through indexing. Here is an example to access your shape & turn on/off in a basic macro:

  oDrawPage = ThisComponent.getSheets().getByName("Sheet1").getDrawPage()
           'Get total # of objects on DrawPage'
  iCount = oDrawPage.Count
           'Cycle through objects'
  for x = 0 to iCount -1
    oImage = oDrawPage.getByIndex(x)
            'Check for wanted shape'
    If oImage.Name = "Shape1" Then
                 'Toggle visible or not      0 = NOT visible     1 = Visible'
            If oImage.Visible Then
                 oImage.Visible = 0
           Else
                oImage.Visible = 1
           End If
    End If
  Next x

Thank you very much!!! Can you link me to some good online documentation about libreoffice macros? I used to work on Excel, but now I will have to move all my code to LibreOffice. It looks like it’s much powerful than Excel VBA, but a little more complicated.

Unfortunately it can be much more complicated. But here are two sources which should easily get you started:

Open Office Macros Explained - PDF click here

LO documentation - click here

Thanks man!