![]() |
|
|
|
#1
|
|||
|
|||
|
Ok, I´m going to describe my problem more detailed:
I have a dropdown with 3 entries (Hi, Hello, Welcome). Then I have a bookmark in this form: Some Text -blank space as a bookmark- Some Text According to what I choose I want to change the content of the bookmark. Hi: " " Hello: newline & "Some new Text: " & newline Welcome: newline & a table & newline The first two cases are not too hard I think: This is a sub to call a makro according to which entry is choosen: Code:
Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
Dim Text As String
Dim Empty As String
Text = vbCrLf & "Some new Text: " & vbCrLf
Empty = " "
Select Case CC.Tag
Case Is = "Tagname"
Select Case CC.Range.Text
Case Is = "Hi"
Call ChangeText(Empty)
Case Is = "Hello"
Call ChangeText(Text)
Case Is = "Welcome"
Call ???
End Select
End Select
End Sub
Code:
Sub ChangeText(ByVal Text As String)
Application.ScreenUpdating = False
Selection.GoTo What:=wdGoToBookmark, Name:="TestBookMark"
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.InsertAfter Text
ActiveDocument.Bookmarks.Add Range:=Selection.Range, _
Name:="TestBookMark"
Selection.Collapse
Application.ScreenUpdating = True
End Sub
Appreciating your help
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Form updating Bookmarks - writes to the bookmarks multiple times
|
PeterPlys | Word VBA | 13 | 01-14-2015 06:41 AM |
TOC hyperlinks and bookmarks.
|
GregCFII | Word | 9 | 03-02-2014 06:43 AM |
| Can't See Bookmarks | bobmayo | Word | 21 | 06-04-2013 07:37 AM |
Table of Bookmarks
|
Niy | Word | 3 | 03-28-2012 12:18 AM |
| Bookmarks for a PDF? | Ownaholic | Word | 0 | 10-30-2010 12:27 AM |