6028错误:无法删除范围。
如果我交换表,它将创建一个表,并在其中创建另一个表。这不是我的目标。要创建两个分开的表,允许它们彼此重叠。
RelativeHorizontalPositionPage
,set RowsHeight
和.Rows.Allowoverlap = True
,它会给我另一个错误5149尺寸必须在0厘米至55.87厘米之间。
我知道我做错了,只是想不出什么。这就是我最终想要得到的
将提供任何帮助。
Set oHF = ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage)
Set aTable2 = oHF.Range.Tables.Add(Range:= _
oHF.Range, Numrows:=1, NumColumns:= _
3, DefaultTableBehavior:=wdWord8TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed)
With aTable2
'.Rows.AllowOverlap = True
.Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineStyle = wdLineStyleSingle
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Rows.SetHeight RowHeight:=CentimetersToPoints(0.5), _
HeightRule:=wdRowHeightAtLeast
.Rows.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.Rows.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.Rows.HorizontalPosition = CentimetersToPoints(2)
.Rows.VerticalPosition = CentimetersToPoints(25.25)
End With
Set aTable = oHF.Range.Tables.Add(Range:= _
oHF.Range, Numrows:=8, NumColumns:= _
1, DefaultTableBehavior:=wdWord8TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed)
With aTable
'.Rows.AllowOverlap = True
.Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineStyle = wdLineStyleSingle
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Rows.SetHeight RowHeight:=CentimetersToPoints(0.5), _
HeightRule:=wdRowHeightAtLeast
.Rows.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.Rows.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.Rows.HorizontalPosition = CentimetersToPoints(2)
.Rows.VerticalPosition = CentimetersToPoints(25.25)
答案 0 :(得分:0)
基本上:
Sub Demo()
Dim HdFt As HeaderFooter, Tbl As Table
With ActiveDocument
Set HdFt = .Sections(1).Footers(wdHeaderFooterFirstPage)
Set Tbl = .Tables.Add(Range:=HdFt.Range.Characters.Last, Numrows:=1, NumColumns:=3, _
DefaultTableBehavior:=wdWord8TableBehavior, AutoFitBehavior:=wdAutoFitFixed)
'Process 1st table
With Tbl
'including:
.Rows.WrapAroundText = True
End With
Set Tbl = .Tables.Add(Range:=HdFt.Range.Characters.Last, Numrows:=8, NumColumns:=1, _
DefaultTableBehavior:=wdWord8TableBehavior, AutoFitBehavior:=wdAutoFitFixed)
'Process 2nd table
With Tbl
End With
End With
End Sub