This is my first post, hope it’s a good one!!
The issue that I’m facing is that in two different excel macros in different woorkbooks I use the internet explorer navigate with a string variable for the url.
The codes are similar for the IExplorer creation and navigate part, they only differ in the string construction, but if we compare the strings in both cases (either trhough add watch or copy/paste) they are the same.
The string I’m assigning is a normal URL which is made of several strings put together.
For workbook A this string is composed of several calls and responses that help building the final string.
For workbook B, parts of the string were written in cells and then used to build up the string to make a call already with the workbook A final string.
Everything works correctly except in workbook B when navigating to the complete url it doesn’t tranfer the whole url, it omits a last part which is a “query” part like this “?type=ST” but the dataurl does have the complete string.
Now the best part, if i write the complete string for the url:
IE.Navigate “https://www.marketwatch.com/investing/stock/aapl?Mod=search” it works and navigates to that complete url (this is an example)
This is the code being used:
Function calling(dataurl As String) As String
Dim IE As InternetExplorer
Dim htmldoc As New HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
Application.StatusBar = "Setting up..."
IE.Visible = False
IE.navigate dataurl
Application.StatusBar = "Calling server..."
Application.Wait (Now + TimeValue("00:00:03"))
Do Until IE.readyState = 4
IE.Refresh2 (3)
Application.Wait (Now + TimeValue("00:00:05"))
Loop
calling = IE.document.body.innerHTML
IE.Quit
Set IE = Nothing
Application.StatusBar = ""
End Function
I’ve tried different browsers for this but IExplorer in the end came through.
Any ideas with this issue?
Thanks for your help.
Javamaral is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.