title: Adding references from VBA Causing Password Prompt To Appear
body: <p>EDIT: I WILL GIVE A 300 rep BOUNTY FOR THIS:-)</p>
  
  <p>I have run out of ideas.  I have a very simple macro that adds references.</p>
  
  <p>It looks like I have the same problem as this <a href="http://www.eggheadcafe.com/software/aspnet/35651964/excel-prompts-for-vba-pas.aspx" rel="nofollow noreferrer">http://www.eggheadcafe.com/software/aspnet/35651964/excel-prompts-for-vba-pas.aspx</a></p>
  
  <pre><code>Sub testAddSolver()
      Call AddSolver()
  End Sub
  
  
  Sub AddSolver()
      Dim strSolverPath As String
      Dim wbSolver As Workbook
      Dim objRef As Object
      Dim oWB As Object    ' NOT as workbook
      Dim ad As AddIn
  
      On Error GoTo errH
      Set oWB = ActiveWorkbook
  
      With Application.AddIns("Solver Add-In")
          strSolverPath = .FullName
          On Error Resume Next
          Set wbSolver = Workbooks(.name)
          On Error GoTo errH
  
          If wbSolver Is Nothing Then
          .Installed = True
          End If
      End With
  
      On Error Resume Next
      Set objRef = oWB.VBProject.References("SOLVER")
      On Error GoTo errH
      If objRef Is Nothing Then
          Call MsgBox(strSolverPath)
          oWB.VBProject.References.AddFromFile strSolverPath
      End If
  
      Call MsgBox("Compleetd")
      Exit Sub
  errH:
      MsgBox Err.Description, , "Error in AddSolver"
  End Sub
  </code></pre>
  
  <p>This adding references works fine until I put a password around the VBA at which point it prompts me for a password.</p>
  
  <p>I have tried absolutely everything</p>