【发布时间】:2019-04-24 14:28:50
【问题描述】:
我只想在幻灯片模式下将 1 张特定幻灯片保存为 .PDF(或至少是图像)。
我想让用户选择浏览位置并使用默认浏览功能选择名称。我不想让他们写路径。
Dim ExportPath As String ' drive:\path to export to
Dim Pixwidth As Integer ' size in pixels of exported image
Dim Pixheight As Integer
Dim oSlide As Slide
' Edit to suit
Pixwidth = 1920 ' arbitrarily ... set whatever value you like here
' Set height proportional to slide height
Pixheight = 1080
ExportPath = ActivePresentation.Path & "\"
Set oSlide = ActivePresentation.SlideShowWindow.View.Slide
With oSlide
.Export ExportPath & "Slide" & CStr(.SlideIndex) & ".JPG", "JPG", Pixwidth, Pixheight
End With
我在网上找到了代码,它运行良好,但不允许用户浏览位置并选择名称。
然后我使用了以下代码,效果非常好:
Dim CurrentSlide As Long
CurrentSlide = ActivePresentation.SlideShowWindow.View.Slide.SlideNumber
With ActivePresentation.PrintOptions
OutputType = ppPrintOutputSlides
End With
ActivePresentation.PrintOut
但是,这并不适用于所有设备。
在某些情况下,它只是无法识别PrintOut 函数,而在其他情况下,它会打印在 OneNote 中。
用户是否可以浏览并保存为 .PDF 文件(导出选项而不是打印选项,以防他们没有 PDF 打印机)
谢谢。
【问题讨论】:
-
坚持使用
.Export,查看此链接以了解使用 FileDialog(又称默认浏览)选择要保存到的文件位置:software-solutions-online.com/…
标签: vba powerpoint