Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #26  
Old 05-30-2018, 03:00 PM
Jailer Jailer is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2010 32bit
Novice
 
Join Date: May 2018
Posts: 7
Jailer is on a distinguished road
Default

So something like this? This gives me an error: Compile error expected end sub.

Code:
Option Explicit

Sub Document_Open()
  With ListBox1
    .Clear
    .MultiSelect = fmMultiSelectMulti
    .AddItem "Accupuncturist"
    .AddItem "Chiropractor"
    .AddItem "Dietician"
    .AddItem "Massage Therapist"
    .AddItem "Naturopath"
    .AddItem "Osteopath"
    .AddItem "Psychologist/Social worker"
    .AddItem "Physiotherapist"
    .AddItem "Podiatrist/Chiropractor"
    .AddItem "Speech Therapist"
  End With
End Sub

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)
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
End Sub
Reply With Quote
 

Tags
form, multi drop down



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Selection Dropdown list Change color according with dropdown selection spk Word VBA 43 07-31-2022 03:51 PM
Multiple Selection Dropdown list 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
Multiple Selection Dropdown list Dropdown selection value coconutt Word VBA 5 09-13-2012 05:23 PM
Multiple Selection Dropdown list Autofill a form which is contingent on a dropdown selection. biffle0764 Word 2 05-09-2012 12:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:32 PM.


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