title: ThisWorkbook.ChangeFileAccess xlReadWrite Creates Multiple VBAProjects for workbook in VBA Window
body: <p>My workbook has the following open event:</p>
  
  <pre><code>Private Sub Workbook_Open()
      ThisWorkbook.ChangeFileAccess xlReadOnly
  End Sub
  </code></pre>
  
  <p>And then this button:</p>
  
  <pre><code>Sub UnlockDeveloper()
  Dim pwd As String
  
  pwd = InputBox("Enter developer password:", "Password")
  
  If pwd = "password" Then
      If ThisWorkbook.ReadOnly = True Then
          ThisWorkbook.ChangeFileAccess xlReadWrite
      End If
  Else
      MsgBox ("Incorrect password.")
  End If
  
  End Sub
  </code></pre>
  
  <p>This all works fine, usually, but sometimes running the UnlockDeveloper sub causes the VBAProject to appear twice in the VBA window, and I have no way of knowing which is the real file. If I make changes in the wrong one the changes are lost as soon as I close Excel.</p>
  
  <p><img src="https://i.stack.imgur.com/ROIRQ.png" alt="screenshot"></p>
  
  <p>Anyone got any ideas how to prevent this?</p>