![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#2
|
||||
|
||||
|
Based on your screenshot
Code:
Private Sub CommandButton1_Click()
Dim oCC As ContentControl
Dim oTable As Table
Dim oRng As Range
Set oTable = ActiveDocument.Tables(1)
For Each oCC In oTable.Range.ContentControls
oCC.LockContentControl = False
Next oCC
oTable.Rows.Last.Range.Copy
Set oRng = oTable.Range
oRng.Collapse 0
oRng.Paste
oRng.ContentControls(1).DropdownListEntries.Item(1).Select
For Each oCC In oTable.Range.ContentControls
oCC.LockContentControl = True
Next oCC
Set oCC = Nothing
Set oTable = Nothing
Set oRng = Nothing
End Sub
Private Sub CommandButton2_Click()
Dim oCC As ContentControl
Dim oTable As Table
Set oTable = ActiveDocument.Tables(1)
For Each oCC In oTable.Range.ContentControls
oCC.LockContentControl = False
Next oCC
oTable.Rows.Last.Delete
For Each oCC In oTable.Range.ContentControls
oCC.LockContentControl = True
Next oCC
Set oCC = Nothing
Set oTable = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remove visible command button when attaching in outlook | mfiltvedt84 | Outlook | 11 | 10-02-2018 04:33 PM |
| Show table list by using chek box command and save document on sharepoint by using command button | Zhibek | Word VBA | 3 | 08-16-2018 06:19 PM |
Print only specified pages of word by 1 click of command button using vba
|
Zhibek | Word VBA | 9 | 08-12-2018 11:44 PM |
| Word 2013 ActiveX Command Button Failure | irallfml@gmail.com | Word VBA | 1 | 05-23-2014 04:19 PM |
Word VBA: How to create a command button and trigger a function?
|
tinfanide | Word VBA | 2 | 12-02-2011 05:51 AM |