+ Reply to Thread
Results 1 to 17 of 17

Accessing IE from excel

  1. #1
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Accessing IE from excel

    Hey everyone,

    I am wanting to make a VB macro in excel that will open an IE page and navigate through it and then export data. Is this possible or does it escape the scope of excel macros? It would be doing the same thing each time the report ran.
    Last edited by ChrisKader; 11-09-2010 at 06:42 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello ChrisKader,

    I have recently posded several different macros to extract data from web pages using IE and VBA. So to answer you question, yes it can be done.
    Last edited by Leith Ross; 11-05-2010 at 05:23 PM. Reason: Retracted statement about searching forum - totally useless
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    I seen a few of your posts but I am not to sure I understand how they work. The webpage does have a login screen with a username/password. And there is also some data that needs to be filled in (Dates, Employees, etc etc) that I would not really know how to implament.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello ChrisKader,

    I would need to see the site and the pages you are interested in before I can code a macro for you. It would make things easier not having to log on to the site. Can you post the links?

  5. #5
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    Unfortunately, the site is internal and proprietary (call center). But I do have the login page source, is there something general you can write up and I can fill in the blanks? I can describe it a little more.

    The data for the report has a start and stop date, I need to click a button to run it. To select employees I click a button and another window pops up with the list of employees and select mine. Then click a button to confirm.

    I really wish I could post code for the site

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello ChrisKader,

    If you can can post a zip file with page source information for each page you are interested in, that would be outstanding. Tell what you want extracted and I'll write the code to do it.

  7. #7
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    I am not allowed to post links or code to the site. AT&T would not be to happy about that.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello Chris,

    Sorry to hear that. You are on your own. The HTML Document Object Model (DOM) is very different from VBA. If you don't have an HTML programming background, this will be difficult for you to do, as you will learning as you go. Here is link that will help. Feel free to ask me any questions you have.

  9. #9
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    Hey Leith,

    So, I am starting with the login page. How would I make a java variable that is the username equal a variable in excel? The answer to this will help later on as well.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello Chris,

    I can not help you with Java, but here is a basic log on script for VBA. This should for you. Just change the user name, password and URL to what you will be using.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 11-05-2010 at 09:07 PM.

  11. #11
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    Hey Leith Ross,

    I got your script working with my site. I ran into a small issue, I get a login confirm screen that requires the users to click OK to continue. What would be the command for that? I tried to use the oInput.Click function, but that did not work.

    Thanks for your help!

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello Chris,

    Is this a Windows dialog box or something from the web server? If it is a Windows dialog and the default button choice is "Yes" or "OK" then using Application.DisplayAlerts may be the answer. I have added it to the code below.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    Hey Leith Ross,

    It is just another page that the login page sends you to and it has an OK button and then redirects you to the actual page.

    Login -> Confim Page -> Actual Page

  14. #14
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello Chris,

    This change assumes there is only one button on the confirmation page to click.
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    10-13-2010
    Location
    Malvern, AR
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Accessing IE from excel

    Hey Leith Ross,

    I tried the above code, and everything stops at the confirmation screen. For some reason, the code is not either seeing that a new page is loaded, or, it does not see the button.

  16. #16
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello Chris,

    Can you send me a copy of the page source for the confirmation screen?

  17. #17
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Accessing IE from excel

    Hello Chris,

    After thinking about this a bit, it could be using an Input Type "Image" instead of "Submit". Check the page source for an Input Image type. The Name property may set to be something like "Submit" or "Enter".

+ 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