![]() |
|
#27
|
||||
|
||||
|
No - the 'UpdateBookmark' needs to be a separate sub - you now have one sub inside another.
Code:
Private Sub CommandButton1_Click()
Dim i As Long, StrOut As String
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
StrOut = StrOut & ListBox1.List(i) & vbCr
End If
Next i
Call UpdateBookmark("bm1", StrOut)
End Sub
Sub UpdateBookmark(StrBkMk As String, StrTxt As String)
Dim BkMkRng As Range
With ActiveDocument
If .Bookmarks.Exists(StrBkMk) Then
Set BkMkRng = .Bookmarks(StrBkMk).Range
BkMkRng.Text = StrTxt
.Bookmarks.Add StrBkMk, BkMkRng
End If
End With
Set BkMkRng = Nothing
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| form, multi drop down |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Change color according with dropdown selection
|
spk | Word VBA | 43 | 07-31-2022 03:51 PM |
Auto text after selection from Dropdown menu
|
trainsy | Word | 2 | 06-04-2014 04:43 AM |
| block selection in dropdown list | Intruder | Excel | 2 | 01-10-2013 10:20 AM |
Dropdown selection value
|
coconutt | Word VBA | 5 | 09-13-2012 05:23 PM |
Autofill a form which is contingent on a dropdown selection.
|
biffle0764 | Word | 2 | 05-09-2012 12:54 PM |