Export MSWord Bookmarks & Selected Text to Excel
I've recently been tasked with document consolidation and standardization at my organization for one of our clients. The client is government and thus standardizes nothing and has 80 bookmarks per document. They want all of the bookmarks and their selected text into an excel document.
The bookmark names aren't standardized so I can't use a lot of the examples here. I know you can do bookmark retrieval by numbers. i.e. - Selection.Bookmarks(1).Name - will give me the name of bookmark #1 and summarily Selection.Bookmark(1).Select will give me all of the text inside the bookmark.
What I'd l ike to be able to do is (even if 1 document at a time), is run a script that dumps all of the bookmark names and their associated text into an excel spreadsheet. I really have no desire to do this manually >.<
Thanks in advance for any assistance you can offer.
Re: Export MSWord Bookmarks & Selected Text to Excel
you can try like this
vb Code:
For Each b In ActiveDocument.Bookmarks
MsgBox b.Name
MsgBox b.Range.Text
Next
if this gives the correct results, instead of the messageboxes, you can insert the strings into excel cells,
you can then automate to read every document in a folder (including subfolders if required), to add to the end of the worksheet, or to add a worksheet for every document, or whatever, depending on your requirements