title: Cannot refresh reference to external xlsm file
body: <p>I have two Excel files, parent and child, where child contains a library of functions used by parent's functions. For versioning purposes I keep them in the same folder and copy and rename the folder in exactly the same location to keep track of my versions. I also want the references to be dynamically updated so that when i move to a new version, parent always points to child in the same location. </p>
  
  <p>So in order to accomplish this I have implemented two routines in parent.</p>
  
  <p>One, is in ThisWorkbook I used Workbook_Open sub:</p>
  
  <pre><code>Private Sub Workbook_Open()
      'Force the location of the shared library to the current project folder irrespective where the project is located
      Call reloadSharedLibrary
  End Sub
  </code></pre>
  
  <p>Two, in Modules.Libraries I added another sub reloadSharedLibrary:</p>
  
  <pre><code>Public librName As Variant
  
  
  Public isRefReloaded As Boolean
  
  Sub reloadSharedLibrary()
  
          isRefReloaded = True
  
          Dim VBAEditor As VBIDE.VBE
          Dim vbProj As VBIDE.VBProject
          Dim chkRef As VBIDE.Reference
          Dim BoolExists As Boolean
          Dim librPath As String
  
          Set VBAEditor = Application.VBE
          Set vbProj = ActiveWorkbook.VBProject
  
          librName = "lib_emtm"
          librPath = Application.ActiveWorkbook.Path &amp; "\lib.xlsm"
  
          ' delete any shared lib (if exists)
          For Each chkRef In vbProj.References
              If chkRef.Name = librName Then
                  vbProj.References.Remove chkRef
                  BoolExists = True
              End If
          Next
  
          ' you can only add it to VBAProject only after you quit the above loop
          On Error Resume Next
          vbProj.References.AddFromFile librPath
  
          If Err.Number &lt;&gt; 0 Then
              MsgBox "FATAR ERROR: Cannot find shared library file in project root": End
          End If
  
  
          Set vbProj = Nothing
          Set VBAEditor = Nothing
  
  End Sub
  </code></pre>
  
  <p>Now, the problem with this is that when I copy the project folder to a new version folder the reference to child does not get updated. The child the version uses is from the old version.</p>
  
  <p>What am I doing wrong? </p>