Understanding Macro Actions That Are Not Trusted


Earlier in this chapter we mentioned that Access 2007 has trusted and not trusted macro actions. As you might recall from Chapter 2, “Exploring the New Look of Access 2007,” the Trust Center settings in the Access Options dialog box control whether Access disables certain content in your database. If your database is not trusted, Access might silently disable any potentially malicious macros or VBA code depending upon the Trust Center settings you enabled or disabled. So what exactly is a malicious macro? In Microsoft’s terms, a malicious macro runs an action that could potentially do harm to your computer or files, such as deleting a file.

Access 2007 separates macro actions into two categories-those that will run in any database, even in a database that is not trusted (trusted macros), and those that can run only in a database that is trusted (not trusted macros). Note that if you select Enable All Macros in the Trust Center Macro Settings section (not recommend by Microsoft), Access treats all macro actions as trusted even when the database is not trusted.

Note 

If you are in a corporate network environment, you should check with your Information Technology department to determine whether your company has established guidelines concerning enabling content in Access databases.

Access 2007 recognizes 32 macro actions as potentially unsafe to run in a database that is not trusted. Seven of the actions are not trusted only when you select certain arguments. Table 18–1 lists the macro actions that Access will run only when the database is trusted. The Comments column lists special cases dependent on the arguments you choose or an alternative trusted method you can use.

Table 18–1: Macro Actions That Are Not Trusted
Open table as spreadsheet

Action

Comments

Close

Setting the Save argument to Prompt is trusted.

CopyDatabaseFile

 

CopyObject

 

DeleteObject

 

Echo

 

OpenDataAccessPage

 

OpenDiagram

 

OpenForm

Setting the View argument to Design or Layout is not trusted.

OpenFunction

 

OpenModule

 

OpenQuery

Setting the View argument to Design is not trusted.

OpenReport

Setting the View argument to Design or Layout is not trusted.

OpenStoredProcedure

 

OpenTable

Setting the View argument to Design is not trusted.

OpenView

 

Printout

 

Quit

Setting the Options argument to Prompt is trusted.

Rename

 

RunApp

 

RunCommand

Commands that affect objects in Design or Layout view are not trusted.

RunSavedImportExport

 

RunSQL

 

Save

 

SendKeys

 

SetValue

Use the trusted SetProperty action instead of SetValue to change the Enabled, Visible, Locked, Left, Top, Width, Height, Fore Color, Back Color, or Caption properties of forms, reports, or controls.

SetWarnings

 

ShowToolbar

 

TransferDatabase

 

TransferSharePointList

 

TransferSpreadsheet

 

TranferSQLDatabase

 

TransferText

 

In the Wedding List Macro sample database, you can find a macro that shows you all the macro actions that are not trusted. Open the mcrXmplNotTrustedActions macro in Design view to see all 32 macro actions that are not trusted, as shown in Figure 18–27.

image from book
Figure 18–27: Macro actions that are not trusted display an exclamation mark in the left column of the macro design window.

image from book Note that when you select a macro action or argument that is not trusted, Access displays an exclamation mark on the selector button of the macro line. When you’re designing your macros, you can use this visual aid to easily see whether any of your macro actions will not run in a database that is not trusted.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

Similar book on Amazon
Access 2007: The Missing Manual
Access 2007: The Missing Manual
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoft Office Access 2007 Forms, Reports, and Queries
Microsoft Office Access 2007 Forms, Reports, and Queries
Alison Balter's Mastering Microsoft Office Access 2007 Development
Alison Balter's Mastering Microsoft Office Access 2007 Development

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net