Container Property

Microsoft Excel Visual Basic

Container Property

       

Returns the object that contains the specified embedded workbook. Read-only Object.

Remarks

Use this property with a contained workbook to return the container object. If the container doesn’t support OLE Automation or the workbook isn’t embedded, this property fails.

Example

This example hides the second section in the binder that contains the active Microsoft Excel workbook and then sets the value of cell A1 to 345.67. In this example, the binder is Binder1.obd.

Set myBinder = GetObject("Binder1.obd", "Office.Binder")
Set myWorkbook = myBinder.Sections(1).Object
With myWorkbook
    .Container.Sections(2).Visible = False
    .Sheets(1).Cells(1, 1).Value = 345.67
End With