Skip i'r prif gynnwys

Sut i swp-drosi ffeiliau fformat .doc i .docx yn Word?

Gan dybio eich bod wedi derbyn rhai dogfennau Word fformat 97-2003, sut allwch chi swp-drosi'r holl ddogfennau fformat .doc hyn i fformat .docx ar unwaith? Bydd yr erthygl hon yn dangos dau ddull i chi ddatrys y broblem hon.

Swp trosi ffeiliau fformat .doc i .docx gyda chod VBA
Swp trosi ffeiliau fformat .doc i .docx gyda Kutools ar gyfer Word


Swp trosi ffeiliau fformat .doc i .docx gyda chod VBA

Mae'r adran hon yn mynd i ddangos y cod VBA i chi drosi'r holl ddogfennau fformat .doc mewn ffolder benodol i ddogfennau .docx ar unwaith. Gwnewch fel a ganlyn.

1. Casglwch yr holl ddogfennau fformat .doc y byddwch chi'n eu trosi i .docx mewn ffolder benodol.

2. Gwasgwch y Alt + F11 allweddol i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

3. Yn y ffenestr, cliciwch Mewnosod > Modiwlau. Yna copïwch isod god VBA i mewn i ffenestr y Modiwl.

Cod VBA: Swp troswch yr holl ddogfennau fformat .doc i .docx mewn ffolder benodol

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. Gwasgwch y F5 allwedd i redeg y cod. Yn yr agoriad Pori ffenestr, dewiswch y ffolder sy'n cynnwys y dogfennau fformat .doc a chlicio OK. Gweler y screenshot:

Yna mae'r holl ddogfennau fformat .doc yn cael eu trosi'n ddogfennau .docx yn syth fel isod dangosir y screenshot.


Swp trosi ffeiliau fformat .doc i .docx gyda Kutools ar gyfer Word

Argymhellir cyfleustodau defnyddiol yn yr adran hon. Efo'r Doc / Docx cyfleustodau Kutools am Word, gallwch chi drosi'r holl ddogfennau fformat .doc mewn ffolder yn hawdd i ddogfennau .docx. Ceisiwch fel a ganlyn.

Kutools am Word : Gyda mwy na 100 o ychwanegion Word defnyddiol, rhydd i geisio heb unrhyw gyfyngiad yn 60 diwrnod.

1. Casglwch yr holl ddogfennau fformat .doc mewn ffolder benodol, yna cliciwch Kutools Byd Gwaith > Doc / Docx. Gweler y screenshot:

2. Yn y Troswr Fformat Dogfen blwch deialog, mae angen i chi wneud fel a ganlyn:

2.1) Dewiswch y ffolder sy'n cynnwys dogfennau fformat .doc yn y Ffolder ffeiliau ffynhonnell adran;
2.2) Dewis Trosi doc i docx oddi wrth y Trosi Fformat rhestr ostwng;
2.3) Yn ddiofyn, mae'r Llwybr cyrchfan yr un peth â'r ffynhonnell blwch yn cael ei wirio. Os ydych chi am roi'r holl ddogfennau .docx wedi'u trosi yn yr un ffolder, dim ond cadw'r opsiwn hwn wedi'i ddewis;
Os ydych chi am wahanu'r dogfennau .docx a'r dogfennau ffynhonnell .doc, dad-diciwch y Llwybr cyrchfan yr un peth â'r ffynhonnell blwch, a dewis ffolder newydd i gadw'r dogfennau .docx yn y Cadw i blwch;
2.4) Cliciwch y dechrau botwm. Gweler y screenshot:

3. Yna mae blwch deialog yn ymddangos i ddweud wrthych faint o ddogfennau sydd wedi'u trosi'n llwyddiannus, cliciwch y OK botwm a chau'r Troswr Fformat Dogfen ffenestr.

Nawr mae'r holl ddogfennau fformat .doc yn cael eu trosi'n ffeiliau .docx. Gweler y screenshot:

Os ydych chi am gael treial am ddim o'r cyfleustodau hwn, ewch i dadlwythwch y meddalwedd am ddim yn gyntaf, ac yna ewch i gymhwyso'r llawdriniaeth yn ôl y camau uchod.


Offer Cynhyrchiant Swyddfa Gorau

Kutools ar gyfer Rhagolwg - Dros 100 o Nodweddion Pwerus i Werthu Eich Outlook

🤖 Cynorthwy-ydd Post AI: E-byst pro ar unwaith gyda hud AI - un clic i atebion athrylith, tôn berffaith, meistrolaeth amlieithog. Trawsnewid e-bostio yn ddiymdrech! ...

📧 E-bostio Automation: Allan o'r Swyddfa (Ar gael ar gyfer POP ac IMAP)  /  Amserlen Anfon E-byst  /  Auto CC/BCC gan Reolau Wrth Anfon E-bost  /  Awto Ymlaen (Rheolau Uwch)   /  Auto Ychwanegu Cyfarchiad   /  Rhannwch E-byst Aml-Dderbynnydd yn Negeseuon Unigol yn Awtomatig ...

📨 Rheoli E-bost: Dwyn i gof E-byst yn Hawdd  /  Rhwystro E-byst Sgam gan Bynciau ac Eraill  /  Dileu E-byst Dyblyg  /  Chwilio Manwl  /  Cydgrynhoi Ffolderi ...

📁 Ymlyniadau ProArbed Swp  /  Swp Datgysylltu  /  Cywasgu Swp  /  Auto Achub   /  Datgysylltiad Auto  /  Cywasgiad Auto ...

🌟 Rhyngwyneb Hud: 😊Mwy o Emojis Pretty a Cŵl   /  Rhowch hwb i'ch Cynhyrchiant Outlook gyda Golygfeydd Tabbed  /  Lleihau Outlook Yn lle Cau ...

???? Rhyfeddodau un clic: Ateb Pawb ag Ymlyniadau Dod i Mewn  /   E-byst Gwrth-Gwe-rwydo  /  🕘Dangos Parth Amser yr Anfonwr ...

👩🏼‍🤝‍👩🏻 Cysylltiadau a Chalendr: Swp Ychwanegu Cysylltiadau O E-byst Dethol  /  Rhannwch Grŵp Cyswllt i Grwpiau Unigol  /  Dileu Atgoffa Pen-blwydd ...

Dros Nodweddion 100 Aros Eich Archwiliad! Cliciwch Yma i Ddarganfod Mwy.

 

 

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