A family of Microsoft word processing software products for creating web, email, and print documents.
Here is a tjp that should point you in the right direction:
How to Programmatically Save Each Page or Section of a Document As Separate File
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi all,
I want to save a word 2007 document (.docx format, 100+ pages) as multiple html files for our website. The division can be based on the style that is already applied to the document, i.e. the content of each heading 1 is saved into one web page. I know Word 2007 has built-in html conversion feature, but it saves the document as one single html file. Anyone know how to do this? thanks.
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Here is a tjp that should point you in the right direction:
How to Programmatically Save Each Page or Section of a Document As Separate File
Thanks Doug,
I follow your instructions and run the modified VB code. Multiple HTML files are generated and they are named test_n.htm where n=1..19.
Now everything is OK except only one issue. The file test_1.htm corresponds to the title and content of the original document, and the files test_2.htm, test_3.htm ... correspond to chapter 1, 2 ... of the document. In original word document, I can ctrl+click an entry in the content to jump to the corresponding chapter, in test_1.htm however, all links are assigned as file:///D:\Public\test_1.htm. Is there any way to solve this issue? Thanks in advance.
Thanks Rohn007.
But there are still two problems. First, the ordinal index number of each section is incorrectly changed to 1. For example, the section title of original document
"chapter 10 section-title"
is changed to
"chapter 1 section-title'
Second, we still have to convert each divided document into html file. This may be inpractical as there are 20 divided documents.
Before splitting the document, run a macro containing the command
ActiveDocument.ConvertNumbersToText
Replace the following line of code in the article to which you were referred
ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc"
with
ActiveDocument.SaveAs filename:="test_" & DocNum & ".htm", FileFormat:=wdFormatHTML
Thanks Rohn007.
But there are still two problems. First, the ordinal index number of each section is incorrectly changed to 1. For example, the section title of original document
"chapter 10 section-title"
is changed to
"chapter 1 section-title'
Second, we still have to convert each divided document into html file. This may be inpractical as there are 20 divided documents.