ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¬°¦óVBA¬d¸ßªºIP»P¹ê»Úºô­¶¤W¬d¸ßªºIP¤£¦P?

[µo°Ý] ¬°¦óVBA¬d¸ßªºIP»P¹ê»Úºô­¶¤W¬d¸ßªºIP¤£¦P?

¤£¦n·N«ä³Â·Ð¦U¦ì¤j¤j,
¤p§Ì¤w¸g§ä¨ì¤j¬ù¤Q­Ó¥i¥H¬d¸ß¨ìIPªºVBAµ{¦¡½X(·íµM¦³³\¦h­«½Æªº)
¦ý¬d¸ßµ²ªG³£¬O192.168.xx.xx

¥i¬O¤p§Ì­nªº¬O¤U¤èºô¯¸
http://dir.twseo.org/ip-check.php
©Ò¬d¸ß¥X¨ÓªºIP=42.72.5.xxx

¬°¦ó©Ò¦³VBAµ{¦¡½X¬d¸ß¥X¨Óªº³£¸òºô­¶¬d¸ßªºIP¤£¦P?¨Ò¦p¤U¤èµ{¦¡½X
  1. Function GetIPAddress()
  2.     Const strComputer As String = "."   ' Computer name. Dot means local computer
  3.     Dim objWMIService, IPConfigSet, IPConfig, IPAddress, i
  4.     Dim strIPAddress As String

  5.     ' Connect to the WMI service
  6.     Set objWMIService = GetObject("winmgmts:" _
  7.         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

  8.     ' Get all TCP/IP-enabled network adapters
  9.     Set IPConfigSet = objWMIService.ExecQuery _
  10.         ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

  11.     ' Get all IP addresses associated with these adapters
  12.     For Each IPConfig In IPConfigSet
  13.         IPAddress = IPConfig.IPAddress
  14.         If Not IsNull(IPAddress) Then
  15.             strIPAddress = strIPAddress & Join(IPAddress, ", ")
  16.         End If
  17.     Next

  18.     MsgBox strIPAddress
  19. End Function
½Æ»s¥N½X
¦U¦ì¤j¤j¥i¦Û¦æ´ú¸Õ¬Ý¬Ý³o¨âºØ¤è¦¡
·|¬d¸ß¥X¨âºØ¤£¦PªºIP

­n¦p¦ó¤~¯à°÷¬d¸ß¨ìºô­¶ªº¨ººØIP¦ì¸m©O?
PKKO

Function GetIPAddress()
        Const strComputer As String = "."   ' Computer name. Dot means local computer
        Dim objWMIService, IPConfigSet, IPConfig, IPAddress, i
        Dim strIPAddress As String

        ' Connect to the WMI service
        Set objWMIService = GetObject("winmgmts:" _
            & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

        ' Get all TCP/IP-enabled network adapters
        Set IPConfigSet = objWMIService.ExecQuery _
            ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

        ' Get all IP addresses associated with these adapters
        For Each IPConfig In IPConfigSet
            IPAddress = IPConfig.IPAddress
            If Not IsNull(IPAddress) Then
                If InStr(1, IPConfig.Description, "WAN (", vbTextCompare) Then
                   MsgBox "ºô­¶ IP = " + IPAddress(0)
                End If
                strIPAddress = strIPAddress & Join(IPAddress, "/") + vbCrLf
            End If
        Next

        MsgBox strIPAddress
    End Function

TOP

¥H§Úªº¬°¨Ò
IPConfig.Description

WAN (PPP/SLIP) Interface  '¼eÀW
Realtek RTL8168/8111 PCI-E Gigabit Ethernet NIC - Packet Scheduler Miniport  ' ¥D¾÷ªO¤Wªº¤º«Øºô¥d
VMware Virtual Ethernet Adapter for VMnet1  'µêÀÀ¾÷¤WªºµêÀÀ¥d
VMware Virtual Ethernet Adapter for VMnet8  'µêÀÀ¾÷¤WªºµêÀÀ¥d

TOP

¦^´_ 3# jackyq


    ·PÁ¤j¤jªº¦^ÂÐ
¤£¹L±zªºµ{¦¡½X°õ¦æ¤§«á
MsgBox "ºô­¶ IP = " + IPAddress(0)=>³o¬qµ{¦¡½X³£µLªk°õ¦æ¨ì

¶]§¹ªºµ²ªG,¸ò§ÚPOªºµ{¦¡½X¤@¼Ë­C
§Ú²{¦b¤Wºô¬dIP=42.XX¶}ÀY
¦ý¬OVBA¬d¥X¨Óªº«o¬O192.168¶}ÀY

¦³¿ìªk¬d¨ì42.XX¶}ÀYªºIP¶Ü?
ÁÙ¬O»¡,¬O¦]¬°§Úªº¹q¸£±µªº¬OWIFI(4g«H¸¹)©Ò¾É­Pªº­ì¦]?
PKKO

TOP

¥»©«³Ì«á¥Ñ jackyq ©ó 2016-2-29 12:40 ½s¿è







¥´¤J  ipconfig  ¬Ý¬Ý¦³µL¥X²{§A­nªºip­È

TOP

¦^´_ 5# jackyq


¨S¦³¥X²{§Ú­nªºIP­C
©Ò¥H¦]¸Ó¬O¦]¬°4G©Ò¾É­PªºÅo?
³£¬O¥X²{192.168.x.x

§Ú¤Wºô¬d¸ßªº³£¬O42.XX¶}ÀY
PKKO

TOP

¥»©«³Ì«á¥Ñ jackyq ©ó 2016-2-29 21:11 ½s¿è

¥i¥H¦Ò¼{¥Î§@¹ú¤èªk
§ìºô­¶¤º®e  http://dir.twseo.org/ip-check.php

TOP

¦^´_ 7# jackyq


    «¢«¢,³o©Û°ª©ú,·PÁ¤j¤j!
PKKO

TOP

        ÀR«ä¦Û¦b : ¤ß¤¤±`¦sµ½¸Ñ¡B¥]®e¡B·P«ä¡Bª¾¨¬¡B±¤ºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD