View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Remove Reference from VBA Projects


Since Excel 2002 there is a new macro security that you need to "approve" to
perform VBA manipulation of VBProject objects.

To set this,
choose Tools/Macro/Security from the Excel menu,
select the Trusted Sources tab
put a check in the checkbox called "Trust Access to Visual Basic Project".



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"salut" wrote in message
...
I was trying to remove missing references from VBA Projects. For example,
this is the code I use if I want to remove "Microsoft ActiveX Direct

Object
2.7 Library"

The error message I got is "Programmatic access to Visual Basic Project is
not trusted". Could anybody help me out? Thanks a lot!

---------------------------------------------------------------------
Sub removeRef()

Dim Wkb As Workbook
Set Wkb = ThisWorkbook
With Wkb.VBProject.References
.Remove (msado15.dll)
End With
End Sub
----------------------------------------------------------------------