title: Mystery Excel Worksheet Objects added by VBA
body: <p><a href="https://i.stack.imgur.com/4IWeW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4IWeW.png" alt="Mystery Worksheet Objects"></a></p>
  
  <p>I have been creating a .xlsm Workbook that contains various bits of VBA. It simply copies data from two other workbooks into tables and then refreshes the PivotTables that are based on those tables to update the charts on the main workbook. All things I have done before in different workbooks without issue. Whilst working on the workbook I have naturally open, saved, and then closed the workbook several time over several different days.</p>
  
  <p>Typically, now that I believe the workbook to be finished, it has developed a glitch whilst opening. Initially I was unable to open the file at all, as it would immediately crash. Only by saving the file to onedrive and downloading it back again, have I been able to keep the file open to see what is going on (for some reason this worked, I don't know why!).</p>
  
  <p>I immediately suspected something in the VBA and so one press of Alt+F11 later I was confronted with this (image above).</p>
  
  <p><strong>All of the Blue Excel Objects in this picture were not created by me!</strong></p>
  
  <p>They contain no code and I do not seem to be able to open them as regular Excel Worksheets.</p>
  
  <p><strong>My Questions are,
  does anyone have any idea what may be causing this?
  Has anyone even seen this before?
  Where do I start debugging this?</strong></p>
  
  <p>Attempting to run any of the VBA in the workbook causes it to instantly crash.</p>
  
  <p>The VBA i suspect the most for the crashing is in these sections;</p>
  
  <pre><code>Public Function ThisWorkbookPath()
      ThisWorkbookPath = ThisWorkbook.Path &amp; Application.PathSeparator
  End Function
  </code></pre>
  
  <p>which is passed to;</p>
  
  <pre><code>Public Function CheckPath(ByVal PathString As String) As Boolean
      Application.Volatile (True)
  
      If Strings.Right(PathString, 1) = "\" Then
          CheckType = vbDirectory
      Else
          CheckType = vbNormal
      End If
  
      If Len(Dir(PathString, CheckType)) &gt; 0 Then
          CheckPath = True    
      Else
          CheckPath = False
      End If
  
  End Function
  </code></pre>
  
  <p>These are both used in the workbook as user defined functions to check if the folder that contains the other 2 workbooks exists on the computer before trying to open them.</p>
  
  <p>ThisWorkbook is now ThisWorkbook1 which might explain why, as the forumla in the workbook calculates, it can't find the correct path and just crashes.</p>
  
  <p>But this doesn't explain where these extra objects came from in the first place.</p>
  
  <p><strong>Any help would be gratefully appreciated</strong></p>