Consulting

Results 1 to 2 of 2

Thread: Toggle button to hide rows in two different tables

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question Toggle button to hide rows in two different tables

    Hello. I am quite new to VBA and would really appreciate some help.

    I have successfully added a toggle button which shows or hides a table table row when it is clicked.
    The trouble I'm having is that I need it to do the same thing in a different table at the same time.
    ie. one button click hides a row in table 8 and also in table 10.

    I am using Word 2010. This is my code so far:
    Private Sub ToggleButton1_Click()
    With ActiveDocument.Tables(8).Rows(2)
    If .HeightRule = wdRowHeightExactly Then
    .HeightRule = wdRowHeightAuto
    ToggleButton1.Caption = "Yes"
    .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
    .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
    .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
    Else
    ToggleButton1.Caption = "No"
    .HeightRule = wdRowHeightExactly
    .Height = ".5"
    .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    .Borders(wdBorderRight).LineStyle = wdLineStyleNone
    End If
    End With
    lbl_Exit:
    Exit Sub
    End Sub

    Thanks in advance for your time.
    Last edited by Shimarisu; 11-10-2014 at 06:23 AM.

Posting Permissions

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