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、保存代碼及文件,且關(guān)閉word并重新打開,重新打開點(diǎn)擊【選項(xiàng)】-》 【啟用此內(nèi)容】 |
免責(zé)聲明:本站部分文章和圖片均來自用戶投稿和網(wǎng)絡(luò)收集,旨在傳播知識(shí),文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請(qǐng)勿用于商業(yè)用途,如果損害了您的權(quán)利,請(qǐng)聯(lián)系我們及時(shí)修正或刪除。謝謝!
始終以前瞻性的眼光聚焦站長(zhǎng)、創(chuàng)業(yè)、互聯(lián)網(wǎng)等領(lǐng)域,為您提供最新最全的互聯(lián)網(wǎng)資訊,幫助站長(zhǎng)轉(zhuǎn)型升級(jí),為互聯(lián)網(wǎng)創(chuàng)業(yè)者提供更加優(yōu)質(zhì)的創(chuàng)業(yè)信息和品牌營(yíng)銷服務(wù),與站長(zhǎng)一起進(jìn)步!讓互聯(lián)網(wǎng)創(chuàng)業(yè)者不再孤獨(dú)!
掃一掃,關(guān)注站長(zhǎng)網(wǎng)微信