Partager via


How to: Edit OLE Objects in Forms and Tables

When you add an OLE object to a table or form, you can edit the data and display settings for the object at design time or run time.

Note

You cannot edit the data of an OLE object in an OLE Bound control at design time.

Some embedded OLE objects support in-place editing so that you can edit the object in the window used by your application. For example, if you double-click a Microsoft Excel worksheet object in a General field, the menu titles change to reflect the Microsoft Excel menu structure and the default Microsoft Excel toolbars are displayed. You or the application user can edit the Microsoft Excel object without leaving your application. However, the Visual FoxPro standard File, Program, and Window menus are not replaced.

Note

Only embedded objects can be edited in place, not linked objects.

If you create a menu title and want it to be displayed even while the user edits an OLE object, select Negotiate in the Prompt Options dialog box of the Menu Designer. For more information, see Designing Menus and Toolbars, or the NEGOTIATE clause in the DEFINE PAD Command topic.

You can also open the Automation server in another window, edit the data or display characteristics there, and have the new values reflected in your application when you return to it.

To edit data in a General field in a table

  1. Open the table you want in a browse window.

  2. Double-click the General field you want to edit.

    An editing window opens for the General field.

  3. In the editing window, double-click the object to edit the data.

To edit embedded or linked objects on a form while designing the form

  1. Select the object representing the data.

  2. With the mouse pointer over the object, click the right mouse button.

  3. From the shortcut menu, choose the object type, and then choose Edit or Open.

To edit objects or data from General fields on a form while running the form

  1. From the Edit menu, select the object.

    For example, if the object is a Microsoft Excel worksheet, select Spreadsheet Object from the Edit menu.

    Tip

    You can also right-click on the object if its AutoVerbMenu property is set to True. Choose the object type, and then choose Edit or Open.

  2. To edit the object visually, choose Edit from the submenu.

    -or-

    To edit the object in a separate window, choose Open from the submenu.

    Warning

    If you change the data in an object while running a form, Visual FoxPro saves the changes only if the data is linked or is associated with an OLE Bound control. Changes associated with an OLE Container control are not saved.

See Also

Tasks

How to: Add OLE Objects to Applications

Other Resources

Working with OLE Objects