VBA scrapping

tyty123

New Member
Joined
Nov 28, 2022
Messages
39
Office Version
  1. 365
Platform
  1. Windows
Hi i had written this code and it had worked originally but now im getting: Sub or function not defined


Sub PullSoftBalance()
Dim ie As New InternetExplorer
Dim doc As New HTMLDocument
Dim elem As Object

ie.Visible = True
ie.Navigate "BTIG"
Do
DoEvents
Loop Until ie.ReadyState = READYSTATE_COMPLETE
Set doc = ie.Document
Set elem = doc.getElementById("balance-after-impact")
If elem Is Nothing Then
MsgBox "No elements with the id 'balance-after-impact' were found on the website."
Else
Dim text As String
text = elem.innerText
Worksheet("soft schedule").Active.Range("B16").Value = text

MsgBox "Soft Balance has been updated from portal"
End If
End Sub


The underline section seem to be the issue
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try...

VBA Code:
Worksheets("soft schedule").Range("B16").Value = text


Hope this helps!
 
Upvote 0
i got a different error now "application-defined or object defined error" (same line highlighted)

Anybody know what that means exactly
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,147
Members
453,021
Latest member
Justyna P

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