'VBA function to get page's URL to extract gps coordinates

I have a little problem, thanks for whatever help you might bring :)

my goal : i want to create a vba function that receives an address and returns the gps coordinates related to this address. To do so, i want to open my address in Openstreetmap (or Google Maps) in order to extract the page's URL which has the gps coordinated within it.

problem : my function only works way, it open the address in the navigator but it won't return the URL...

my code :

Option Explicit
Function AdresseToCoordonnesGPS(URL As String)
    Dim navigateur As Object
    Set navigateur = CreateObject("Shell.Application").ShellExecute("microsoft-edge:" & URL) 
    navigateur.Visible = True
    Do While navigateur.busy And navigateur.ReadyState <> 4
       DoEvents
    Loop
    pause (3)
    
    Dim redirection As String 
    redirection = navigateur.locationUrl
    redirection = Right(redirection, Len(redirection) - InStr(redirection, "#"))   
    redirection = Right(redirection, Len(redirection) - InStr(redirection, "/"))
    AdresseToCoordonnesGPS = redirection
End Function

result : this function manages to open the link in the navigator (microsoft edge) it won't copy the page's URL, which i need in order to extract the GPS coordinates here's what it return :

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source