0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【PowerPoint】色のついた四角形を並べる

Last updated at Posted at 2025-05-04

やること

 パワーポイントで、色のついた四角形を並べたものを過去に作成したため、メモしておく。

事前確認:Qiitaでの記事

 以下の検索をしたところ、70件ヒットした。(2025/05/04時点)
  「tag:VBA tag:PowerPoint」の検索結果 - Qiita

図形、描画

PowerPointに関数のグラフを描く #VBA - Qiita
最終更新日 2025年02月24日 投稿日 2024年10月17日

Powerpointのフリーフォーム(多角形)を直線に変換したい #VBA - Qiita
最終更新日 2022年10月05日 投稿日 2022年10月05日

【PowerPointVBA】選択中shpの中身を同名shpに展開する #VBA - Qiita
最終更新日 2022年03月11日 投稿日 2022年03月11日

【PowerPoint】指定名Shapeの表示/非表示を切り替えて擬似的にスライドに余白設定する【VBA】 #VBA - Qiita
最終更新日 2022年02月25日 投稿日 2022年02月25日

PowerPoint VBA 図形の名前の設定/取得、指定名の図形を狙って読み書き #VBA - Qiita
投稿日 2021年10月29日

PowerPointでカラーコードに合わせて図形を塗りつぶす #VBA - Qiita
投稿日 2021年03月17日

表から数値を読み取って水位レベルを描画したい #VBA - Qiita
最終更新日 2020年11月09日 投稿日 2020年11月09日

矢印コネクタと仲良くなるための PowerPoint マクロ #VBA - Qiita
投稿日 2020年09月13日

【PowerPoint VBA】まともな『オブジェクトの整列』(左揃え等)コマンドを作成する #VBA - Qiita
投稿日 2020年06月16日

グループ化されたオートシェイプに対して、グループ解除せずに処理を行う #Excel - Qiita
最終更新日 2020年05月17日 投稿日 2020年05月17日

PowerPointの図形の位置や大きさを揃えるVBScript #VBA - Qiita
最終更新日 2019年03月22日 投稿日 2019年03月22日

PowerPointで円を弾ませてみる #VBA - Qiita
最終更新日 2017年01月15日 投稿日 2017年01月15日

VBAのシェイプ形状、MSOAutoShapeTypeの画像一覧 #Excel - Qiita
最終更新日 2016年05月24日 投稿日 2016年05月24日

全シェイプをコレクションに格納する #VBA - Qiita
投稿日 2015年06月07日

選択した図形を動かないように固定するPowerPointマクロ #VBA - Qiita
最終更新日 2015年05月30日 投稿日 2015年05月30日

テキスト

パワーポイントのVBAでコメントを取得する #PowerPoint - Qiita
投稿日 2025年04月14日

PowerPoint VBA 複数の置換条件でプレゼンテーションの文字列を一括置換する #VBAマクロ - Qiita
投稿日 2024年11月28日

游ゴシック Mediumの疑似ボールド体を游ゴシック BoldにするVBA #PowerPoint - Qiita
投稿日 2022年05月13日

PowerPointのFontをすべて変更するVBA (グループ化されていても!) #VBA - Qiita
投稿日 2020年05月18日

パワポマクロ クリップボードの文字列を取得(参照設定しない) #VBA - Qiita
投稿日 2019年05月25日

[PowerPoint VBA]コンマを全消しするマクロ(Replaceの使用例) #TextRange.Replace - Qiita
投稿日 2017年12月06日

PowerPoint内のテキストを取得する #VBA - Qiita
最終更新日 2015年05月24日 投稿日 2015年05月24日

選択範囲内で置換するPowerPointマクロ #VBA - Qiita
最終更新日 2015年05月24日 投稿日 2015年05月24日

選択範囲内から検索するPowerPointマクロ #VBA - Qiita
最終更新日 2015年05月24日 投稿日 2015年05月24日

表の各行の高さをそろえる【PowerPointVBA】 #VBA - Qiita
投稿日 2022年07月26日

PowerPoint 表の操作 セルの結合と分割で遊ぶ #VBA - Qiita
投稿日 2021年10月29日

音声

ノート読み上げを録音した音声の複数スライド組み込みをPowerPointVBAで自動化してみた #業務自動化 - Qiita
最終更新日 2024年03月09日 投稿日 2023年12月12日

PowerPoint のノートを音声読み上げしてスライドに埋め込む #VBA - Qiita
最終更新日 2020年05月07日 投稿日 2020年05月07日

PowerPointで茜ちゃんに喋ってもらう #VBA - Qiita
投稿日 2019年08月02日

スタイル

PowerPoint VBA ページ番号のスタイルを決める #VBA - Qiita
投稿日 2023年02月28日

Powerpoint VBA Powerpointで一気に参照設定を設定するマクロ Set Reference Settings Into PowerPoint Quickly. #refer - Qiita
投稿日 2021年05月11日

【PowerPoint】スライドをランダムで表示 #VBA - Qiita
最終更新日 2020年04月16日 投稿日 2019年12月04日

【PowerPoint】スライドを指定した数ごとにランダムで表示する #VBA - Qiita
最終更新日 2019年12月10日 投稿日 2019年12月10日

パワポでズンドコキヨシ #VBA - Qiita
最終更新日 2016年03月18日 投稿日 2016年03月17日

スライドショー中にファイルにアクセスしてスライドショーの内容を変更する #VBA - Qiita
最終更新日 2019年04月27日 投稿日 2019年04月27日

PowerPointのスライドの右隅に総ページ数を挿入するVBScript #VBA - Qiita
最終更新日 2019年03月22日 投稿日 2019年03月22日

スライド表示とマスター表示を切り替えるPowerPointマクロ #VBA - Qiita
最終更新日 2015年05月25日 投稿日 2015年05月25日

アドイン

PowerPointアドインを作る手順の概要 #VBA - Qiita
最終更新日 2024年06月18日 投稿日 2024年06月18日

PowerPoint用のアドインの紹介 #VBA - Qiita
最終更新日 2020年02月02日 投稿日 2020年02月02日

Azureアイコンセットを挿入するPowerPointアドインの紹介 #VBA - Qiita
最終更新日 2020年04月18日 投稿日 2020年04月18日

AWSアイコンセットを挿入するPowerPointアドインの紹介 #VBA - Qiita
投稿日 2020年05月08日

入出力

【PowerPoint】pdfとして保存する【VBA】 #VBA - Qiita
最終更新日 2022年02月25日 投稿日 2022年02月25日

大量のPowerPointファイルをPNG画像に変換するときに使ったVBScript #VBA - Qiita
最終更新日 2021年10月25日 投稿日 2021年10月25日

PowerPointのスライドを画像ファイルとしてExportするVBScript #VBA - Qiita
投稿日 2019年03月22日

PowerPointのVBAからスライドに埋め込んだOLEオブジェクトをファイルとして利用する #Excel - Qiita
投稿日 2020年08月23日

Excelのセルの内容でPPTのスライドを大量生成する #VBA - Qiita
投稿日 2021年03月02日

[ VBA ] Excel の各セルの値を各スライドのタイトルにした PowerPoint の自動生成 #Windows - Qiita
投稿日 2019年08月15日

PowerPoint VBA で 動画ファイルを作るときの注意 #VBA - Qiita
最終更新日 2019年11月13日 投稿日 2019年11月12日

VBA Powerpointの参照設定をイミディエイトに出力する Wordはファイルに出力する Powerpoint And WinWord Export Reference Settings #PowerPoint - Qiita
投稿日 2019年02月27日

VBAを用いて複数のパワーポイントから対象の表の内容をエクセルに抽出する #Excel - Qiita
最終更新日 2018年11月25日 投稿日 2018年11月25日

その他

VBA

PowerPoint VBA リファレンス 項目リスト #reference - Qiita
投稿日 2018年10月20日

再背面にペーストするPowerPointマクロ #VBA - Qiita
最終更新日 2015年05月30日 投稿日 2015年05月30日

PowerPointのViewTypeを取得 #VBA - Qiita
最終更新日 2015年05月30日 投稿日 2015年05月25日

PowerPointで"Workbook_Open"相当のことをするには #VBA - Qiita
最終更新日 2017年01月04日 投稿日 2017年01月04日

パワポマクロ ActiveSlide関数を作成 #VBA - Qiita
投稿日 2019年05月25日

PowerPointで横スクロールさせるマクロ #VBA - Qiita
投稿日 2015年06月22日

MS Officeの形状の中のテキストの取得方法の確認(TextRangeオブジェクト) #Excel - Qiita
最終更新日 2018年09月21日 投稿日 2017年01月08日

Excel Word PowerPoint VBA 56色カラーパレットの色をRGB分解してリスト化する #Publisher - Qiita
最終更新日 2019年09月22日 投稿日 2019年05月19日

PowerPoint VBA ThemaColorの色をRGB分解する #VBA - Qiita
投稿日 2019年05月21日

連携

Excel VBA を起点とした半自動化で利用した技術 #RPA - Qiita
最終更新日 2023年11月01日 投稿日 2023年09月15日

エクセルで簡単に論文用のグラフ作成(チャートエリアとプロットエリアの悩みからおさらば) #Excel - Qiita
最終更新日 2020年05月07日 投稿日 2020年05月07日

Word内の画像サイズを一括で変更してしまおう #VBA - Qiita
投稿日 2024年10月05日

Claude 3.5 Sonnetを使ってmermaidの図をパワポ・エクセルにVBA出力(オブジェクトで出力) #Excel - Qiita
最終更新日 2024年09月08日 投稿日 2024年08月29日

【時短】助けてChatGPT ! 会議資料を作ってください ブルースマンデーをハッピーマンデーに変えて!! #Excel - Qiita
最終更新日 2024年09月01日 投稿日 2024年08月26日

VBA で Anthropic Claude 3 を使ってみよう #Excel - Qiita
投稿日 2024年04月22日

PowerPoint VBA で Azure Architecture Icons Deck を生成する #Azure - Qiita
投稿日 2021年08月06日

ADOを使ってExcelテンプレートへ差し込み一斉出力するシステムを作ってみた #VBA - Qiita
最終更新日 2021年04月18日 投稿日 2021年04月18日

PowerPointをメディア講義に対応させるメモ(PPT+CeVIO) #VBA - Qiita
最終更新日 2020年04月15日 投稿日 2020年04月13日

WinActorとVBAでパワポ資料を自動作成する #RPA - Qiita
最終更新日 2019年07月12日 投稿日 2019年07月12日

powershell で Office を捕まえてターミナルとして操作する #Excel - Qiita
最終更新日 2019年10月05日 投稿日 2019年10月04日

実現方法

 以下を使用。

色四角.bas
Attribute VB_Name = "色四角"
Option Explicit
'   DocumentWindow object
'   Presentation object     プレゼンテーション
'   └Slide object          スライド
'     └Shape object        図形、Text box等
Sub 色四角を作成し配置()
    Dim sld_w As Single                     ' スライドの幅  (=ActiveWindow.Selection.SlideRange.Master.Width)
    Dim sld_h As Single                     ' スライドの高さ(=ActiveWindow.Selection.SlideRange.Master.Height)
' *** 図形を描くスライドの準備 ***
    Call set_slide                          ' 最後に白紙スライド追加
    ' スライドのサイズを取得
    With ActiveWindow.Selection
        sld_w = .SlideRange.Master.Width
        sld_h = .SlideRange.Master.Height
    End With
' *** 描画1:RGBグラデーション ***
    Call RGBW_32gradation(sld_w, sld_h)     ' R/G/B/Y/C/M/Wのグラデーション
' *** 図形を描くスライドの準備 ***
    Call set_slide                          ' 最後に白紙スライド追加
' *** 描画2:RGBグラデーション ***
    Call Hue_32gradation(sld_w, sld_h)      ' R/Y/G/C/B/M/Rのグラデーション
End Sub


Function set_slide()
'-------------------------------------------------------------------
' 関数: set_slide
' 説明: 現在のプレゼンテーションに白紙スライドを追加し、
'       最後のスライドへ移動します。
' 引数:
'   なし
' 戻り値:
'   なし
'
' 使用例:
'       Call set_slide
'-------------------------------------------------------------------
'    ' ウィンドウの最大化
'    Application.ActiveWindow.WindowState = ppWindowMaximized
' Application.WindowState プロパティ (PowerPoint) | Microsoft Learn
' https://learn.microsoft.com/ja-jp/office/vba/api/powerpoint.application.windowstate
'        1 : ppWindowNormal
'        2 : ppWindowMinimized
'        3 : ppWindowMaximized
    ' 白紙スライドを末尾に挿入
    With ActivePresentation.Slides
        .Add _
            Index:=.Count + 1, _
            Layout:=ppLayoutBlank
    End With
    ' 最後のスライドに切り替える
    ActiveWindow.View.GotoSlide _
        Index:=ActivePresentation.Slides.Count
End Function


Function DrawSquare(ByVal shp_x As Single, ByVal shp_y As Single, _
                    ByVal shp_w As Single, ByVal shp_h As Single, _
                    ByVal R As Single, ByVal G As Single, ByVal B As Single)
'-------------------------------------------------------------------
' 関数: DrawSquare
' 説明: 指定した座標位置(shp_x, shp_y)とサイズ(shp_w, shp_h)に基づいて、
'       スライド上にRGB値(R, G, B)で塗りつぶされた四角形を描画
'       四角形は塗りつぶしの透明度および枠線の設定も同時に実施。
' 引数:
'   shp_x      - 四角形の左上隅のX座標 (Single型)
'   shp_y      - 四角形の左上隅のY座標 (Single型)
'   shp_w      - 四角形の幅 (Single型)
'   shp_h      - 四角形の高さ (Single型)
'   R          - 塗りつぶし色の赤色成分 (Single型, 0~255)
'   G          - 塗りつぶし色の緑色成分 (Single型, 0~255)
'   B          - 塗りつぶし色の青色成分 (Single型, 0~255)
' 戻り値:
'   なし
'
' 使用例:
'   ' X=50, Y=50 の位置に幅200、高さ100 の青色系の四角形を描画
'   DrawSquare(50, 50, 200, 100, 0, 0, 255)
'-------------------------------------------------------------------
    Dim myDocument As Object
    Set myDocument = ActivePresentation.Slides(ActivePresentation.Slides.Count)
    With myDocument.Shapes.AddShape _
        (msoShapeRectangle, shp_x, shp_y, shp_w, shp_h)
            .Fill.ForeColor.RGB = RGB(R, G, B)      '塗りつぶしの色
            .Fill.Transparency = 0                  '塗りつぶしの透明度(0で不透明)
            .Line.Weight = 0                        '枠線の線幅(0で枠線なし)
            .Line.ForeColor.RGB = RGB(R, G, B)      '線の色
    End With
End Function


Function RGBW_32gradation(ByVal sld_w As Single, ByVal sld_h As Single)
'-------------------------------------------------------------------
' 関数: RGBW_32gradation
' 説明: 指定したスライドの幅(sld_w)と高さ(sld_h)に基づいて、
'       スライド上に7色×2行(計32階調/色)のグラデーションの
'       四角形を描画
'       7色は上からR/G/B/Y/C/M/W
' 引数:
'   sld_w      - スライドの幅 (Single型)
'   sld_h      - スライドの高さ (Single型)
' 戻り値:
'   なし
'
' 使用例:
'   ' 幅960、高さ540のスライドにグラデーションを描画する
'   Call RGBW_32gradation(960, 540)
'-------------------------------------------------------------------
    Dim shp_x As Single                 ' 四角形の左上隅のX座標
    Dim shp_y As Single                 ' 四角形の左上隅のY座標
    Dim shp_w As Single                 ' 四角形の幅
    Dim shp_h As Single                 ' 四角形の高さ
    Dim shp_r As Single                 ' 四角形の色(R)
    Dim shp_g As Single                 ' 四角形の色(G)
    Dim shp_b As Single                 ' 四角形の色(B)
    Dim R As Single, G As Single, B As Single
    Const Tone = 32                     ' 32階調
    Dim tone_s As Single
        tone_s = Round(256 / Tone, 0)   ' 1stepの減色量
    ' 四角のサイズを決定
    shp_w = sld_w / (Tone / 2)          ' 横方向:32階調 = 16階調×2行
    shp_h = sld_h / (7 * 2)             ' 縦方向:7色×2行
    ' 色の初期化(ベースは白)
    shp_r = 255
    shp_g = 255
    shp_b = 255
    ' 描画
    ' 各セルの位置に応じ、RGB各成分を横方向(shp_x)と縦方向(shp_y)で段階的に減少させ、
    ' 7種類の色パターンの四角形を描画。
    ' 1) 横方向: 左から右へ、1cellあたりtone_sずつ減算
    '    255から8ずつ減算(shp_x/shp_w:0~15→255~135)
    ' 2) 縦方向: 2段目はさらに減色量を加算して減算
    '    127(255-16×8)から8ずつ減算(127~7)
    For shp_y = 0 To shp_h * 2 - 1 Step shp_h   '縦(四角形の高さ×2)
        For shp_x = 0 To sld_w - 1 Step shp_w   '横(スライドの幅)
            R = shp_r - shp_x / shp_w * tone_s - (Tone / 2) * tone_s * shp_y / shp_h
            G = shp_g - shp_x / shp_w * tone_s - (Tone / 2) * tone_s * shp_y / shp_h
            B = shp_b - shp_x / shp_w * tone_s - (Tone / 2) * tone_s * shp_y / shp_h
            Call DrawSquare(shp_x, shp_y + 0 * shp_h, shp_w, shp_h, R, 0, 0)    ' R00 (R)
            Call DrawSquare(shp_x, shp_y + 2 * shp_h, shp_w, shp_h, 0, G, 0)    ' 0G0 (G)
            Call DrawSquare(shp_x, shp_y + 4 * shp_h, shp_w, shp_h, 0, 0, B)    ' 00B (B)
            Call DrawSquare(shp_x, shp_y + 6 * shp_h, shp_w, shp_h, R, G, 0)    ' RG0 (Y)
            Call DrawSquare(shp_x, shp_y + 8 * shp_h, shp_w, shp_h, 0, G, B)    ' 0GB (C)
            Call DrawSquare(shp_x, shp_y + 10 * shp_h, shp_w, shp_h, R, 0, B)   ' R0B (M)
            Call DrawSquare(shp_x, shp_y + 12 * shp_h, shp_w, shp_h, R, G, B)   ' RGB (W)
       Next
    Next
End Function


Function Hue_32gradation(ByVal sld_w As Single, ByVal sld_h As Single)
'-------------------------------------------------------------------
' 関数: Hue_32gradation
' 説明: 指定したスライドの幅(sld_w)と高さ(sld_h)に基づいて、
'       スライド上に色相を変化させたグラデーションの四角形を描画。
'       下記のRGB値の増減法を用いて、6種類の色相パターンを2行に
'       配し、計12段階の色変化を表現。
'       ・各色相パターン
'         000-060:  赤固定 (255)、青固定 (0)、緑が増加 (0~255)
'         060-120:  緑固定 (255)、青固定 (0)、赤が減少 (255~0)
'         120-180:  緑固定 (255)、赤固定 (0)、青が増加 (0~255)
'         180-240:  青固定 (255)、赤固定 (0)、緑が減少 (255~0)
'         240-300:  青固定 (255)、緑固定 (0)、赤が増加 (0~255)
'         300-360:  赤固定 (255)、緑固定 (0)、青が減少 (255~0)
' 引数:
'   sld_w      - スライドの幅 (Single型)
'   sld_h      - スライドの高さ (Single型)
' 戻り値:
'   なし
'
' 使用例:
'   ' 幅960、高さ540のスライドにグラデーションを描画する
'   Call Hue_32gradation(960, 540)
'-------------------------------------------------------------------
    Dim shp_x As Single                 ' 四角形の左上隅のX座標
    Dim shp_y As Single                 ' 四角形の左上隅のY座標
    Dim shp_w As Single                 ' 四角形の幅
    Dim shp_h As Single                 ' 四角形の高さ
    Dim shp_r As Single                 ' 四角形の色(R)
    Dim shp_g As Single                 ' 四角形の色(G)
    Dim shp_b As Single                 ' 四角形の色(B)
    Dim R As Single, G As Single, B As Single
    Const Tone = 32                     ' 32階調
    Dim tone_s As Single
        tone_s = Round(256 / Tone, 0)   ' 1stepの減色量
    ' 四角のサイズを決定
    shp_w = sld_w / (Tone / 2)          ' 横方向:32階調 = 16階調×2行
    shp_h = sld_h / (6 * 2)             ' 縦方向:6色×2行
    ' 色の初期化(ベースは白)
    shp_r = 255
    shp_g = 255
    shp_b = 255
    ' 描画
    ' 各セルの位置に応じ、RGB各成分を横方向(shp_x)と縦方向(shp_y)で段階的に減少させ、
    ' 色パターンの四角形を描画。
    ' 1) 横方向: 左から右へ、1cellあたりtone_sずつ減算
    '    255から8ずつ減算(shp_x/shp_w:0~15→255~135)
    ' 2) 縦方向: 2段目はさらに減色量を加算して減算
    '    127(255-16×8)から8ずつ減算(127~7)
    ' -------------------------------------------
    ' 色の計算例
    '       R = shp_r - shp_x / shp_w * 8 - 16 * 8 * shp_y / shp_h
    '       G = shp_g - shp_x / shp_w * 8 - 16 * 8 * shp_y / shp_h
    '       B = shp_b - shp_x / shp_w * 8 - 16 * 8 * shp_y / shp_h
    ' -------------------------------------------
    For shp_y = 0 To shp_h * 2 - 1 Step shp_h   '縦(四角形の高さ×2)
        For shp_x = 0 To sld_w - 1 Step shp_w   '横(スライドの幅)
            G = shp_x / shp_w * tone_s + (Tone / 2) * tone_s * shp_y / shp_h
                Call DrawSquare(shp_x, shp_y + 0 * shp_h, shp_w, shp_h, 255, G, 0)      ' 255G++000
            R = shp_r - shp_x / shp_w * tone_s - (Tone / 2) * tone_s * shp_y / shp_h    ' :  :  :
                Call DrawSquare(shp_x, shp_y + 2 * shp_h, shp_w, shp_h, R, 255, 0)      ' R--255000
            B = shp_x / shp_w * tone_s + (Tone / 2) * tone_s * shp_y / shp_h            ' :  :  :
                Call DrawSquare(shp_x, shp_y + 4 * shp_h, shp_w, shp_h, 0, 255, B)      ' 000255B++
            G = shp_g - shp_x / shp_w * tone_s - (Tone / 2) * tone_s * shp_y / shp_h    ' :  :  :
                Call DrawSquare(shp_x, shp_y + 6 * shp_h, shp_w, shp_h, 0, G, 255)      ' 000G--255
            R = shp_x / shp_w * tone_s + (Tone / 2) * tone_s * shp_y / shp_h            ' :  :  :
                Call DrawSquare(shp_x, shp_y + 8 * shp_h, shp_w, shp_h, R, 0, 255)      ' R++000255
            B = shp_b - shp_x / shp_w * tone_s - (Tone / 2) * tone_s * shp_y / shp_h    ' :  :  :
                Call DrawSquare(shp_x, shp_y + 10 * shp_h, shp_w, shp_h, 255, 0, B)     ' 255000B--
       Next
    Next
End Function


Function Checkerboard_2pattern(ByVal sld_w As Single, ByVal sld_h As Single)
'-------------------------------------------------------------------
' 関数: Checkerboard_2pattern
' 説明: 指定したスライドの幅(sld_w)と高さ(sld_h)に基づいて、
'       スライド上に市松模様のパターンを描画する関数。
'       定数div_countで設定された分割数により、スライドの幅を分割。
' 引数:
'   sld_w      - スライドの幅 (Single型)
'   sld_h      - スライドの高さ (Single型)
' 戻り値:
'   なし
'
' 使用例:
'   ' 幅960、高さ540のスライドに市松模様を描画する
'   Call Checkerboard_2pattern(960, 540)
'-------------------------------------------------------------------
    Dim shp_x As Single                 ' 四角形の左上隅のX座標
    Dim shp_y As Single                 ' 四角形の左上隅のY座標
    Dim shp_w As Single                 ' 四角形の幅
    Dim shp_h As Single                 ' 四角形の高さ
    Dim shp_r As Single                 ' 四角形の色(R)
    Dim shp_g As Single                 ' 四角形の色(G)
    Dim shp_b As Single                 ' 四角形の色(B)
    Dim R As Single, G As Single, B As Single
    Const div_count = 128               ' 分割数
    ' 四角のサイズを決定
    shp_w = sld_w / div_count
    shp_h = shp_w
    ' 色の初期化(ベースは白)
    shp_r = 255
    shp_g = 255
    shp_b = 255
    ' 描画
    For shp_y = 0 To sld_h / shp_h
        For shp_x = 0 To div_count - 1
            If (shp_x Mod 2 = 0) Xor (shp_y Mod 2 = 0) Then
                R = 255
            Else
                R = 0
            End If
            G = R
            B = R
            Call DrawSquare(shp_w * shp_x, shp_h * shp_y, shp_w, shp_h, R, G, B)
       Next
    Next
End Function

 これを使用すると、以下のようなものができる。
色四角.gif

(追記)
【PowerPoint】色のついた四角形を並べる #VBA - Qiitaに続く。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?