Excel VBA Introduction Part 47.1 - Browsing to Websites and Scraping a Web Page

Share
Embed
  • Published on Nov 13, 2016
  • PLEASE NOTE: x-rates.com now uses https rather than http. Please update the code as necessary.
    By Andrew Gould
    Download files here www.wiseowl.co.uk/videos/excelvba/scraping-web-pages.htm
    www.wiseowl.co.uk - Scraping a web page in VBA involves getting a reference to an HTML document and then processing its elements to extract the useful parts and write them to another location in a readable format. This video shows you how to do that using both Internet Explorer and basic XML HTTP requests. You'll learn a bit about the Document Object Model, as well as how to identify HTML elements by name and by tag type. You'll also see how to loop through various collections of HTML elements and their children using an example involving exchange rate tables.
    If you'd like to help fund Wise Owl's conversion of tea and biscuits into quality training videos you can click this link www.wiseowl.co.uk/donate?t=1 to make a donation. Thanks for watching!
    You can buy our Introduction to Excel VBA book here www.lulu.com/shop/andrew-gould/introduction-to-excel-vba/paperback/product-23301058.html
    Visit www.wiseowl.co.uk for more online training resources in Microsoft Excel, SQL Server, Reporting Services, Analysis Services, Integration Services, ASP.NET, C#, Visual Basic, Microsoft Access, Microsoft PowerPoint, Microsoft Word, Microsoft Project, Microsoft Publisher, Microsoft Visio and more

Comments • 233

  • Александр Жеребко

    Thank you for your lessons. They are helpfull. But please, speak a bit slower next time. Some of you fans do not speak english as good as you. Thank you again.

  • Mahesh Kumar
    Mahesh Kumar 13 days ago

    im having one query on span class, how to get values from it (www.xe.com/)

  • Mahesh Kumar
    Mahesh Kumar 13 days ago +1

    Wow.. what a video, Awesome Sir

  • Elnur Shabanov
    Elnur Shabanov 23 days ago

    Your explanation is superbly detailed!

  • Michael Lass
    Michael Lass 24 days ago +2

    I have to say, this has been the best video I have watched on scraping. Very well explained.

    • WiseOwlTutorials
      WiseOwlTutorials  24 days ago +1

      Thanks Michael, happy to hear you found it useful and thanks for watching!

  • Eric Huechteman
    Eric Huechteman 26 days ago

    When I try the IE.Document.forms... at 16:38, I get "Object required" error. My code is exactly the same....

    • WiseOwlTutorials
      WiseOwlTutorials  25 days ago

      Strange, it still works when I try it. Perhaps you could add an extra condition to the loop like so:
      Do While IE.ReadyState READYSTATE_COMPLETE And IE.Busy
      Loop
      I hope that helps!

  • Aaron Chiche
    Aaron Chiche Month ago

    I tried to scrap from the following website property.phila.gov/ but I got stuck at the clicking part. It seems the site is using javascript ... Is there a way to make it work?

    • WiseOwlTutorials
      WiseOwlTutorials  Month ago

      Hi Aaron, you can make this work by applying the Submit method to the form rather than trying to click the button. Here's some example code that will perform a search for 1234 Market Street and write out the results to a worksheet, I hope it helps!
      Sub Philly()
      Dim IE As New SHDocVw.InternetExplorer
      Dim HTMLDoc As MSHTML.HTMLDocument
      Dim HTMLInput As MSHTML.IHTMLElement
      Dim HTMLForm As MSHTML.HTMLFormElement
      Dim HTMLTable As MSHTML.IHTMLElement

      IE.Visible = True
      IE.navigate "property.phila.gov/"

      Do While IE.ReadyState READYSTATE_COMPLETE Or IE.Busy
      Loop

      Set HTMLDoc = IE.Document

      'Enter input value
      Set HTMLInput = HTMLDoc.getElementById("search-address")
      HTMLInput.Value = "1234 Market Street"

      'Submit the form
      Set HTMLForm = HTMLDoc.forms(0)
      HTMLForm.submit

      'Wait to allow page to process
      Application.Wait Now + TimeValue("00:00:05")

      Set HTMLDoc = IE.Document

      'Get a reference to the results table using its class name
      Set HTMLTable = HTMLDoc.getElementsByClassName("tablesaw tablesaw-stack")(0)

      WriteTableToWorksheet HTMLTable

      End Sub
      Sub WriteTableToWorksheet(TableToProcess As MSHTML.IHTMLElement)
      Dim TableSection As MSHTML.IHTMLElement
      Dim TableRow As MSHTML.IHTMLElement
      Dim TableCell As MSHTML.IHTMLElement
      Dim BookieLink As MSHTML.IHTMLElement
      Dim RowNum As Long, ColNum As Long
      Dim OutputSheet As Worksheet

      RowNum = 0
      ColNum = 0

      Set OutputSheet = ThisWorkbook.Worksheets.Add

      For Each TableSection In TableToProcess.Children

      For Each TableRow In TableSection.Children

      RowNum = RowNum + 1

      For Each TableCell In TableRow.Children

      ColNum = ColNum + 1
      Debug.Print TableCell.tagName

      If TableCell.tagName = "TD" Then
      OutputSheet.Cells(RowNum, ColNum).Value = TableCell.getElementsByClassName("tablesaw-cell-content")(0).innerText
      Else
      OutputSheet.Cells(RowNum, ColNum).Value = TableCell.innerText
      End If

      Next TableCell

      ColNum = 0

      Next TableRow

      Next TableSection

      OutputSheet.Range("A1").CurrentRegion.EntireColumn.AutoFit

      End Sub

    • Aaron Chiche
      Aaron Chiche Month ago

      I also tried to use the following command: Application.SendKeys "~" to "press" enter after the search text is pasted into the field but it would not work.

  • sushil sharma
    sushil sharma Month ago

    Sub Webtest_1()
    Dim ie As SHDocVw.InternetExplorer
    Set ie = New SHDocVw.InternetExplorer

    ie.Visible = True
    ie.navigate ("en.wikipedia.org/wiki/main_page")

    Do While ie.ReadyState READYSTATE_COMPLETE
    Loop

    Debug.Print ie.LocationName, ie.LocationURL

    ie.Document.forms("Searchform").elements("search").Value = "Document Object Model"
    ie.Document.forms("Searchform").elements("go").Click

    End Sub

    I am writing same kind of code but getting an error.
    " Run-time error '424'
    Object Required "
    what is it mean?

    • WiseOwlTutorials
      WiseOwlTutorials  Month ago +1

      Hi sushil, try these two lines instead:
      ie.document.forms("searchform").elements("searchInput").Value = "Document Object Model"
      ie.document.forms("searchform").elements("go").Click
      I hope that helps!

  • Ravi Singhal
    Ravi Singhal Month ago

    Hello sir.. I need your help, i want to automate the process in which i want to upload the image from my local drive... I am able to do most of the step.. But i need your help in pasting the file path in dialog box open after clicking on upload pic... Please help me out.

    • WiseOwlTutorials
      WiseOwlTutorials  Month ago

      Hi Ravi, sorry I'm not sure on that one - I think posting a question on Stackoverflow is your best chance to get help with this question!

  • Jayjay F
    Jayjay F Month ago

    Can u use google chrome instead of internet explorer, would u need a different library for that?

    • WiseOwlTutorials
      WiseOwlTutorials  Month ago

      Hi Jay, Selenium is what you need to manipulate Chrome via VBA codingislove.com/browser-automation-in-excel-selenium/

  • Trolha14
    Trolha14 Month ago

    Awesome tutorial!!!
    Could someone tell me if it’s possible to populate those tables, rows and cells with data?
    How can we do that?

  • Daniel P
    Daniel P Month ago +1

    Thank you so much for this

  • Sreeraj Gopinathan Kadungalloor

    Excellent tutorials sir , could you please make a tutorial on how to work with date picker while web scraping. This would be really helpful.

    • WiseOwlTutorials
      WiseOwlTutorials  2 months ago

      Hi Sreeraj, we do have a video which explains how to install the Date Time Picker control ru-clip.net/video/JtRQC5qnrHQ/video.html (although it may be difficult to find a copy of the file these days). Using the control for web-scraping is really no different to using it for any other purpose. You can access the date picked by using the Value property of the control:
      Dim DatePicked As Date
      DatePicked = DTPicker1.Value
      You can then use that value for whatever you need!

  • Mirko Prazzoli
    Mirko Prazzoli 2 months ago +1

    53:00 I have an issue with the attribute .send, it doesn't work when I run the macro and give me an error at that line. Any explanation?
    Ps. Amazing video :)

    • WiseOwlTutorials
      WiseOwlTutorials  2 months ago

      Happy you managed to get it working Robert, thanks for letting me know!

    • WiseOwlTutorials
      WiseOwlTutorials  2 months ago

      Great! Happy you got it working!

    • Robert Sparkman
      Robert Sparkman 2 months ago +1

      ​@WiseOwlTutorials I have tried both HTTPS and HTTP, neither are working for me :(
      love the video so much

      re:
      I tried: www.x-rates.com/table/?from=GBP&amount=3
      the "www." seems to have resolved the error

    • Mirko Prazzoli
      Mirko Prazzoli 2 months ago +1

      @WiseOwlTutorials has anyone told you that you are genius? Thanks so much, it works now

    • WiseOwlTutorials
      WiseOwlTutorials  2 months ago

      Thanks Mirko! You may need to change the URL to use HTTPS rather than HTTP (the video was recorded quite a while ago!). I hope that helps and thanks for watching!

  • Michelle Goodwin
    Michelle Goodwin 2 months ago

    This is the best.

  • ahmed AhMeD
    ahmed AhMeD 2 months ago

    Thank you, how about if the web page have Captcha, how to make the XML approach work? Thanks

    • ahmed AhMeD
      ahmed AhMeD 2 months ago

      @WiseOwlTutorials thank you, what a out an allready open Ie with loaded page, how to handle it? I don't want to navigate and load the page again, is there a way to handle it, if so how to differentiate between more than one instance all are loaded I mean how to target the correct one, thank you

  • yogeshwarpe
    yogeshwarpe 2 months ago

    First of all thank you very much!!! for the in depth knowledge on this section which made our life so easy with doing tedious tasks while working. Secondly we gained helpful knowledge on getting bots deployed at work for us :-)
    You're awesome Sir!!!!

  • Quinton Ballenden
    Quinton Ballenden 2 months ago

    Simply outstanding!

  • Samuel Roya
    Samuel Roya 2 months ago

    @54:37 If anyone gets "Run-time error '-2147024891 (800700005)': Access is denied." Then change to

  • Justin Cortes
    Justin Cortes 2 months ago

    I've been looking everywhere for this

  • Uttam kumar
    Uttam kumar 3 months ago

    Hello Sir,

    I have one request to you. Please make a video on google map scraping using VBA. That we can extract email, phone number, etc. from google map.
    It will help us a lot.

    Thank you!

  • mauricio montilla
    mauricio montilla 3 months ago

    you are the best

    • mauricio montilla
      mauricio montilla 3 months ago

      @WiseOwlTutorials Just one question, when i want to execute a code. And Set HTMLDoc = IE.Document i end up with "The object invoked has disconnected from its clients." error. Any tip? thanks

  • Joshua Beckey
    Joshua Beckey 3 months ago

    This is dope.

  • TechConnect & Learning
    TechConnect & Learning 3 months ago

    Hi Adrew, Could you please assist me on below error which I am facing while running the code "Error Code 462 Remote server machine does not exit or is unavailable". Below is my VBA code a week ago code was working fine but post upgrading window 10 facing this issue in VBA as well as vb.net also.Sub IEautomations()
    Dim IE As SHDocVw.InternetExplorer
    Set IE = New SHDocVw.InternetExplorerDim MyWebPageDocument As MSHTML.HTMLDocument
    Dim MyWebPgeEleColl As MSHTML.HTMLElementCollection
    Dim MyWebEle As MSHTML.IHTMLElementIE.navigate ("google.com")
    IE.Visible = TrueDo While IE.Busy Or IE.readyState READYSTATE_COMPLETE
    DoEvents
    LoopSet MyWebPageDocument = IE.document
    MyWebPageDocument.getElementsByName("q").Value = "RPA with vb.net"

  • Antonio Spatuzzi
    Antonio Spatuzzi 3 months ago

    Dear WiseOwl, this video is just amazing. This is what i was looking for and tought me something completely new. I've tried to apply this technique to scrape tables from the web to excel and wiht wikipedia and other pages it works, but with this page (www.whoscored.com/Regions/108/Tournaments/5/Italy-Serie-A) it does not work at all. It can't find the tables I'm interested in and it does not show me the innertext of the table I'm interested in. Do you have any explaination why is that?
    I wish you a onderful evening.

    • Antonio Spatuzzi
      Antonio Spatuzzi 3 months ago

      @WiseOwlTutorials my dear, thanks to your help I achieved my goal and I scrape what I needed to scrape. I didn't find any solution until now for Mac but for now it is ok. I moved to the scraping of the next website I need and I used the same code but of course changing the HTML classes and ids. I have only one problem that I can't figure out: most of time the code doesn't go till the end and Error run-91.
      I write you below the code, ptobably you can explain me why. I think the code is correct because a few times work but then next time I run it, doesn't work anymore.
      My aim is to take scrape the table "under-over" for all 3 tabs (Totale-Casa-Fuori). I wish you a wonderful weekend.
      Antonio
      Sub GetOptionUnderOver()
      Dim IE As New SHDocVw.InternetExplorer
      Dim HTMLDoc As MSHTML.HTMLDocument
      Dim TableOptionsLinks As MSHTML.IHTMLElementCollection
      Dim TableOptions As MSHTML.IHTMLElement
      Dim TableOptionLink As MSHTML.IHTMLElement
      IE.Visible = True
      IE.navigate "www.diretta.it/calcio/francia/ligue-1/classifiche/"

      Do While IE.readyState READYSTATE_COMPLETE Or IE.Busy
      Loop

      Set HTMLDoc = IE.document
      Set TableOptions = HTMLDoc.getElementById("tabitem-over_under")
      Set TableOptionsLinks = TableOptions.getElementsByTagName("a")

      For Each TableOptionLink In TableOptionsLinks
      Debug.Print TableOptionLink.href, TableOptionLink.innerText

      If TableOptionLink.href = "www.diretta.it/calcio/francia/ligue-1/classifiche/#over_under" And TableOptionLink.innerText = "Over/Under" Then
      TableOptionLink.Click
      Do While IE.readyState READYSTATE_COMPLETE Or IE.Busy
      Loop
      GetTableTotale HTMLDoc.getElementById("table-type-6-2.5")
      End If
      Next TableOptionLink
      End Sub
      Sub GetTableTotale(HTMLTable As MSHTML.IHTMLElement)

      Dim TableSection As MSHTML.IHTMLElement
      Dim TableRow As MSHTML.IHTMLElement
      Dim TableCell As MSHTML.IHTMLElement
      Dim TableRows As MSHTML.IHTMLElementCollection
      Dim RowNum As Long, ColNum As Integer

      Worksheets("Foglio2").Activate
      RowNum = 1

      For Each TableSection In HTMLTable.Children
      If LCase(TableSection.tagName) "tfoot" Then
      If LCase(TableSection.tagName) = "thead" Then
      Set TableRows = TableSection.getElementsByClassName("main")
      ElseIf LCase(TableSection.tagName) = "tbody" Then
      Set TableRows = TableSection.Children
      End If
      For Each TableRow In TableRows
      ColNum = 1
      For Each TableCell In TableRow.Children
      Cells(RowNum, ColNum).Value = TableCell.innerText
      ColNum = ColNum + 1
      Next TableCell
      RowNum = RowNum + 1
      Next TableRow
      End If
      Next TableSection
      End Sub

    • Antonio Spatuzzi
      Antonio Spatuzzi 3 months ago

      @WiseOwlTutorials I'm speechless. The video that you just did is just amazing. It is really an honor to me that you took so much care of my problem.
      I'm really sorry I didn't give many informations about what I wanted to do, so here it is:
      my aim is to scrape the table "wilde" that you can find in standings and the table "wilde" that you find in form.
      I'm trying to do that right now. My concern is now that I have to click on 3 times on links since I have to push first on wilde, then on form and then one last time on wilde. I wonder if I can do everything in one procedure or not and finally I would like to do everything not using Internet explorer since I'd like to use this code on windows and on Mac. I'll try my best and if I'm gonna stumble in any problem I won't hesitate to ask you.
      Thank you very much for your wondeful work.

  • THEGAMINGHELP101
    THEGAMINGHELP101 4 months ago

    Do you have a video showing how to find an already open instance of internet explorer based on part of the URL instead of opening a new Instance of ie?

    • THEGAMINGHELP101
      THEGAMINGHELP101 4 months ago

      WiseOwlTutorials I figured out how to get a good print out of my data. However it is printing out all the text from the page as one tag. Is there a method to print each new word of a string in a new cell?
      Also do you have a video for clicking drop down menus to eventually click on a download link?

    • THEGAMINGHELP101
      THEGAMINGHELP101 4 months ago

      @WiseOwlTutorials Ok. Also another question. I am trying to implement something like the following. Navigate to an internal database entry a number in a search box and click a button to search (note when clicking button the URL is still the same). Doing the above works no problem using the IE method but using the faster method causes an error after clicking button, is this one of the cases it is not possible to use the fast method or is there a work around?
      Also another question.
      The data I am trying to get is within a table however here is the problem.
      HTML example,
      Table
      Table
      Table
      Table
      Tr
      Td(data I want)
      So as you can tell using the method in the video causes my data to get printed a million times and in odd ways. Do you have any suggestions?

  • CyberNaut WA
    CyberNaut WA 4 months ago

    Followed example, but found XML not work :( Why is it so??

  • Paul Sparrow
    Paul Sparrow 4 months ago

    This is a brilliant video tutorial ! Concise, explanatory and well presented....well done ! I wish I had found this video 2 years ago when I started self-learning how to scrape websites. I have struggled in all that time...now, I hope to take some of these tips to good use.

    • Paul Sparrow
      Paul Sparrow 3 months ago

      @WiseOwlTutorials if you are not confident, then what does that make me ha ha ! I have used my existing basic skills to create a website auto-login tool. You see, at my work place there are thousands of people who have unique Usernames & Passwords for over 10 different sites they have to log into. This is very very time consuming, not forgetting where they store their personal data. So I developed a tool that automates this process using similar coding. Currently, the estimated savings run into multi-millions, using such a simple approach. I am struggling with some coding problems though, I don't suppose you provide 1-2-1 advice by any chance?

  • Pelaja Ahmadi Rahbar
    Pelaja Ahmadi Rahbar 4 months ago

    nice video :D but i have a question: why do you use a Object and not a Array ? is that because the object have more information to carry and a array can´t handle that ?

  • Khushi Gaur
    Khushi Gaur 5 months ago

    Thanks for the video, just need to ask as i have ids under div, then fieldset, and then class. Not able to reach that part to find the element by id and select.... Im not a programmer but tried to follow you... But no success....i can send all the html code to look for...basically after submit on first page it opens another page on same page, that is where i need to select element by id to fill data from excel....see if you can help...

  • Daniel Chang
    Daniel Chang 5 months ago

    i got an error -vba runtime error 214702891 access is denied

  • Scott Jarousky
    Scott Jarousky 5 months ago

    Good Video! I was thinking of loading multiple rows of data from a spreadsheet into an array, then looping through the array to rapidly enter data into a web app (say entering invoices or something repetitive). Once a full record is submitted to the website it may take a variable amount of time for the site to save before I move on to the next record to input. Should I do a "Do While ReadyState..." loop after a record is submitted, not worry about it, or is there something better than a "Do While ReadyState…" loop?

  • DestinyHnn
    DestinyHnn 5 months ago

    I fetched the data from a url, which includes only plain text , in multiple lines, but when I use this code, it put everything in one cell, without line break, can someone help please to add each line in a cell?
    XMLdoc.body.innerHTML = XMLpage.responseText
    Range("B2").Value = XMLdoc.body.innerHTML

  • Alejandro Cerón
    Alejandro Cerón 5 months ago

    Hello sir. I just happen to watch your video a couples of weeks ago, and try it with some pages here at work but it gives me some kind of error on the Do While readystate_complete. It says “the object invoked has disconnected from its clients”. Do you know what is that ? Than you for the help

  • NICKSON KASONGO
    NICKSON KASONGO 5 months ago

    Amazing video.. can you please explain how to upload a file to any website using excel vba.

  • Missing No
    Missing No 5 months ago

    what if the website has divs and not tables?

  • spiderx01
    spiderx01 6 months ago

    I have somebody problem with Run-time error '-2147024891 (80070005)': Access is denied . Use MSXML2.ServerXMLHTTP60 instead of MSXML2.XMLHTTP60. The problem happens probably, because MSXML2.XMLHTTP60 is for website on the local network(intranet). So you can try add required site to trusted sites or intranet sites or use MSXML2.ServerXMLHTTP60. Trusted sites you can change in the internet options -> security -> choose local intranet or trusted sites -> click on sites -> advanced -> add your site.

  • Chris Schmid
    Chris Schmid 6 months ago

    Thanks for the video, this is of great help!
    For one of the pages I work with, I encounter the problem, that I have to log on (which runs fine with VBA), then a new screen appears and there is a selection to the left as well as a standard column on top of the page. when running a For Each HTMLA In HTMLAs loop, I can get the hyperlinks of the top of the page, but cannot access them to the left. Do you have any way of helping me? The page seems to be formatted with mostly only hyperlinks, two TR and one table (that covers both the top row as well as the left column). Thanks

  • john bensen
    john bensen 7 months ago +1

    Amazing !
    VBA is such a (with due to respect) a fucking language .
    But you made it very easy to work with .
    Thanks a lot .

  • Chris Raisin
    Chris Raisin 7 months ago

    You are a great presenter! One of the best I have viewed on the Internet....keep up this great work.

  • Govindpreet Singh
    Govindpreet Singh 8 months ago

    Dear i sincerely like to appreciate your teaching skills, each video of your is so informative and you have made it simple to understand.

  • ABHISHEK PATEL
    ABHISHEK PATEL 8 months ago

    I'm trying to click. A button on a web site but am unable to do so
    The HTML code is

  • Victhor Trautmann
    Victhor Trautmann 8 months ago

    If you're having trouble with the first loop, try InternetExplorerMedium instead of InternetExplorer. EX: Dim IE as New SHDocVw.InternetExplorerMedium

  • Gestão Office
    Gestão Office 9 months ago

    Olá !
    Gostaria de aprender webScraping de maneira profissional usando Excel?
    E o melhor sem necessidade de usar navegador, usando direto o protocolo HTTP?
    Conheça o curso de WebScraping com Excel VBA.
    Veja o vídeo no link abaixo.
    ru-clip.net/video/CpbhAra6xrE/video.html
    Abraços

  • Tom-Inge Nilsen
    Tom-Inge Nilsen 9 months ago +1

    By far the best video tutorial regarding web scraping with VBA!

  • Jim Smyth
    Jim Smyth 10 months ago

    Great tutorial, but when using XML method found that it don't retrieve tables controlled by java script. Where as IE method I can create a loop, allowing for extra content to load. is there a way in the XML method where this can be simulated?

  • Wiel h01
    Wiel h01 10 months ago

    At the last if statement the only way it works when wou put www. in front of x-rates

  • Al-Amin Mollah
    Al-Amin Mollah 10 months ago

    Dear Mr. Andrew Gould,
    Your excel vedio are the best I have ever seen excel vedio in youtube.
    Could you please help me to solve below problems:
    Suppose, I searched giving the word "excel vba" in wiseowl page after navigating wiseowl.co.uk using excel vba code & after that I need Web page info from the loaded page if the new page loaded in 1) new tab 2) current tab. Please somebody give me solution.

  • Dr. Anurag Singhal
    Dr. Anurag Singhal 10 months ago +2

    You are an amazing teacher. I wanted to get currency rates onto my excel sheet, and you are sent to me by God. You have explained it in exquisite detail. Even a child can follow.

  • Trupti Bobade
    Trupti Bobade 10 months ago

    I am getting the Run time error as "Object Required". Can you please help me with it.

  • kapil sharma
    kapil sharma 10 months ago

    awesome

  • sadfj ltie3
    sadfj ltie3 11 months ago

    Just an amazing series, crystal-clear explanation, lots of hands-on experience, and perfect pacing--bravo, and thanks for this!

  • Lekshey
    Lekshey 11 months ago +2

    Watched many vba videos from other tutors but not so informative, constructive and logical as yours. There is saying in English... knowledge itself is of no value, it's the use of it that makes it valuable, you are simply genius!! kudos !!!

  • Ernestas Raudys
    Ernestas Raudys 11 months ago

    Hello, i try use module 2 but have problems with script, for my templete is Input and i don't know how write in script , if you can help me please

  • Michal Elston
    Michal Elston Year ago

    How do I choose what table I want to get the information from. I currently have a site with 14 tables.

  • Rich K
    Rich K Year ago

    How Can I make my complete vba a project run on a network such that, items sold by client 1 will show on client 2 instantly?

  • JoergB
    JoergB Year ago

    Very competent explained. For me as a german with medium english know how it is well understandable! THANKS!

  • leela g
    leela g Year ago

    Hi Andrew,
    I need to enter username in a textbox, i used "Set username = HTMLDoc.getElementById("id1005")" line of code and then trying to give a value "username.Value = "abc"", when it is executing this line getting run time error 91.
    used the code same as you wrote in the video.
    please help me.

  • Amit Sharma
    Amit Sharma Year ago

    Watched the entire video..Seriously ..it's too good... only one help needed to let me know the user input method as mentioned in comments below..Pls.

  • Amit Sharma
    Amit Sharma Year ago

    Hi Andrew,
    Need ur help to understand as in the codes we have fixed the values for currency and amount. What if these are to be filled by user at time of navigation. How are we going to action this.
    Pls help.
    Wishes,
    Amit

  • Abhayjit Thind
    Abhayjit Thind Year ago

    Great Tutorial. Proper organisation and perfect execution.

  • Rey Reyes
    Rey Reyes Year ago

    What a great video tutorial! You're a genius!
    I only have one question, sir. What code shall I use if the owner/creator of the site disabled the "button" and will only be activated when you manually type in or paste a value in search bar? Thank you so much!

  • Neeta gupta
    Neeta gupta Year ago

    Hii sir, is there any way to find the latest uploaded file by date using vba

  • Artur Bensel
    Artur Bensel Year ago

    great video! thanks

  • Fred Durst
    Fred Durst Year ago

    Is there any way to click a Button while you choose the XML method? While using IE the click event works fine for me, when i try it like
    HTMLDoc.body.innerHTML = XMLPage.responseText
    HTMLDoc.getElementById("test").Click
    i got only a Runtime Error.

  • Alex Casha
    Alex Casha Year ago

    I am do an automatic web scraping. The values are changing every hour. Is it possible that every hour the automated imported data get recorded on separate cells rather than replacing it?

  • Harold Kumar
    Harold Kumar Year ago

    Great Video but I'm getting conflicting results for the 2 different "find the amount of tables" methods for the following webpage:
    financials.morningstar.com/valuation/price-ratio.html?t=AAPL
    With IE I get 3 tables in the Immediate section, but with XML I get 0 tables in the Immediate section. Can anyone confirm or deny this? I checked the code a million times and I know the IE version is correct. Thanks to who ever can solve this first.

  • Crystal Yin
    Crystal Yin Year ago

    Looks like the x-rate.com website no longer lets people send xml references. If youre trying to browse to the xrate website via xml, it will give you an "access denied" error message. However, if you try it with any other website, e.g. finance.yahoo.com/quote/%5EGSPC/ the method will still work!

  • Tahor Sui Juris
    Tahor Sui Juris Year ago

    Excellent! How would one input to an incremental auto fill, autocomplete drop-down that does not have an index reference?

  • Emilio De Jesús Grullón

    Thank you so much!

  • Tyagi Munde
    Tyagi Munde Year ago +1

    You are most talented in the world

  • Dara Meybodi
    Dara Meybodi Year ago

    Hi, I was wondering what the difference between HTMLDocument and iHTMLDocument is. Or more generally, what's the difference between HTML and iHTML object?

    • Mohan raj
      Mohan raj 2 months ago

      Hi Sir, I have completed the webscraping and placed macro in azure server. My website will trigger the macro when user click on the button in website(local server). As soon as user click button its working however IE and Excel is keeping running in the background. If user click the button second time immediately after 1st attempt then macro showing error saying IE running. Also, please help me to display the error in website instead of message box.

  • Jeshan :D
    Jeshan :D Year ago

    Mad respect for this bro!

  • J Nada
    J Nada Year ago +1

    Amazing content, can't thank you enough

  • Arthur Manlutac
    Arthur Manlutac Year ago

    Hi Andrew, Thank you for your videos.
    Could you please help me with my codes below? I only shared part of my code where I need help with. I also changed the URL.
    Sub CreateIncidentTicket()
    Dim IE as InternetExplorerMedium 'I use this due to our IE settings.
    Dim ObjCollection as Object
    Set IE = New InternetExplorerMedium
    'PROBLEM 1: I want to automate the ticket creation and the details are in excel sheet. everytime I do, a NEW instance of
    'InternetExplorerMedium is created. Is there a way i can loop and scan my desktop and look for URL that contains part of '"itsm-webapp.mysite.com/arsys/forms/itsm-arapp.mysite.com"
    'and click the button as below?
    IE.Navigate "itsm-webapp.mysite.com/arsys/forms/itsm-arapp.mysite.com" 'i changed the company name to 'mysite'
    IE.Visible = True
    Do While IE.ReadyState READYSTATE_COMPLETE
    Loop
    Application.Wait (Now + TimeValue ("00:00:10"))
    ' PROBLEM 2: the browser is already in ready state but the page is loading something internally that's why i had to out 10seconds 'for it to load. so i need to loop until a specific text on the body appears or if a specific button appears.
    Set CreateBtn = IE.document.getElementById("WIN_1_301429000")
    CreateBtn.Click
    End Sub