title: VBA Power Point WebBrowser Works only once
body: <p>I'm working on powerpoint addin in VBA. It should insert new slide with webbrowser - this works. Problem is when i try to navigate this control to web url. When i try first time and then enter in presentation mode - it works. When i try second time i get an exception and webbrowser is not displaying website :</p>
  
  <p>code : (this works only once before presentation mode, after that when i try to run it again  i recive an error)</p>
  
  <pre><code>Sub creteUrls()
      Dim sld As Slide
      Dim sha As Shape
      Dim tempSh As Shape
      Dim i As Long
      Dim URL$
          For Each sld In ActivePresentation.Slides
              For Each sha In sld.Shapes
                  For i = 4 To ActivePresentation.CustomXMLParts.Count
                      Set tempSh = sha
                          If tempSh.Name = CStr(ActivePresentation.CustomXMLParts(i).SelectNodes("webbrowser/name").item(1).Text) Then
                              URL = CStr(ActivePresentation.CustomXMLParts(i).SelectNodes("webbrowser/url").item(1).Text)
                              tempSh.OLEFormat.Object.Navigate URL, 4
                          End If
                      Set tempSh = Nothing
                  Next i
              Next
          Next
      End Sub
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/89Qf4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/89Qf4.png" alt="exception"></a></p>