• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unable to get finance data

uday

Member
Hi,

I have created a macro and assigned to a activex command button, but I am unable to extract the data from Yahoo finance and getting an error message.

Please find the attached file and help me.

Thanks
Uday
 

Attachments

  • Yahoo Finance Data.xlsm
    153 KB · Views: 0

Hi !

• Error message ?
• URL ?
• Which data to extract ?
• Method to grab data ?
• Post script between code tags …

Many samples here and all over the Web, so via a single search …
 
Code is working fine..

Code:
Sub Macro1()
'
' Macro1 Macro
'
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;http://real-chart.finance.yahoo.com/table.csv?s=TCS.NS&d=3&e=5&f=2015&g=d&a=7&b=25&c=2004&ignore=.csv" _
        , Destination:=Range("$A$1"))
'        .CommandType = 0
        .Name = "table.csv?s=TCS.NS&d=3&e=5&f=2015&g=d&a=7&b=25&c=2004&ignore="
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = False
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileOtherDelimiter = ","
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
    Columns("A:A").EntireColumn.AutoFit
End Sub
 
Back
Top