Daniel,
Hopefully the changes they are making this weekend will take care of some of these communication issus.
Here's the basic code to do this. There are three routines, ImportHTML is the main one. It will read filenames from the specified text file. The format of the text file should be like:
-----------
c:\htmlfiles\file1.htm
c:\htmlfiles\file2.htm
...
------------
It will set a bookmark for each html file, import the file and then go through and convert all of the links to be links to bookmarks.
Issues:
1) All hyperlinks are converted - if you have any external links, or links to bookmarks within the page, some additional code will be needed to skip them.
2) It would be best if images have absolute path/filenames. If not, the image files will have to be moved to the relative location to the Word doc. e.g. if you have an image with src=mypic.gif, it will have to be placed in the same folder as the Word doc.
3) This code has no error checking.
Let me know if this is what you were thinking of, and if you have any questions.
Sub ImportHTML()
Dim sFileName As String
Dim iFile As Integer
Dim sText As String
Dim sHTMLFile As String
Dim sBookmark As String
sFileName = "c:\htmlfiles\filelist.txt"
iFile = FreeFile
Open sFileName For Input As iFile
Do Until EOF(iFile)
Line Input #iFile, sText
If Len(sText) > 0 Then
sHTMLFile = Trim$(sText)
sBookmark = GetBookmark(sHTMLFile)
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:=sBookmark
Selection.TypeParagraph
Selection.InsertFile FileName:=sHTMLFile
Selection.InsertBreak Type:=wdPageBreak
End If
Loop
Close #iFile
ConvertLinksEnd Sub
more to follow....