+ Reply to Thread
Results 1 to 4 of 4

Using Macros for Internet Explorer Control

  1. #1
    Registered User
    Join Date
    09-07-2010
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    2

    Using Macros for Internet Explorer Control

    Hi, I am creating an excel document that automatically log's into a webpage and copies data back to a spread sheet. I can login and copy the data back to excel but I have the following problems:

    1. After logging in I run another macro to retrieve data but it opens another explorer window. How do you use an explorer window already open? I am opening explorer using CODE: Set ie = CreateObject("Internetexplorer.Application")

    2. How can you check the url of the page you are currently on, or on multiple explorer windows? and can you use a wild key? for example "www.google.com/*"

    I am a little new to this, not sure if the answer is simple and infront of me.

    Thanks in advance for any help.
    Last edited by PaulAS; 09-07-2010 at 03:31 PM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Using Macros for Internet Explorer Control

    1. Just use ie again.
    2. Not sure what you mean - if you are automating IE, you should know what page you're on.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    09-07-2010
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Using Macros for Internet Explorer Control

    1. I have a button on my main page to login to a website, there are other buttons on the same page that either display a web page or copy data back to excel. Once I have clicked login button the screen goes back to excel and if the user clicks a button to display a particular web page it creates another explorer window. Once the user has finished with the excel document it can leave multiple windows open which i would like to prevent but I don't want to close all intances of internet explorer either just incase they have other work open.

    2. I would like to check the url of the page because if the user trys to login but already is logged in the page gets redirected also the website has a login timeout (which is way to short) and if the user clicks a button to view the web page while logged out it will direct to the login screen and stop, I would like to check the url for this and set it to run the login macro before re-routing to the web page. As for the wild key I was thinking I could check all instances of explorer open on the website and close when loggin out using the answer from 1.

    Thanks

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Using Macros for Internet Explorer Control

    If you are creating the explorer windows in your code, you should keep the references to each instance in a Collection; then, when your app exits, you can loop through the collection and just terminate the instances that you opened.
    To check the url, you can access the ie.document.url

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1