small_badger
03-14-2011, 12:55 AM
Hi everybody.
I want to create a macro which changes font size only in tables not in the free text of the Word document. The point is that I want to start this macro from 3rd table to the end of the Word document.
The problem is I can’t run this macro and I don’t know why it doesn’t work?
May by You will help me, please.
Option Explicit
Sub change_font_size()
Dim x&
Application.ScreenUpdating = False
On Error Resume Next
For x = 1 To ThisDocument.Tables.Count
With ThisDocument.Tables(x).Range.Font
Select Case x
Case 3: .Size = 7
Case Is > 5: .Size = 7
End Select
End With
Next
Application.ScreenUpdating = True
End Sub
Second problem:
This macro is ok, but now I want to start action from 8th page of my Word document. It is possible?
Sub delete_empty_table()
Dim oTable As Table
Dim oRow As Row
For Each oTable In ActiveDocument.Tables
For Each oRow In oTable.Rows
'Check whether row is empty - delete if it is
If Len(oRow.Range.Text) = oRow.Cells.Count * 2 + 2 Then
oRow.Delete
End If
Next oRow
Next oTable
End Sub
I want to create a macro which changes font size only in tables not in the free text of the Word document. The point is that I want to start this macro from 3rd table to the end of the Word document.
The problem is I can’t run this macro and I don’t know why it doesn’t work?
May by You will help me, please.
Option Explicit
Sub change_font_size()
Dim x&
Application.ScreenUpdating = False
On Error Resume Next
For x = 1 To ThisDocument.Tables.Count
With ThisDocument.Tables(x).Range.Font
Select Case x
Case 3: .Size = 7
Case Is > 5: .Size = 7
End Select
End With
Next
Application.ScreenUpdating = True
End Sub
Second problem:
This macro is ok, but now I want to start action from 8th page of my Word document. It is possible?
Sub delete_empty_table()
Dim oTable As Table
Dim oRow As Row
For Each oTable In ActiveDocument.Tables
For Each oRow In oTable.Rows
'Check whether row is empty - delete if it is
If Len(oRow.Range.Text) = oRow.Cells.Count * 2 + 2 Then
oRow.Delete
End If
Next oRow
Next oTable
End Sub