![]() |
#9
|
||||
|
||||
![]()
Try, for example:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean) Dim Tbl As Table, Rng As Range If CCtrl.Title <> "Demo" Then Exit Sub Application.ScreenUpdating = False Set Rng = ActiveDocument.Bookmarks("Tbl").Range Select Case CCtrl.Range.Text Case "Yes" If Rng.Tables.Count > 0 Then Exit Sub Set Tbl = Rng.Tables.Add(Range:=Rng, NumRows:=1, NumColumns:=2) With Tbl .AllowAutoFit = False .Borders.Enable = True .Rows.Height = InchesToPoints(0.75) .Columns(1).Width = InchesToPoints(2.5) .Columns(2).Width = InchesToPoints(3) With .Cell(1, 1).Range .Text = "Account:" & vbCr & " " .ContentControls.Add Type:=wdContentControlText, Range:=.Paragraphs(2).Range.Characters.First .ContentControls(1).Range.Text = "" .Paragraphs(1).Range.Font.Bold = True End With With .Cell(1, 2).Range .Text = "Remarks:" & vbCr .Paragraphs(1).Range.Font.ColorIndex = wdTurquoise End With End With Case Else If Rng.Tables.Count > 0 Then Rng.Tables(1).Delete End Select Set Tbl = Nothing: Set Rng = Nothing Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Selection of a dropdown creates another dropdown wih the list | krishnamurthy.ka2810 | Word VBA | 1 | 04-26-2018 11:44 PM |
![]() |
hrzagi | Word | 1 | 12-17-2017 09:38 PM |
![]() |
kevinbradley57 | Word VBA | 10 | 08-09-2017 03:54 PM |
excel2016: can't create dropdown | afik | Excel | 4 | 11-13-2016 01:38 PM |
Help!! Dropdown List | christo16 | Word | 1 | 06-29-2015 05:18 AM |