Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 09-04-2018, 02:36 AM
macropod's Avatar
macropod macropod is offline dropdown list to create tables Windows 7 64bit dropdown list to create tables Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
Code in the attachment in post #6 updated.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
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
dropdown list to create tables Dropdown content control and tables hrzagi Word 1 12-17-2017 09:38 PM
dropdown list to create tables Change colours in different tables based on dropdown selections 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:49 PM.


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