+ Reply to Thread
Results 1 to 4 of 4

Extract alt text from a website with macro

  1. #1
    Registered User
    Join Date
    07-05-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    14.0.07166.5000
    Posts
    2

    Extract alt text from a website with macro

    I have been trying to extract data from a alt="" string, but i keep getting either a error 91 or 428.

    The website is: http://nordeagws.gws.fcnws.com/fs_Ov...=1,2,3,4,5,6,7

    and the data is the morningstar rating, which currently is 4. The problem is that this is not expressed as text but as an image.
    The line is: <img alt="4" src="http://www.excelforum.com/images/nordeagws/ico_ms_4.png"> (I have attached a picture of the website code for navigation).
    I want to extract the "4", but have falied for hours with a lot of different approaches..

    I code is currently as following:

    Sub stock_rating()
    Dim IE As Object

    ' Create InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")


    ' View IE (True/false)
    IE.Visible = False

    IE.navigate "http://nordeagws.gws.fcnws.com/fs_Oversigt.html?isin=DK0010265859&clientid=dknb2&shelves=DKNB2,DKNB2 DFP2,DKNB2 PBPM&currency=DKK&culture=da-DK&CategoryFilter:taborder=1,2,3,4,5,6,7"

    ' Statusbar
    Application.StatusBar = "Loading, Please wait..."

    ' Wait while IE loading...
    Do While IE.Busy
    Application.Wait DateAdd("s", 1, Now)
    Loop

    Application.Wait (Now + TimeValue("00:00:01"))



    Debug.Print IE.document.getelementbyid("BasicData2").getElementsByTagName("img").getAttribute("alt").Text


    End Sub

    Do you have any ideas as to what I'm doing wrong?
    Thanks.
    Attached Images Attached Images
    Last edited by Alexander12345; 07-05-2016 at 11:18 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Extract alt text from a website with macro

    Try the attached.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-05-2016
    Location
    Aarhus, Denmark
    MS-Off Ver
    14.0.07166.5000
    Posts
    2

    Re: Extract alt text from a website with macro

    THANKS!!!!! My nightmare is finally over!!

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Extract alt text from a website with macro

    You are welcome!
    Please mark it as solved. Top hand side drop down menu.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need Help in Creating Macro to extract data from website.
    By houstonking in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2014, 08:04 PM
  2. VBA to log into website to extract data
    By andrewg10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2014, 07:57 PM
  3. Replies: 0
    Last Post: 10-16-2013, 10:58 AM
  4. Replies: 2
    Last Post: 05-18-2013, 02:31 PM
  5. Extract information from a website
    By wieslaw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-03-2013, 05:46 AM
  6. Macro to extract table data from website into my excel file
    By garbisrobert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2012, 02:38 PM

Tags for this Thread

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