How to Copy paste data range from Excel to powerpoint slide

后端 未结 3 2128
独厮守ぢ
独厮守ぢ 2020-12-22 00:02

I am trying to prepare code to copy and paste excel data range from excel sheet to powerpoint slide but I am able to paste images only.

Please help with the suitable

3条回答
  •  庸人自扰
    2020-12-22 00:19

    It still surprises me that many of the PasteSpecial options are not available form the clipboard or in PowerPoint generally. I think there is a way around this using a different method. Instead of:

    PPSlide.Shapes.PasteSpecial ppPasteOLEObject
    

    Try using this method:

    PPSlide.Parent.CommandBars.ExecuteMso "PasteExcelTableSourceFormatting"
    

    I am not certain of the correct idMso argument to use but I would start with that, it looks like it works the way I would expect it to:

    PowerPoint Result

    enter image description here

    Excel Table Example

    enter image description here

    If not, there are several others that might be worth checking:

    • PasteSourceFormatting
    • PasteDestinationTheme
    • PasteAsEmbedded
    • PasteExcelTableSourceFormatting
    • PasteExcelTableDestinationTableStyle

    This method is not as well-documented compared to many other methods. The Application.CommandBars property reference has nary a mention of the ExecuteMso method, which I found some information about here (and on SO where I have seen it used once or twice before):

    The full list of idMso parameters to explore, which come as part of a rather large executable for use with fluent ribbon UI design, current for Office 2013 I believe:

    http://www.microsoft.com/en-us/download/details.aspx?id=727

提交回复
热议问题