Consulting

Results 1 to 5 of 5

Thread: Using VBA in Word, I need to be able to access the actual text of the document...

  1. #1
    VBAX Newbie
    Joined
    Jul 2011
    Posts
    2
    Location

    Using VBA in Word, I need to be able to access the actual text of the document...

    Using VBA in Microsoft Word, I need to be able to access the actual text of the document, not just some of the properties of the document. How can I both access and change the text, as well as move the cursor around in the document. I can't figure that out. Sorry this is probably a newbie question.

  2. #2
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Hi lvlr,

    At its most basic, a document's text can be accessed via 'Activedocument.Range.Text'. To change any of the content, though, you need to tell Word where to find it (eg by reference to a known paragraph number, a table cell, a textbox, a bookmarked range, via 'Find', etc). Your post gives no indication of what you're trying to do, so only the most generic advice can be given.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Newbie
    Joined
    Jul 2011
    Posts
    2
    Location

    By sections...

    Quote Originally Posted by macropod
    To change any of the content ... you need to tell Word where to find it (eg by reference to a known paragraph number, a table cell, a textbox, a bookmarked range, via 'Find', etc). Your post gives no indication of what you're trying to do, so only the most generic advice can be given.
    If possible I would like to be able to change the document via section. I wrote a VBA "program?" that is currently able to count the sections. And I would like to be able to either delete by section or copy and paste as a new section if possible.

    Thanks for the help so far!

  4. #4
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Hi lvlr,

    Again, you give insufficient information for help to be given. Which Section? and what do you want to do - delete, copy or paste? If it's the latter, where is the data to be pasted coming from?
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Cross-posted at: http://www.tek-tips.com/viewthread.c...1654498&page=1
    (where the OP is equally obscure as to what the objective, if any, might be).

    lvlr, for cross-posting etiquette, please read: http://www.excelguru.ca/node/7
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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