Pages

Saturday, November 13, 2010

UDF to find redirect Web URL

Sometimes you have a list of web links which are redirecting to other links and you want to find out the new URL. Try this UDF:



Function redirect_url(url1 As String)
    Dim myIE As Object
    Set myIE = CreateObject("InternetExplorer.Application")
    
    myIE.Navigate url1
    
    Do While myIE.Busy
    Loop
    
    redirect_url = myIE.Document.URL
    myIE.Quit
    Set myIE = Nothing

End Function

No comments:

Post a Comment