+ Reply to Thread
Results 1 to 6 of 6

Help click on link javascript webpage

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    3

    Help click on link javascript webpage

    I'm a total newbie when it comes to VBA, I'm learning a lot on this website.

    The problem I have I can't click a link on a website with javascript on it. It's a page in my intranet so I can't provide a link. I have person names on Excel and want to access a website cliking on the names of those persons.

    Here is the source portion from the webpage, the 'XXXXXXXXXX' is the specific name with 20-30 similar on each page, so the idea is get the name from excel and click on the appropiate link.

    Please Login or Register  to view this content.
    The
    And this is what I have so far

    Please Login or Register  to view this content.
    TIA

    Rick

  2. #2
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Help click on link javascript webpage

    why not just make the href directly to that person? as in, instead of clicking it, use the referring link directly in excel

    and where the XXXXXX's exist you replace that with the name you intended to click on. It seems that you can edit the URL to bring back the results you need rather than relying on a click, else am i missing something?

    Lets say the link was


    Please Login or Register  to view this content.
    You could just go ahead and launch your browser to point to:

    url = "http://google.com/gina"
    ..
    ..
    ie.navigate url

    additionally, you could point that through excel by doing:

    Please Login or Register  to view this content.
    this should create the name Gina, in A1, with the hyperlink as it appears. The way you would have to select and click, would be to create references to MSHTML, and let VBA parse the info, then use .getelement to grab the ID of the field, select, and then click
    Last edited by jayinthe813; 09-05-2012 at 08:18 PM.

  3. #3
    Registered User
    Join Date
    09-04-2012
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Help click on link javascript webpage

    I'm trying to automate the process using vba from excel. That link will open another page with a form that needs to be filled with data from excel, then loop through every name on the list.
    I'm trying to figure out the navegation part first as the rest would be easier (I think)

  4. #4
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Help click on link javascript webpage

    well then, if you intend to fill out forms and stuff you will definitely need to learn how to use DOM. DOM lets VB see everything about the webpage, then you tell it where you want to edit information. You will start to think of it as automating excel from VBA btw (not the other way around). Im currently stuck on a VBA issue using DOM, and this forum's strength doesn't seem to really be in the programming, especially for web forms.

    http://stackoverflow.com/questions/7...sing-excel-vba


    You need to go to tools > References and check "Microsoft HTML Object Library" as well as "Microsoft Internet Controls"

    Disclaimer: Im very new to this

    I would modify that code like so (I dont like that browser time out stuff, but keep in mind this script will loop until the browser is "DONE" loading the page, so if its a busy server, it wont know when to stop):

    Please Login or Register  to view this content.
    once you hit that . it will give you a full range of methods to do. You should figure out how to select it and click it, which im not entirely sure about (you can google, but most of the stuff will be about javascript. From what I understand, it will be similar because the DOM is universal), you might be able to do .click at the end of it. With the lack of support Ive gotten for my web button issue, im thinking this will probably be your only bet, but it is the right way to do it (through DOM). The problem wont be so much doing it, its telling VB what to select and take control of. But luckily using the WITH tag in that sense, when you finally figure it out and get to the forms part, you can set the form data from variables all at once. This is intermediate stuff, so dont be surprised if you dont fully see it or understand, you just need to keep playing with it and thinking of ideas.
    Last edited by jayinthe813; 09-05-2012 at 11:42 PM.

  5. #5
    Registered User
    Join Date
    09-04-2012
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Help click on link javascript webpage

    I found the solution

    Please Login or Register  to view this content.
    Instead of "clickable text" I'm using a variable (PersonN) that gets each name from excel

    Found the solution here http://www.codeforexcelandoutlook.co...rnet-explorer/

    Thank you jayinthe813! You pointed me in the right direction
    Last edited by rickmdz; 09-06-2012 at 01:41 AM.

  6. #6
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Help click on link javascript webpage

    great job on figuring that out by the way :D
    Last edited by Cutter; 09-07-2012 at 03:53 PM. Reason: Removed whole post quote

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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