santhoshbes2729
New Member
- Joined
- Oct 6, 2016
- Messages
- 15
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
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