cfbrian
06-13-2006, 09:21 PM
Hi
I have a document that has a few topics of related information, grouped in pasages spread over the entire text (similar information but in different wording). If I want to use a certain topic, I would have to go through the entire text to delete the unrelated passages. It is quite tedious!!
I have created a combobox with 5 items, relating to the 5 topics. My intention is, when I pick one of the selection, click 'OK' the code will go through the document and delete all the text that does not pertain to the wanted selection.
I have placed enclosed books throughout the document. As far as I know, even with similar topics, I have to name them different e.g. Jupiter_1, Jupiter_2. (I am a newbie, please advise if I can do it differently.)
Also, how do I write the code to delete all the bookmarks without having to spell out the different bookmarks repeatedly :
With ActiveDocument
If ComboBoxApplication.Value = "Mars" Then
Selection.GoTo What:=wdGoToBookmark, Name:="Jupiter_1"
Selection.Delete
End If
End With
If ComboBoxApplication.Value = "Mars" Then
Selection.GoTo What:=wdGoToBookmark, Name:="Jupiter_2"
Selection.Delete
End If
End With
Thanks
I have a document that has a few topics of related information, grouped in pasages spread over the entire text (similar information but in different wording). If I want to use a certain topic, I would have to go through the entire text to delete the unrelated passages. It is quite tedious!!
I have created a combobox with 5 items, relating to the 5 topics. My intention is, when I pick one of the selection, click 'OK' the code will go through the document and delete all the text that does not pertain to the wanted selection.
I have placed enclosed books throughout the document. As far as I know, even with similar topics, I have to name them different e.g. Jupiter_1, Jupiter_2. (I am a newbie, please advise if I can do it differently.)
Also, how do I write the code to delete all the bookmarks without having to spell out the different bookmarks repeatedly :
With ActiveDocument
If ComboBoxApplication.Value = "Mars" Then
Selection.GoTo What:=wdGoToBookmark, Name:="Jupiter_1"
Selection.Delete
End If
End With
If ComboBoxApplication.Value = "Mars" Then
Selection.GoTo What:=wdGoToBookmark, Name:="Jupiter_2"
Selection.Delete
End If
End With
Thanks