Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-15-2019, 06:44 AM
aaghd72 aaghd72 is offline Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Windows 10 Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Office 2019
Novice
Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save
 
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, 14 views)

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

Tags
delete, macro, rows



Similar Threads
Thread Thread Starter Forum Replies Last Post
Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Macro that deletes all empty rows in selected table MathiasFC Word VBA 2 02-10-2019 04:06 PM
Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Delete Empty Table Rows cltay87 Word VBA 4 02-27-2017 04:23 AM
Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Macro to delete all empty rows from all tables braddgood Word VBA 15 10-02-2015 01:54 PM
Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Delete All empty Rows - Print - Undo all Rows deleted Bathroth Word VBA 1 10-01-2014 01:40 PM
Design Macro or Code to Delete Table Rows When Null/Blank/Empty Upon Doc Close/Save Macro to delete rows with all empty cells ubns Excel Programming 2 08-14-2012 02:01 AM

Other Forums: Access Forums

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