我想从PowerPoint演示文稿中创建Excel工作表,在其中我可以保留PowerPoint幻灯片的格式并能够调整某些值。有人知道吗?
我听说要从excel工作表中创建PowerPoint幻灯片,尽管我需要采取其他方法,因为我想保留PowerPoint幻灯片的格式,但需要能够调整某些值。有人知道吗?
我基本上需要一个外观和工作方式类似于我的PowerPoint幻灯片的Excel工作表。
这是我到目前为止所拥有的:
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
.
.
.
我想做的就是扭转这些,我找不到任何提示。无论是在书本上还是在互联网上。
答案 0 :(得分:0)
这是一种基本方法。此代码是从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