#1   Report Post  
CMK
 
Posts: n/a
Default Export Bookmarks?

I have created 30 or so documents with at least 75 bookmarks in each. Is
there any way I can export a bookmark list (TXT) from each document? I need
to compare bookmarks between documents and I'm hoping that I don't have to
type them all out.
  #2   Report Post  
CyberTaz
 
Posts: n/a
Default

I, for one, have never seen a way to do this from within Word. There may be
some type of utility that will enable you to print a list, but I'm not aware
of one.

Continue to check back because the MVPs & others usually seem to come up
with something.

Good Luck |:)


On 3/23/05 7:03 PM, in article
, "CMK" wrote:

I have created 30 or so documents with at least 75 bookmarks in each. Is
there any way I can export a bookmark list (TXT) from each document? I need
to compare bookmarks between documents and I'm hoping that I don't have to
type them all out.


--



  #3   Report Post  
Jean-Guy Marcil
 
Posts: n/a
Default

CMK was telling us:
CMK nous racontait que :

I have created 30 or so documents with at least 75 bookmarks in each.
Is there any way I can export a bookmark list (TXT) from each
document? I need to compare bookmarks between documents and I'm
hoping that I don't have to type them all out.


You could try a little macro like this one:

'_______________________________________
Sub TypeOutBookmarkList()

Dim MyBkmk As Bookmark
Dim MyList As String
Dim DocList As Document
Dim CurDocName As String

With ActiveDocument
If .Bookmarks.Count = 0 Then
MsgBox "There are no bookmarks in this document."
Exit Sub
End If

For Each MyBkmk In .Bookmarks
MyList = MyList & MyBkmk.Name & Chr(13)
Next

CurDocName = .Name
End With

Set DocList = Documents.Add

With DocList
.Range.Text = "Here is the list of bookmarks in " _
& CurDocName & ":" & Chr(13) & Chr(13) & MyList
.PrintOut
.Close wdDoNotSaveChanges
End With
End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #4   Report Post  
Beth Mc
 
Posts: n/a
Default

What if I want this macro to list the bookmarks in a new blank doc instead of
printout?

Thanks,
Beth

"Jean-Guy Marcil" wrote:

CMK was telling us:
CMK nous racontait que :

I have created 30 or so documents with at least 75 bookmarks in each.
Is there any way I can export a bookmark list (TXT) from each
document? I need to compare bookmarks between documents and I'm
hoping that I don't have to type them all out.


You could try a little macro like this one:

'_______________________________________
Sub TypeOutBookmarkList()

Dim MyBkmk As Bookmark
Dim MyList As String
Dim DocList As Document
Dim CurDocName As String

With ActiveDocument
If .Bookmarks.Count = 0 Then
MsgBox "There are no bookmarks in this document."
Exit Sub
End If

For Each MyBkmk In .Bookmarks
MyList = MyList & MyBkmk.Name & Chr(13)
Next

CurDocName = .Name
End With

Set DocList = Documents.Add

With DocList
.Range.Text = "Here is the list of bookmarks in " _
& CurDocName & ":" & Chr(13) & Chr(13) & MyList
.PrintOut
.Close wdDoNotSaveChanges
End With
End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org




  #5   Report Post  
ERS ERS is offline
Junior Member
 
Posts: 0
Default

Quote:
Originally Posted by CMK View Post
I have created 30 or so documents with at least 75 bookmarks in each. Is
there any way I can export a bookmark list (TXT) from each document? I need
to compare bookmarks between documents and I'm hoping that I don't have to
type them all out.
Hi CMK,
The following macro shall enable you to extract bookmarks within a document to a new one.

Create a new module and paste these codes:

Sub ExtractBookmarksInMultiDoc()
Dim objBookmark As Bookmark
Dim objTable As Table
Dim nRow As Integer
Dim objDoc As Document, objNewDoc As Document
Dim objParagraph As Paragraph
Dim strFolder As String, strFile As String

strFolder = InputBox("Enter folder path he ")
strFile = Dir(strFolder & "*.docx", vbNormal)

While strFile ""
Set objDoc = Documents.Open(FileName:=strFolder & strFile)
Set objDoc = ActiveDocument
Set objNewDoc = Documents.Add

Selection.TypeText Text:="Bookmarks in " & "'" & objDoc.Name & "'"

Set objTable = Selection.Tables.Add(Range:=Selection.Range, numrows:=1, numcolumns:=3)
objTable.Borders.Enable = True
nRow = 1

For Each objParagraph In objNewDoc.Paragraphs
If objParagraph.Range.Style = "Caption" Then
objParagraph.Range.Delete
End If
Next objParagraph

With objTable
.Cell(1, 1).Range.Text = "Name"
.Cell(1, 2).Range.Text = "Texts"
.Cell(1, 3).Range.Text = "Page Number"

For Each objBookmark In objDoc.Bookmarks
objTable.Rows.Add
nRow = nRow + 1
.Cell(nRow, 1).Range.Text = objBookmark.Name
.Cell(nRow, 2).Range.Text = objBookmark.Range.Text
.Cell(nRow, 3).Range.Text = objBookmark.Range.Information(wdActiveEndAdjustedP ageNumber)
objDoc.Hyperlinks.Add Anchor:=.Cell(nRow, 3).Range, Address:=objDoc.Name, _
SubAddress:=objBookmark.Name, TextToDisplay:=.Cell(nRow, 3).Range.Text
Next objBookmark
End With
objNewDoc.SaveAs2 FileName:=objDoc.Path & "\" & "Bookmarks in " & objDoc.Name
objDoc.Close
strFile = Dir()
Wend
End Sub


This macro is for batch processing.

Bookmarks will be arranged in a table in new document with bookmark texts and page numbers in link.

You can follow the link to quickly jump to the bookmark location in main document.

For more detailed information, you can refer to this article:

https://www.datanumen.com/blogs/batc...word-document/

Hope that helps!
ERS

Last edited by ERS : April 25th 17 at 04:45 AM
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
View (displaying) bookmarks - Word 2003 Eric G Microsoft Word Help 4 May 18th 05 04:44 AM
Find & Replace Bookmarks jbc Microsoft Word Help 1 December 24th 04 10:03 PM
Add bookmarks in header/footer Kind writer/user/programmer Microsoft Word Help 1 December 7th 04 08:55 PM
Lock portion of the document after inserting bookmarks Sesame Microsoft Word Help 2 December 7th 04 04:49 AM
How to protect bookmarks Flip Microsoft Word Help 6 November 30th 04 01:38 PM


All times are GMT +1. The time now is 03:05 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"