C
chemicals
I have the following code which creates and populates a table in Word. I
want to set the fonts in the entire table to a smaller size and possibly a
different font type.
I am inserting this table at a bookmark. How can I do this for the entire
table?
Here's the code:
Dim objTable As Word.Table
Dim rngRange As Word.Range
If (m_objDoc.Bookmarks.Exists(strbkmk)) Then
Set rngRange = m_objDoc.Bookmarks(strbkmk).Range
m_objDoc.Bookmarks(strbkmk).Select
rngRange.Text = varText
rngRange.Select
Set objTable = m_objWord.Selection.ConvertToTable(Separator:=vbTab)
objTable.AutoFormat Format:=wdTableFormatGrid8, ApplyShading:=True,
ApplyBorders:=True, ApplyHeadingRows:=True
objTable.AutoFitBehavior wdAutoFitContent
Set objTable = Nothing
rngRange.SetRange Start:=rngRange.Start - 3, End:=rngRange.End + 3
'Debug.Print rngRange.Text
m_objDoc.Bookmarks.Add strbkmk
InsertTableAtBookmark = True
Else
MsgBox "Missing bookmark in Word template [" & strbkmk & "]"
InsertTableAtBookmark = False
End If
want to set the fonts in the entire table to a smaller size and possibly a
different font type.
I am inserting this table at a bookmark. How can I do this for the entire
table?
Here's the code:
Dim objTable As Word.Table
Dim rngRange As Word.Range
If (m_objDoc.Bookmarks.Exists(strbkmk)) Then
Set rngRange = m_objDoc.Bookmarks(strbkmk).Range
m_objDoc.Bookmarks(strbkmk).Select
rngRange.Text = varText
rngRange.Select
Set objTable = m_objWord.Selection.ConvertToTable(Separator:=vbTab)
objTable.AutoFormat Format:=wdTableFormatGrid8, ApplyShading:=True,
ApplyBorders:=True, ApplyHeadingRows:=True
objTable.AutoFitBehavior wdAutoFitContent
Set objTable = Nothing
rngRange.SetRange Start:=rngRange.Start - 3, End:=rngRange.End + 3
'Debug.Print rngRange.Text
m_objDoc.Bookmarks.Add strbkmk
InsertTableAtBookmark = True
Else
MsgBox "Missing bookmark in Word template [" & strbkmk & "]"
InsertTableAtBookmark = False
End If