'아래 매크로는 Jobs 추가기능중의 하나를 변형하였습니다.
'http://cafe.naver.com/gameppt/139722
Option Explicit
'부채꼴 삽입
Sub AddBlockArc1()
Dim i As Integer
Dim w As Single, h As Single
Dim Max As Integer
Dim user As String
Dim Adj3 As Double
Dim SLD As Slide
On Error GoTo ErrMsg:
Set SLD = ActiveWindow.View.Slide
user = InputBox("부채꼴(BlockArc)1의 개수를 입력하세요:", "부채꼴그리기", "26")
If Len(user) = 0 Then Exit Sub
Max = CInt(user)
user = InputBox("부채꼴(BlockArc)1의 반지름을 입력하세요: 0~0.5", "부채꼴그리기", "0.1")
If Len(user) = 0 Then Exit Sub
Adj3 = CDbl(user)
w = ActivePresentation.PageSetup.SlideWidth
h = ActivePresentation.PageSetup.SlideHeight
Randomize
For i = 1 To Max
With SLD.Shapes.AddShape(msoShapeBlockArc, w / 2 - h / 2, 0, h, h)
.Name = "BlockArc_" & i
.Adjustments(1) = 270 '(i - 1) * (360 / Max) + 270
.Adjustments(2) = .Adjustments(1) + 360 / Max '.Adjustments(1) + (360 / Max)
.Adjustments(3) = Adj3
.Rotation = 360 / Max * (i - 1)
'.Fill.ForeColor.RGB = RGB(256 - 256 / Max * i, 256 - 256 / Max * i, 256 - 256 / Max * i)
'.Fill.ForeColor.RGB = RGB(128 + 128 * Rnd, 128 + 128 * Rnd, 128 + 128 * Rnd)
.Fill.ForeColor.RGB = rgbGray
.Line.Visible = msoTrue
.Line.ForeColor.RGB = rgbDarkGray
.Line.Weight = 0.25
.Select False
With .TextFrame.TextRange
.Text = Chr(Asc("A") + i - 1) '문자
.Font.Color = rgbWhite
.Font.Size = 25
.Font.Bold = msoTrue
End With
End With
Next i
ActiveWindow.Selection.ShapeRange.Group.Name = "Arc_Group_" & SLD.Shapes.Count
Exit Sub
ErrMsg:
MsgBox "슬라이드를 선택하세요." & vbNewLine & vbNewLine & _
Err.Description, vbCritical
End Sub
'부채꼴 삽입
Sub AddBlockArc2()
Dim i As Integer
Dim w As Single, h As Single
Dim Max As Integer
Dim user As String
Dim Adj3 As Double
Dim SLD As Slide
On Error GoTo ErrMsg:
Set SLD = ActiveWindow.View.Slide
user = InputBox("부채꼴(BlockArc)2의 개수를 입력하세요:", "부채꼴그리기", "26")
If Len(user) = 0 Then Exit Sub
Max = CInt(user)
user = InputBox("부채꼴(BlockArc)2의 반지름을 입력하세요: 0~0.5", "부채꼴그리기", "0.1")
If Len(user) = 0 Then Exit Sub
Adj3 = CDbl(user)
w = ActivePresentation.PageSetup.SlideWidth - 100
h = ActivePresentation.PageSetup.SlideHeight - 100
Randomize
For i = 1 To Max
With SLD.Shapes.AddShape(msoShapeBlockArc, 50 + w / 2 - h / 2, 50, h, h)
.Name = "BlockArc_" & i
.Adjustments(1) = 270 '(i - 1) * (360 / Max) + 270
.Adjustments(2) = .Adjustments(1) + 360 / Max '.Adjustments(1) + (360 / Max)
.Adjustments(3) = Adj3
.Rotation = 360 / Max * (i - 1)
'.Fill.ForeColor.RGB = RGB(256 - 256 / Max * i, 256 - 256 / Max * i, 256 - 256 / Max * i)
'.Fill.ForeColor.RGB = RGB(128 + 128 * Rnd, 128 + 128 * Rnd, 128 + 128 * Rnd)
.Fill.ForeColor.RGB = rgbWhite
.Fill.Transparency = 1
'.Fill.BackColor.RGB = rgbWhite
.Line.ForeColor.RGB = rgbWhite
.Line.Transparency = 1
'.Line.BackColor.RGB = rgbWhite
.Line.Weight = 1
.Line.Visible = msoFalse
.Select False
With .TextFrame.TextRange
.Text = i '숫자
.Font.Color = rgbDarkGray
.Font.Size = 18
.Font.Bold = msoTrue
End With
End With
Next i
ActiveWindow.Selection.ShapeRange.Group.Name = "Arc_Group_" & SLD.Shapes.Count
Exit Sub
ErrMsg:
MsgBox "슬라이드를 선택하세요." & vbNewLine & vbNewLine & _
Err.Description, vbCritical
End Sub
최근댓글