Numa pesquisada rápida vi que o Internet Explorer não vem instalado no Windows 11.
Como o seu script usa o IE não é possivel interagir com os elementos do site quando abre no Edge.
Visto que era algo simples, mudei a captura pra HTTP. Script abaixo e macro anexa.
Código: Selecionar todos
Sub CapturaHTTP()
Dim req As Object
Dim html As MSHTML.HTMLDocument
Dim compra, venda As String
Set req = CreateObject("WinHttp.WinHttprequest.5.1")
Set html = New MSHTML.HTMLDocument
req.Open "GET", "https://ptax.bcb.gov.br/ptax_internet/consultarUltimaCotacaoDolar.do"
req.Send
html.body.innerHTML = req.responseText
compra = html.querySelectorAll(".fundoPadraoBClaro2 td").Item(1).innerText
venda = html.querySelectorAll(".fundoPadraoBClaro2 td").Item(2).innerText
UserForm2.PTAX_COMPRA.Text = FormatCurrency(compra, 4)
UserForm2.PTAX_VENDA.Text = FormatCurrency(venda, 4)
Set req = Nothing
Set html = Nothing
End Sub