-
[WORD] font size in tables
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.
[vba]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[/vba]
Second problem:
This macro is ok, but now I want to start action from 8th page of my Word document. It is possible?
[vba]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[/vba]
-
You have some conflicting statements.
a) I want to start action from 8th page of my Word document.
b) For Each oTable In ActiveDocument.Tables
The first has a start (8th page), the second has no start - it processes ALL tables regardless of where they are.
As for starting at the 8th page, you can either place a bookmark at th estrt of the 8th page (but remember it could move), or put the cursor there and process from there to the end of the document. Use Range.
"The problem is I can’t run this macro and I don’t know why it doesn’t work?"
What does that even mean? You can't run it? What happens? Your computer freezes? Word freezes? Word crashes? Nothing happens? Something happens but you do not know what it is? You get error messages? You do not get error messages?
Hopefully the ampersand in Dim x& is a typo. You do not really have & there, do you?
-
Gerry
22 hours?????
Not my coding style, since I tend to be wordy, but VBA takes it
[VBA]
Option Explicit
Sub drv()
Dim i&
MsgBox VarType(i)
End Sub
[/VBA]
Stop back and visit us
The Word forum won't be the same
Paul
-
Yikes. Sorry. I forgot all about that. My bad. I never use it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules