Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 06-27-2015, 12:58 AM
Schildkröte Schildkröte is offline Bookmarks Windows 8 Bookmarks Office 2013
Novice
Bookmarks
 
Join Date: Jun 2015
Posts: 6
Schildkröte is on a distinguished road
Default

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
This is a macro to change the text of a bookmark.

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
But in the third case I would like to insert a table (7 rows, 2 columns) and put some text in the first column. Then everything should be the range of my bookmark again.

Appreciating your help
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bookmarks Form updating Bookmarks - writes to the bookmarks multiple times PeterPlys Word VBA 13 01-14-2015 06:41 AM
Bookmarks 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
Bookmarks 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

Other Forums: Access Forums

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


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