Excel 2007. Trust Access to VBA Project Checked, still not truste


B

Barb Reinhardt

I've just migrated to a new laptop and Excel 2007 in the last 24 hours and am
unable to run a macro that worked in 2003 on 2007 (that's a newsflash, huh?)
Anyway, I'm trying to programmatically access information about the VBA
Project and when I get to this line

Set VBProj = mySlide.Parent.VBProject

I get an error that the project is not trusted. (OK, this is PowerPoint,
but it's running out of Excel). I've changed the settings to trust this
project and I still get the error. Is there something that our admins need
to do so that I can run this? Do I need to trust this out of PowerPoint?

Thanks,
Barb Reinhardt
 
Ad

Advertisements

B

Barb Reinhardt

I just set it's current location to be a trusted location and I'm still
getting the error. What next?

Thanks for your help.

Barb
 
B

Bob Phillips

What exactly are you doing that needs trusted access? if you post that I can
try it here.
 
B

Barb Reinhardt

The trusted location is on my Z drive. I'm getting an error in this function

Public Function VBSlideProj(mySlide As PowerPoint.Slide) As Boolean
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent

Set VBProj = mySlide.Parent.VBProject 'Error here

VBSlideProj = False
For Each VBComp In VBProj.VBComponents
If VBComp.Name = mySlide.Name Then
VBSlideProj = True
Exit Function
End If
Next VBComp

End Function


I'm actually opening some powerpoint presentations and am checking to see if
there is a VBComponent attached to each slide. If there is, I want to do
something different.
 
Ad

Advertisements

B

Barb Reinhardt

OK, so how do I do that when I'm not sure which powerpoint presentation I'm
going to be using each time?
 
P

Peter T

Exactly as you would in any Office application, including Excel. Didn't we
discuss this once before? It's a one-off application level setting, that
'ought' to be done manually by the user -

in 2007
Office button
App' Name Options
Trust Center
Trust Center settings
Trust access to the VBA project object model

In 2002/3
Tools
Macro
Security
Trusted publishers
Trust access to VB Project

In this case looks like 5 steps in all versions, somehow it seems like its
considerably more in '2007 !

Regards,
Peter T
 
B

Barb Reinhardt

No, we didn't discuss in the context of 2007. Should I set up a "trusted
location" in PowerPoint as well?
 
P

Peter T

No, we didn't discuss in the context of 2007.

Maybe not in 2007 but it's the same issue in all versions since 2002. Only
difference is where to find the setting in the UI.
Should I set up a "trusted
location" in PowerPoint as well?

Programmatic access to a VBProject is not a "trusted location" issue.

Regards,
Peter T
 
B

Barb Reinhardt

OK then, I still have a problem.

I'm running a macro out of Excel 2007. I'm opening powerpoint and need to
have programmatic access to the VBA Project in PowerPoint. It worked in
2003 and now doesn't in 2007. I have trusted the VBA Project in the source
code, trusted the location where the source code is saved in Excel and
PowerPOint and still nada. I'm not sure what to do next.
 
Ad

Advertisements

G

gimme_this_gimme_that

I'm not clear on whether you're running the Macro from Excel or PPT.

Anyway, it's possible that the slide hasn't been opened and it's
bombing because of that.

You should check that the macro works in PPT - because it's possible
that M$ doesn't provide access to the PPT VBProject.

If it's a security thing, MS Office comes with a program for creating
digital certifcates called
Selfcert.exe. It allows you to create digital certificates.

For details see page 27 of "Microsoft Office 2007 Programming" for a
step through.

Or try Googling Selfcert.exe and see if you get lucky.
 
P

Peter T

I don't follow this bit-
"I have trusted the VBA Project in the source code"

That does not relate to anything you might do in the source code.

Have you ticked "Trust access to the VBA project object model" in your
PP-2007?

(In the instructions I gave, after hitting "Trust Center settings" I
overlooked to mention you need to be of the "Macro settings" page. For me
that tends to open by default but it might not for you.)


There are all sorts of security settings which affect things differently. In
simple terms, the macro security settings affect whether or not the
Application can run your VBA code "macros enabled". If the VBA or code file
is in a "Trusted Location" it might open with under a "higher" security
level. Similarly as might a "signed" project.

Your current issue is not related to macro security, at least not as far as
your code and its host application is concerned. A different type of
security setting affects whether a VBProject can be referenced by some other
application, eg your VBA. Typically Excel VBA code might want to reference
some other code project within Excel, even itself (even to reference itself
the security setting must be enabled).

However you are attempting to reference a VBProject hosted by PowerPoint.
This means you need to follow the instructions to I gave earlier in any/all
version(s) of PowerPoint that you are automating with your Excel VBA.

Looking again at what you originally wrote -
"I get an error that the project is not trusted."

No, it's not "the project" that is not trusted, it is "access to the
project" is not trusted. That's completely different.

It's one of those "once you get it" type of things, have another look.

Normally it's up to the user to change the security setting

Regards
Peter T
 
B

Barb Reinhardt

I'm running this from Excel and am accessing the PowerPoint object model.
I can try a digital cert, but I don't think that's going to help in this
circumstance. it's not able to access the VBA Project with code, the rest
works fine. I self cert other things, so I know how to do that.
The slide is opened. It wouldn't find it if it weren't.
 
B

Barb Reinhardt

I thought I changed this, but I just found that in PowerPoint, the option to
Trust access to the VBA Project Object model is greyed out. I can't change
it. Any idea how I can change it?
 
P

Peter T

Hmm, I really don't know, I can't recreate say by changing other security
options, loading different file types or no loaded files at all.

Might be worth posting a new question specifically about this, here or in
the PowerPoint group. Someone will know! If not I'll ask in another place.

Regards,
Peter T
 
Ad

Advertisements

P

Peter T

The issue, Trust Access to VB Projects in general and why that option is
greyed in Powerpoint is not related to SelfCert or project signing.

Regards,
Peter T
 
Ad

Advertisements

B

Barb Reinhardt

The problem was a group policy setting on my computer that needed to be
changed. What a pain!

Thanks for your assistance.
 
Ad

Advertisements


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