Scriptorium

us fr nl




VBA: Internet

Loading information from the internet in Excel using the XMLHTTP Object
Please check the improved article on my new website here: http://www.vba-and-excel.com/vba/internet/6-loading-information-from-the-internet-using-the-xmlhttp-object This routine shows you how to use the XMLHTTP object to retrieve information from the internet in Excel. This object doesn't require an instance of Internet Explorer to be started and is generally considered to be faster then the IE Document object (which does require an IE instance). In addition this object has equivalent implementations in other browsers such as Mozilla, Safari, Konquerer, Icebrowser and Opera meaning written code around the XMLHTTP object can be easily ported for use with other browsers.

Ping a computer in VBA using WMI
Windows Management Instrumentation (WMI) provides a uniform interface for any local or remote applications or scripts that obtain management data from a computer system, a network, or an enterprise. Information such as a computer name, logged in user and even process data can be easily retrieved using any script language that supports ActiveX objects.

Ping a computer in VBA
Windows Scripting is a very powerful tool to work with a network. You can do many things with it. This example demonstrates the usage of the Shell and FileSystem object to do a ping to a server on the internet.

Looking up the IP address of a domain
If you want to lookup the IP address of a domain you could resort to using API calls in VBA because there is no standard function for doing this. Another (easier) way is to use a third party utility to lookup the IP address and use that from VBA.

Login to a site using the Internet Explorer Application, controlled from VBA
This sub routine shows how to use the Internet Explorer Application from VBA.

Login to a site using the Internet Explorer Application with a direct URL controlled from VBA
This sub routine shows how to use the Internet Explorer Application to login to a site using a direct URL, all from with VBA code. Normally when you enter your webmail for example, you start on the login page. After entering your credentials you are then taken further. Doing this in a browser (or browser object) takes time because the login page has to be opened and (if visible) rendered. It's important to know that a login page usually does nothing else but collecting data (login name and password for example) and then sends that data to the server for processing. Using a direct URL skips the login page. The data needed to login is feeded by a VBA routine to the server by means of a direct URL. It's really a simple technique that works most of the time and it surprises me that you hardly see it used in VBA routines. In fact I haven't seen it used before and that's silly because in a lot of situations this is easier to implement then going throught the login process as described in the other login routine listed on this site (http://scriptorium.serve-it.nl/view.php?sid=30)

Loading information from the internet in Excel using the Internet Explorer Document object
This routine shows you how to use the Internet Explorer Document object to retrieve information from the internet in Excel.

Load and Print a webpage in Internet Explorer, all directed by Excel VBA
This Sub opens IE and feeds it with an URL. The webpage is then printed and IE is closed.

Atom Feed
Contact | About This Application | Scriptorium Website