ไปยังเนื้อหาหลัก

จะแปลงไฟล์รูปแบบ. doc เป็น. docx ใน Word ได้อย่างไร?

สมมติว่าคุณได้รับเอกสาร Word ในรูปแบบ 97-2003 บางชุดคุณจะแปลงเอกสารรูปแบบ. doc ทั้งหมดเหล่านี้เป็นรูปแบบ. docx พร้อมกันได้อย่างไร บทความนี้จะแสดงวิธีการสองวิธีในการแก้ปัญหานี้

Batch แปลงไฟล์รูปแบบ. doc เป็น. docx ด้วยรหัส VBA
Batch แปลงไฟล์รูปแบบ. doc เป็น. docx ด้วย Kutools for Word


Batch แปลงไฟล์รูปแบบ. doc เป็น. docx ด้วยรหัส VBA

ส่วนนี้จะแสดงรหัส VBA เพื่อแปลงเอกสารรูปแบบ. doc ทั้งหมดในโฟลเดอร์ที่ระบุเป็นเอกสาร. docx พร้อมกัน กรุณาดำเนินการดังนี้

1. โปรดรวบรวมเอกสารรูปแบบ. doc ทั้งหมดที่คุณจะแปลงเป็น. docx ในโฟลเดอร์ที่ระบุ

2 กด อื่น ๆ + F11 กุญแจสำคัญในการเปิด Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง

3. ในหน้าต่างคลิก สิ่งที่ใส่เข้าไป > โมดูล. จากนั้นคัดลอกโค้ด VBA ด้านล่างลงในหน้าต่างโมดูล

รหัส VBA: Batch แปลงเอกสารรูปแบบ. doc ทั้งหมดเป็น. docx ในโฟลเดอร์ที่ต้องการ

Sub ConvertDocToDocx()
'Updated by ExtendOffice 20181128
    Dim xDlg As FileDialog
    Dim xFolder As Variant
    Dim xFileName As String
    Application.ScreenUpdating = False
    Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
    If xDlg.Show <> -1 Then Exit Sub
    xFolder = xDlg.SelectedItems(1) + "\"
    xFileName = Dir(xFolder & "*.doc", vbNormal)
    While xFileName <> ""
        Documents.Open FileName:=xFolder & xFileName, _
            ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
            PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
            WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
            wdOpenFormatAuto, XMLTransform:=""
        ActiveDocument.SaveAs xFolder & Replace(xFileName, "doc", "docx"), wdFormatDocumentDefault
        ActiveDocument.Close
        xFileName = Dir()
    Wend
    Application.ScreenUpdating = True
End Sub

4 กด F5 กุญแจสำคัญในการเรียกใช้รหัส ในการเปิด หมวดหมู่สินค้า หน้าต่างเลือกโฟลเดอร์ที่มีเอกสารรูปแบบ. doc แล้วคลิก OK. ดูภาพหน้าจอ:

จากนั้นเอกสารรูปแบบ. doc ทั้งหมดจะถูกแปลงเป็นเอกสาร. docx ทันทีตามภาพด้านล่างที่แสดง


Batch แปลงไฟล์รูปแบบ. doc เป็น. docx ด้วย Kutools for Word

จะแนะนำยูทิลิตี้ที่มีประโยชน์ในส่วนนี้ กับ เอกสาร / Docx ประโยชน์ของ Kutools สำหรับ Wordคุณสามารถแปลงเอกสารรูปแบบ. doc ทั้งหมดในโฟลเดอร์เป็นเอกสาร. docx ได้อย่างง่ายดาย โปรดลองดังต่อไปนี้

Kutools สำหรับ Word : ด้วยโปรแกรมเสริม Word ที่มีประโยชน์มากกว่า 100 รายการ ทดลองใช้ฟรีไม่มีข้อจำกัดใน 60 วัน.

1. โปรดรวบรวมเอกสารรูปแบบ. doc ทั้งหมดในโฟลเดอร์ที่ระบุจากนั้นคลิก Kutools พลัส > เอกสาร / Docx. ดูภาพหน้าจอ:

2 ใน ตัวแปลงรูปแบบเอกสาร คุณต้องทำดังนี้:

2.1) เลือกโฟลเดอร์ที่มีเอกสารรูปแบบ. doc ในไฟล์ โฟลเดอร์ซอร์สไฟล์ มาตรา;
2.2) เลือก แปลง doc เป็น docx จาก แปลงรูปแบบ รายการแบบหล่นลง
2.3) โดยค่าเริ่มต้นไฟล์ เส้นทางปลายทางเหมือนกับต้นทาง เลือกช่องแล้ว หากคุณต้องการวางเอกสาร. docx ที่แปลงแล้วทั้งหมดในโฟลเดอร์เดียวกันให้เลือกตัวเลือกนี้ไว้
หากคุณต้องการแยกเอกสาร. docx และเอกสาร. doc ต้นทางโปรดยกเลิกการเลือก เส้นทางปลายทางเหมือนกับต้นทาง แล้วเลือกโฟลเดอร์ใหม่เพื่อบันทึกเอกสาร. docx ในไฟล์ บันทึกลง กล่อง;
2.4) คลิกปุ่ม เริ่มต้น ปุ่ม. ดูภาพหน้าจอ:

3. จากนั้นกล่องโต้ตอบจะปรากฏขึ้นเพื่อแจ้งให้คุณทราบว่ามีการแปลงเอกสารสำเร็จแล้วให้คลิกที่ไฟล์ OK และปิดปุ่ม ตัวแปลงรูปแบบเอกสาร หน้าต่าง

ตอนนี้เอกสารรูปแบบ. doc ทั้งหมดถูกแปลงเป็นไฟล์. docx ดูภาพหน้าจอ:

หากคุณต้องการทดลองใช้ยูทิลิตีนี้ฟรีโปรดไปที่ ดาวน์โหลดซอฟต์แวร์ฟรี ก่อนแล้วไปใช้การดำเนินการตามขั้นตอนข้างต้น


สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

Kutools สำหรับ Outlook - คุณสมบัติอันทรงพลังมากกว่า 100 รายการเพื่อเติมพลังให้กับ Outlook ของคุณ

🤖 ผู้ช่วยจดหมาย AI: ส่งอีเมลระดับมืออาชีพทันทีด้วยเวทมนตร์ AI คลิกเพียงครั้งเดียวเพื่อตอบกลับอย่างชาญฉลาด น้ำเสียงที่สมบูรณ์แบบ การเรียนรู้หลายภาษา เปลี่ยนรูปแบบการส่งอีเมลอย่างง่ายดาย! ...

📧 การทำงานอัตโนมัติของอีเมล: ไม่อยู่ที่สำนักงาน (ใช้ได้กับ POP และ IMAP)  /  กำหนดการส่งอีเมล  /  Auto CC/BCC ตามกฎเมื่อส่งอีเมล  /  ส่งต่ออัตโนมัติ (กฎขั้นสูง)   /  เพิ่มคำทักทายอัตโนมัติ   /  แบ่งอีเมลผู้รับหลายรายออกเป็นข้อความส่วนตัวโดยอัตโนมัติ ...

📨 การจัดการอีเมล์: เรียกคืนอีเมลได้อย่างง่ายดาย  /  บล็อกอีเมลหลอกลวงตามหัวเรื่องและอื่นๆ  /  ลบอีเมลที่ซ้ำกัน  /  การค้นหาขั้นสูง  /  รวมโฟลเดอร์ ...

📁 ไฟล์แนบโปรบันทึกแบทช์  /  การแยกแบทช์  /  การบีบอัดแบบแบตช์  /  บันทึกอัตโนมัติ   /  ถอดอัตโนมัติ  /  บีบอัดอัตโนมัติ ...

🌟 อินเตอร์เฟซเมจิก: 😊อีโมจิที่สวยและเจ๋งยิ่งขึ้น   /  เพิ่มประสิทธิภาพการทำงาน Outlook ของคุณด้วยมุมมองแบบแท็บ  /  ลดขนาด Outlook แทนที่จะปิด ...

???? เพียงคลิกเดียวสิ่งมหัศจรรย์: ตอบกลับทั้งหมดด้วยไฟล์แนบที่เข้ามา  /   อีเมลต่อต้านฟิชชิ่ง  /  🕘 แสดงโซนเวลาของผู้ส่ง ...

👩🏼‍🤝‍👩🏻 รายชื่อและปฏิทิน: แบทช์เพิ่มผู้ติดต่อจากอีเมลที่เลือก  /  แบ่งกลุ่มผู้ติดต่อเป็นกลุ่มแต่ละกลุ่ม  /  ลบการแจ้งเตือนวันเกิด ...

เกิน คุณสมบัติ 100 รอการสำรวจของคุณ! คลิกที่นี่เพื่อค้นพบเพิ่มเติม

 

 

Comments (14)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Dobrý den,
já bych potřeboval, ale VBA script který by fungoval včetně podsložek. Umíte někdo prosím upravit i tento skript? Děkuji.

ENG:
Good day,
I would need a VBA script that would work including subfolders. Can someone please edit this script as well? Thank you.
This comment was minimized by the moderator on the site
Hi Daniel Beneš,
To include subfolders, please try the following VBA code.
After adding the code, go to the Tools tab, click References, in the opening References - Project dialog box, check the Microsoft Scripting Runtime box, and then click the OK button to save the changes. See the following screenshot:
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/check-scripting_runtime.png
After that, press the F5 key to run the code.

Sub ConvertDocToDocx()
'Updated by ExtendOffice 20221124
  Dim xDlg As FileDialog
  Dim xFldPath As Variant
  Dim xFileName As String
  On Error Resume Next
  Application.ScreenUpdating = False
  Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
  If xDlg.Show <> -1 Then Exit Sub
  xFldPath = xDlg.SelectedItems(1) + "\"
  Call ListAllFiles(xFldPath)
  Application.ScreenUpdating = True
End Sub

Function ListAllFiles(FldPath)
  Dim xFSO As FileSystemObject
  Dim xFolder As Folder
  Dim xSubFolder As Folder
  Dim xNewName As String
  On Error Resume Next
  xFileName = Dir(FldPath & "*.doc", vbNormal)
  While xFileName <> ""
    xNewName = VBA.Left$(xFileName, VBA.InStrRev(xFileName, "doc") - 1) & "docx"
    Documents.Open FileName:=FldPath & xFileName, _
        ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto, XMLTransform:=""
    ActiveDocument.SaveAs FldPath & xNewName, wdFormatDocumentDefault
    ActiveDocument.Close
    xFileName = Dir()
  Wend
  Set xFSO = CreateObject("Scripting.FileSystemObject")
  Set xFolder = xFSO.GetFolder(FldPath)
  For Each xSubFolder In xFolder.SubFolders
    Call ListAllFiles(xSubFolder.Path + "\")
  Next
  Set xFSO = Nothing
  Set xFolder = Nothing
End Function
This comment was minimized by the moderator on the site
Nice tool but I got the problem, that I can't convert DOC files (written in capitals!) into docx files.
It works with doc files.
This comment was minimized by the moderator on the site
Hi,
The following code can help to convert both doc. and DOC. files into docx files. Please give it a try. Thanks for your feedback.

Sub ConvertDocToDocx()
'Updated by ExtendOffice 20220506
    Dim xDlg As FileDialog
    Dim xFolder As Variant
    Dim xFileName As String
    Application.ScreenUpdating = False
    Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
    If xDlg.Show <> -1 Then Exit Sub
    xFolder = xDlg.SelectedItems(1) + "\"
    xFileName = Dir(xFolder & "*.doc", vbNormal)
    While xFileName <> ""
        Documents.Open FileName:=xFolder & xFileName, _
            ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
            PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
            WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
            wdOpenFormatAuto, XMLTransform:=""
        ActiveDocument.SaveAs xFolder & Replace(VBA.LCase(xFileName), "doc", "docx"), wdFormatDocumentDefault
        ActiveDocument.Close
        xFileName = Dir()
    Wend
    Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
Thanks for sharing
This comment was minimized by the moderator on the site
best graphic design company in india
Designing is a craft of communicating words as articulations. Visuals matter more than words in the advanced field.
The experts in the designing business recommend that illustrations are simpler to recall than words,
and that is the reason Website designing and Graphics play an imperative job.

This comment was minimized by the moderator on the site
Thanks for sharing this useful information.
This comment was minimized by the moderator on the site
This is really insightful article , found it very helpful and informational
This comment was minimized by the moderator on the site
HelloNice post .. Keep sharing.Thank You
This comment was minimized by the moderator on the site
Hello sir,
I love with this post.I really appreciate for this website.Your information is so good and valuable.Lovable idea and concept for sharing this website.
This is an amazing website.This post is nice.
Thanks for sharing
This comment was minimized by the moderator on the site
Hi....Hi, This blog content very technical information, it is on of the best blog i have got. Very interesting and describe in a very easy way.
This comment was minimized by the moderator on the site
Hello,
I am glad to find this useful information Thanks for sharing this amazing article.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations