Results 1 to 2 of 2

Thread: Macro - Copy the data from Webpage - Error
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Oct 2016
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Macro - Copy the data from Webpage - Error

    Hi Team,
    Thanks for your support !!
    Need a help in macro. My requirement is I need to open a webpage Click on submit button Enter the Request ID Press Enter Need to copy the data from the text box (it may be Read only or editable option)
    I am able to do the function till entering the request id. But I am stuck. I am not able to press enter and copy the data from text box and paste it in excel
    Can any one please help me in resolving the issue.
    Option Explicit

    Sub InitialNotification()
    Dim wsNew As Worksheet
    Dim rng As Range
    Dim IE As Object
    Dim doc As Object
    Dim tbls As Object
    Dim divContent As Object
    Dim tbData As Object
    Dim rw As Object
    Dim col As Object
    Dim cl As Object
    Dim strBaseURL As String

    strBaseURL = "https://brightstar.service-now.com/"

    Set wsNew = Worksheets.Add

    Set rng = wsNew.Range("A1")

    Set IE = CreateObject("InternetExplorer.Application")

    IE.navigate strBaseURL

    Do While IE.Busy: DoEvents: Loop

    Do While IE.ReadyState <> 4: DoEvents: Loop

    IE.Visible = True

    Set doc = IE.document

    IE.document.getElementById("okta-signin-submit").Value = "Sign In"
    IE.document.getElementById("okta-signin-submit").Click
    IE.document.querySelector("[class='input-group-addon-transparent icon-search sysparm-search-icon']").Click
    IE.document.getElementById("sysparm_search").Value = "INC0180901"
    IE.document.querySelector("[class='input-group-addon-transparent icon-search sysparm-search-icon']").Click
    Application.SendKeys ("~"), True
    Application.SendKeys ("ENTER"), True ' nEED TO CHECK eNTER KEY OPTION
    Do While doc.ReadyState <> "complete": DoEvents: Loop
    Set divContent = doc.getElementById("incident.sys_created_on")

    Set tbls = divContent.getelementsbyTagName("TABLE")

    Set tbData = tbls(0)

    For Each rw In tbData.Rows

    For Each cl In rw.Cells
    rng.Value = cl.innertext
    Set rng = rng.Offset(, 1)
    Next cl

    Set rng = wsNew.Cells(rng.Row + 1, 1)
    Next rw
    End Sub

  2. #2
    New Member
    Join Date
    Oct 2016
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Macro - Copy the data from Webpage - Error

    Hi All,

    Ca any one help me out in this.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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