Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Sub TranslateDocIntoDocx()
  2. Dim objWordApplication As New Word.Application
  3. Dim objWordDocument As Word.Document
  4. Dim strFile As String
  5. Dim strFolder As String
  6.  
  7. strFolder = "E:\Temp\"
  8. strFile = Dir(strFolder & "*.doc", vbNormal)
  9.  
  10. While strFile <> ""
  11. With objWordApplication
  12. Set objWordDocument = .Documents.Open(FileName:=strFolder &strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)
  13.  
  14. With objWordDocument
  15. .SaveAs FileName:=strFolder & Replace(strFile, "doc", "docx"), FileFormat:=16
  16. .Close
  17. End With
  18. End With
  19. strFile = Dir()
  20. Wend
  21.  
  22. Set objWordDocument = Nothing
  23. Set objWordApplication = Nothing
  24. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement