Autant mettre les paramètres dans la fonction
Function quelleheure() As String
quelleheure = ""
DoEvents
URL = "https://24timezones.com/fr_temps/paris_temps_local.php"
On Error Resume Next
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", URL, False
.Send
If .Status = 200 Then
quelleheure = Split(Split(.responseText, "<span id=""currentTime"">")(1), "</span>")(0)
End If
End With
End Function
on peut aussi utiliser GetElementById
Function quelleheure() As String
Dim html
Set html = CreateObject("htmlFile")
quelleheure = ""
DoEvents
URL = "https://24timezones.com/fr_temps/paris_temps_local.php"
On Error Resume Next
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", URL, False
.Send
If .Status = 200 Then
html.body.innerhtml = .responseText
quelleheure = html.GetElementById("currentTime").innertext
End If
End With
End Function