+ Reply to Thread
Results 1 to 14 of 14

Getting specific text from webpage.

  1. #1
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Cool Getting specific text from webpage.

    Hi there!

    I was wondering if somebody could help me with the following:

    For my work, i've been creating a receipt system for incomming orders in Excel. When we get an order online, we receive it in a online web environment (Google Chrome). From there, we can print the page for our own administration in Google Chrome. But what we want, is that Excel takes the data and puts it in the right tables and cells, so that we can print our own receipts, instead of printing the whole page with a lot of unnecessary information, or even information that we don't want the customer to see.

    So how do I do this? We can't edit the website because it's controlled by a different company. I've tried it with 'getElementsByClassName', but with no succes. Also, the text i'm trying to get, is not in a seperate class. The whole page counts as the only class in the page. I've heard about the option "Find" and "FindNext", but I don't know how to use them. What helps, is that everything they ordered always starts with a '#'. I need to get the value after that and put it in the right cell in my sheet.

    Here's what I got so far:

    Please Login or Register  to view this content.
    This gives me an error.


    Who can help me? Please keep in mind that I have almost no VBA experience, but I do have programming experience. I used to program games in C# and JavaScript. So this is kinda new to me.


    Arnout

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting specific text from webpage.

    Are you able to use the Data Connection fuunctionality to connect to the web page table and bring the data directly into Excel?

    Then once you have the data in Excel it should be relatively straightforward to update any other table(s) you already have.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    I havn't heard about this function yet. Where can I find this? And how do I use it?
    Last edited by arnolduzzz; 05-21-2017 at 03:41 PM.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting specific text from webpage.

    Hi,

    Click the Data Ribbon menu item then over on the left in the 'Get External Data' select the 'From Web' option and enter the web page and select the appropriate table. It does mean that the web page has to have a suitable table that Excel can link to.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Getting specific text from webpage.

    Also, the web interface that you use is just that - interface. The data are stored in a DB. You said you don't control the website, so it's some sort of third-party cloud based order management system/service. You can check if there is API or other access to back-end DB data supported by the service provider
    If you are pleased with a member's answer then use the Star icon to rate it.

  6. #6
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    Hi,

    Click the Data Ribbon menu item then over on the left in the 'Get External Data' select the 'From Web' option and enter the web page and select the appropriate table. It does mean that the web page has to have a suitable table that Excel can link to.
    Ah yeah, I know what you're getting at. I already got this with succes, but here where my troubles:

    1. I don't know how to do this in VBA (like refreshing and stuff)

    2. The data is not always in the same cell. Sometimes it's in B25, but sometimes it could also be in B27 for example. Not sure how to fix this (maybe with the Find and FindNext function since there is a # for every order?)

    3. I only need the get the number after the # and place that in sheet 1. How do I recognize the numbers?

  7. #7
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    Quote Originally Posted by buran View Post
    Also, the web interface that you use is just that - interface. The data are stored in a DB. You said you don't control the website, so it's some sort of third-party cloud based order management system/service. You can check if there is API or other access to back-end DB data supported by the service provider
    I thought about that too. There is not, or we can't use it.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting specific text from webpage.

    First things first. We need to establish whether Excel CAN connect and read the table data before we consider how to automate the process and read the information you need.

    What's the URL and which is the table?

  9. #9
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    Quote Originally Posted by Richard Buttrey View Post
    First things first. We need to establish whether Excel CAN connect and read the table data before we consider how to automate the process and read the information you need.

    What's the URL and which is the table?

    The URL we can use for this example is "https://mijn.sitedish.nl/bestelling.php?id=2&src=live" . You need to logon, but it's accessible on our network. The class for this table in HTML is "bestelling bes3":

    Please Login or Register  to view this content.

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting specific text from webpage.

    Unfortunately that web page requires a log in and password which of course I don't have.

  11. #11
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    Quote Originally Posted by Richard Buttrey View Post
    Unfortunately that web page requires a log in and password which of course I don't have.
    Yes, that's what i said. Hang on, I'll download the page and upload it to my own website.

  12. #12
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    Quote Originally Posted by Richard Buttrey View Post
    Unfortunately that web page requires a log in and password which of course I don't have.
    This is without all the CSS files and such, so just plain text. But the HTML code is the same. I don't really want this to be too public, so I'll send you a link via PM.

  13. #13
    Registered User
    Join Date
    05-21-2017
    Location
    Groningen, The Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Getting specific text from webpage.

    I tried it again, and I got it to work suddenly. Only thing I did is retype some stuff. Weird bug in VBA?

    Now that I got the data, I need to put the right numbers in the right cells. I have to use Find right?

  14. #14
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Getting specific text from webpage.

    Hi,

    So are you saying that you can now populate a range with the table from the web page and you're now looking to get stuff into other cells?

    If so would you upload the workbook and manually add the results you expect and tell us which are the results.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. iOpus IMACRO to exctrat specific text from webpage
    By khushboo# in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2017, 10:21 AM
  2. [SOLVED] Help downloading specific data from a webpage!
    By danssainz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-23-2015, 11:56 AM
  3. Check a webpage for specific text and highlight a cell based on result
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2013, 09:56 AM
  4. VBA to pull Text from specific div class on webpage
    By Bigbadbigbird in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2013, 05:04 PM
  5. [SOLVED] Macro to open a specific webpage
    By Chatters in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2013, 11:19 AM
  6. Finding & clicking on a specific webpage hyperlink
    By Steach91 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2008, 03:06 AM
  7. [SOLVED] How can I link to a specific worksheet from a webpage?
    By RMF in forum Excel General
    Replies: 1
    Last Post: 09-07-2005, 03:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1