|
How to update information within unrelated excel objects inserted in slides of a presentation
' ====== Class Module - EventClass =====Option ExplicitPublic WithEvents App As Excel.ApplicationPrivate Sub App_WorkbookDeactivate(ByVal Wb As Excel.Workbook)Call UpdateXLCellsEnd Sub' ====== End Of Class Module - EventClass =====' ======= Module =======Option Explicit' ------ Code Specific to Hooking into Excel Events -----Dim AppClass As New EventClassSub SetExcelHook()Set AppClass.App = Excel.ApplicationEnd SubSub UnHook()AppClass.App = NothingEnd Sub' ------ End Of Code Specific to Hooking into Excel Events -----Sub UpdateXLCells()Dim X As IntegerDim Y As VariantFor X = 2 To 4 Y = Y + GetXlRngValues(ActivePresentation.Slides(X).Shapes(1), "B2")NextSetXlRngValues ActivePresentation.Slides(1).Shapes(1), "B2", YEnd SubFunction GetXlRngValues(oShape As PowerPoint.Shape, _ Rng As String) As VariantDim XLObj As Excel.WorkbookDim CellValues As VariantSet XLObj = oShape.OLEFormat.ObjectGetXlRngValues = XLObj.Worksheets(1).Range(Rng)End FunctionSub SetXlRngValues(oShape As PowerPoint.Shape, _ Rng As String, Value As Variant)Dim XLObj As Excel.WorkbookDim CellValues As VariantSet XLObj = oShape.OLEFormat.ObjectXLObj.Worksheets(1).Range(Rng) = ValueEnd Sub' ===== End Of Code =====
H0UZNPRO.rar
(33.04 KB, 下载次数: 251)
|
|