How to retreive single page content in VBA MS-Word2007

I have the necessity to create from a .DOC file, for each page in it, a page.html
I explain better, for each page in the .DOC document I need to create a single HTML document.
from A.doc -> to -> Apage1.html, Apage2.html, Apage3.html
All this with VBA.
How can I do?
Who is Participating?
David LeeConnect With a Mentor Commented:
Hi. bobdylan75.  

Try this.
Sub SavePages()
    Dim wrdDoc1 As Word.Document, _
        wrdDoc2 As Word.Document, _
        wrdRange As Word.Range, _
        intPages As Integer
    Set wrdDoc1 = ActiveDocument
    On Error Resume Next
    For intPages = 1 To ActiveDocument.ActiveWindow.Panes(1).Pages.Count
        Set wrdRange = ActiveDocument.Range
        Selection.GoTo wdGoToPage, wdGoToAbsolute, intPages
        Set wrdRange = ActiveDocument.Bookmarks("\Page").Range
        Set wrdDoc2 = Application.Documents.Add
        wrdDoc2.SaveAs wrdDoc1.Name & "-Page" & intPages & ".html", wdFormatHTML
        Set wrdDoc2 = Nothing
End Sub

Open in new window

bobdylan75Author Commented:
You are not a sage, you are something like a cyber-god!
thank you!
David LeeCommented:
LOL!  Thanks and you're welcome.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.