![]() |
#2
|
||||
|
||||
![]()
Call the following sub to fill your bookmarks with the data required. You can call it from your userform e.g. as follows, replacing the bookmark names and values as appropriate.
Code:
Select Case Me.ComboBoxName.ListIndex Case 0 FillBM "Bookmarkname", "Value to put in bookmark" FillBM "AnotherBookmarkname", "Another value to put in bookmark" 'etc Case 1 FillBM "Bookmarkname", "Value to put in bookmark" FillBM "AnotherBookmarkname", "Another value to put in bookmark" 'etc 'Repeat for each list index as required End Select Code:
Public Sub FillBM(strBMName As String, strValue As String) Dim orng As Range With ActiveDocument On Error GoTo lbl_Exit Set orng = .Bookmarks(strBMName).Range orng.Text = strValue orng.Bookmarks.Add strBMName End With lbl_Exit: Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Tags |
bookmarks, combobox |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
PeterPlys | Word VBA | 13 | 01-14-2015 06:41 AM |
![]() |
savo | Word | 6 | 04-11-2013 11:04 AM |
![]() |
Rattykins | Word VBA | 4 | 06-27-2012 10:02 PM |
Linking multiple choice questions to answers | Microsoftenquirer1000 | Word | 1 | 06-11-2012 06:53 AM |
![]() |
Foxtrot75 | Word | 1 | 03-02-2012 03:31 AM |