Mostafa Kanza
New Member
- Joined
- Jan 3, 2020
- Messages
- 1
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
I am trying to extract temperature data table based for the city that the user inputs.
so far, i am stuck at writting the city into the website and then clicking search.
after that I want to automate instead of fixed Cairo, i want the user input in excel to be the one in the toolbox
after that I would want to extract the table of that specific city into the excel.
thanks a lot in advance
_____________________________
Sub Extract_MKSA()
'Dim path As Stringpath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
'Dim executable As String executable = path.Combine(path, "C:\Program Files (x86)\Google\Chrome\Application")
'Process.Start(executable, "Google")
Dim html As HTMLDocument
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.addressbar = 0
objIE.StatusBar = 0
objIE.Toolbar = 0
objIE.Visible = True
objIE.navigate ("World Weather Information Service")
Do
DoEvents
Loop Until objIE.Readystate = 4
pageSource = objIE.Document.body.outerhtml
objIE.Document.getElementsByClassName("top_searchbox ui-autocomplete-input").Value = "Cairo" // getelementsbyclassname is not working to input "Cairo"
objIE.Document.getElementsByID("q_search").Value = "Cairo" // this inputs "Cairo" still when i click even manually on the search button it seems as if there is nothing in the websites textbox.
'objIE.Document.getElementsByname("submit").Click // the search button has no id and i am trying to click the button to search for cairo and then later worry about how to extract the table into excel.
End Sub
Thanks a lot in advance.
so far, i am stuck at writting the city into the website and then clicking search.
after that I want to automate instead of fixed Cairo, i want the user input in excel to be the one in the toolbox
after that I would want to extract the table of that specific city into the excel.
thanks a lot in advance
_____________________________
Sub Extract_MKSA()
'Dim path As Stringpath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
'Dim executable As String executable = path.Combine(path, "C:\Program Files (x86)\Google\Chrome\Application")
'Process.Start(executable, "Google")
Dim html As HTMLDocument
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.addressbar = 0
objIE.StatusBar = 0
objIE.Toolbar = 0
objIE.Visible = True
objIE.navigate ("World Weather Information Service")
Do
DoEvents
Loop Until objIE.Readystate = 4
pageSource = objIE.Document.body.outerhtml
objIE.Document.getElementsByClassName("top_searchbox ui-autocomplete-input").Value = "Cairo" // getelementsbyclassname is not working to input "Cairo"
objIE.Document.getElementsByID("q_search").Value = "Cairo" // this inputs "Cairo" still when i click even manually on the search button it seems as if there is nothing in the websites textbox.
'objIE.Document.getElementsByname("submit").Click // the search button has no id and i am trying to click the button to search for cairo and then later worry about how to extract the table into excel.
End Sub
Thanks a lot in advance.