Link to home
Start Free TrialLog in
Avatar of WonHop
WonHopFlag for United States of America

asked on

CHANGE THE HEIGHT OF THE ROWS IN A MS WORD TABLE

Hello All.
I need to change the Height of of the Rows of a MS Word Table.
Below is the code that creates and changes the Width of the columns.

strAppendixAName = "Appendix_A.docx"
strAppendixAPath = CurrentProject.Path
strAppendixAFullPath = strAppendixAPath & "\" & "Appendix_A.docx"

Dim objWord
Dim objDoc
Dim objSelection

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
Set objSelection = objWord.Selection

objWord.Visible = True
objDoc.SaveAs (strAppendixAFullPath)

 objDoc.Select
 objDoc.Activate
 objDoc.ActiveWindow.Activate

'If The Selected Document Is Not Open, A Message Box Will Open Telling The User To Open The Selected File.
If objDoc Is Nothing Then 'The Selected Document Is Not Open.
    MsgBox "Please Open The Selected Document" & vbCrLf & vbCrLf & strAppendixAPath, vbCritical, "Document Is Not Open"
    PID = Shell("explorer.exe " & strAppendixAPath, vbNormalFocus) 'If The Document Is Not Open, This Will Open The File Explorer To The Correct Folder.
    Exit Sub
Else '
End If

objSelection.TypeText ("Appendix A" & vbCrLf & "Total items:  " & inttblAppendixAWorking & vbCrLf & vbCrLf)

inttblAppendixAWorking = 10
intRows = inttblAppendixAWorking
intCols = 2

 'Create Table.  This moves the Table below any data that is in the document.
Set tblAppA = objDoc.Tables.Add(Range:=objDoc.Bookmarks("\EndOfDoc").Range, _
                                                    NumRows:=intRows, _
                                                    NumColumns:=intCols)

tblAppA.Range.Font.Size = 12
tblAppA.Borders.Enable = True

tblAppA.Columns.PreferredWidthType = wdPreferredWidthPoints
tblAppA.Columns(1).PreferredWidth = CentimetersToPoints(3)
tblAppA.Columns(2).PreferredWidth = CentimetersToPoints(14#)

=================================================================
CHANGE THE HEIGHT OF THE ROWS IN THE TABLE
=================================================================
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WonHop

ASKER

Thanks Norie.  That worked.  

I did make one Change.  I had to add a (s) at the end of Centimeters.

tblAppA.Rows.Height = CentimetersToPoints(0.3) ' change 2 to the required height