如何使用VBA将所有* .potx文件转换为* .pptx文件? [英] How to convert all *.potx files to *.pptx files with VBA?

查看:341
本文介绍了如何使用VBA将所有* .potx文件转换为* .pptx文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个约20个* .potx文件的文件夹,我想将所有* .potx文件转换为* .pptx,然后删除* .potx文件.

I have a folder of ~20 *.potx files and I would like to convert all *.potx files to *.pptx, then delete the *.potx files.

推荐答案

以下内容将循环浏览所有模板,转换和删除模板文件.

The following will loop through all your templates, convert, and delete the template files.

Sub loopFiles()

    Dim fso As New FileSystemObject
    Dim fil As File
    Dim fold As Folder

    Set fold = fso.GetFolder(yourFolder)

    For Each fil In fold.Files

        If InStr(1, fil.Name, ".potx") > 0 Then
            Application.Presentations.Open fil.Path
            ActivePresentation.SaveAs Replace(fil.Path, ".potx", ".pptx"), ppSaveAsDefault
            ActivePresentation.Close

            'if you truly want to delete them, don't recommend since they are .potx
            fil.Delete True
        End If

    Next fil

End Sub

这篇关于如何使用VBA将所有* .potx文件转换为* .pptx文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆