WonHop
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.Applica tion")
Set objDoc = objWord.Documents.Add
Set objSelection = objWord.Selection
objWord.Visible = True
objDoc.SaveAs (strAppendixAFullPath)
objDoc.Select
objDoc.Activate
objDoc.ActiveWindow.Activa te
'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:=o bjDoc.Book marks("\En dOfDoc").R ange, _
NumRows:=intRows, _
NumColumns:=intCols)
tblAppA.Range.Font.Size = 12
tblAppA.Borders.Enable = True
tblAppA.Columns.PreferredW idthType = wdPreferredWidthPoints
tblAppA.Columns(1).Preferr edWidth = CentimetersToPoints(3)
tblAppA.Columns(2).Preferr edWidth = CentimetersToPoints(14#)
========================== ========== ========== ========== =========
CHANGE THE HEIGHT OF THE ROWS IN THE TABLE
========================== ========== ========== ========== =========
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.Applica
Set objDoc = objWord.Documents.Add
Set objSelection = objWord.Selection
objWord.Visible = True
objDoc.SaveAs (strAppendixAFullPath)
objDoc.Select
objDoc.Activate
objDoc.ActiveWindow.Activa
'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:=o
NumRows:=intRows, _
NumColumns:=intCols)
tblAppA.Range.Font.Size = 12
tblAppA.Borders.Enable = True
tblAppA.Columns.PreferredW
tblAppA.Columns(1).Preferr
tblAppA.Columns(2).Preferr
==========================
CHANGE THE HEIGHT OF THE ROWS IN THE TABLE
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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