Consulting

Results 1 to 4 of 4

Thread: Solved: Copy text from specific pages with VBA

  1. #1

    Solved: Copy text from specific pages with VBA

    hello all
    well i am new comer to the world of VBA so please bear with me.I have to write some macros in MS Word through which i will be exporting the text to a PHP page for further processing.The PHP part is ok except for one thing, the problems are as follow...

    1. How can i get the page numbers of the word document in VBA.
    2. Is it possible to read the text of a document page wise.

    3. The new lines of word document are not identified by php.it display it as a single line....

    ne suggestions, comments, tricks, tipps..... ne thing

    Regards

  2. #2

    page numbers

    hi
    well getting page numbers in damn too easy....

    it is like

    Dim pages as Long
    pages = Selection.Information(wdNumberOfPagesInDocument)


    ok but now i dont know how to jump to a particular page and get its text....


  3. #3
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi truckman,

    To select the text in a page you can use ..

    [VBA]
    Selection.GoTo(wdGoToPage, , pagenumber).Bookmarks("\Page").Range.Text
    [/VBA]
    Getting text of individual lines depends a bit on how your text is structured - Word, as a word processor, reflows text over lines depending on available space, but there is a built-in "\Line" bookmark similar to the "\Page" one above which may be of help. If you post back with a few more details I may be able to help a bit more.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  4. #4
    Hello Tony

    Thanx a lot buddy, it is working.hopefully i wont be having any problem....but you never know....so if i will have , will come back here again.....

    Thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •