title: VBA Error 70: Permission Denied during IE automation
body: <p>I've been trying to create a quick subroutine in VBA through Excel 2010 to automate putting a list of URLs through bit.ly and copying the abbreviated links back to replace their original link. BUT I'm getting an Error 70: Permission Denied runtime error along the way. I've had a few courses and this MOSTLY works, but I'm not highly familiar with VBA and could use some help in debugging this if possible (it'd be a huge help). Here's the code:</p>
  
  <pre><code>Option Explicit
  
  Dim IE As Object
  
  Sub AutoAbbrev()
  
  Set IE = CreateObject("InternetExplorer.Application")
  Dim holdURL As String
  Dim row_number As Integer
  IE.Visible = True
  
  For row_number = 101 To 112
  
  holdURL = ""
  
  If Range("b" &amp; row_number).Value = "" Then GoTo Skip
  
  IE.navigate "http://www.bitly.com" 'load bit.ly
  
  Do While IE.readyState &lt;&gt; 4
      DoEvents
  Loop
  
  IE.document.all("shorten_url").Value = Range("b" &amp; row_number).Value
  IE.document.all("shorten_btn").Click
  
  Do While IE.document.all("shorten_url").Value = Range("b" &amp; row_number).Value Or IE.document.all("shorten_url").Value = ""
      DoEvents
  Loop
  
  holdURL = IE.document.all("shorten_url").Value
  IE.document.all("shorten_url").Value = ""
  Range("b" &amp; row_number).Value = holdURL
  
  Skip:
  Next row_number
  
  End Sub
  
  Private Sub Command1_Click()
  
  AutoAbbrev
  End Sub
  
  Private Sub Form_Unload(Cancel As Integer)
  Set IE = Nothing
  If TypeName(IE) &lt;&gt; "Nothing" Then Unload IE
  Set IE2 = Nothing
  If TypeName(IE2) &lt;&gt; "Nothing" Then Unload IE2
  
  End Sub
  </code></pre>
  
  <p>The error is mostly thrown on this line after the program has run through one or more iterations:</p>
  
  <pre><code>Do While IE.document.all("shorten_url").Value = Range("b" &amp; row_number).Value Or IE.document.all("shorten_url").Value = ""
          DoEvents
      Loop
  </code></pre>
  
  <p>If any specific advice could be provided to help me over this hump, I'd greatly appreciate it. Thanks!</p>