Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-02-2017, 12:10 PM
michael.smith@safetech.ca michael.smith@safetech.ca is offline MS Word VBA macro to add a line to a table with formatting and set to original content Windows 10 MS Word VBA macro to add a line to a table with formatting and set to original content Office 2013
Novice
MS Word VBA macro to add a line to a table with formatting and set to original content
 
Join Date: Feb 2017
Posts: 1
michael.smith@safetech.ca is on a distinguished road
Default MS Word VBA macro to add a line to a table with formatting and set to original content

I am creating a MS Word form and want to give the option to "Add Education". This would be a macro button that would:
  • Unprotect the form
  • Add a line to an existing table with formatting
  • Set the new line to blank
  • Protect the form
I have a dropdown list in the first column of the table that would need to be set back to Choose and item

Attached is what I have found, but this just creates the form fields in the new row.

Sub AddTableRow()


Dim rw As Row
Dim cl As Cell
Dim ffld As FormField

ActiveDocument.Unprotect Password:=""
Set rw = ActiveDocument.Tables(4).Rows.Add
For lngIndex = 1 To oCol.Cells.Count
oCol.Cells(lngIndex).Range.Copy
.Columns(lngCol).Cells(lngIndex).Range.Paste
Next lngIndex
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub
Reply With Quote
  #2  
Old 02-02-2017, 01:59 PM
macropod's Avatar
macropod macropod is offline MS Word VBA macro to add a line to a table with formatting and set to original content Windows 7 64bit MS Word VBA macro to add a line to a table with formatting and set to original content 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

See: https://www.msofficeforums.com/word-...html#post38312
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Word VBA macro to add a line to a table with formatting and set to original content How do I add selection of multi line content control list to specific table cell Dudlee Word VBA 1 09-20-2016 04:58 PM
a table pasted in word from excel is not similar to the original table in excel Mukapa Word Tables 1 01-18-2016 07:31 AM
MS Word VBA macro to add a line to a table with formatting and set to original content macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
MS Word VBA macro to add a line to a table with formatting and set to original content Merging Word documents and keeping the formatting exactly as it appears in the original document NovaScotia Word 4 01-21-2015 11:44 PM
MS Word VBA macro to add a line to a table with formatting and set to original content Merge only the text in a table and keep the 2 original colums of a table james1979uk Word Tables 5 12-15-2013 05:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:31 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