Capturing Redirected URL with macro
I am trying to capture the redirected URL with Excel Macro, but during run time, this piece of code giving me a run time error (Run-time error '-2147467259 (80004005)':Method 'Document' of object 'IWebBrowser2' failed). Could some one please help me whats wrong with this code and how to fix this issue.
Dim myIE as Object
Dim redURL as String
Set myIE = CreateObject("InternetExplorer.Application")
myIE.visible = True
myIE.Navigate <URL1>
Do While myIE.Busy
Loop
'This is where I am getting the Run time error.
'Run-time error '-2147467259 (80004005)':Method 'Document' of object 'IWebBrowser2' failed
redURL = myIE.Document.URL
|