Finally, the GetMyMACAddress follows a similar approach with GetMyLocalIP function and returns the MAC address of the first adapter that has a non-empty IP.
Ip Geo Location For Excel Free Search CHECKOnly great content straight to your inbox Insert details about how the information is going to be processed Join Us, Its Free Search CHECK ALSO 3 Ways To Hide Call Hidden Macros In VBA PDF Search Through VBA Get Set The Default Windows Printer With VBA Open A Password-Protected PDF File With VBA Add Records Into Existing Access Table From Excel Using VBA Article Navigation Introduction As the title implies, today we will learn how to retrieve the local and the public IP address, as well as the MAC address of a computer using VBA.First of all, the definition of IP address according to Wikipedia is the following: An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or network interface identification and location addressing. Its role has been characterized as follows: A name indicates what we seek. Public or external IP VS local or private IP A publicexternal IP address is any valid address, or number, that can be accessed over the Internet. Internet standards groups, such as the Network Information Center (NIC) or the Internet Assigned Numbers Authority (IANA), are the organizations responsible for registering IP ranges and assigning them to organizations, such as Internet Service Providers (ISPs). On the other hand, a localprivate IP address is any number or address assigned to a device on a private TCPIP Local Area Network that is accessible only within the Local Area Network. For a resource inside the Local Area Network to be accessible over the Internet, a device within the Local Area Network must be connected to the Internet with a public IP address, and the networking must be appropriately configured. MAC address (from Wikipedia ) A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and WiFi. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI reference model. MAC addresses are most often assigned by the manufacturer of a network interface controller (NIC) and are stored in its hardware, such as the cards read-only memory or some other firmware mechanism. If assigned by the manufacturer, a MAC address usually encodes the manufacturers registered identification number and may be referred to as the burned-in address (BIA). It may also be known as an Ethernet hardware address (EHA), hardware address or physical address. This can be contrasted to a programmed address, where the host device issues commands to the NIC to use an arbitrary address. Simplistic definitions When I am thinking of IP or MAC address, one simple term comes always to my mind: the national identity number ID number. MAC address is the hardwares ID number (usually the ID number of the network adapter), whereas the IP address is the ID number of the computer over the local or the global network. As the ID number is used by the governments of many countries as a means of tracking their citizens, similarly the MAC and IP addresses are used over a local or global network (internet) to track down different computers or devices. Manual solution The short video below demonstrates two manual ways of retrieving the local IP and MAC address of your computer, as well as a single way to retrieve your publicexternal IP: Network connection details (local IP and MAC address). Command prompt ipconfig and getmac (local IP and MAC address). Moreover, the video also presents the results from the VBA functions that are given below. VBA code Unfortunately, there is no way to get programmatically the publicexternal IP of a computer without communicating with another computer over the internet. Thus, the GetMyPublicIP function sends a request to and returns the response text. The GetMyLocalIP function, on the other hand, uses WMI to get the IP addresses from the network adapters that have the property IPEnabled equal to true; then it returns the first non-empty IP.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |