(Solved) – Return a Boolean value from one function to another function – VBA

(solved)-–-return-a-boolean-value-from-one-function-to-another-function-–-vba

I’m learning VBA and I’m having trouble returning a boolean value from one function to another. I’ve been seeing other similar questions to try to solve but I couldn’t.

So, I have this function :

 Public Function Verifica_Permite_Gas()

 Dim permit As Boolean


' Se a torneira permite gasta
If Permite_GAS Then

    permit = True

Else
    ' Não permite
    Debug.Print "Erro torneira nao devia conter Gas - Torneira_3 - metodo Permite_GAS"

    permit = False

End If

 End Function

And you should return the value for this function

Public Function Verifica_Gas()

Dim permite As Boolean

permite = listaTorneiraSetor(a).Verifica_Permite_Gas()

End Function

The program works, has no errors but always returns false even when Permit_GAS = TRUE
I don’t understand why, can someone help me solve it?

Leave a Reply

Your email address will not be published. Required fields are marked *