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

Web query still not working

Excel Help for Web Query Still Not Working in Automating Data Analysis Tasks


Forum TopicLogin

Web Query Still Not Working

Rate this:
(3/5 from 1 vote)
ConfusedHi

Sorry to write back, I have go through many web pages to find the code similar to it or method but i didnt get any. Can you send me any link where i can learn this. i dont understand whts wrong in
below mention code.

VBA Code:
Sub downloadnav()
Dim wst As Worksheet
Dim StrDate As String
Dim MyPost As String
Const MyUrl As String = "http://www.idbifortis.com/TrackNAV.aspx?lm1=1"
   
'MyPost = "TxtDate=04-Nov-2009"
'This is where you need to build your string from the date cell
'It may be better to format you cell as dd-mmm-yyy
 StrDate = Range("B5").Text
 MyPost = "TxtDate=" & StrDate
'There are more parameters required when you look at the
'source HTML of the page in question:
 MyPost = MyPost & "&CboFund=0&CboFund=0"
Sheets.Add
ActiveSheet.Name = "temp"
Sheets("temp").Select
'varconnection = MyUrl & TxtDate
      
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;" & MyUrl, Destination:=Cells(1, 1))
            .PostText = MyPost
            .BackgroundQuery = True
            .TablesOnlyFromHTML = True
            .Refresh BackgroundQuery:=False
            .SaveData = True
        End With
End Sub

 Posted by on
 
View Full Post

Find relevant Excel templates and add-ins for web query still not working in the