Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2015, 11:53 PM
dsjk9190 dsjk9190 is offline Link listbox (with multiple columns) to bookmark based on selection Windows 8 Link listbox (with multiple columns) to bookmark based on selection Office 2010 64bit
Novice
Link listbox (with multiple columns) to bookmark based on selection
 
Join Date: Jan 2015
Posts: 4
dsjk9190 is on a distinguished road
Default Link listbox (with multiple columns) to bookmark based on selection

I'm after some thoughts on creating a listbox on a userform (with multiple selections available), then have this linked to a particular bookmark. However the text that appears in the listbox isn't all of the wording I'd like to add, so I'm thinking of creating a second column.
Below is the first part of the code that I've worked out, however I want to try link a selection to a bookmark.

Private Sub UserForm_Initialize()
With Me.ListBox1Area
.ColumnCount = 2
.ColumnWidths = .Width & ",0"
.AddItem
.List(.ListCount - 1, 0) = ""
.AddItem
.List(.ListCount - 1, 0) = "Area 1"
.List(.ListCount - 1, 1) = "Description...."
.AddItem
.List(.ListCount - 1, 0) = "Area 2"
.List(.ListCount - 1, 1) = "Description...."


.ListIndex = 0
End With
End Sub
Reply With Quote
  #2  
Old 01-29-2015, 12:31 AM
Guessed's Avatar
Guessed Guessed is offline Link listbox (with multiple columns) to bookmark based on selection Windows 7 32bit Link listbox (with multiple columns) to bookmark based on selection Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You don't link an item to a bookmark but you could add a column to hold the bookmark name and then have another macro to do something when the selection is made. eg
Private Sub ListBox1Area_OnChange()
'your code here
End Sub
Reply With Quote
  #3  
Old 01-29-2015, 03:49 PM
dsjk9190 dsjk9190 is offline Link listbox (with multiple columns) to bookmark based on selection Windows 8 Link listbox (with multiple columns) to bookmark based on selection Office 2010 64bit
Novice
Link listbox (with multiple columns) to bookmark based on selection
 
Join Date: Jan 2015
Posts: 4
dsjk9190 is on a distinguished road
Default

That's what I'm trying to work out, the code to insert the selection (from the listbox) at the bookmark. As I have another column in the listbox, I would need to differentiate which column belongs to a particular bookmark
Reply With Quote
  #4  
Old 01-29-2015, 04:29 PM
Guessed's Avatar
Guessed Guessed is offline Link listbox (with multiple columns) to bookmark based on selection Windows 7 32bit Link listbox (with multiple columns) to bookmark based on selection Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Assuming you are not using a multi-select listbox, the code might look like this if you also assume you want to put the contents of the second column into the location of the bookmark name which appears in the first column

ActiveDocument.Bookmarks(ListBox1Area.Value).range .text = ListBox1Area.List(ListBox1Area.ListIndex, 1)
Reply With Quote
  #5  
Old 01-29-2015, 11:22 PM
dsjk9190 dsjk9190 is offline Link listbox (with multiple columns) to bookmark based on selection Windows 8 Link listbox (with multiple columns) to bookmark based on selection Office 2010 64bit
Novice
Link listbox (with multiple columns) to bookmark based on selection
 
Join Date: Jan 2015
Posts: 4
dsjk9190 is on a distinguished road
Default

I am hoping on using a multi-select listbox, how would this change the code?
Reply With Quote
  #6  
Old 01-29-2015, 11:28 PM
Guessed's Avatar
Guessed Guessed is offline Link listbox (with multiple columns) to bookmark based on selection Windows 7 32bit Link listbox (with multiple columns) to bookmark based on selection Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Let me google that for you
Reply With Quote
Reply

Tags
listbox bookmark

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link listbox (with multiple columns) to bookmark based on selection Moving Selected Items from a Multiselect Listbox on a userform to a bookmark in Word marksm33 Word VBA 3 01-15-2015 07:55 PM
Link listbox (with multiple columns) to bookmark based on selection Getting mult resps. selected in listbox to concatenate & paste at a bookmark in Word marksm33 Word VBA 3 01-15-2015 05:59 PM
Link listbox (with multiple columns) to bookmark based on selection This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel 1 08-08-2014 09:41 AM
Link listbox (with multiple columns) to bookmark based on selection TOC: Link to bookmark or image Mijin Word 2 09-22-2011 03:14 AM
Link listbox (with multiple columns) to bookmark based on selection Putting a bookmark on a REF field in the selection b0x4it Word VBA 4 05-26-2011 01:14 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:23 AM.


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