+ Reply to Thread
Results 1 to 9 of 9

Macro for links with different endings (tickers)

Hybrid View

rolex Macro for links with... 04-14-2015, 04:02 AM
LokeshKumar Re: Macro for links with... 04-14-2015, 04:19 AM
rolex Re: Macro for links with... 04-14-2015, 04:26 AM
rolex Re: Macro for links with... 04-14-2015, 04:38 AM
LokeshKumar Re: Macro for links with... 04-14-2015, 05:28 AM
rolex Re: Macro for links with... 04-14-2015, 06:02 AM
LokeshKumar Re: Macro for links with... 04-14-2015, 06:19 AM
LokeshKumar Re: Macro for links with... 04-14-2015, 06:49 AM
LokeshKumar Re: Macro for links with... 04-15-2015, 01:49 AM
  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    US
    MS-Off Ver
    2007
    Posts
    35

    Macro for links with different endings (tickers)

    SOLVED by KUMAR
    Last edited by rolex; 04-14-2015 at 06:05 AM.

  2. #2
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Macro for links with different endings (tickers)

    Could you give me website link and table name...I will give you code which fetch out data without query connection.
    Lokesh Kumar
    Stay Hungry.. Stay Foolish..
    _________________________________________________________
    Please Click STAR to Add Reputation if my/someone's answer helped!

  3. #3
    Registered User
    Join Date
    04-14-2015
    Location
    US
    MS-Off Ver
    2007
    Posts
    35

    Re: Macro for links with different endings (tickers)

    Getting tickers to excel
    Last edited by rolex; 04-14-2015 at 06:05 AM.

  4. #4
    Registered User
    Join Date
    04-14-2015
    Location
    US
    MS-Off Ver
    2007
    Posts
    35

    Re: Macro for links with different endings (tickers)

    getting tickers to excel from websites
    Last edited by rolex; 04-14-2015 at 06:05 AM.

  5. #5
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Macro for links with different endings (tickers)

    Hi,

    Could you please just try the following code
    Const URl As String = "http://www.netfonds.no/quotes/about.php?paper="
        
    Sub Tickers()
        Dim xmlHttp As Object
        Dim html As HTMLDocument
        Dim MarketValue As Variant
        
            Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
            
                For i = 2 To Range("B1000").End(xlUp).Row
                
                    xmlHttp.Open "GET", URl & Cells(i, 2), False
                    xmlHttp.setRequestHeader "Content-Type", "text/xml"
                    xmlHttp.send
                    
                        Set html = New MSHTML.HTMLDocument
                        html.body.innerHTML = xmlHttp.ResponseText
            
                            MarketValue = html.getElementsByClassName("right")(2).innerText
                            Cells(i, 3) = MarketValue
                Next i
        
    End Sub
    Here is your attachement..Tickers.xlsm

    If your question is resolved, mark it SOLVED using the thread tools. Click on the star if you think some-1 helped you.

  6. #6
    Registered User
    Join Date
    04-14-2015
    Location
    US
    MS-Off Ver
    2007
    Posts
    35

    Re: Macro for links with different endings (tickers)

    Thank you! It looks such short script making more than the one I tried to create which is nowhere near.

    I really appreciate your help, was doing it for along time but now I can see how it should have been done.

  7. #7
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Macro for links with different endings (tickers)

    Click on the star if you think some-1 helped you. in this case its me.......

  8. #8
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Macro for links with different endings (tickers)

    Hey
    Use the following code....
    I tried to send you msg......
    Const URl As String = "http://www.netfonds.no/quotes/about.php?paper="
        
    Sub Tickers()
        Dim xmlHttp As Object
        Dim html As HTMLDocument
        Dim MarketValue As Variant
        
            Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
            
                For i = 2 To Range("B1000").End(xlUp).Row
                    
                    On Error Resume Next
                        xmlHttp.Open "GET", URl & Cells(i, 2), False
                        xmlHttp.setRequestHeader "Content-Type", "text/xml"
                        xmlHttp.send
                        
                            Set html = New MSHTML.HTMLDocument
                            html.body.innerHTML = xmlHttp.ResponseText
                
                                MarketValue = html.getElementsByClassName("right")(2).innerText
                                If Err.Number = 91 Then
                                    Cells(i, 3) = "Incorrect Ticker/Record not Found"
                                Else
                                    Cells(i, 3) = MarketValue
                                End If
                Next i
        
    End Sub

  9. #9
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Macro for links with different endings (tickers)

    Hi
    There is an error since you have not added the following library:-
    Tools->References->Microsoft HTML Object Library...

    I have attached the file after adding the library....hope it will work fine at your end.

    here is your attachment...Tickers.xlsm

    Cheers....

+ 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. Parsing Financial Data for Various Tickers
    By SDGreen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2014, 09:20 AM
  2. Replies: 13
    Last Post: 10-06-2009, 07:50 PM
  3. Req: How to import rates for tickers (financial)?
    By cantog in forum Excel General
    Replies: 1
    Last Post: 07-01-2009, 12:58 PM
  4. Eliminate endings from part numbers
    By infinitysales in forum Excel General
    Replies: 14
    Last Post: 12-12-2008, 05:56 PM
  5. Roundup to .99 endings
    By mj99 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-21-2006, 08:55 PM

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