Creating and Accessing a OLEObject
问题 I have an VBA Macro that at times requires me to create a new slide with a new embedded excel spreadsheet, then edit that spreadsheet. A simplified version of this code: Dim sld As Slide Dim shp As shape Dim pptWorkbook As Object Set sld = ActivePresentation.slides.add(ActivePresentation.slides.Count + 1, ppLayoutBlank) Set shp = sld.Shapes.AddOLEObject(100, 100, 100, 100, "Excel.Sheet") DoEvents If shp.Type = msoEmbeddedOLEObject Then 'Error thrown here Set pptWorkbook = shp.OLEFormat.Object