![]() |
|
#1
|
|||
|
|||
|
Hello everyone, this is my first post. I have a new problem to resolve. I have like 1000 .doc files that i need to convert them in .html files. Is there a function/script/batch/program or something like this to help me, so i can convert them in one time? Best regards to all Thank you |
|
#2
|
||||
|
||||
|
You could do that with a macro like:
Code:
Sub SaveAllAsHTML()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
If strFolder & "\" & strFile <> strDocNm Then
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
.SaveAs FileName:=Split(.FullName, ".doc")(0) & ".htm", Fileformat:=wdFormatHTML, AddToRecentFiles:=False
.Close SaveChanges:=False
End With
End If
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
The macro includes it's own folder browser, so all you need do is run it and point it to thje folder to process; all documents in that folder will be re-saved as html files.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Tags |
| convert doc to html, html |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
I want to create a lists within lists (nested merges)
|
AndyS | Mail Merge | 10 | 12-11-2015 03:05 PM |
| File lists like windows explorer in onenote? | karmajohn | OneNote | 0 | 07-22-2015 02:24 PM |
| Width in cm/inches in HTML file | JM-R | Word | 0 | 09-08-2014 09:28 AM |
Import HTML into Word .doc file?
|
Clueless in Seattle | Word | 1 | 07-31-2012 12:12 PM |
| VBA Code to Print Individual Resource Lists to a pdf File | OTPM | Project | 0 | 05-24-2011 12:21 PM |