Code:
Private Declare Function RasEnumConnections Lib "rasapi32" Alias "RasEnumConnectionsA" (ByVal lprasconn As Long, ByVal lpcb As Long, ByVal lpcConnections As Long) As Long
Private Declare Function RasGetConnectionStatistics Lib "rasapi32" (ByVal hRasConn As Long, ByVal lpStatistics As Long) As Long
Private Type RASCONN
    dwSize As Long
    hRasConn As Long
    szEntryName(0 To 256) As Byte
    szDeviceType(0 To 16) As Byte
    szDeviceName(0 To 128) As Byte
    pad As Byte
End Type
Private Type RAS_STATS
    dwSize As Long
    dwBytesXmited As Long
    dwBytesRcved As Long
    dwFramesXmited As Long
    dwFramesRcved As Long
    dwCrcErr As Long
    dwTimeoutErr As Long
    dwAlignmentErr As Long
    dwHardwareOverrunErr As Long
    dwFramingErr As Long
    dwBufferOverrunErr As Long
    dwCompressionRatioIn As Long
    dwCompressionRatioOut As Long
    dwBps As Long
    dwConnectDuration As Long
End Type

Private Sub Form_Load()
    Dim x As RASCONN
    Dim stat As RAS_STATS
    Dim y As Long, z As Long
        
    x.dwSize = Len(x)
    y = x.dwSize
    
    Debug.Print y
    Debug.Print RasEnumConnections(VarPtr(x), VarPtr(y), VarPtr(z))
    Debug.Print z
    Debug.Print y
    Debug.Print StrConv(x.szEntryName, vbUnicode)
    Debug.Print StrConv(x.szDeviceType, vbUnicode)
    Debug.Print StrConv(x.szDeviceName, vbUnicode)

    'i m getting an error below it should return 0 do not know why 
    Debug.Print RasGetConnectionStatistics(x.hRasConn, VarPtr(stat))
    Debug.Print stat.dwBytesRcved
    
    
End Sub