View Single Post
 
Old 02-15-2019, 06:44 AM
aaghd72 aaghd72 is offline Windows 10 Office 2019
Novice
 
Join Date: Feb 2019
Posts: 15
aaghd72 is on a distinguished road
Smile Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save

This is the code I am trying. When I saved the file (.docm) it didn't work. What am I doing wrong? Please! Thanks!

Private Sub oApp_DocumentBeforeSave(ByVal Doc As Document, _
SaveAsUI As Boolean, Cancel As Boolean)
Sub DelRows()
Application.ScreenUpdating = False
Dim r As Long
With ActiveDocument.Tables(1)
For r = .Rows.Count To 1 Step -1
With .Rows(r)
If .Range.Fields.Count > 0 Then .Delete
End With
Next
End With
Application.ScreenUpdating = True
End Sub
Attached Files
File Type: dotm Try - Dissemination Meeting Agenda Template.dotm (82.9 KB, 12 views)

Last edited by aaghd72; 02-15-2019 at 10:47 AM. Reason: Added Document
Reply With Quote