Macro - Copy the data from Webpage - Error

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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,213,526
Messages
6,114,122
Members
448,550
Latest member
CAT RG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top