Hi. I'm just learning how to use Word 2003 mail merge to create
I don't know much about scripting and expected something
simpler. But if I have to I'll give it a try. Thanks again.
While trying to solve my mailmerge conversion issue I Googled upon
a May 7, 2004 post of yours which explained this issue in more detail.
Specifically, you wrote the following macro to convert doc files to HTML:
*******************************
Public Sub BatchSaveAsHTML()
Dim myFile As String
Dim myHTML As String
Dim myLen As String
Dim myLen2 As String
Dim PathToUse As String
Dim myDoc As Document
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .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(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If
myFile = Dir$(PathToUse & "*.doc")
While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)
myLen = Len(myFile)
myLen2 = myLen - 3
myHTML = Left(myFile, myLen2) & "HTML"
myDoc.SaveAs FileName:=myHTML, FileFormat:=wdFormatHTML
myDoc.Close Savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub
*********************************************
I notice that your reply contains some slight changes from the earlier
version.
I installed your macro and it worked well, and was faster than I thought
it would be. However, I do have some questions:
1.) The output HTML files were saved to the "my documents folder." Is there
a way I can set the output files to the folder of my choice? Or could I at
least set the
output to be saved in the same folder from which I loaded my original doc
files?
2.) The HTML is not filtered and therefore I get some extra data in the HTML
source. Is there a way I can clean up the HTML during the macro?
3.) Does it matter that the Word default macro template does not contain
the word "Public" preceeding the word sub?
In addition, when I went to your website I downloaded the macro that splits
the
merged file into separate files (MMtoDocsRev19.dot). Your tutorial on that
macro
showed some familiar screenshots. I realized that your macro was already on
my
Word 2003 system, even though I don't remember ever having placed it there.
It is located in my Applications Data\Microsoft\Word startup folder
as MailMergetoDocsRev19.dot. Are the two files equivalent?
I'd like to again thank you so much for all your assistance in this matter.