Hello Guys,
I have a list of CR Numbers in Column A (count 4000) and my purpose is to extract "VAT Number" and "Arabic Name" registered against the CR number on the VAT Website. For ease, I am putting a sample CR as "1010069143"
Following is the code developed by me and I am facing the following issues. I tried looking at numerous websites, tutorials and I am badly stuck with this. Can you please assist me in adding few comments / rectify the command to help active my objective.
Sub OpenWebpage()
Dim IE As New InternetExplorer
Dim HTMLDOC As HTMLDocument
Dim HTMLINPUT As IHTMLElement
Dim HTMLButtons As IHTMLElementCollection
Dim HTMLButton As IHTMLElement
Dim x As Integer
For x = 2 To 400
IE.Visible = True
IE.Navigate "https://www.vat.gov.sa/en/vat-taxpayer-lookup"
Do While IE.readyState <> READYSTATE_COMPLETE
Loop
IE.document.forms("company-lookup-form").elements("edit-search-parameter").Value = 2
IE.document.forms("company-lookup-form").elements("edit-vat-account-no").Value = Cells(x, 1)
IE.document.forms("company-lookup-form").elements("edit-submit").Click
' I have to do this because I am unable to write a code to click on Catpcha thus I don't mind to manually complete the captcha and VBA to then take the process forward.
Application.Wait Now + TimeValue("00:00:05")
IE.document.getelementsbyID("edit-cr--RUcsBn-vb_E").Value = Cells(x, 1)
IE.document.getelementsbyID("edit-submit--s2QHBIxZ_78").Click
IE.document.getelementsbyClass("odd").Value = Cells(x, 2)
IE.document.getelementsbyClass("Even").Value = Cells(x, 3)
Next x
End Sub
I have a list of CR Numbers in Column A (count 4000) and my purpose is to extract "VAT Number" and "Arabic Name" registered against the CR number on the VAT Website. For ease, I am putting a sample CR as "1010069143"
Following is the code developed by me and I am facing the following issues. I tried looking at numerous websites, tutorials and I am badly stuck with this. Can you please assist me in adding few comments / rectify the command to help active my objective.
Sub OpenWebpage()
Dim IE As New InternetExplorer
Dim HTMLDOC As HTMLDocument
Dim HTMLINPUT As IHTMLElement
Dim HTMLButtons As IHTMLElementCollection
Dim HTMLButton As IHTMLElement
Dim x As Integer
For x = 2 To 400
IE.Visible = True
IE.Navigate "https://www.vat.gov.sa/en/vat-taxpayer-lookup"
Do While IE.readyState <> READYSTATE_COMPLETE
Loop
IE.document.forms("company-lookup-form").elements("edit-search-parameter").Value = 2
IE.document.forms("company-lookup-form").elements("edit-vat-account-no").Value = Cells(x, 1)
IE.document.forms("company-lookup-form").elements("edit-submit").Click
' I have to do this because I am unable to write a code to click on Catpcha thus I don't mind to manually complete the captcha and VBA to then take the process forward.
Application.Wait Now + TimeValue("00:00:05")
IE.document.getelementsbyID("edit-cr--RUcsBn-vb_E").Value = Cells(x, 1)
IE.document.getelementsbyID("edit-submit--s2QHBIxZ_78").Click
IE.document.getelementsbyClass("odd").Value = Cells(x, 2)
IE.document.getelementsbyClass("Even").Value = Cells(x, 3)
Next x
End Sub