I’m having a really hard time finding an answer for this, with such generic terminology, and it’s possible my question is still difficult to parse. I have some code with a variable representing the amount of free disk space remaining as a percentage. I want to call it into a function, where I use the reverse amount in a message to the user, i.e. the amount of used space. Can I do a little math in the function call?
Public Sub MyApp()
Dim nFreeSpace As Integer
nFreeSpace = GetFreeSpace
DisplayUsedSpace 100 - nFreeSpace 'Is this valid?
End Sub
Private Function DisplayUsedSpace(ByVal nUsedSpace As Integer) As Boolean
MsgBox("You have used " & nUsedSpace & "% of your disk drive space.")
End Function
Yes, that is valid. Although, I probably would write it as this
But, your code would work fine too.