This code uses the StrPtr (string pointer) function, that return pointer to string.
If the user pressed cancel on the inputbox, the result from the inputbox will be pointer that points to Null (vbNullString Constant), that is equal to 0.
Note that empty string ("") is Not Null.
Private Sub Form_Load()
Dim str As String
str = InputBox("Press OK or Cancel")
If StrPtr(str) = 0
MsgBox "You pressed Cancel"