使用Powerpoint for macos自动合并pptx文件
2017-06-22 19:04
597 查看
' ' references: ' https://www.rondebruin.nl/mac/mac015.htm ' https://stackoverflow.com/questions/5316459/programmatically-combine-slides-from-multiple-presentations-into-a-single-presen ' https://msdn.microsoft.com/en-us/library/office/hh710200(v=office.14).aspx ' Sub MergePPTX() On Error Resume Next MyPath = MacScript("return (path to documents folder) as String") 'Or use MyPath = "Macintosh HD:Users:Ron:Desktop:TestFolder:" ' In the following statement, change true to false in the line "multiple ' selections allowed true" if you do not want to be able to select more ' than one file. Additionally, if you want to filter for multiple files, change ' {""com.microsoft.Excel.xls""} to ' {""com.microsoft.excel.xls"",""public.comma-separated-values-text""} ' if you want to filter on xls and csv files, for example. MyScript = _ "set applescript's text item delimiters to "","" " & vbNewLine & _ "set theFiles to (choose file of type " & _ " {""org.openxmlformats.presentationml.presentation""} " & _ "with prompt ""Please select a file or files"" default location alias """ & _ MyPath & """ multiple selections allowed true) as string" & vbNewLine & _ "set applescript's text item delimiters to """" " & vbNewLine & _ "return theFiles" MyFiles = MacScript(MyScript) On Error GoTo 0 If MyFiles <> "" Then Presentations.Add Dim fileName As String MySplit = Split(MyFiles, ",") For N = LBound(MySplit) To UBound(MySplit) fileName = Replace(MySplit(N), "sys:", "/") fileName = Replace(fileName, ":", "/") ImportFromPPT fileName, 1, 2 Next N End If End Sub Sub ImportFromPPT(fileName As String, SlideFrom As Long, SlideTo As Long) Dim SrcPPT As Presentation, SrcSld As Slide, Idx As Long, SldCnt As Long Set SrcPPT = Presentations.Open(fileName, , , msoFalse) SldCnt = SrcPPT.Slides.Count If SlideFrom > SldCnt Then Exit Sub If SlideTo > SldCnt Then SlideTo = SldCnt For Idx = SlideFrom To SlideTo Step 1 Set SrcSld = SrcPPT.Slides(Idx) SrcSld.Copy With ActivePresentation.Slides.Paste .Design = SrcSld.Design .ColorScheme = SrcSld.ColorScheme ' if slide is not following its master (design, color scheme) ' we must collect all bits & pieces from the slide itself ' >>>>>>>>>>>>>>>>>>>> If SrcSld.FollowMasterBackground = False Then .FollowMasterBackground = False .Background.Fill.Visible = SrcSld.Background.Fill.Visible .Background.Fill.ForeColor = SrcSld.Background.Fill.ForeColor .Background.Fill.BackColor = SrcSld.Background.Fill.BackColor ' inspect the FillType object Select Case SrcSld.Background.Fill.Type Case Is = msoFillTextured Select Case SrcSld.Background.Fill.TextureType Case Is = msoTexturePreset .Background.Fill.PresetTextured (SrcSld.Background.Fill.PresetTexture) Case Is = msoTextureUserDefined ' TextureName gives a filename w/o path ' not implemented, see picture handling End Select Case Is = msoFillSolid .Background.Fill.Transparency = 0# .Background.Fill.Solid Case Is = msoFillPicture ' picture cannot be copied directly, need to export and re-import slide image If SrcSld.Shapes.Count > 0 Then SrcSld.Shapes.Range.Visible = False bMasterShapes = SrcSld.DisplayMasterShapes SrcSld.DisplayMasterShapes = False SrcSld.Export SrcPPT.Path & SrcSld.SlideID & ".png", "PNG" .Background.Fill.UserPicture SrcPPT.Path & SrcSld.SlideID & ".png" Kill (SrcPPT.Path & SrcSld.SlideID & ".png") SrcSld.DisplayMasterShapes = bMasterShapes If SrcSld.Shapes.Count > 0 Then SrcSld.Shapes.Range.Visible = True Case Is = msoFillPatterned .Background.Fill.Patterned (SrcSld.Background.Fill.pattern) Case Is = msoFillGradient ' inspect gradient type Select Case SrcSld.Background.Fill.GradientColorType Case Is = msoGradientPresetColors .Background.Fill.PresetGradient _ SrcSld.Background.Fill.GradientStyle, _ SrcSld.Background.Fill.GradientVariant, _ SrcSld.Background.Fill.PresetGradientType Case Is = msoGradientOneColor .Background.Fill.OneColorGradient _ SrcSld.Background.Fill.GradientStyle, _ SrcSld.Background.Fill.GradientVariant, _ SrcSld.Background.Fill.GradientDegree End Select Case Is = msoFillBackground ' Only shapes - we shouldn't come here End Select End If ' >>>>>>>>>>>>>>>>>>>> End With Next Idx End Sub
相关文章推荐
- 在苹果MAC OS X Lion系统上使用Outlook for MAC 2011配置Exchange
- 在TeXShop中使用中文(for Mac OS)
- 在苹果MAC OS X Lion系统上使用Outlook for MAC 2011配置Exchange邮箱 推荐
- ArcGIS Runtime SDK for Mac OS X使用示例
- 在苹果MAC OS X系统上使用Outlook for MAC 2011配置Exchange邮箱
- ArcGIS Runtime SDK for Mac OS X使用示例
- MacOS with Docker for Mac[使用oc cluster up 安装openshift origin]
- Mac OS X: 如何变更Office for Mac的注册码
- 在dell dimension 5150 上安装mac os x for pc 10.4.8 手记 3] 显卡的安装
- 在dell dimension 5150 上安装mac os x for pc 10.4.8 手记 0] TIPS
- 使用Mac OS X系统必须了解的10条命令
- Mac OS X: 禁止自动绑定硬盘卷
- Mac OS X: 禁止自动绑定硬盘卷
- ASE.ChartDirector.for.Ruby.v4.1.MacOSX
- Mac OS X(L1-3): 登录/退出自动运行程序的设置
- Mac OS X for Photographers: Optimized image workflow for the Mac user
- Mac OS X:自动登录的设置(Autologin Configuration)
- 在dell dimension 5150 上安装mac os x for pc 10.4.8 手记 2] 声卡的安装
- Mac OS X:自动登录的设置(Autologin Configuration)
- 在 Mac OS X 中启用和使用 root 用户