PC Review


Reply
Thread Tools Rate Thread

Can I batch convert files to word?

 
 
Raroboy
Guest
Posts: n/a
 
      10th Dec 2007
I recently installed Office 2007. I have about 700 files in the .html format
and I want to convert them into Office .docx files. I know how to do this on
a single basis but I would like to know if I can do a batch conversion. The
..html files are email letters that I want to put into .docx format so I can
write a book. Any Ideas?
thanks
Paul
 
Reply With Quote
 
 
 
 
Graham Mayor
Guest
Posts: n/a
 
      11th Dec 2007
The following macro will convert all the files from a folder selected from
the macro. Ensure that Word Options > Advanced > General > Confirm file
conversion on open is NOT checked or you will have to confirm 700 times! -
http://www.gmayor.com/installing_macro.htm

Sub SaveAllAsDOCX()
Dim strFileName As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document

With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
strPath = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFileName = Dir$(strPath & "*.htm")

While Len(strFileName) <> 0
Set oDoc = Documents.Open(strPath & strFileName)

strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".docx"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatDocumentDefault
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFileName = Dir$()
Wend
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Raroboy wrote:
> I recently installed Office 2007. I have about 700 files in the .html
> format and I want to convert them into Office .docx files. I know how
> to do this on a single basis but I would like to know if I can do a
> batch conversion. The .html files are email letters that I want to
> put into .docx format so I can write a book. Any Ideas?
> thanks
> Paul



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I batch convert 97-2003 .xls files to 2007 .xlsx files =?Utf-8?B?RGF2ZSBOdXR0YWxs?= Microsoft Excel Misc 4 3rd Aug 2009 11:38 PM
How can I convert a batch of .wpd files to Word 2007 files? SPW Microsoft Word New Users 3 15th Jul 2008 05:10 AM
Re: Need to batch convert WordPerfect to Word files Suzanne S. Barnhill Microsoft Word Document Management 0 26th Feb 2004 12:43 AM
Re: Need to batch convert WordPerfect to Word files Charles Kenyon Microsoft Word Document Management 0 25th Feb 2004 09:15 PM
Re: Need to batch convert WordPerfect to Word files Jezebel Microsoft Word Document Management 0 25th Feb 2004 09:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:01 PM.