Я получаю смешанную ошибку ширины ячейки еще раз - PullRequest
0 голосов
/ 14 января 2019
Sub Demo()
    Application.ScreenUpdating = False
    Dim r as Long
    Dim C As Range
    With ActiveDocument.Tables(1)
        For r = 2 To .Rows.Count

            With .Rows(r)
                If .Cells.Count < 5 Then .Cells(2).Delete
                If .Cells.Count > 4 Then .Cells(3).Delete

            End WIth
        Next
        ActiveDocument.Tables(1).Cell(1,2).Delete
    End With
    Application.ScreenUpdating = True
End Sub

1 Ответ

0 голосов
/ 14 января 2019

Как я указывал в другой ветке, процесс должен выполняться на уровне ячеек. Таким образом:

        With .Rows(r)
            If .Cells.Count < 3 Then
                .Cells(2).Width = InchesToPoints(4)
                .Cells(3).Width = InchesToPoints(2)
            ElseIf .Cells.Count > 4 Then
                .Cells(2).Width = InchesToPoints(4)
                .Cells(3).Width = InchesToPoints(2)
                .Cells(4).Width = InchesToPoints(3)
            End If
        End With
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...