1、打开Word文件的 VBA编辑器,快捷键 Alt+F11,右击【ThisDocument】-》 【插入模块】; 2、双击刚才插入的【模块1】,添加如下代码: Private Function SaveAsFile(ByVal fileFormat As String) Dim strDocName As String Dim intPos As Integer Find position of extension in filename strDocName = ActiveDocument.Name intPos = InStrRev(strDocName, ".") If intPos = 0 Then If the document has not yet been saved Ask the user to provide a filename strDocName = InputBox("Please enter the name of your document.") Else Strip off extension strDocName = Left(strDocName, intPos - 1) strDocName = strDocName & fileFormat End If Save file with new extension ActiveDocument.SaveAs fileName:=strDocName, fileFormat:=wdFormatText Close active document ActiveDocument.Close SaveChanges:=wdSaveChanges, OriginalFormat:=wdOriginalDocumentFormat End Function 3、保存代码及文件,且关闭word并重新打开,重新打开点击【选项】-》 【启用此内容】 |
免责声明:本站部分文章和图片均来自用户投稿和网络收集,旨在传播知识,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系我们及时修正或删除。谢谢!
始终以前瞻性的眼光聚焦站长、创业、互联网等领域,为您提供最新最全的互联网资讯,帮助站长转型升级,为互联网创业者提供更加优质的创业信息和品牌营销服务,与站长一起进步!让互联网创业者不再孤独!
扫一扫,关注站长网微信