1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Sub AddFigureCaption() Dim sld As Slide Dim shp As Shape Dim txtBox As Shape If ActiveWindow.Selection.Type = ppSelectionShapes Then Set sld = ActiveWindow.View.Slide Set shp = ActiveWindow.Selection.ShapeRange(1)
Set txtBox = sld.Shapes.AddTextbox( _ Orientation:=msoTextOrientationHorizontal, _ Left:=shp.Left - 7, _ Top:=shp.Top + shp.Height + 5, _ Width:=shp.Width, _ Height:=20) With txtBox.TextFrame .TextRange.Text = "X" With .TextRange.Font .Size = 14 .Name = "微软雅黑" End With .TextRange.ParagraphFormat.Alignment = ppAlignCenter .VerticalAnchor = msoAnchorMiddle .MarginBottom = 0 .MarginLeft = 0 .MarginRight = 0 .MarginTop = 0 .AutoSize = ppAutoSizeNone .WordWrap = True End With txtBox.Width = shp.Width txtBox.Select
Else MsgBox "请先选择一个图片。", vbInformation End If End Sub
|