Programmatic access to Visual Basic Project is not trusted


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.
 
Ad

Advertisements

G

Guest

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.
 
Ad

Advertisements

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top