Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-20-2015, 04:10 AM
gmayor's Avatar
gmayor gmayor is offline Linking Combobox to multiple bookmarks Windows 7 64bit Linking Combobox to multiple bookmarks Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 

Tags
bookmarks, combobox



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Combobox to multiple bookmarks Form updating Bookmarks - writes to the bookmarks multiple times PeterPlys Word VBA 13 01-14-2015 06:41 AM
Linking Combobox to multiple bookmarks Linking to Bookmarks savo Word 6 04-11-2013 11:04 AM
Linking Combobox to multiple bookmarks VBA code to extract specific bookmarks from multiple word files 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
Linking Combobox to multiple bookmarks linking title across multiple documents Foxtrot75 Word 1 03-02-2012 03:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft