PRB: Programmatic Access to Office XP VBA Project Is Denied

Transcription

PRB: Programmatic Access to Office XP VBA Project Is Denied
Programmatischen Zugriff auf VBA Projekt wird nicht vertraut Fehler 6068
Dienstag, 7. Februar 2006
16:30
Problem: in Word kein Zugriff über VBA auf VBA-Module
Ursache: Microsoft "sichert" Word
Lösung: Extras-Macros-Sicherheit-Vertrauswürdige Herausgeber, Haken bei Zugriff auf Visual
Basic-Projekt vertrauen, siehe MS Dokumentation
Suchbegriffe: Word VBA Module 6008
Stand: 2006-02-07
PRB: Programmatic Access to Office XP
VBA Project Is Denied
View products that this article applies to.
Article ID
:
282830
Last Review
:
December 15, 2003
Revision
:
1.0
This article was previously published under Q282830
SYMPTOMS
Code that is written to automate an Office application and programmatically manipulate the
Microsoft Visual Basic for Applications (VBA) environment and object model may fail on
Office XP with one of the following error messages:
From Visual Basic or VBA:
Run-time error '6068': Programmatic Access to Visual Basic Project is not trusted
From Microsoft Visual C++, Microsoft Foundation Classes (MFC), or ActiveX Template
Library (ATL):
HRESULT = 0x800A17B4 (-2146822220) "Programmatic Access to Visual Basic Project is
not trusted"
The same code works without error on computers with Office 97 and Office 2000.
CAUSE
Office XP adds a security option to deliberately lock out programmatic access to the VBA
object model from any Automation client unless a user chooses to permit such access. This
Word Seite 1
object model from any Automation client unless a user chooses to permit such access. This
is a per user and per application setting, and denies access by default.
This security option makes it more difficult for unauthorized programs to build "selfreplicating" code that can harm end-user systems.
RESOLUTION
For any Automation client to be able to access the VBA object model programmatically, the
user running the code must explicitly grant access. To turn on access, the user must follow
these steps:
1.
Open the Office application in question. On the Tools menu, click Macro, and then click
Security to open the Macro Security dialog box.
2.
On the Trusted Sources tab, click to select the Trust access to Visual Basic Project
check box to turn on access.
3.
Click OK to apply the setting. You may need to restart the application for the code to run
properly if you automate from a Component Object Model (COM) add-in or template.
APPLIES TO
•
Microsoft Office Excel 2003
•
Microsoft Excel 2002 Standard Edition
•
Microsoft Office PowerPoint 2003
•
Microsoft PowerPoint 2002 Standard Edition
•
Microsoft Office Word 2003
•
Microsoft Word 2002 Standard Edition
Back to the top
Keywords:
kbautomation kbprb KB282830
Eingefügt aus <http://support.microsoft.com/default.aspx?
scid=http://support.microsoft.com:80/support/kb/articles/Q282/8/30.ASP&NoWebContent=1>
Word Seite 2