Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hide columns/rows (All)

    Hi

    Is it possible to hide columns in a WORD document?

    By that I mean, say I have a table of 6 cols by 10 rows. Can I hide say the first two columms and specific rows (say 3, 8, 9) so that the table then becomes a 4 cols by 7 rows table? In my testing, I found that if I select the column and then set the font to hidden it hides the information but leaves a blank column in the place. I would like it to hide the columns as well. BTW: I would like to do this using a macro for our users.

    Thanks.

    Robie
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hide columns/rows (All)

    Excel is more suitable for this kind of thing - it has menu options for hiding rows and columns.

    In Word, you can use code like this:

    Dim tbl As Table
    Dim r As Row
    Dim c As Column
    Dim cel As Cell

    Set tbl = ActiveDocument.Tables(1)

    ' General properties needed
    tbl.AllowAutoFit = False
    tbl.Rows.HeightRule = wdRowHeightExactly
    tbl.Columns.PreferredWidthType = wdPreferredWidthPoints

    ' Hide a row
    Set r = tbl.Rows(2)
    r.Height = 1

    ' Hide a column
    Set c = tbl.Columns(2)
    For Each cel In c.Cells
    cel.LeftPadding = 0
    cel.RightPadding = 0
    Next cel
    c.PreferredWidth = 0

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide columns/rows (All)

    Thanks Hans. Excel is certainly better but powers that be require it to be word. I will try out your suggestion.
    Thanks.
    Robie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •