I have been delving through multiple websites to try and find some help with IE and web queries and linking them together and have failed to find anything directly related.
I use a web query to Download multiple pages at one time, however, the major problem is that i have to go into the data section log in to the site and then run the query. What I am trying to do is make it so that all I have to do it click a button and have it run completely without having to do the extra step... here is my code (this code runs in conjunction with a another piece that places it in a specific sheet):
Dim ieApp As InternetExplorer
Dim iedoc As Object
Dim ieTable As Object
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.navigate "insert url here"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set iedoc = ieApp.document
With iedoc.forms(0)
.username.Value = "username"
.password.Value = "password"
.submit.Click
End With
'ieApp.Quit
Application.CutCopyMode = False
Set New_Web_Query = dest.Parent.QueryTables.Add(Connection:="URL;" & URL, Destination:=dest)
With New_Web_Query
.Name = "web_query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
I can get it to do each thing of code individually (as in I run the code and it runs IE, but it does not run the query), however, I am just not sure how to link them together. Help would be wonderful. Thank you in advance.
I use a web query to Download multiple pages at one time, however, the major problem is that i have to go into the data section log in to the site and then run the query. What I am trying to do is make it so that all I have to do it click a button and have it run completely without having to do the extra step... here is my code (this code runs in conjunction with a another piece that places it in a specific sheet):
Dim ieApp As InternetExplorer
Dim iedoc As Object
Dim ieTable As Object
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.navigate "insert url here"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set iedoc = ieApp.document
With iedoc.forms(0)
.username.Value = "username"
.password.Value = "password"
.submit.Click
End With
'ieApp.Quit
Application.CutCopyMode = False
Set New_Web_Query = dest.Parent.QueryTables.Add(Connection:="URL;" & URL, Destination:=dest)
With New_Web_Query
.Name = "web_query"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
I can get it to do each thing of code individually (as in I run the code and it runs IE, but it does not run the query), however, I am just not sure how to link them together. Help would be wonderful. Thank you in advance.