+ Reply to Thread
Results 1 to 12 of 12

Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    Hi there,

    I don't know if I am going about this the right way, or if it is possible to do this in VBA, but I'm trying to link two pieces of code together by using one piece of code as a variable in another piece.

    The first piece of code web scrapes, the bbc sports football results page.

    In the tab called URL in the workbook URL in cell A is the URL 'http://www.bbc.co.uk/sport/football/results'
    Please Login or Register  to view this content.

    So once the code above opens up the URL I want to use the '& sURL' as more of a variable for the below code rather than just opening up the URL in cell A1. Run the following piece of code before it begins the webscrape and drops it into the worksheet Scrape


    The below is a solution that was given to me before on this forum for manipulating a java table. Now I don't know if I should go to the website 1st using the above and then try run the below code. Or if I should change the 'sURL' to a variable that contains the below code?
    Please Login or Register  to view this content.
    Thanks for any help given.
    Last edited by Al_O_L; 08-29-2013 at 11:11 AM. Reason: Adding Coding Tags

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    What are you trying to achieve?

    Is it to grab the results for a particular team/league/country/date? eg the English Championship.

    By the way, the second code doesn't manipulate any table(s) as far as I can see.

    Oh, almost forgot - can you edit your post to add code tags?
    Last edited by Norie; 08-29-2013 at 07:45 AM.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    Hi Norie,

    The second piece of code changes the drop down menu on the bbc website and then clicks 'update' do get the historical results of a given division.

    That's what I meant by 'manipulating a Java table'. As the URL doesn't change per different result selected.

    What I'm trying to accomplish is getting the webscrape after the drop down menu is changed by the second piece of code.

    Thanks

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    As far as I can see, the data you're after is here: http://www.bbc.co.uk/sport/football/...tion-118996115 - you should be able to use a normal webquery to grab this

  5. #5
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    Hi Kyle123,

    Thanks for your reply but it's the functionality I'm after more than the results themselves. But thank you for your post it is one way about going about getting the results.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    What functionality are you after?

    By the way, I really don't see how you can combine the 2 sets of code - they do different things.

  7. #7
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    Hi Norie - I'm looking for the functionality of changing a Java table by selecting what I want from a drop down menu then taking a webscrape?

    Hi Kyle123 - How did you get that URL? http://www.bbc.co.uk/sport/football/...tion-118996115 thanks?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    There isn't a 'JAVA' table on that page, it's just a bog-standard HTML table.

    Doesn't the code you posted change the table to the one you want?

  9. #9
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    Hi Norie,

    Yes the 2nd part of the code changes the table, and the 1st part of the code takes the webscrape but what I can't do, and what I am trying to do is change the table and then take the webscrape.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    The first code is getting the data with a web query, that's not quite the same as 'scraping'.

    The second code doesn't appear to change the table.

    It selects Championship but the Update button seems to become disabled when that happens.

    Did you try the URL that Kyle posted?

  11. #11
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Connecting two pieces of VBA (1) mainipulate a JAVA table and then (2) Webscrape

    Hi Norie,

    The second piece of code changes the results page specifically to just the championship results. It does this by selecting it in the drop down and then clicks 'update'. The 1st code only webscrapes the default URL (or default HTML table), I want the 1st piece of code to 'wait' until I've changed it to the championship results, before it webscrapes.

    So I want to know how to integrate the two pieces of code, I thought it'd be possible to do this by changing the 1st piece of code to call on the other piece of code at the point when it calls upon the URL. I just don't know how to make that happen, hence my call to the boards....?

    Kyle123 did suggest a slightly different way about getting the specific results, which I will probably resort too if the above can't be done, but I still need to know how he got to that webpage?

    In theory I thought what I wanted to do was conceptually quite simple, the only thing in theory, that I want to do is call upon a macro piece of code instead of a variable. The variable currently being the cell that contains the BBC a URL. The macro being the second piece of code.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    You can't integrate the 2 pieces of code.

+ 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. Java table
    By f3zz in forum Excel General
    Replies: 2
    Last Post: 07-11-2011, 11:01 AM
  2. Finding pieces of a value in a table
    By root in forum Excel General
    Replies: 6
    Last Post: 07-21-2006, 01:31 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