+ Reply to Thread
Results 1 to 6 of 6

Selecting the first object in a website table

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Selecting the first object in a website table

    Hi all,

    I have an intranet site that when I do a search, I get displayed in a table below the results. for 99% I should get one result, but it can happen that there could be at one point two results, but that is very rare.
    Once I have the result, I need to select it so I can upload a document. I can't share the intranet site, but I have a link to a website with similar setup.

    http://www.cqc.org.uk/search/site/me...e=15&mode=html

    in the link, I would like to select with vba the first link that appears (KH Medical (Lundwood Medical Centre PMS Practice). As it is possible that the results will be different, it needs to select the first object from the table and not on name as the name could have different numbers behind (KH Medical (Lundwood Medical Centre PMS Practice-3389203883 as an example how it could look like and I don't have those numbers nowhere to compare. I only can think about: KH Medical (Lundwood Medical Centre PMS Practice* being the * as a joker)

    Any help getting this would be great.

    Greetings,

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Selecting the first object in a website table

    Hello Megatronixs,

    Because you are requesting help with an Intranet site, there are many company policies and security concerns. This often prevents you from supplying us critical information needed for a solution.

    Add to that, you are presenting a "similar" site as a model. While the information may appear to be a close match in appearance, the underlying HTML could be completely different.

    For example, you say your information (I am assuming on the intranet site and you have verified this point) is in a table. On the site you have posted, it is not in a table. It is in a Div element.

    Unless you can post a copy of the HTML page source for the site you actually want data from, there is little we can do to help you.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Selecting the first object in a website table

    Hi,

    Thanks for the info.
    I will try to take apart the intranet site (save it as .mth) and then leave only those parts that I need to interact with and post them. This way I will comply with my company's policy and will be able to get it solved :-)
    It is hard sometimes to find solutions when everything is so strict.

    Maybe it is possible to show the possible solution for the above link? This way I could learn more :-)

    greetings.

  4. #4
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Selecting the first object in a website table

    Hi,

    I managed to get some part of the html what is the interesting one.

    As you can see, the last 2 parts are the ones I want to click. 99 procent there will be only one text link to click, but if there is a second one, it should be not used and go to the next part of the code. Let assume there is only the first one (ThisIsTheFirstOne_2014s1107eres105ee0_a_id), it should click that link. If it finds that there are more than 2, it should step out of the code (not click it).

    I hope you will be able to help.

    HTML Code: 
    Thanks in advance and greetings.

  5. #5
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Selecting the first object in a website table

    Hi,

    maybe the below code could be edited to find the first one?

    Please Login or Register  to view this content.
    I'm just guessing what could be done to get the solution :-)

    Greetings.

  6. #6
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Selecting the first object in a website table

    Hi all,

    Closing this one as a better solution could be made. I have started another thread that makes more sense:

    http://www.excelforum.com/excel-prog...ml#post3902393

    Hope some one can help out :-)

    Greetings.

+ 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. Need to import table from website. Excel is not recognizing the table
    By elitelimfish in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-17-2013, 04:02 AM
  2. Selecting a picture object
    By Bope in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-02-2008, 12:36 PM
  3. Calendar object - Selecting more than one date
    By memphis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2007, 12:37 PM
  4. Change object formula without selecting first ?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2006, 01:15 AM
  5. Selecting object
    By Ronbo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2005, 09:06 AM

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