Programming Microsoft Access 2000 (Microsoft Programming Series)

The shared Office objects, listed in the table below, provide support in several important areas of functionality. Some of these object models are not available in all Office components. The table describes the models, mentions when they have restricted availability across Office components, and highlights where you can find further information about them in this book. To get online help and work with any of these objects, you must reference the Microsoft Office 9 Object Library. You can do this through the Tools menu in the Microsoft Visual Basic Editor (VBE) or programmatically (as this chapter will show later).

Shared Office Objects

Object Description Comment
CommandBar You can use this object and its col- lections to create and modify tool- bars, menu bars, and shortcut menus. You can make design-time changes manually and with VBA code. You can make run-time changes exclusively with VBA code. See further discussion and samples in this chapter.
Assistant You use this object to support cus- tom help requirements for the Office Assistant and Office Assistant balloon. Various properties and methods let you control the type and animation of the Assistant as well as the content and behavior of the balloon. See further discussion and samples in this chapter.
FileSearch You use this object to represent the functionality of the Open dialog box. See further discussion and samples in this chapter.
COMAddin This is a representation of a COM add-in in Access and other Office host applications. See the Microsoft Office 2000 Programmer's Guide.
LanguageSettings This object lets you programmatically return information about lan- guage installation, user interface, and help settings. Tracks locale identi-fier information when deploying Office internationally.
AnswerWizard You use this object to program- matically manipulate the Answer wizard. Includes properties and methods for manipulating files returned by the Answer wizard.
DocumentProperty This object represents a built-in or custom property of an Office docu- ment. There are up to 28 built-in properties, which include such document attributes as title, author, comments, last print date, last save time, and total editing time. This object also supports custom document properties. For Word documents, Excel workbooks, and Microsoft PowerPoint presentations only.
HTMLProject This object is a top-level project in the Microsoft Script Editor. You use the HTMLProjectItem collection to track HTML documents within a project. For Word documents, Excel workbooks, and PowerPoint presentations only.
Script This object represents a block of script in the Script Editor. For Word documents, Excel workbooks, and PowerPoint presentations only.
WebPageFont This object represents the default font when a document is saved as a web page. For Word documents, Excel workbooks, and PowerPoint presentations only.

Access Database Properties

Access does not have a shared DocumentProperty object as Word, Excel, and PowerPoint do, but it makes much of the same kind of information available using three Documents objects: MSysDB, SummaryInfo, and UserDefined. These are available exclusively through Data Access Object's (DAO's) Database Container. You can't use them with Microsoft ActiveX Data Objects (ADO). The SummaryInfo object contains all properties on the Summary tab of the Database Properties dialog box. The UserDefined object contains all properties on the Custom tab of that dialog box. The MSysDB object contains all the properties defined under Tools-Startup in a database.

The following sample enumerates the properties collection of each DAO Database Container object:

Sub enumDBProps() Dim db As Database, p As DAO.Property 'Set reference to current database. Set db = CurrentDb 'Print heading for results. Debug.Print "User defined properties" Debug.Print "=======================" 'Iterate through UserDefined database properties. For Each p In db.Containers!Databases. _ Documents!UserDefined.Properties Debug.Print p.Name, p.Value Next 'Print heading for results. Debug.Print Debug.Print "Summary Properties" Debug.Print "==================" 'Iterate through SummaryInfo database properties. For Each p In db.Containers!Databases. _ Documents!SummaryInfo.Properties Debug.Print p.Name, p.Value Next 'Print heading for results. Debug.Print Debug.Print "MSysDB Properties" Debug.Print "=================" 'Iterate through MSysDB database properties. For Each p In db.Containers!Databases. _ Documents!MSysDB.Properties Debug.Print p.Name, p.Value Next End Sub

Категории