본문으로 바로가기

PPT의 shape 이름 지정하기

category Devlogs 2024. 3. 19. 16:19

아래의 코드를.. ppt내에서 macro를 추가하고..
shape을 선택하고.. 추가된 macro을 실행하면.. shape 이름을 지정할 수 있음.

Sub NameShape()
'used to name shapes
'select the shape by clicking on it then go to macros and and then run this code !!!!
'you can then use that name in VBA to reference that object. lot easier than trying to guess at "rectangle 2" or what index a object is.
 
    Dim Name$
    On Error GoTo AbortNameShape
    If ActiveWindow.Selection.ShapeRange.Count = 0 Then
        MsgBox "No Shapes Selected"
        Exit Sub
    End If
    Name$ = ActiveWindow.Selection.ShapeRange(1).Name
    Name$ = InputBox$("Give this shape a name", "Shape Name", Name$)
    If Name$ <> "" Then
        ActiveWindow.Selection.ShapeRange(1).Name = Name$
    End If
     
    Exit Sub
     
AbortNameShape:
    MsgBox Err.Description
     
End Sub

 


Korea Tcl/Tk Community
블로그 이미지 ihmin 님의 블로그
VISITOR 오늘 / 전체