+ Reply to Thread
Results 1 to 1 of 1

VBA Web Query

Hybrid View

asdzxc VBA Web Query 05-20-2012, 06:47 AM
  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    VBA Web Query

    In J1, put ^dji
    macro stop at With ActiveSheet.QueryTables.Add(Connection:=StrURL, Destination:=Range("A1"))
    Dim StrURL As String
    On Error Resume Next
    ThisWorkbook.Connections(1).Delete
    Err.Clear: On Error GoTo 0
    StrURL = "URL;http://ichart.finance.yahoo.com/table.csv?s=" & _
    Worksheets("Sheet1").Range("J1").Value & "&a=10&b=13&c=2011&d=06&e=6&f=2013& " & g = "&ignore=.xlsx"
    If Range("H1").Value = "" Then
         StrURL = StrURL & "&g=w&ignore=.xlsx"
    Else
         StrURL = StrURL & "&g=m&ignore=.xlsx"
    End If
            With ActiveSheet.QueryTables.Add(Connection:=StrURL, Destination:=Range("A1"))
                .FieldNames = True
                .RowNumbers = False
                .FillAdjacentFormulas = False
                .PreserveFormatting = True
                .RefreshOnFileOpen = False
                .BackgroundQuery = True
                .RefreshStyle = xlInsertDeleteCells
                .SavePassword = False
                .SaveData = True
                .AdjustColumnWidth = True
                .RefreshPeriod = 0
                .WebSelectionType = xlAllTables
                .WebFormatting = xlWebFormattingNone
                .WebPreFormattedTextToColumns = True
                .WebConsecutiveDelimitersAsOne = True
                .WebSingleBlockTextImport = False
                .WebDisableDateRecognition = False
                .Refresh BackgroundQuery:=False
    Last edited by asdzxc; 05-20-2012 at 07:00 AM.

+ 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