今回は遊びで図形を動かしてみることにした。
図形といってもクリップアートを挿入しただけの手抜き作業だ・・・ キー操作(←、→)で図形の動く方向を決めて、スペースキーでこのマクロを中止してみる。 Option Explicit Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vkey As Long) As Long Sub 動く車() Dim mycar As Shape Dim myflg As Boolean Dim x As Integer Set mycar = ActiveSheet.Shapes("車") myflg = True x = 0 Do While myflg = True If GetAsyncKeyState(39) <> 0 Then'右方向キー x = 1 End If If GetAsyncKeyState(37) <> 0 Then'左方向キー x = -1 End If If GetAsyncKeyState(32) <> 0 Then'スペースキー myflg = False End If mycar.IncrementLeft x DoEvents Loop End Sub
by slayer0210
| 2005-12-06 13:00
| マクロ
|
カテゴリ
以前の記事
フォロー中のブログ
検索
最新のトラックバック
その他のジャンル
ファン
記事ランキング
ブログジャンル
画像一覧
|
ファン申請 |
||