Sctipt - slide

Sctipt - slide #

What is it? #

Useful functions for handling slide.


jpg export #

Exports selected slides as JPG files.

Sub jpgExport()

    Dim pptPres As Presentation
    Dim filePath As String
    Dim slidenum As String
    Dim slicePageNum() As String
    Dim pagenum As Integer
    Dim i As Integer

    On Error GoTo Err_Check

    Set pptPres = ActivePresentation
    
    If pptPres.Path = "" Then
        MsgBox "프레젠테이션이 파일로 저장되지 않았습니다. 저장 후 다시 시도하세요.", vbExclamation
        Exit Sub
    Else
        filePath = pptPres.Path
    End If

    slidenum = InputBox("Input PageNumber")
    
    If InStr(slidenum, ",") Then
        slicePageNum = Split(Replace(slidenum, " ", ""), ",")
        For i = LBound(slicePageNum) To UBound(slicePageNum)
            On Error Resume Next
            pagenum = CInt(slicePageNum(i))
            If IsNumeric(pagenum) And pagenum <= pptPres.Slides.Count Then
                With pptPres.Slides(pagenum)
                    .Export filePath & "\Slide" & pagenum & ".jpg", "JPG"
                End With
            Else
                MsgBox "non-numeric value or wrong page number: " & slicePageNum(i), vbExclamation
            End If
            On Error GoTo Err_Check
        Next i
    Else        
        pagenum = CInt(slidenum)
        If IsNumeric(pagenum) And pagenum <= pptPres.Slides.Count Then
            With pptPres.Slides(pagenum)
                .Export filePath & "\Slide" & pagenum & ".jpg", "JPG"
            End With
        Else
            MsgBox "non-numeric value or wrong page number", vbExclamation
            Exit Sub
        End If
    End If

    MsgBox "export complete"
Exit Sub

Err_Check:
    MsgBox "오류번호: " & Err.Number & vbCr & "오류내용: " & Err.Description, vbCritical, "오류 발생"
    Exit Sub

End Sub

slide_resizes #

Changes slide size based on pixel dimensions.


groupRelease #

Ungroups all groups on all slides at once