Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of VBComponents method in Excel 2007

Status
Not open for further replies.

phudgens

Technical User
Jul 8, 2004
117
US
I use the following code to delete selected code modules from my Excel 2003 workbook and it works fine, both on my computer and on my co-workers. We upgraded to Excel 2007 and it still worked fine on my computer but not on my co-workers. I've checked to make sure that all the appropriate libraries are being invoked (6 of them) and they are. The message they get is: "Programmatic access is not trusted" and when I hover over VBComponents in debug mode, I get a "failed" message. Does anyone know what the problem might be?

Code:
    Set ThisVBProject = ActiveWorkbook.VBProject.VBComponents
    
    Call UnprotectVBProj(SecretWord)
    
    For Each VBCom In ThisVBProject
        If LCase(VBCom.Name) = "fracfill" Then ThisVBProject.Remove ThisVBProject(VBCom.Name)
    Next VBCom

Thanks,
Paul Hudgens
Denver
 



Do you have a Tools > References reference checked for

Micorsoft Visual Basic for Applications Extinsibility

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Yes - Extensibility 5.3 on both mine and my co-workers computers.

Thanks,
Paul Hudgens
 
You have to trust VBA project in the excel's security options.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I realized that the Excel file that I was giving my co-workers was from 2003. When I gave them the version from 2007, it automatically checked the "Trust access to the VBA project object model" box when they loaded the file. This fixed the problem. Thanks to everybody.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top