網路城邦
回本城市首頁 唐老鴨之家
市長:  副市長:
加入本城市推薦本城市加入我的最愛訂閱最新文章
udn城市資訊科技網路分享【唐老鴨之家】城市/討論區/
討論區Excel VBA 字體:
上一個討論主題 回文章列表 下一個討論主題
用powerpoint畫美國國旗的VBA程式(原創)
 瀏覽841|回應0推薦0


等級:6
留言加入好友
Sub MACRO2()

Rem draw 13 stripes (6 red 5 white)

For k = 0 To 12 Step 2

ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 0, k * 41.54, 720, 41.54).Select

With ActiveWindow.Selection.ShapeRange

.Fill.ForeColor.RGB = RGB(255, 0, 0)

.Line.ForeColor.RGB = RGB(255, 0, 0)

End With

Next k

For k = 1 To 11 Step 2

ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 0, k * 41.54, 720, 41.54).Select

With ActiveWindow.Selection.ShapeRange

.Fill.ForeColor.RGB = RGB(255, 255, 255)

.Line.ForeColor.RGB = RGB(255, 0, 0)

End With

Next k


Rem draw the blue block

ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 0, 0, 360, 7 * 41.54).Select

With ActiveWindow.Selection.ShapeRange

.Fill.ForeColor.RGB = RGB(0, 0, 255)

.Line.ForeColor.RGB = RGB(0, 0, 255)

End With


Rem draw 50 stars

For y = 4 To 254 Step 50

For x = 8 To 313 Step 61

ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShape5pointStar, x, y, 36, 36).Select

With ActiveWindow.Selection.ShapeRange

.Fill.ForeColor.RGB = RGB(255, 255, 255)

.Line.ForeColor.RGB = RGB(0, 0, 255)

End With

Next x

Next y

For y = 30 To 230 Step 50

For x = 40 To 284 Step 61

ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShape5pointStar, x, y, 36, 36).Select

With ActiveWindow.Selection.ShapeRange

.Fill.ForeColor.RGB = RGB(255, 255, 255)

.Line.ForeColor.RGB = RGB(0, 0, 255)

End With

Next x

Next y


End Sub
回應 回應給此人 推薦文章 列印 加入我的文摘

引用
引用網址:https://city.udn.com/forum/trackback.jsp?no=58536&aid=5231212