Reputation: 1
I am currently running this code but it won't work.
ObjTable.Cell(3,2).Range.Text = "hello"
objTable.Cell(3,2).range
.Font.Name = "Arial"
.Font.Size = "14"
Only the words come out but not the format of the words.
Upvotes: 0
Views: 79
Reputation: 13515
Even more efficient:
With objTable.Cell(3,2).Range
.Text = "hello"
.Font.Name = "Arial"
.Font.Size = "14"
End With
Upvotes: 0
Reputation: 5243
You need to encapsulate the .Font.Name
and .Font.Size
in a with statement like so:
ObjTable.Cell(3,2).Range.Text = "hello"
With objTable.Cell(3,2).Range
.Font.Name = "Arial"
.Font.Size = "14"
End With
See https://learn.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/with-statement for more information.
Upvotes: 1