在幻灯片模式下将 PPT 幻灯片导出为 PDF 时浏览要保存和命名的位置

Browsing location to save and name while exporting PPT Slide as PDF in SlideShow Mode

我只想在幻灯片模式下将 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 打印机)

谢谢。

Application.FileDialog(msoFileDialogSaveAs).Show
Dim Location As String
Location = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)

您可以使用上面的代码获取用户想要的路径和名称。

此代码将允许您导出:ActivePresentation.ExportAsFixedFormat