Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Hide Only a Section of Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DGjr. - 13 Apr 2006 20:14 GMT
Hi. I'm trying to find/write vba script that will hide only a select number
of rows from a table - so that I deselect a checkbox and it hides say, 10
rows below it. I've found the following code, but it hides ALL rows
underneath it. I only want some. Can someone help me?

Private Sub CheckBox1_Change()
Call ShowHideTable
End Sub

Sub ShowHideTable()
With Selection
  .GoTo What:=wdGoToTable, Which:=wdGoToNext, _
     Count:=1, Name:=""
  .Tables(1).Select
End With
If CheckBox1.Value = True Then
  With Selection.Font
     .Hidden = False
  End With
  With ActiveWindow.View
     .ShowHiddenText = True
     .ShowAll = True
  End With
Else
  With Selection.Font
     .Hidden = True
  End With
  With ActiveWindow.View
     .ShowHiddenText = False
     .ShowAll = False
  End With
  With Selection
     .Collapse direction:=wdCollapseStart
     .MoveLeft unit:=wdCharacter, Count:=1
  End With
End If
End Sub
Dave Lett - 13 Apr 2006 21:41 GMT
Hi,

You can try something like the following:

Dim oTbl As Table
Dim oRng As Range
Set oTbl = ActiveDocument.Tables(1)
Set oRng = ActiveDocument.Range(Start:=oTbl.Rows(2).Range.Start, _
   End:=oTbl.Rows(5).Range.End)
oRng.Font.Hidden = True

HTH
Dave

> Hi. I'm trying to find/write vba script that will hide only a select
> number
[quoted text clipped - 34 lines]
> End If
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.