Home > Forum Home > Automating Data Analysis Tasks > Automating a web query login to download data > Web Query problem: not able to pass through login page Share

Web Query problem: not able to pass through login page

Excel Help for Web Query Problem: Not Able To Pass Through Login Page in Automating Data Analysis Tasks


Forum TopicLogin

Web Query Problem: Not Able To Pass Through Login Page

Rate this:
(3/5 from 6 votes)
Confused
Hi all,
I am trying to run a web query using VBA, but not able to pass through the login screen. I am using the following code for the query. 
I am trying access the website using the URL: [http://www.inkresearch.ca/coReport/coReport.php?ticker=AN]

When I access the website thorugh a browser, first I get a login page at [http://www.inkresearch.ca/]

Once logged in, I get http://www.inkresearch.ca/myInk.php , where I enter a ticker like 'AP' to go to the desired webpage.

Can you please suggest a solution to this problem?

Thanks,
MG.
VBA Code:
Public Sub InkWeb() Dim MyPost As String
Dim MyUrl As String
Dim PostUser As String
Dim PostPassword As String
   
   
   
MyUrl = Trim(Range("A1").Value)         ' URL
PostUser = Trim(Range("A2").Value)      ' Username
PostPassword = Trim(Range("A3").Value)  ' Password
   
MyPost = PostUser & PostPassword
   
With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;" & MyUrl, Destination:=Cells(5, 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 problem: not able to pass through login page in the