Home > Forum Home > Analyzing Corporate Financial Data > Macro that will automatically log me into web application > Using a web query instead Share

Using a web query instead

Excel Help for Using A Web Query Instead in Analyzing Corporate Financial Data


Forum TopicLogin

Using A Web Query Instead

Rate this:
(3/5 from 2 votes)
SadInstead of initiating and using the IE object, why not try using a simple web query instead.  The following code may work.

VBA Code:
Sub Login_WebQuery()
Dim MyPost As String
Const MyUrl As String = "https://www.btwholesale.com/siteminderagent/forms/login.fcc"
Const PostUser As String = "USER=" & Worksheets("Login Data").Range("C5").Value
Const PostPassword As String = "&PASSWORD=" & Worksheets("Login Data").Range("D5").Value
   
MyPost = PostUser & PostPassword
   
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
 Excel Business Forums Administrator
 Posted by on
 
View Full Post

Find relevant Excel templates and add-ins for Using a web query instead in the