Adding references from VBA Causing Password Prompt To Appear
Posted
by ChloeRadshaw
on Stack Overflow
See other posts from Stack Overflow
or by ChloeRadshaw
Published on 2010-03-23T14:26:49Z
Indexed on
2010/03/23
16:13 UTC
Read the original article
Hit count: 523
EDIT: I WILL GIVE A 300 rep BOUNTY FOR THIS:-)
I have run out of ideas. I have a very simple macro that adds references.
It looks like I have the same problem as this http://www.eggheadcafe.com/software/aspnet/35651964/excel-prompts-for-vba-pas.aspx
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
This adding references works fine until I put a password around the VBA at which point it prompts me for a password.
I have tried absolutely everything
© Stack Overflow or respective owner