View Full Version : 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.
macropod
07-11-2011, 04:10 AM
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.
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!
macropod
07-11-2011, 11:58 PM
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?
macropod
07-12-2011, 04:04 AM
Cross-posted at: http://www.tek-tips.com/viewthread.cfm?qid=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
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.