【发布时间】:2020-12-18 23:01:09
【问题描述】:
例如:导出幻灯片编号 30 到 80(导出为 mp4)。 一些宏? 或者:只导出一个部分。
我找到了一个按部分导出幻灯片的宏,但它是 png 格式,当我切换到 mp4 时它不起作用。 (罗德里戈·莫拉斯宏)。
Sub Test_Export()
Dim sld As Slide
i = 1
DesiredSection = SectionIndexOf("Test")
For Each sld In ActivePresentation.Slides
If sld.sectionIndex = DesiredSection Then
ActivePresentation.Slides(i).Export filenamepng & "TEST" & i & ".png", "PNG"
End If
i = i + 1
Next
End Sub
Function SectionIndexOf(sSectionName As String) As Long
Dim x As Long
With ActivePresentation.SectionProperties
For x = 1 To .Count
If .Name(x) = sSectionName Then
SectionIndexOf = x
End If
Next
End With
End Function
用户(Albert Floor)可以使用此宏将选定的幻灯片导出为 PDF
Private Sub CommandButton4_Click()
Dim myInput As String
Dim savePath As String\
'Name of Student
myInput = ActivePresentation.Slides(1).Shapes("TextBox2").OLEFormat.Object.Text\
'Location of saved file
savePath = ActivePresentation.Path & "\" & myInput & " Antwoorden Virtueel Lab" & ".pdf" \\\\
'Select path student took
If ActivePresentation.Slides(9).Shapes("TextBox1").OLEFormat.Object.Text = "PRARDT" Then
'Change view
ActivePresentation.SlideShowWindow.View.Exit
'Prevents error
ActiveWindow.Panes(1).Activate
'Select specific slides
ActivePresentation.Slides.Range(Array(9, 11, 15)).Select
'save selected slides as PDF
ActivePresentation.ExportAsFixedFormat Path:=savePath, FixedFormatType:=ppFixedFormatTypePDF, RangeType:=ppPrintSelection
MsgBox "file saved"
Else
MsgBox "wont work"
End If
End Sub
【问题讨论】:
-
有什么原因你不能复制幻灯片,删除你不想要的幻灯片,然后用OBS或类似的方式录制?
-
您能否详细说明您遇到的问题以及您希望宏能做什么?
-
看起来你是新来的。请阅读本指南,了解如何提出可以得到良好答案的问题:stackoverflow.com/help/how-to-ask
-
@Beefster 关于删除幻灯片,我有很多幻灯片和视频/图像,所以当我尝试删除时,我必须等待很长时间,而且 PowerPoint 经常停止工作,我不得不关闭它。我用OBS录制,但是我做了大量的工作,全天的录制时间需要我很长时间。出于这个原因,我在 Sandboxie 中打开了几个 powerpoints 以同时导出多个视频。我之所以采用这种方式是因为 PowerPoint 甚至无法持续使用我 40% 的硬件,我已经向 Microsoft 支持寻求帮助并执行了许多教程,但它没有奏效。
-
@Marcucciboy2 我在导出大量 mp4 时遇到问题。尝试删除多张幻灯片时需要很长时间,有时会崩溃,因为我有很多带有视频/图像的幻灯片。我希望宏能让我将特定幻灯片导出到 mp4 以解决所有这些问题。例如:导出幻灯片编号 30 到 80(导出为 mp4)。
标签: vba powerpoint