Programmatic access to Visual Basic Project is not trusted

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a template which i need to distribute to unknown number of audiance. If "Programmatic access to Visual Basic Project is not trusted" is not checked manually, i get the following error : Programmatic access to Visual Basic Project is not trusted, "Runtime error 1004

Is there anyway that I can set the option under: Tools, Macro, Security...Trust access to Visual Basic Project through my VBA code.
 
Boy howdy, I sure hope not.

What use would that setting be if you could?

-----Original Message-----

I have a template which i need to distribute to unknown
number of audiance. If "Programmatic access to Visual
Basic Project is not trusted" is not checked manually, i
get the following error : Programmatic access to Visual
Basic Project is not trusted, "Runtime error 1004"
Is there anyway that I can set the option under: Tools,
Macro, Security...Trust access to Visual Basic Project
through my VBA code.
 
I am trying to delete all forms, modules and other coding ...from the project once i m done with my output. Size of the end output is the concern. I am using following code......but that only works if "Programattic access to Visual Basic Code is not trusted" is checked.

Sub DeleteALLVBA(
Dim VBComp As VBIDE.VBComponen
Dim VBComps As VBIDE.VBComponent

Set VBComps = ActiveWorkbook.VBProject.VBComponent

For Each VBComp In VBComp
Select Case VBComp.Typ
Case vbext_ct_StdModule, vbext_ct_MSForm, vbext_ct_ClassModul
VBComps.Remove VBCom
Case Els
With VBComp.CodeModul
.DeleteLines 1, .CountOfLine
End Wit
End Selec
Next VBCom
End Sub
 
Back
Top