Sub VytvorPrezentaciZObrazku()
    Dim pptPres As Presentation
    Dim pptSlide As Slide
    Dim fs As Object
    Dim folder As Object
    Dim file As Object
    Dim obrazekPath As String
    Dim folderPath As String
    Dim shape As shape
    
    ' Vbr aktuln prezentace
    Set pptPres = ActivePresentation
    
    ' Vydn sloky od uivatele
    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = "Vyber sloku s obrzky"
        If .Show = -1 Then
            folderPath = .SelectedItems(1) & "\"
        Else
            MsgBox "Nebyla vybrna dn sloka.", vbExclamation, "Chyba"
            Exit Sub
        End If
    End With

    ' Prochzen soubor ve sloce
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set folder = fs.GetFolder(folderPath)

    For Each file In folder.Files
        If LCase(Right(file.Name, 4)) = ".jpg" Or LCase(Right(file.Name, 4)) = ".png" Then
            ' Pidn novho snmku
            Set pptSlide = pptPres.Slides.Add(pptPres.Slides.Count + 1, ppLayoutBlank)
            
            ' Cesta k obrzku
            obrazekPath = folderPath & file.Name
            
            ' Vloen obrzku na snmek
            Set shape = pptSlide.Shapes.AddPicture(obrazekPath, msoFalse, msoCTrue, 300, 50, 300, 400)
        End If
    Next file

    MsgBox "Prezentace byla spn vygenerovna!", vbInformation, "Hotovo"

    ' Uvolnn objekt
    Set fs = Nothing
    Set folder = Nothing
End Sub

