Solved

How to retreive single page content in VBA MS-Word2007

Posted on 2009-05-08
3
163 Views
Last Modified: 2013-11-10
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?
Thanks.
0
Comment
Question by:bobdylan75
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24337629
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
        wrdRange.Copy
        Set wrdDoc2 = Application.Documents.Add
        wrdDoc2.Range.Paste
        wrdDoc2.SaveAs wrdDoc1.Name & "-Page" & intPages & ".html", wdFormatHTML
        wrdDoc2.Close
        Set wrdDoc2 = Nothing
    Next
End Sub

Open in new window

0
 

Author Closing Comment

by:bobdylan75
ID: 31579386
You are not a sage, you are something like a cyber-god!
thank you!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24344153
LOL!  Thanks and you're welcome.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ejb stateless example 2 27
Create a text box form field in Word - up to 500 words? 3 21
microsoft word short cuts 3 47
Selenium docs api java index 3 48
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question