View Single Post
 
Old 07-11-2015, 12:12 PM
souravkp souravkp is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Jul 2015
Location: India
Posts: 1
souravkp is on a distinguished road
Default 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
Reply With Quote