Friday, August 31, 2018

excel - VBA Tools>References Prompting for ProjectPassword to Open



I have searched online for a bit with no luck in finding a way around this.



I inherited an Excel workbook where the VBA code not protected. I can view | edit the code with no problem. However, when trying to run the code I get:





Compile Error: Can't find project or library.




I then go to Tools > References in the VBE and am prompted for a VBAProject Password.



My experience tells me that there is a reference set to some other VBAProject that is password protected that is no longer relevant, or at least it's missing, but how can I bypass this password error to check on the missing project.


Answer



While the end result answer may not be that universally helpful, I thought the methodology I used to get the answer may be useful for others.




I discovered the offending reference was



Name: ACRODISTXLib
FullPath: C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\acrodist.exe


The citrix path where the file is normally run houses Adobe Acrobat. My desktop houses Adobe Reader.



Adobe Acrobat has 2 other references:




Name: Acrobat
FullPath: C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\acrobat.tlb
Name: AcrobatAccessLib
FullPath: C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\plug_ins\Accessibility.api


These get translated nicely to machines with only Reader installed as:



Name: Acrobat
FullPath: C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.dll

Name: AcrobatAccessLib
FullPath: C:\Program Files (x86)\Adobe\Reader 10.0\Reader\plug_ins\Accessibility.api


The first reference does not.



This is the code I used to compare the references in each workbook in each environment, which I decided to it when I get an error in accessing the reference name and fullpath in the workbook on my desktop:



Dim ref As Object


For Each ref In ThisWorkbook.VBProject.References
Debug.Print ref.Name & " | " & ref.fullpath
'If ref.isbroken Then
'ref.Remove
'ThisWorkbook.VBProject.References.Remove ref
'End If
Next

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...