View Single Post
  #2 (permalink)  
Old August 12th, 2009, 09:44 PM
Shasur Shasur is offline
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

"By clicking the TextBold2 i.e., the selected word in the listbox will match the word document and the cursor will automatically pointed there.
"

Do you want the click to take you to the position TextBold2?

If that is the case, you need to place some bookmarks in the document when you are loading them to the userform's listbox. The bookmarks should have the prefix similar to the textprefixes. This might be in the Userform_Initialize event


For example, TextBold1 will have BookMK1, TextBold2 will BookMK2 and so on

Then in the click event of the listbox you can use the following

Selection.GoTo what:=wdGoToBookmark, Name:="BookMK" & listbox1.listindex

You can delete/clear those bookmarks in userform's terminate event if needed

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote