H
Hemantexec
Hey Peoples,
I have a table in word , and am trying to change the font size for the
different lines that are in the cell. So for a given cell (say row1,
col3) i want the first line to be font size 16, the next line to be
font size 13.
Anyone know of a way to do this?
My code is alot more complicated than what I've shown here, I've just
tried to keep it to the basics for this problem. All of the places
where there is quotation marks are normally variables.
Sub InsertAddress()
Dim oCell As Cell
Dim oRow As Row
Dim MyRange As Range
For Each oRow In Selection.Tables(1).Rows
For Each oCell In oRow.Cells
oCell.Select
'This code only puts text into every odd numbered coloumn
'code starts
Dim colnum As String
colnum = oCell.ColumnIndex / 2
colnum = Right(colnum, 1)
If colnum = "5" Then 'code ends
'The code in this If trys to put two lines into a cell with the top
line being size 16,
'and the second line being size 13
Selection.Text = "AddressLine1" & vbCrLf
Selection.Font.Size = "16"
MsgBox Selection.Text
With Selection
.InsertAfter ("AddressLine2")
.Font.Size = "13"
End With
MsgBox Selection.Text
End If
Next oCell
Next oRow
End Sub
Any help greatly appreciated,
Cheers,
Hemant
I have a table in word , and am trying to change the font size for the
different lines that are in the cell. So for a given cell (say row1,
col3) i want the first line to be font size 16, the next line to be
font size 13.
Anyone know of a way to do this?
My code is alot more complicated than what I've shown here, I've just
tried to keep it to the basics for this problem. All of the places
where there is quotation marks are normally variables.
Sub InsertAddress()
Dim oCell As Cell
Dim oRow As Row
Dim MyRange As Range
For Each oRow In Selection.Tables(1).Rows
For Each oCell In oRow.Cells
oCell.Select
'This code only puts text into every odd numbered coloumn
'code starts
Dim colnum As String
colnum = oCell.ColumnIndex / 2
colnum = Right(colnum, 1)
If colnum = "5" Then 'code ends
'The code in this If trys to put two lines into a cell with the top
line being size 16,
'and the second line being size 13
Selection.Text = "AddressLine1" & vbCrLf
Selection.Font.Size = "16"
MsgBox Selection.Text
With Selection
.InsertAfter ("AddressLine2")
.Font.Size = "13"
End With
MsgBox Selection.Text
End If
Next oCell
Next oRow
End Sub
Any help greatly appreciated,
Cheers,
Hemant