×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using VBA to extract information from Internet explorer - I'm stuck

Using VBA to extract information from Internet explorer - I'm stuck

Using VBA to extract information from Internet explorer - I'm stuck

(OP)
I designed some code a while ago using VBA and Excel, to check which people on my database are still VAT registered. I'm based in the UK, and I was using a European website, but because of Brexit it's no longer working! I changed it to a British website now, and I managed to get the code to enter the VAT number from Excel into the webpage, but I can't find the Id or name of the submit button, so I'm not able to submit it. After I've submitted it I'll probably need some more help with the next page, but I'll see if anyone can help me solve this one first. Many thanks for your help. Here's the code (I put ??? in place of the ID and name for now).


Sub CheckVatPlayers()

Dim x As Integer, y As Integer, z As String
Dim objIE As InternetExplorer
Dim aEle As HTMLLinkElement
Dim findtext As String, player As String

x = 2



Set objIE = New InternetExplorer
objIE.Visible = True


Do Until Cells(x, 1) = ""

'If Left(Cells(x, 4), 2) <> "GB" Then
'Cells(x, 4) = "GB" & Replace(Cells(x, 4), " ", "")
'End If

objIE.Navigate "https://www.tax.service.gov.uk/check-vat-number/en..."


Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
Application.Wait Now + #12:00:01 AM#


objIE.Document.getElementById("target").Value = Cells(x, 4).Value


objIE.Document.getElementsByName("???")(0).Click
'objIE.Document.getElementById("???").Click

Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
Application.Wait Now + #12:00:01 AM#


y = 2


For Each aEle In objIE.Document.getElementsByClassName("VAT registration details")

Debug.Print aEle.innerText

z = Trim(aEle.innerText)
Cells(x, 7) = z

If Left(z, 1) = "V" Then
Cells(x, 7).Font.Color = vbBlack
Else: Cells(x, 7).Font.Color = vbRed
End If

With Cells(x, 6)
.Value = Date
.NumberFormat = "dd/mm/yyyy"
End With

y = y + 1

Next

x = x + 1
Loop

End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close