Home > Forum Home > Automating Data Analysis Tasks > Download Historical NAV form web > Revised code still not working Share

Revised code still not working

Excel Help for Revised Code Still Not Working in Automating Data Analysis Tasks


Forum TopicLogin

Revised Code Still Not Working

Rate this:
(3/5 from 1 vote)
ConfusedDear Sir

I have done modification in web query but still, its not working, it download only current data, not the date entered in cell value i.e B5

I will greatly appreciate your any help on this

VBA Code:
Sub downloadnav()
   
   
    Dim bmonth, bday, byear, emonth, eday, eyear As Integer
    Dim wst As Worksheet
    Dim TxtDate As String
    Const MyUrl As String = "http://www.idbifortis.com/TrackNAV.aspx?lm1=1"
   

    bmonth = Month(Range("b5").Value)
    bday = Day(Range("b5").Value)
    byear = Year(Range("b5").Value)
       
   
   
    TxtDate = bmonth - 1 & "&b=" & bday & "&c=" & byear & "&d=" & emonth - 1 & "&g=d&q=q&s=" & "&y=0&x=.csv"
'Get the data
'-----------------------------------------------------------------------------------------------------
   Sheets.Add
    ActiveSheet.Name = "temp"
    Sheets("temp").Select
        varconnection = MyUrl & TxtDate
       
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;" & varconnection, Destination:=Range( _
            "A1"))
            .Name = "TrackNAV.aspx?lm1=1"
                .RefreshStyle = xlInsertDeleteCells
               .WebFormatting = xlWebFormattingNone
        .WebTables = """DGNav"""
               .Refresh BackgroundQuery:=False
        End With
        End Sub

 Posted by on
 
View Full Post

Find relevant Excel templates and add-ins for Revised code still not working in the