title: VBA: Method "Move" of object "Sheets" failed
body: <p>I have written a simple module in VBA that works fine when saved it as a macro but when I saved the same as Add-In and run, it behaves strange.
  It gives Error: Method "Move" of object "Sheets" failed
  and then open sheets from file number 1 (x=1 in the code).</p>
  
  <p>Thank you all for help. I have not tried it with another system to check security issue in my MS Excel but I have not locked code or sheet thru password.</p>
  
  <p>Code:</p>
  
  <pre><code>Sub opensheets()
      Dim openfiles
      Dim x As Integer
      On Error GoTo ErrHandler
      Application.ScreenUpdating = False
      openfiles = Application.GetOpenFilename _
      (FileFilter:="Microsoft Excel Files (*.xls;*.xlsx),*.xls;*.xlsx", _
      MultiSelect:=True, Title:="Select Excel files!")
  
      If TypeName(openfiles) = "Boolean" Then
          MsgBox "You need to select atleast one file"
          GoTo ExitHandler
      End If
  
      x = 1
      While x &lt;= UBound(openfiles)
          Workbooks.Open Filename:=openfiles(x)
          Sheets().Move After:=ThisWorkbook.Sheets _
            (ThisWorkbook.Sheets.Count)
          x = x + 1
      Wend
  ExitHandler:
      Application.ScreenUpdating = True
      Exit Sub
  
  ErrHandler:
      MsgBox Err.Description
      Resume ExitHandler
  End Sub
  </code></pre>