dike691 发表于 2013-8-27 00:00:00

一页9张PPT自动排版宏命令

【调整页边距及页眉页脚距,适用于A4纸】
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(0.6)
.BottomMargin = CentimetersToPoints(0.6)
.LeftMargin = CentimetersToPoints(1)
.RightMargin = CentimetersToPoints(0.8)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(0.5)
.FooterDistance = CentimetersToPoints(0.9)
.PageWidth = CentimetersToPoints(29.7)
.PageHeight = CentimetersToPoints(21)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
.LayoutMode = wdLayoutModeLineGrid
End With

【调整每张幻灯片的大小为高184宽262,也许还有更佳的值,可自己尝试】

Dim i As Integer
For i = 1 To ActiveDocument.InlineShapes.Count
ActiveDocument.InlineShapes(i).Height = 184
ActiveDocument.InlineShapes(i).Width = 262
Next i

【给每张幻灯片加边框】

Selection.HomeKey Unit:=wdStory

Dim j As Integer
For j = 1 To ActiveDocument.InlineShapes.Count

Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.InlineShapes(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With

Selection.MoveRight Unit:=wdCharacter, Count:=1
Next j

End Sub

awanteeo 发表于 2017-3-21 08:46:12

好好学习,天天向上!
页: [1]
查看完整版本: 一页9张PPT自动排版宏命令