VBA:パワポ: 一括テキスト処理

対象は図形、表の2つ。
一括でフォント統一、文字置換、図形余白を設定。

Sub 図形調整()
	cnt = 0
	For Each sld In ActivePresentation.Slides
		For Each shp In sld.Shapes
			If shp.HasTextFrame Then
				cnt = cnt + 1
				shp.TextFrame.TextRange.Font.Name = "Meiryo UI"
				shp.TextFrame.TextRange.Font.NameFarEast = "Meiryo UI"
				shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, ":", ":")
				shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "(", "(")
				shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, ")", ")")
				' 0.5 = 0.02 cm / 1 = 0.04 cm
				shp.TextFrame.MarginLeft = 1
				shp.TextFrame.MarginRight = 1
				shp.TextFrame.MarginTop = 1
				shp.TextFrame.MarginBottom = 1
			End If
		Next shp
	Next sld
	MsgBox "Done: " & cnt
End Sub

Sub TextBox調整()
	cnt = 0
	For Each sld In ActivePresentation.Slides
		For Each shp In sld.Shapes
			If shp.HasTable Then
				With shp.Table
				For i = 1 To .Columns.Count
					For j = 1 To .Rows.Count
						.Cell(j, i).Shape.TextFrame.TextRange.Font.Name = "Meiryo UI"
						.Cell(j, i).Shape.TextFrame.TextRange.Font.NameFarEast = "Meiryo UI"
						' 0.5 = 0.02 cm / 1 = 0.04 cm
						.Cell(j, i).Shape.TextFrame.MarginLeft = 4
						.Cell(j, i).Shape.TextFrame.MarginRight = 4
						.Cell(j, i).Shape.TextFrame.MarginTop = 1
						.Cell(j, i).Shape.TextFrame.MarginBottom = 1
					Next j
				Next i
				End With
			End If
		Next shp
	Next sld
	MsgBox "Done: " & cnt
End Sub