Xin code chuyển nhanh các file docx trong 1 foder sang file doc

Liên hệ QC

LinDan

Thành viên tiêu biểu
Tham gia
8/2/12
Bài viết
412
Được thích
111
Em xin nhờ các bác giúp em chuyển nhiều file word đuôi docx sang đuôi doc mà không cần mở file nên ạ (em cần chuyển rất nhiều file nếu sử dụng chức năng save as sẽ rất lâu). Em xin cảm ơn các bác ạ
 
Em xin nhờ các bác giúp em chuyển nhiều file word đuôi docx sang đuôi doc mà không cần mở file nên ạ (em cần chuyển rất nhiều file nếu sử dụng chức năng save as sẽ rất lâu). Em xin cảm ơn các bác ạ
Thử với thủ tục này xem sao:

Nhớ thay đổi: strFolder = "E:\Temp\"

Mã:
Sub TranslateDocxIntoDoc()
  Dim objWordApplication As New Word.Application
  Dim objWordDocument As Word.Document
  Dim strFile As String
  Dim strFolder As String

  strFolder = "E:\Temp\"
  strFile = Dir(strFolder & "*.docx", vbNormal)

  While strFile <> ""
    With objWordApplication
      Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)
      With objWordDocument
        .SaveAs FileName:=strFolder & Replace(strFile, "docx", "doc"), FileFormat:=0
        .Close
      End With
    End With
    strFile = Dir()
  Wend

  Set objWordDocument = Nothing
  Set objWordApplication = Nothing
End Sub
 
Lần chỉnh sửa cuối:
Web KT
Back
Top Bottom