PDA

View Full Version : Multiple Bookmarks Help



pyccanful
08-17-2015, 11:09 AM
I tried to use the ActiveDocument.Fields.Update but it does update the reference bookmark (ctrl + f9)

It updates the regular bookmark and simply deletes the reference bookmark when I execute the function.


Private Sub CommandButton1_Click()
Dim City As String
Dim CityLoc As Range


Set CityLoc = ActiveDocument.Bookmarks("test").Range


City = Me.TextBox1.Value

CityLoc.Text = City

ActiveDocument.Fields.Update


End Sub

pyccanful
08-17-2015, 01:35 PM
Im just trying to get data from a userform and create 48 identical labels,

I was hoping to just type reference bookmarks at each label

But copying and pasting the textboxes would be okay too.

Any help would be greatly appreciated!

gmayor
08-18-2015, 02:06 AM
I would avoid text boxes. Word Labels use tables to provide the format. Perhaps the simplest approach would be to use http://www.gmayor.com/Envelope_Label_Add_In.htm which will create as many identical labels as you require.

If you wanted exactly 48 labels, then you could create a blank label, put a bookmark in the first label and a cross reference field in each of the other labels and use the FillBM method shown in the other thread in this forum in which you asked about bookmarks. You would have to update the fields to update the cross references.

It would also be simple enough to fill every cell with the value(s) from the userform, but this can cause a problem if your label blanks have spaced cells (which the linked solution overcomes).

The two threads should have provided enough information to get you going.