title: How to Open an Excel Document from Share Point by Internet Explorer using VBA
body: <p>Am new to VBA &amp; trying to learn as I go. Am currently stuck with an Issue here which I need some help.</p>
  
  <p>Am trying to open an Excel workbook(<code>Test.xlsx</code>) from the share point using Internet Explorer. Once the File is opened, I would like to close IE.  Then copy few Sheets from the Workbook, copy/Move it to a new Workbook &amp; close the original Workbook. 
  I searched a lot in Google &amp; came with below codes which works OK if I run it separately, but If I combine with my original program (which I manged to generate by recording Macros) it gives an Error message 'Run-time error'9': Subscript out of range'which when I debug will highlight my Error Handler Code <code>(Workbooks("Test.xlsx").Close SaveChanges:=False)</code>.</p>
  
  <p>I really cant understand the mistake here.
  Can someone please help me with the correct codes here.</p>
  
  <p>Basically my requirement is to open an Excel Workbook from Share point(<code>"URL/TEST.xlsx"</code>) using Internet Explorer(in a new window),close IE window &amp; then to copy/move few sheets from the original Workbook(Test.xlsx) to new Workbook, close the original workbook(Test.xlsx) &amp; make amendments in the new workbook(Book##).</p>
  
  <p>Can someone please help me with the codes here. </p>
  
  <p>Below are the codes I managed to get from Google/Internet.</p>
  
  <pre><code>Sub OpenIE()
  
    Dim objIE As Object
  
    Set objIE = CreateObject("InternetExplorer.Application")
  
    objIE.Navigate "URL/TEST.xlsx"
  
    objIE.Visible = True**
  
  On Error GoTo My_Error_Handler
  
      Windows("Test.xlsx").Visible = True
  
  On Error GoTo My_Error_Handler
  
      Sheets(Array("Stats", "Mtx")).Select
  
      Sheets("Mtx").Activate
  
      Sheets(Array("Stats", "Mtx")).Copy
  
      Sheets("Mtx").Select
      '
  '
  '
  '
  ' so on 
  '
  '
  My_Error_Handler:
  
      Workbooks("Test.xlsx").Close SaveChanges:=False
  
      ActiveWorkbook.Close SaveChanges:=False
  
      MsgBox "Error: (" &amp; Err.Number &amp; ") " &amp; Err.Description, vbCritical
  
  End Sub
  </code></pre>
  
  <p>Thanks</p>