J
Jason Logue
Hi, I am working on a userform that allows the user to
click a button and load a listbox with bookmarks in a
specific document. The user can then click on one and
click the Command button for the window and it will load
that bookmark name in the specified area of the Word
document/template. I would like the bookmark names to be
available for the user, but I want the content of the
bookmark to be loaded into the template, not the bookmark
name.
Here is the code I have right now:
Sub CommandButton1_Click()
Dim i As Integer, source As Document
Set source = Documents.Open("C:\Documents and
Settings\Logue\My Documents\Allied
Title\exceptions\chapterone.doc")
For i = 1 To source.Bookmarks.Count
ListBox1.AddItem source.Bookmarks(i).Name
Next i
Documents("Chapterone.doc").Close
End Sub
The following code is for the actual userform the listbox
is on:
Private Sub CommandButton2_Click()
With ActiveDocument
.Bookmarks("exceptions1").Range.InsertBefore ListBox1
End With
UserForm3.Hide
End Sub
Thanks for any help!
-Jason
click a button and load a listbox with bookmarks in a
specific document. The user can then click on one and
click the Command button for the window and it will load
that bookmark name in the specified area of the Word
document/template. I would like the bookmark names to be
available for the user, but I want the content of the
bookmark to be loaded into the template, not the bookmark
name.
Here is the code I have right now:
Sub CommandButton1_Click()
Dim i As Integer, source As Document
Set source = Documents.Open("C:\Documents and
Settings\Logue\My Documents\Allied
Title\exceptions\chapterone.doc")
For i = 1 To source.Bookmarks.Count
ListBox1.AddItem source.Bookmarks(i).Name
Next i
Documents("Chapterone.doc").Close
End Sub
The following code is for the actual userform the listbox
is on:
Private Sub CommandButton2_Click()
With ActiveDocument
.Bookmarks("exceptions1").Range.InsertBefore ListBox1
End With
UserForm3.Hide
End Sub
Thanks for any help!
-Jason