Note: The other languages of the website are Google-translated. Back to English
Logáil isteach  \/ 
x
or
x
Cláraigh  \/ 
x

or

Conas baisc cáipéisí Word a thiontú go comhad txt?

Tá an t-alt seo ag caint ar conas gach doiciméad Word a thiontú i bhfillteán ar leith chun comhaid TXT a scaradh i Word.

Baisc doiciméid Word a thiontú go comhaid txt le VBA


Baisc doiciméid Word a thiontú go comhaid txt le VBA

Is féidir leis an gcód VBA thíos cuidiú le gach doiciméad Word i bhfillteán ar leith a thiontú go comhaid txt ag an am céanna. Déan mar a leanas le do thoil.

1. I ndoiciméad Word, brúigh an Eile + F11 eochracha a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

2. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil Ionsáigh > Modúil, ansin cóipeáil thíos an cód isteach i bhfuinneog an Mhodúil.

Cód VBA: Baisc doiciméid Word a thiontú go comhaid txt

Sub ConvertDocumentsToTxt()
'Updated by Extendoffice 20181123
    Dim xIndex As Long
    Dim xFolder As Variant
    Dim xFileStr As String
    Dim xFilePath As String
    Dim xDlg As FileDialog
    Dim xActPath As String
    Dim xDoc As Document
    Application.ScreenUpdating = False
    Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
    If xDlg.Show <> -1 Then Exit Sub
    xFolder = xDlg.SelectedItems(1)
    xFileStr = Dir(xFolder & "\*.doc")
    xActPath = ActiveDocument.Path
    While xFileStr <> ""
        xFilePath = xFolder & "\" & xFileStr
        If xFilePath <> xActPath Then
            Set xDoc = Documents.Open(xFilePath, AddToRecentFiles:=False, Visible:=False)
            xIndex = InStrRev(xFilePath, ".")
            Debug.Print Left(xFilePath, xIndex - 1) & ".txt"
            xDoc.SaveAs Left(xFilePath, xIndex - 1) & ".txt", FileFormat:=wdFormatText, AddToRecentFiles:=False
            xDoc.Close True
        End If
        xFileStr = Dir()
    Wend
    Application.ScreenUpdating = True
End Sub

3. Brúigh an F5 eochair chun an cód a rith.

4. Sa Brabhsáil fuinneog, roghnaigh an fillteán tá cáipéisí Word a athróidh tú go comhaid txt, agus cliceáil ar an OK cnaipe. Féach an pictiúr:

Ansin feiceann tú go ndéantar gach doiciméad san fhillteán roghnaithe a thiontú go comhaid txt ag an am céanna. Féach an pictiúr:



Uirlisí Táirgeachta Focal Molta

 

Kutools For Word - Níos mó ná 100 Gné Ardteist le haghaidh Word, Sábháil Do 50% Am

  • Is féidir oibríochtaí casta agus arís agus arís eile a dhéanamh próiseáil aon-uaire i soicindí.
  • Cuir isteach íomhánna iomadúla thar fhillteáin i ndoiciméad Word ag an am céanna.
  • Cumaisc agus comhcheangail comhaid Word iolracha thar fhillteáin i gceann amháin leis an ord atá uait.
  • Roinn an doiciméad reatha i ndoiciméid ar leithligh de réir ceannteidil, briseadh ailt nó critéir eile.
  • Tiontaigh comhaid idir Doc agus Docx, Docx agus PDF, bailiú uirlisí le haghaidh comhshó agus roghnú coitianta, agus mar sin de ...

Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Mina · 3 months ago
    Not working for me, any ideas why?
    Do I need to do this in a word document from the same folder I want to convert or any new word document that I start? -Tried both options and none is working but I am also not getting any error messages

    • To post as a guest, your comment is unpublished.
      mIk · 3 months ago
      Change xFileStr = Dir(xFolder & "\*.doc") to xFileStr = Dir(xFolder & "\*.docx") as i assume you have newer word files format.
    • To post as a guest, your comment is unpublished.
      Mina · 3 months ago
      I'm using windows 10 and Microsoft office 2016
  • To post as a guest, your comment is unpublished.
    DebSutter · 3 months ago
    Thank you! This is extremely helpful
    • To post as a guest, your comment is unpublished.
      Mina · 3 months ago
      How did you get it to work?
  • To post as a guest, your comment is unpublished.
    Mario · 1 years ago
    I'm a fan of poetry. I needed to convert more than 700 word compositions to txt. Thanks to your subroutine I managed to do it in no time.
    Thank you