' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Private Function StringToLong(addr As String) As Long
    Dim parts() As String
    parts = Split(addr, ".")
    StringToLong = CLng(parts(0)) * 256 * 256 * 256 + CLng(parts(1)) * 256 * 256 + CLng(parts(2)) * 256 + CLng(parts(3))
End Function

Private Sub Check_Click()
    Dim netval As Long
    netval = StringToLong(Net.Text)
    Dim hostval As Long
    hostval = StringToLong(Host.Text)
    Dim netsize As Integer
    netsize = 2 ^ (32 - CInt(Size.Text))
    If (netval <= hostval) And (hostval <= netval + netsize - 1) Then
        MsgBox "Same net"
    Else
        MsgBox "Different net"
    End If
End Sub
