Share this Page URL
Help

Chapter 31. Exchanging Data with Automat... > Adding ActiveX Controls to Your Appl... - Pg. 1108

Exchanging Data with Automation and ActiveX Controls 1108 The ControlName.Action = acOLEActivate statement is required if the embedded object has not been activated when you execute the preceding code example, either in the Debug window or a VBA procedure. An embedded object in a frame must be activated before you can refer to its Object.Application.PropertyName property. Linked objects in object frames don't support Automation. You receive a This object does not support OLE Automation error mes- sage when you execute Set wdaName = uofName.Object. Application.WordBasic for a linked file. Figure 31.26 shows an example of activating an embedded Word 97 object and then reading the value of bookmarked text by using the Selection object. To execute the code shown in Figure 31.26, you must first insert an unbound Word 97 object created from a file with bookmarks that are named "Excel8Head" and "Word8Head" in a form named frmWord. You must also create a ref- erence to the Microsoft Word 8.0 object library and declare the object variables wdaUA97 and wddUA97 in the Declarations section of a module. Figure 31.26. Reading the text of a bookmark in an embedded OLE object. By using Automation and code similar to that shown in Figure 31.26, you can create a document that consists of nothing but empty bookmarks. Then you can fill the bookmarks with text contained in Text or Memo fields of tables or from the Value property of control objects on forms. Using Automation provides a much more flexible method of creating specialized documents than using Access 95's Merge It feature. Adding ActiveX Controls to Your Application ActiveX controls (OCXs) are a special class of programmable Automation objects that expose their own events in addition to their properties and methods. You embed the ActiveX control in a form and program the control with the same types of statements used with native Access controls, such as a text box or combo box. Some ActiveX controls are databound, in which case you embed the control in a form bound to an Access table or query.