Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #17  
Old 09-09-2014, 09:38 PM
macropod's Avatar
macropod macropod is offline Delete Rows in Protected Table with Form Fields Windows 7 64bit Delete Rows in Protected Table with Form Fields 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

The macro to which you refer requires all formfields on a row to be empty before a deletion will occur. Your document, however, always has content in the formfields in columns 3-5. Hence no row will ever be deleted. Since your 'controlling' field appears to be the first one on each row, you might try:
Code:
Sub DeleteEmptyRows()
'Delete empty rows in the table
Application.ScreenUpdating = False
Dim StrPwd As String, i As Long
StrPwd = ""
With ActiveDocument
  If .ProtectionType = wdAllowOnlyFormFields Then .Unprotect Password:=StrPwd
  With .Tables(1)
    For i = .Rows.Count - 1 To 2 Step -1
      With .Rows(i)
        If Trim(.Range.FormFields(1).Result) = "" Then .Delete
      End With
    Next
  End With
  .Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=StrPwd
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
delete row, form fields, protected form

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows in Protected Table with Form Fields Text Form Fields - Filling the table cell simville02 Word Tables 1 01-31-2013 11:12 PM
Using macro to add variable number of rows to a protected word table Julia Word Tables 1 01-09-2013 06:04 AM
Delete Rows in Protected Table with Form Fields Delete all rows but the last. elky1967 Word VBA 14 09-21-2012 05:27 AM
Adding table lines to protected form razberri Word Tables 2 10-27-2010 05:58 PM
Editing Password protected form fields in Word 2007 tamilan Word 2 02-16-2010 09:45 AM

Other Forums: Access Forums

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