Object...

Home Search Site Map

Up
Cells...
Chart...
Columns
Comment
Diagram...
Function...
Hyperlink...
Name
Object...
Page Break
Picture
Rows
Symbol...
Worksheet

New! Excel User Group Now Open @ www.excelusergroup.org, Check It Out!


Menu command Type What happens next?
Object... ...

Allows you to insert an object into a worksheet for any applications that have their objects' exposed' to Excel. Displays a dialog box (below), with the list of objects, selecting one 'embeds' that object into the worksheet. It can either be displayed fully or as an icon. When displayed fully, double-clicking allows you to edit the object in-situ, with Excel's toolbars being replaced with that of the object selected. (Excel's title bar will also reflect this with something similar to 'Document in Book1'. If you choose Icon view, the object is still held in the worksheet, but double-clicking the icon, starts the associated application displaying the object within it. The 'Create from File' tab allows you to embed an existing document, rather than starting anew. To delete an OLE (Object Linking and Embedding) object, click off it and then single-click back on and Edit>Cut, or press the delete key.

VBA Sub InsertWordObject()
Dim wrdDoc As OLEObject
Dim wks As Worksheet
Set wks = ActiveSheet
'Assign the new OLE object to a variable of the same type
Set wrdDoc = wks.OLEObjects.Add(ClassType:="Word.Document.8")
'Activate the object and re-size it.
With wrdDoc
.Activate
.Height = 300
.Width = 500
End With
End Sub

Top

 

Copyright Nick Hodge 2008. All Rights Reserved.