Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Houston, Tx, USA
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there a quick way of exporting or creating a list of the bookmarks in a document?

    I need to use the bookmarks in hyperlinks in another application, and I don't know any other way other than opening the Insert / Bookmarks dialog, and copying one by one.

    Help appreciated!
    Guillermo

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='gchutrau' post='776501' date='23-May-2009 07:29']Is there a quick way of exporting or creating a list of the bookmarks in a document?

    I need to use the bookmarks in hyperlinks in another application, and I don't know any other way other than opening the Insert / Bookmarks dialog, and copying one by one.

    Help appreciated![/quote]
    Hi gchutrau,

    The following macro generates a list of all bookmarks at the end of the active document, and displays their contents:
    Code:
    Sub ListBkMrks()
    Dim oBkMrk As Bookmark
    If ActiveDocument.Bookmarks.Count > 0 Then
      With Selection
    	.EndKey Unit:=wdStory
    	.TypeText Text:=vbCrLf & "Bookmark" & vbTab & "Contents"
    	For Each oBkMrk In ActiveDocument.Bookmarks
    	  .TypeText Text:=vbCrLf & oBkMrk.Name & vbTab & oBkMrk.Range.Text
    	Next oBkMrk
      End With
    End If
    End Sub
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The following macro creates a list of the names of the bookmarks in the active document; the list is created in a new document that you can print or save.

    Code:
    Sub ListBookmarks()
      Dim docSource As Document
      Dim docTarget As Document
      Dim bmk As Bookmark
      Set docSource = ActiveDocument
      Set docTarget = Documents.Add
      For Each bmk In docSource.Bookmarks
    	With docTarget.Content
    	  .InsertAfter bmk.Name
    	  .InsertParagraphAfter
    	End With
      Next bmk
    End Sub
    If you save the macro in your Normal.dot (Normal.dotm for Word 2007), you can call it from any document.

  4. #4
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Houston, Tx, USA
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='776509' date='22-May-2009 16:58']The following macro creates a list of the names of the bookmarks in the active document; the list is created in a new document that you can print or save.

    Code:
    Sub ListBookmarks()
      Dim docSource As Document
      Dim docTarget As Document
      Dim bmk As Bookmark
      Set docSource = ActiveDocument
      Set docTarget = Documents.Add
      For Each bmk In docSource.Bookmarks
    	With docTarget.Content
    	  .InsertAfter bmk.Name
    	  .InsertParagraphAfter
    	End With
      Next bmk
    End Sub
    If you save the macro in your Normal.dot (Normal.dotm for Word 2007), you can call it from any document.[/quote]

    Cool! Works perfect!! Thank you.
    Guillermo

Posting Permissions

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