Batch conversion of Word 2007 to html

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a large number of Word files that I have to convert to html and would
like to do a batch conversion verses doing them one by one. Is there an easy
way to accomplish this? Any help would be appreciated.

Ron
 
How about

Sub SaveAllAsHTML()
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 & "*.doc?")

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

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

http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Graham:

Thanks for the reply but your suggestions is 'over my head'! Prior versions
of Word had a batch conversion Wizard and it was easy to make such
conversions. I have searched Word 2007 for the batch conversion Wizard and
it does not seem to exist. Was this feature omitted?

Thanks again.

Ron
 
It's just a simple macro - the link at the end of my earlier reply explains
how to install such listings. All you have to do is run the macro?

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Answered in reply to your separate question.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Uni said:
Graham Mayor said:
How about
[cut]
...batch conversion of doc>html
[cut]

Wow - any chance that something similar would be possible as
a "Batch conversion to .pdf"-macro?

I have installed the Word 2007 "Save as pdf" add-in. But it's
a nightmare if I have to manually save all the docs as pdf...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top