How can I check the visualize in the bill of material section in visual basic language?

I am writing a macro with VBA and how can I get the control value of the checkbox in the image below as a boolean value?

The code should do my job as follows.

My code needs to contain a check like this. But I don't know how to set a boolean value to a variable.

dim bomcheck as boolean

set bomcheck = oproduct.....getattributeboolean("Visualize in the Bill of Material").


if bomcheck = true then

excelsheet.cells(i,10).value = oproduct.name

excelsheet.cells(i,11).value = oproduct.definition

else
i = i + 1

end if