I have been trying to figure out how to hide 2 rows in Microsoft word. I know that it does not have the same features as excel, but what I am doing needs to be done in word. I currently have a table and I wanted to hide 2 rows.
Here is the basic info:
- The table has a total of 17 rows.
- I want to hide rows 16 & 17.
- Row 16 had 5 columns
- Row 17 has 3 columns.
- the table cannot have a title...
- Microsoft word --> Office 16
This table is being pulled into excel using a different VBA script and the parameters of that script require that this table still contains 17 rows. I have been trying to figure out how to minimize/hide these rows in a word for a couple of days now. I have found several pieces of code online and I get errors with each code.
I am very much a noob when it comes to VBA.
Here is the code I have tried to utilize:
Private Sub CommandButton1_Click()
Dim BBGEarlyAppr As Range
Dim BBGEarlyAppr2 As Range
With ActiveDocument.Tables(1)
Set BBGEarlyAppr = .Rows(7).Range
BBGEarlyAppr.End = .Rows(41).Range.End
End With
With ActiveDocument.Tables(1)
Set BBGEarlyAppr2 = .Rows(60).Range
BBGEarlyAppr2.End = .Rows(68).Range.End
End With
With BBGEarlyAppr.Font
.Hidden = True
End With
With BBGEarlyAppr2.Font
.Hidden = True
End With
End Sub
I get an error at BBGEarlyAppr.End = .Rows(41).Range.End
"the requested member of the collection does not exist"
Is this because rows are off? Also, hiding the font does not appear to remove the font within the cells...
Any help or explanation would be greatly appreciated. I