redbaron06
New Member
- Joined
- Aug 6, 2010
- Messages
- 44
Hi all,
I was wondering if anyone was has been able to create a web query using excel to pull data from a https webpage requring a login. I just threded through past inquries on the web and on the boards to no avail. Below is the current code, which fails to work. Any ideas or suggestions are greatly appreciated!
I was wondering if anyone was has been able to create a web query using excel to pull data from a https webpage requring a login. I just threded through past inquries on the web and on the boards to no avail. Below is the current code, which fails to work. Any ideas or suggestions are greatly appreciated!
Sub GetWebData()
Dim MyPost As String
Const MyUrl As String = https://random.webpage.com/OA_HTML/AppsLocalLogin.jsp?
Const M__Id As String = "username=XXXXXX" 'Change user name here
Const M__Ida As String = "password=******" 'Change password here
Fields = M__Id & M__Ida
With ActiveSheet.QueryTables.Add(Connection:="URL;" & MyUrl, Destination:=Range("A1"))
.PostText = Fields
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub