'I have a problem when referencing a control element on an OOo spreadsheet from macro

I have a problem when referencing a control element on an OOo spreadsheet from macro. I've tried to use something like .getControl("Checkbox1"), but it`s not working. Maybe I use a wrong method... But how to do this right?

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim argument(0) as new com.sun.star.beans.PropertyValue
oDocument = StarDesktop.ActiveFrame.Controller.Model
oSheets = oDocument.Sheets
oSheet = oSheets.GetByIndex(Store)
rem CHECKING THE STATE OF THE CHECKBOXES
With oSheet

oCheckBox = .GetbyName("ByCard") 
rem this call generates an error

Card = False
Account = False
rem Dump = oCheckBox.getState
if Dump = 1 then Card = True
rem oCheckBox = .getControl("ByAccount")
rem Dump = oCheckBox.getState
if Dump = 1 then Account = True
End With


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source