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并重新打開,重新打開點擊【選項】-》 【啟用此內容】 |
免責聲明:本站部分文章和圖片均來自用戶投稿和網絡收集,旨在傳播知識,文章和圖片版權歸原作者及原出處所有,僅供學習與參考,請勿用于商業用途,如果損害了您的權利,請聯系我們及時修正或刪除。謝謝!
始終以前瞻性的眼光聚焦站長、創業、互聯網等領域,為您提供最新最全的互聯網資訊,幫助站長轉型升級,為互聯網創業者提供更加優質的創業信息和品牌營銷服務,與站長一起進步!讓互聯網創業者不再孤獨!
掃一掃,關注站長網微信