Results 1 to 13 of 13

Use VBA to update a Webpage using JavaScript

Threaded View

  1. #1
    Registered User
    Join Date
    08-14-2012
    Location
    Somerset, NJ
    MS-Off Ver
    Excel 2007
    Posts
    7

    Use VBA to update a Webpage using JavaScript

    Hi,
    I'm trying to use excel to update a webpage for work. It's a shared webpage that is basically a Checklist that the owner of that task will fill in confirming that their part of the process is complete. Once this is done by the owner, the supervisor of the owner's group would need to go in and click the Radio Button to either Approve or Reject. There are a ton of Radio Buttons that need to be clicked, so I was able to get this part to work, but for ALL radio buttons.


    I'm sure (nay, certain) below is the long way of doing it, but this part of the code has been working, and just clicks approve on all of the radio buttons.


    Sub Checklist()
    
    Set oIE = CreateObject("InternetExplorer.Application")
        
        For Each oIE In CreateObject("shell.Application").Windows
            If InStr(1, oIE.LocationURL, "internal website here") > 0 Then
            'If InStr(1, oIE.LocationURL, "internal website here") > 0 Then
                    oIE.Visible = True
                    
        On Error Resume Next
        
        oIE.Document.getElementsByName("ctl00$ContentPlaceHolder1$dgReports$ctl02$gnVerify").Item(0).Click
    
        oIE.Document.getElementsByName("ctl00$ContentPlaceHolder1$dgReports$ctl03$gnVerify").Item(0).Click
        
        oIE.Document.getElementsByName("ctl00$ContentPlaceHolder1$dgReports$ctl04$gnVerify").Item(0).Click
    
        oIE.Document.getElementsByName("ctl00$ContentPlaceHolder1$dgReports$ctl05$gnVerify").Item(0).Click
    
    Etc...
    My problem now is that I only would like to have the macro click Approve when someone from my group completes the job. So, say there are 10 steps in the process. Steps 1-5 are done by Tim, steps 6-8 are done by Joe and steps 9 & 10 are done by Mike.

    Is there a way that I can get the code to only click the radio buttons for just Tim? I thought maybe an If statement would work, but I can't get it to work. I didn't get very far with it, but it was still Appproving all of them or just skipping all of the radio buttons.

    When I look at the JavaScript, this is the part where I see the name of the owner who completed the task.

    <span id="ctl00_ContentPlaceHolder1_dgReports_ctl03_lbAuditValue1Name">Tim</span>

    Thanks in advance for your help!

    Moderator Note:

    Pls use code tags around your code next time as per forum rules.
    Last edited by Fotis1991; 10-11-2013 at 10:39 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Anyone know how to read javascript and objects from a webpage
    By Fratshack in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2013, 02:08 PM
  2. [SOLVED] Help click on link javascript webpage
    By rickmdz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2012, 11:59 PM
  3. how to download webpage by skipping javascript
    By catjoke in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-30-2010, 12:54 AM
  4. Execute javascript code on a webpage with VBA
    By menyanthe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2009, 05:23 AM
  5. Open a webpage using Javascript in Excel
    By jbrack@email.uophx.edu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-17-2006, 05:10 PM

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