使用VBA代码将ppt保存为pdf [英] save ppt as pdf using VBA code
本文介绍了使用VBA代码将ppt保存为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里我试图将ppt保存到pdf。这是我试过的代码。但我得到的错误就像没有安装pdf转换器。但我已经在我的系统中安装了pdf。请解决这个问题。 />
Sub ppttopdf(control 正如 IRibbonControl)
Dim 路径 As 字符串
path = D:\ power
Save_PowerPoint_Slide_as_Images路径
MsgBox 导出到D: \ power
结束 Sub
Sub Save_PowerPoint_Slide_as_Images(路径作为 字符串)
Dim sImagePath 作为 字符串
Dim sImageName 作为 字符串
Dim sPrefix As String
Dim oSlide 作为幻灯片' *幻灯片对象
Dim lScaleWidth 作为 长 ' *比例宽度
Dim lScaleHeight 作为 长 ' *缩放高度
On 错误 GoTo Err_ImageSave
sImagePath = path
sPrefix = Split(ActivePresentation.Name, 。)( 0 )
对于 每个 oSlide 在 ActivePresentation.Slides
sImageName = sPrefix& - & oSlide.SlideIndex& 。pdf
oSlide.Export sImagePath& \& sImageName, PDF
下一步 oSlide
Err_ImageSave:
如果 Err<> 0 然后
MsgBox Err.Description
结束 如果
结束 Sub
解决方案
为什么要强行打开门?
请使用 Presentation.ExportAsFixedFormat方法(PowerPoint 2007及更高版本) [ ^ ]
Here i am trying to save ppt to pdf.This is the code i have tried.But i am getting error like "no pdf converter installed".But i have installed pdf in my system.please solve this problem.
Sub ppttopdf(control As IRibbonControl)
Dim path As String
path = "D:\power"
Save_PowerPoint_Slide_as_Images path
MsgBox "Exported into D:\power"
End Sub
Sub Save_PowerPoint_Slide_as_Images(path As String)
Dim sImagePath As String
Dim sImageName As String
Dim sPrefix As String
Dim oSlide As Slide '* Slide Object
Dim lScaleWidth As Long '* Scale Width
Dim lScaleHeight As Long '* Scale Height
On Error GoTo Err_ImageSave
sImagePath = path
sPrefix = Split(ActivePresentation.Name, ".")(0)
For Each oSlide In ActivePresentation.Slides
sImageName = sPrefix & "-" & oSlide.SlideIndex & ".pdf"
oSlide.Export sImagePath & "\" & sImageName, "PDF"
Next oSlide
Err_ImageSave:
If Err <> 0 Then
MsgBox Err.Description
End If
End Sub
解决方案
Why to force doors wide open?
Please, use Presentation.ExportAsFixedFormat Method (PowerPoint 2007 and higher)[^]
这篇关于使用VBA代码将ppt保存为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文