Batch converting Works (WPS) to Word (DOC)
My friends mum needed a bunch of works files to work on her PC, but I could so not be bothered searching around for a works install disc, plus the converter from the Microsoft site wasn’t working.
So I took the documents to work where I knew the converter was working but there was still like over 100 documents and I didn’t want to open and save each one.
Luckily I found this page (can’t believe I’m linking to an MS site) which had a macro to use to convert a whole bunch of WPS’s to DOC’s.
I’ll re-post it here incase that other page disappears (also I made an adjustment so it works):
[code lang="vb"]
Sub Batch_Save_WPS_as_DOC97()
Dim bConv As Boolean
Dim strFileName As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim Response As Long
Dim fDialog As FileDialog
bConv = Options.ConfirmConversions
Options.ConfirmConversions = False
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "Save all as DOC"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
End With
'If Documents.Count > 0 Then
'Documents.Close SaveChanges:=wdPromptToSaveChanges
'End If
strFileName = Dir$(strPath & "*.wps")
While Len(strFileName) <> 0
Set oDoc = Documents.Open(strPath & strFileName)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".doc"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatDocument97
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFileName = Dir$()
Wend
Options.ConfirmConversions = bConv
End Sub
[/code]
Don’t worry about the fact it says doc97 format it just means the format between 97 and 2003 (i.e. doc and not docx).
So you just:
- Open up a new word doc
- Press Alt+F11 to open the VB editor
- Insert a new module
- Copy and paste the above code
- Save the document
- Press Alt+F8 to open the macro window
- Select Batch_Save_WPS_as_DOC97 and hit Run
- Select the folder you want and hit OK
- Watch it do its thing
It won’t overwrite any of the original documents so you don’t need to stress (I made a backup anyway just in case).
Hope this helps anyone in need.
By the way thanks to codesnippet for the syntax highlighting