我通常在Word文档中输入HTML代码,然后在MS Word中使用邮件合并来生成批量独立的Word文档,这些文档之间存在微小的差异。
这些微小差异的来源是 Excel 工作表,然后我使用第三方软件 (ReNamer) 将扩展名从 .doc 文件转换为 .html 文件。
有没有更好的方法来生成批量独立的HTML文件?
首先,为什么不将用 word 编写的 html 内容直接导出为 html 文件,您可以通过 VBA 执行此操作。
Sub SaveHTML()
Dim fileName
Dim PName
Dim FName
Dim FType
' Define your file path, name and type
PName = "C:\Temp\"
FName = "index"
FType = ".html"
' Export the file as plain text
ActiveDocument.SaveAs2 _
fileName:=PName & FName & FType, _
FileFormat:=wdFormatText, _
LockComments:=False, _
Password:="", _
AddToRecentFiles:=True, _
WritePassword:="", _
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, _
SaveFormsData:=False, _
SaveAsAOCELetter:=False, _
Encoding:=1252, _
InsertLineBreaks:=True, _
AllowSubstitutions:=False, _
LineEnding:=wdCRLF, _
CompatibilityMode:=0
End Sub