我想从powerpoint演示文稿中创建excel工作表,在其中我可以保留powerpoint幻灯片的格式,并能够调整某些值。有人知道怎么做吗?
我听说过在excel工作表中创建powerpoint幻灯片,但我需要走另一条路,因为我想保留powerpoint幻灯片的格式,但需要能够调整某些值。有人知道怎么做吗?
我基本上需要一个Excel工作表,它看起来和我的powerpoint幻灯片很像。
这是我到目前为止所知道的:
Dim PowerPointApp As Object
Dim myPresentation As Object
.
.
.
'Adds a slide to the presentation - is this also possible for worksheets?
Set mySlide = myPresentation.slides.Add(myPresentation.slides.Count + 1, 11) '11 = ppLayoutTitleOnly
' Pastes the copied range out of the excel into the Powerpoint
mySlide.Shapes.PasteSpecial DataType:=2
.
.
.
我想要做的是扭转这些,我找不到任何提示如何。既不是在书本上也不是在互联网上。
发布于 2019-08-22 04:32:46
这里是一个基本的方法。此代码从Excel内部运行,需要对powerpoint对象库的引用。它在Excel中创建一个新的工作表,每张幻灯片一个工作表,并跨幻灯片内容复制(即,所有形状)。它根据形状在幻灯片上的位置来定位形状。这有点像是一个概念启蒙。干杯。
Option Explicit
' ---> ADD REFERENCE TO MICROSOFT POWERPOINT OBJECT LIBRARY
Public Sub CreateSheetsFromSlides()
Dim vPowerPoint As PowerPoint.Application
Dim vPresentation As PowerPoint.Presentation
Dim vSlide As PowerPoint.Slide
Dim vPowerpointShape As PowerPoint.Shape
Dim vExcelShape
Dim vSheet As Worksheet
' Open the powerpoint presentation
Set vPowerPoint = New PowerPoint.Application
Set vPresentation = vPowerPoint.Presentations.Open("source.pptx")
' Loop through each powerpoint slide
For Each vSlide In vPresentation.Slides
' Create a new worksheet ... one per slide ... and name the worksheet same as the slide
Set vSheet = ThisWorkbook.Sheets.Add(, After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))
vSheet.Name = vSlide.Name
MsgBox vSheet.Name
' Loop through each shape on the powerpoint slide and copy to the new worksheet
For Each vPowerpointShape In vSlide.Shapes
vPowerpointShape.Copy
' Create the shape on the worksheet and position it on the sheet at the same top/left as it is on the slide
vSheet.PasteSpecial
Set vExcelShape = vSheet.Shapes(vSheet.Shapes.Count)
vExcelShape.Top = vPowerpointShape.Top
vExcelShape.Left = vPowerpointShape.Left
Next
Next
vPresentation.Close
vPowerPoint.Quit
End Sub
https://stackoverflow.com/questions/57577051
复制相似问题