Created
April 6, 2016 08:34
-
-
Save naichilab/78ae5f30272683d8e29eb17ada9e3f3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Const DEBUG_MODE As Boolean = False | |
Sub 図に枠線をつける() | |
'このマクロは「行内」画像にしか作用しません。 | |
Const THEME_COLOR As Integer = wdThemeColorBackground2 | |
Const TINT_AND_SHADE As Long = 0 | |
Const BRIGHTNESS As Double = -0.25 | |
Const WEIGHT As Double = 0.5 | |
Dim shp As InlineShape | |
Dim shapes As Variant | |
Set shapes = Selection.InlineShapes | |
Dim total As Long | |
total = shapes.Count | |
If total = 0 Then | |
MsgBox "選択範囲に「行内」画像が含まれていません。" | |
Exit Sub | |
End If | |
If MsgBox("選択範囲にある" & CStr(total) & "個の「行内」画像に枠線を付けます。この操作は取り消せません。実行しますか?", vbOKCancel) = vbCancel Then | |
Exit Sub | |
End If | |
Dim done As Long | |
done = 0 | |
Call writeStatusBar(done, total) | |
For Each shp In shapes | |
If shp.Type = msoChart Then | |
shp.Line.Visible = msoTrue | |
If DEBUG_MODE Then | |
shp.Line.ForeColor = RGB(255, 0, 0) | |
Else | |
shp.Line.ForeColor.ObjectThemeColor = THEME_COLOR | |
End If | |
shp.Line.ForeColor.TintAndShade = TINT_AND_SHADE | |
shp.Line.ForeColor.BRIGHTNESS = BRIGHTNESS | |
shp.Line.WEIGHT = WEIGHT | |
End If | |
done = done + 1 | |
Call writeStatusBar(done, total) | |
Next shp | |
Application.StatusBar = "" | |
MsgBox "完了しました。" | |
End Sub | |
Sub writeStatusBar(done As Long, total As Long) | |
Application.StatusBar = "画像に枠線描画 : " & CStr(done) & " / " & CStr(total) | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment