パワーポイントのマクロでテーマスタイルと標準スタイル確認

↓これをpowerpointでやりたい!!!
artfulplace.hatenablog.com

要するにテーマスタイルと標準スタイル(?)を並べたい!!

定数で指定してるのにエラーになるのかよ!!

MsoShapeStyleIndex 列挙(?)はSingleで指定しないとエラーになるよ
MsoShapeStyleIndex 列挙 (Office) | Microsoft Learn

線は10001~10042まで行けた(定義不明)

結果

  • 透過効果がわかるように背景に色つけてます
  • スライドはA3のサイズ指定

コード

vba

Sub 四角のサンプル()
Dim sld As Slide, shp As Shape
Dim l As Single, t As Single, w As Single, h As Single
Set sld = ActivePresentation.Slides(1)
w = 10 * 8
h = 3 * 8
Dim i As Single
For i = 1 To 77
Set shp = sld.Shapes.AddShape(msoShapeRectangle, l, t, w, h)
shp.ShapeStyle = i
shp.TextFrame.TextRange.Text = "テスト" & vbCrLf & "テスト"
shp.TextFrame.TextRange.Font.Size = 8
t = t + h
If i Mod 7 = 0 Then
l = l + w
t = 0
End If
Next
End Sub
Sub 線のサンプル()
Dim sld As Slide, shp As Shape
Dim l As Single, t As Single, w As Single, h As Single
Set sld = ActivePresentation.Slides(1)
w = 10 * 8
t = 3 * 8 * 10
Dim i As Single
For i = 1 To 42
Set shp = sld.Shapes.AddLine(l, t, l + w, t)
shp.ShapeStyle = i + 10000
t = t + 10
If i Mod 7 = 0 Then
l = l + w
t = 3 * 8 * 10
End If
Next
End Sub

どのくらい面白かった?

星を押して送信してね

平均 0 / 5. Vote count: 0

是非フォローしてください

最新の情報をお伝えします

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です