Prev: Pass control name from Access to Word and save text in the control
Next: Pass control name from Access to Word and save text in the con
From: andreas on 13 Feb 2010 15:02 Dear Experts: Below macro sets certain padding values for the selected table. Regrettably it fails to work on tables with merged cells. Have you got any idea how to re-write the code so that tables featuring merged cells also get worked on? Help is much appreciated. Thank you very much in advance. Regards, Andreas Sub SetPadding Dim myCell As Cell Dim myRow As row Dim myTable As Table Set myTable = Selection.Tables(1) For Each myRow In myTable.rows For Each myCell In myRow.Cells myCell.TopPadding = CentimetersToPoints(0) myCell.BottomPadding = CentimetersToPoints(0) myCell.LeftPadding = CentimetersToPoints(0.19) myCell.RightPadding = CentimetersToPoints(0.19) myCell.WordWrap = True myCell.FitText = False Next Next End Sub
From: Greg Maxey on 13 Feb 2010 15:45 Sub SetPadding() Dim myCell As Cell Dim myTable As Table Set myTable = Selection.Tables(1) For Each myCell In myTable.Range.Cells With myCell .TopPadding = CentimetersToPoints(0) .BottomPadding = CentimetersToPoints(0) .LeftPadding = CentimetersToPoints(0.29) .RightPadding = CentimetersToPoints(0.29) .WordWrap = True .FitText = False End With Next myCell End Sub andreas wrote: > Dear Experts: > > Below macro sets certain padding values for the selected table. > Regrettably it fails to work on tables with merged cells. Have you got > any idea how to re-write the code so that tables featuring merged > cells also get worked on? > > Help is much appreciated. Thank you very much in advance. > > Regards, Andreas > > > Sub SetPadding > > Dim myCell As Cell > Dim myRow As row > Dim myTable As Table > > Set myTable = Selection.Tables(1) > For Each myRow In myTable.rows > For Each myCell In myRow.Cells > myCell.TopPadding = CentimetersToPoints(0) > myCell.BottomPadding = CentimetersToPoints(0) > myCell.LeftPadding = CentimetersToPoints(0.19) > myCell.RightPadding = CentimetersToPoints(0.19) > myCell.WordWrap = True > myCell.FitText = False > > Next > Next > > End Sub
From: andreas on 13 Feb 2010 19:21
On Feb 13, 9:45 pm, "Greg Maxey" <gma...(a)mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote: > Sub SetPadding() > Dim myCell As Cell > Dim myTable As Table > Set myTable = Selection.Tables(1) > For Each myCell In myTable.Range.Cells > With myCell > .TopPadding = CentimetersToPoints(0) > .BottomPadding = CentimetersToPoints(0) > .LeftPadding = CentimetersToPoints(0.29) > .RightPadding = CentimetersToPoints(0.29) > .WordWrap = True > .FitText = False > End With > Next myCell > End Sub > > > > andreas wrote: > > Dear Experts: > > > Below macro sets certain padding values for the selected table. > > Regrettably it fails to work on tables with merged cells. Have you got > > any idea how to re-write the code so that tables featuring merged > > cells also get worked on? > > > Help is much appreciated. Thank you very much in advance. > > > Regards, Andreas > > > Sub SetPadding > > > Dim myCell As Cell > > Dim myRow As row > > Dim myTable As Table > > > Set myTable = Selection.Tables(1) > > For Each myRow In myTable.rows > > For Each myCell In myRow.Cells > > myCell.TopPadding = CentimetersToPoints(0) > > myCell.BottomPadding = CentimetersToPoints(0) > > myCell.LeftPadding = CentimetersToPoints(0.19) > > myCell.RightPadding = CentimetersToPoints(0.19) > > myCell.WordWrap = True > > myCell.FitText = False > > > Next > > Next > > > End Sub- Hide quoted text - > > - Show quoted text - Hi Greg, that's it! Great! Thank you very much for your professional help. Regards, Andreas |