请问如何提取ppt文件中的图片

snz 2006-04-28 10:00:06
用什么方法能提取ppt文件中的图片,多谢各位帮忙!
...全文
380 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
snz 2006-06-23
  • 打赏
  • 举报
回复
多谢,已经搞定。
xiongyuhui 2006-05-24
  • 打赏
  • 举报
回复
用Shape对象调用Export(图片名,图片类型)

VBA:
' Work's only in PowerPoint 2000 and later
Sub ExtractImagesFromPres()
On Error GoTo ErrorExtract
Dim oSldSource As Slide
Dim oDsnSource As Design
Dim oMstSource As Master
Dim oShpSource As Shape
Dim Ctr As Integer
Dim sPath As String

sPath = "c:\"
Ctr = 0

For Each oSldSource In ActivePresentation.Slides
For Each oShpSource In oSldSource.Shapes
If oShpSource.Type = msoPicture Then
' Hidden Export method
Call oShpSource.Export(sPath & "Img" & _
Format(Ctr, "0000") & ".PNG", ppShapeFormatPNG)
Ctr = Ctr + 1
End If
Next oShpSource
Next oSldSource

For Each oDsnSource In ActivePresentation.Designs
For Each oShpSource In oDsnSource.SlideMaster.Shapes
If oShpSource.Type = msoPicture Then
' Hidden Export method
Call oShpSource.Export(sPath & "Img" & _
Format(Ctr, "0000") & ".JPG", ppShapeFormatJPG)
Ctr = Ctr + 1
End If
Next oShpSource

For Each oShpSource In oDsnSource.SlideMaster.Background
If oShpSource.Type = msoPicture Then
' Hidden Export method
Call oShpSource.Export(sPath & "Img" & _
Format(Ctr, "0000") & ".JPG", ppShapeFormatJPG)
Ctr = Ctr + 1
End If
Next oShpSource
Next oDsnSource


If Ctr = 0 Then
MsgBox "There were no images found in this presentation", _
vbInformation, "Image extraction failed."
End If
Exit Sub
ErrorExtract:
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, "Error #" & Err.Number
End If
End Sub

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧