A family of Microsoft word processing software products for creating web, email, and print documents.
I need to hide tables and table rows with VBA.
Hiding text with .Font.Hidden is not a problem. However when I print the document, there are many blank table rows. Is there a way to hide them?
Thank you!
Use a macro containing the following code:
Dim i As Long, j As Long, n As Long
Dim blnhide As Boolean
Dim strDoc As String
With ActiveDocument
strDoc = .FullName
For i = .Tables.Count To 1 Step -1
With .Tables(i)
For j = .Rows.Count To 1 Step -1
With .Rows(j)
For n = 1 To .Cells.Count
If .Cells(n).Range.Font.Hidden = True Then
blnhide = True
Else
blnhide = False
End If
Next n
If blnhide = True Then
.Delete
End With
Next j
End With
Next i
.PrintOut
.Close wdDoNotSaveChanges
End With
Documents.Open (strName)